void KUiConnectInfo::SetInfoMsg(LOGIN_BG_INFO_MSG_INDEX eIndex) { m_DelRoleBgImg.LeaveAlone(); m_DelRoleBtn.LeaveAlone(); m_CancelDelRoleBtn.LeaveAlone(); m_ConfirmBtn.LeaveAlone(); m_ContinueBtn.LeaveAlone(); m_InputPwdWnd.LeaveAlone(); // m_BtnUnlockLink.LeaveAlone(); m_RoleName.LeaveAlone(); m_szMessage[0] = 0; m_nMsgLen = 0; m_nColor2CharacterStartIndex = 0; m_nColor2CharacterEndIndex = 0; KIniFile* pIni = g_UiBase.GetCommConfigFile(); if (pIni) { char szKey[8]; char szBuff[64]; itoa(eIndex, szKey, 10); pIni->GetString("InfoString", szKey, "", szBuff, sizeof(szBuff)); m_nMsgLen = sprintf(m_szMessage, szBuff, m_szString); if (m_nMsgLen) { m_uLastMsgColorChanageTime = IR_GetCurrentTime(); m_nColor2CharacterEndIndex = TSplitString(m_szMessage, m_nColor2CharacterStartIndex + 1, false); } } if (eIndex == CI_MI_TO_DEL_ROLE) //13=要删除角色 { AddChild(&m_DelRoleBgImg); AddChild(&m_InputPwdWnd); AddChild(&m_DelRoleBtn); AddChild(&m_RoleName); char szBuff[64]; sprintf(szBuff, "角色名字:%s", m_szString); m_RoleName.SetText(szBuff); AddChild(&m_CancelDelRoleBtn); Wnd_SetFocusWnd(&m_InputPwdWnd); } else if (eIndex == CI_MI_TO_TRANSFER_ROLE) { AddChild(&m_ContinueBtn); } else if (eIndex != CI_MI_ENTERING_GAME) { // if(eIndex == CI_MI_ACCOUNT_LOCKED) // { // AddChild(&m_BtnUnlockLink); // } AddChild(&m_ConfirmBtn); } }
void KUiConnectInfo::SetInfoMsg(LOGIN_BG_INFO_MSG_INDEX eIndex) { m_DelRoleBgImg.LeaveAlone(); m_DelRoleBtn.LeaveAlone(); m_CancelDelRoleBtn.LeaveAlone(); m_ConfirmBtn.LeaveAlone(); m_InputPwdWnd.LeaveAlone(); m_szMessage[0] = 0; m_nMsgLen = 0; m_nColor2CharacterStartIndex = 0; m_nColor2CharacterEndIndex = 0; KIniFile* pIni = g_UiBase.GetCommConfigFile(); if (pIni) { char szKey[8]; itoa(eIndex, szKey, 10); pIni->GetString("InfoString", szKey, "", m_szMessage, sizeof(m_szMessage)); m_nMsgLen = strlen(m_szMessage); if (m_nMsgLen) { m_uLastMsgColorChanageTime = IR_GetCurrentTime(); m_nColor2CharacterEndIndex = TSplitString(m_szMessage, m_nColor2CharacterStartIndex + 1, false); } } if (eIndex == CI_MI_TO_DEL_ROLE) //13=要删除角色 { AddChild(&m_DelRoleBgImg); AddChild(&m_InputPwdWnd); AddChild(&m_DelRoleBtn); AddChild(&m_CancelDelRoleBtn); Wnd_SetFocusWnd(&m_InputPwdWnd); } else if (eIndex != CI_MI_ENTERING_GAME) { AddChild(&m_ConfirmBtn); } }
void KUiConnectInfo::PaintWindow() { KWndImage::PaintWindow(); if (m_nMsgLen && g_pRepresentShell) { if (IR_IsTimePassed(m_uMsgColorChangeInterval, m_uLastMsgColorChanageTime)) { if (m_nColor2CharacterEndIndex != m_nMsgLen) m_nColor2CharacterStartIndex = m_nColor2CharacterEndIndex; else m_nColor2CharacterStartIndex = 0; m_nColor2CharacterEndIndex = TSplitString(m_szMessage, m_nColor2CharacterStartIndex + 1, false); } int nX = m_nAbsoluteLeft + m_nTextCentreX - m_nMsgLen * m_nFont / 4; int nY = m_nAbsoluteTop + m_nTextCentreY; if (m_nColor2CharacterStartIndex) { g_pRepresentShell->OutputText(m_nFont, m_szMessage, m_nColor2CharacterStartIndex, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); nX += m_nColor2CharacterStartIndex * m_nFont / 2; } g_pRepresentShell->OutputText(m_nFont, &m_szMessage[m_nColor2CharacterStartIndex], m_nColor2CharacterEndIndex - m_nColor2CharacterStartIndex, nX, nY, m_uMsgColor2, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor2); nX += (m_nColor2CharacterEndIndex - m_nColor2CharacterStartIndex) * m_nFont / 2; if (m_nColor2CharacterEndIndex < m_nMsgLen) { g_pRepresentShell->OutputText(m_nFont, &m_szMessage[m_nColor2CharacterEndIndex], m_nMsgLen - m_nColor2CharacterEndIndex, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); } } }
void KUiConnectInfo::PaintWindow() { KWndImage::PaintWindow(); if (m_nMsgLen && g_pRepresentShell) { if (IR_IsTimePassed(m_uMsgColorChangeInterval, m_uLastMsgColorChanageTime)) { if (m_nColor2CharacterEndIndex != m_nMsgLen) m_nColor2CharacterStartIndex = m_nColor2CharacterEndIndex; else m_nColor2CharacterStartIndex = 0; m_nColor2CharacterEndIndex = TSplitString(m_szMessage, m_nColor2CharacterStartIndex + 1, false); } //判断是否超出一行 int nMsgLen; if(m_nMsgLen > INFO_LENGTH) { nMsgLen = TSplitString(m_szMessage, INFO_LENGTH, FALSE); } else { nMsgLen = m_nMsgLen; } int nX = m_nAbsoluteLeft + m_nTextCentreX - nMsgLen * m_nFont / 4; int nY = m_nAbsoluteTop + m_nTextCentreY - ((m_nMsgLen > nMsgLen) ? m_nFont / 2: 0); if (m_nColor2CharacterStartIndex) { //如果要变色的字在第一行,就不需要很特别的处理 if(m_nColor2CharacterStartIndex < nMsgLen) { g_pRepresentShell->OutputText(m_nFont, m_szMessage, m_nColor2CharacterStartIndex, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); nX += m_nColor2CharacterStartIndex * m_nFont / 2; } //要变色的字在下一行,那就 else { //先直接画出第一行 g_pRepresentShell->OutputText(m_nFont, m_szMessage, nMsgLen, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); //坐标换到下一行去 nX = m_nAbsoluteLeft + m_nTextCentreX - (m_nMsgLen - nMsgLen) * m_nFont / 4; nY += m_nFont; //再画到要变色的那个字的前面 g_pRepresentShell->OutputText(m_nFont, &m_szMessage[nMsgLen], m_nColor2CharacterStartIndex - nMsgLen, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); nX += (m_nColor2CharacterStartIndex - nMsgLen) * m_nFont / 2; } } //画出要变色的那个字 g_pRepresentShell->OutputText(m_nFont, &m_szMessage[m_nColor2CharacterStartIndex], m_nColor2CharacterEndIndex - m_nColor2CharacterStartIndex, nX, nY, m_uMsgColor2, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor2); //如果刚好到行尾了,就要换行 if(m_nColor2CharacterEndIndex == nMsgLen) { nX = m_nAbsoluteLeft + m_nTextCentreX - (m_nMsgLen - nMsgLen) * m_nFont / 4; nY += m_nFont; } //不然的话就不用换行了 else { nX += (m_nColor2CharacterEndIndex - m_nColor2CharacterStartIndex) * m_nFont / 2; } //如果变色的那个字不是整句话的末尾 if (m_nColor2CharacterEndIndex < m_nMsgLen) { //如果是两行的话,要进行特别判断,如果还没到第二行,就要分两行画 //剩下的那些字 if(nMsgLen < m_nMsgLen) { int nPos; if(m_nColor2CharacterEndIndex < nMsgLen) { g_pRepresentShell->OutputText(m_nFont, &m_szMessage[m_nColor2CharacterEndIndex], nMsgLen - m_nColor2CharacterEndIndex, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); nX = m_nAbsoluteLeft + m_nTextCentreX - (m_nMsgLen - nMsgLen) * m_nFont / 4; nY += m_nFont; nPos = nMsgLen; } else { nPos = m_nColor2CharacterEndIndex; } g_pRepresentShell->OutputText(m_nFont, &m_szMessage[nPos], m_nMsgLen - nPos, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); } //不是的话,就直接一行画出后面的就行了 else { g_pRepresentShell->OutputText(m_nFont, &m_szMessage[m_nColor2CharacterEndIndex], nMsgLen - m_nColor2CharacterEndIndex, nX, nY, m_uMsgColor, 0, TEXT_IN_SINGLE_PLANE_COORD, m_uMsgBorderColor); } } } }
//-------------------------------------------------------------------------- // 功能:响应键盘按键操作 //-------------------------------------------------------------------------- int KWndEdit::OnKeyDown(int nKeyCode, int nModifiers) { int nRet = 1; switch(nKeyCode) { case VK_DELETE: if (m_nCaretPos < m_nTextLen) { int nNextPos = TSplitString(m_pText + m_nCaretPos, 1, false); m_nTextLen -= nNextPos; memmove(m_pText + m_nCaretPos, m_pText + m_nCaretPos + nNextPos, m_nTextLen - m_nCaretPos + 1); UpdateData(); } break; case VK_LEFT: if (m_nCaretPos) { m_nCaretPos = TSplitString(m_pText, m_nCaretPos - 1, true); FmtForShow(); } break; case VK_RIGHT: if (m_nCaretPos < m_nTextLen) { m_nCaretPos += TSplitString(m_pText + m_nCaretPos, 1, false); FmtForShow(); } break; case VK_HOME: m_nCaretPos = 0; FmtForShow(); break; case VK_END: m_nCaretPos = m_nTextLen; FmtForShow(); break; case VK_UP: if (MULTI_LINE && m_nCaretLineIndex) { int nCharPerLine = (m_Width * 2) / m_nFontSize; int nLineHead = 0, nLineEnd = 0; for (nRet = 0; nRet < m_nCaretLineIndex; nRet++) { nLineHead = nLineEnd; nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine); } m_nCaretPos = nLineHead + TSplitString(&m_pText[nLineHead], (m_nCaretPos - nLineEnd), false); if (m_nCaretPos >= nLineEnd && nLineEnd) { m_nCaretPos = nLineEnd; if(m_pText[nLineEnd - 1] == KTC_ENTER) m_nCaretPos--; } FmtForShow(); } else if (m_pParentWnd) nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_UP); break; case VK_DOWN: if (MULTI_LINE) { int nCharPerLine = (m_Width * 2) / m_nFontSize; int nLineHead = 0, nLineEnd = 0; for (nRet = 0; nRet <= m_nCaretLineIndex; nRet++) { nLineHead = nLineEnd; nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine); } m_nCaretPos = nLineEnd + TSplitString(&m_pText[nLineEnd], (m_nCaretPos - nLineHead), false); nLineHead = nLineEnd; nLineEnd = nLineHead + SplitStringLine(&m_pText[nLineHead], 1, nCharPerLine); if (m_nCaretPos >= nLineEnd && nLineEnd) { m_nCaretPos = nLineEnd; if(m_pText[nLineEnd - 1] == KTC_ENTER) m_nCaretPos--; } FmtForShow(); } else if (m_pParentWnd) nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_DOWN); break; case VK_TAB: case VK_PRIOR: case VK_NEXT: case VK_ESCAPE: if (m_pParentWnd) nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, nKeyCode); break; case VK_RETURN: if (m_pParentWnd) { if ((m_Flag & WNDEDIT_ES_MULTI_LINE) == 0) nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN); else if ((GetKeyState(VK_CONTROL) & 0x8000) == 0 && (GetKeyState(VK_SHIFT) & 0x8000) == 0) nRet = m_pParentWnd->WndProc(WND_N_EDIT_SPECIAL_KEY_DOWN, (unsigned int)(KWndWindow*)this, VK_RETURN); else if (InsertChar(0x0a, 0)) { UpdateData(); nRet = 1; } } break; case 'V': //粘帖 if ((GetKeyState(VK_CONTROL) & 0x8000) && Paste()) nRet = 1; break; case 'C': //复制 if ((GetKeyState(VK_CONTROL) & 0x8000) && Copy()) nRet = 1; break; default: if ((nKeyCode < '0' || nKeyCode > '9') && (nKeyCode < 'A' || nKeyCode > 'Z') && (nKeyCode < VK_NUMPAD0 || nKeyCode > VK_DIVIDE)) { nRet = 0; } } return nRet; }