//-------------------------------------------------------------------------- // 功能:连接游戏服务 //-------------------------------------------------------------------------- int KLogin::ConnectAccountServer(const unsigned char* pIpAddress) { KIniFile IniFile; if (pIpAddress && IniFile.Load("\\Config.ini")) { int nPort; IniFile.GetInteger("Server", "GameServPort", 8888, &nPort); return g_NetConnectAgent.ClientConnectByNumericIp(pIpAddress, nPort); } return false; }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiParadeItem::LoadScheme(const char* pScheme) { if (m_pSelf) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI); if (Ini.Load(Buff)) m_pSelf->LoadScheme(&Ini); } }
/************************************************************************** *功能:弹出错误描述窗口 ***************************************************************************/ void Error_Box() { if(s_uErrorCode) { KIniFile Ini; char szFormatString[512], szOutputInfo[512], szBuf[16]; //嗷,开始显示错误信息咯 Ini.Load(ERROR_STRING); Ini.GetString("Strings", itoa(s_uErrorCode,szBuf,10), "", szFormatString, sizeof(szFormatString)); if(szFormatString[0] == 0) { Ini.GetString("Strings", "Unknown", "", szFormatString, sizeof(szFormatString)); if(szFormatString[0] == 0) strcpy(szFormatString, "未知的错误(错误号: %d)"); } while(true) { char* pszNextLine = strchr(szFormatString, NEXT_LINE_CHARA); if (pszNextLine == NULL) break; *pszNextLine = '\n'; } const char* pszCodePos = strstr(szFormatString, "%d"); const char* pszStringPos = strstr(szFormatString, "%s"); if (pszCodePos) { if (pszStringPos) { if (pszCodePos < pszStringPos) sprintf(szOutputInfo, szFormatString, s_uErrorCode, s_szErrorString); else sprintf(szOutputInfo, szFormatString, s_szErrorString, s_uErrorCode); } else { sprintf(szOutputInfo, szFormatString, s_uErrorCode); } } else if (pszStringPos) { sprintf(szOutputInfo, szFormatString, s_szErrorString); } else strcpy(szOutputInfo, szFormatString); MessageBox(NULL, szOutputInfo, "剑侠情缘网络版", MB_OK | MB_ICONERROR); s_uErrorCode = 0; } s_szErrorString[0] = 0; }
void KUiTaskNote_System::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_SYSTEM); if (Ini.Load(Buff)) { KWndPage::Init(&Ini, "Main"); m_BtnDelete.Init(&Ini, "DeleteBtn"); m_RecordList.Init(&Ini, "List"); } }
//载入设定 bool UiSoundLoadSetting() { KIniFile Setting; if (!Setting.Load(SETTING_FILE)) return false; char szSection[8]; for (int i = 0; i < (int)UI_SOUND_COUNT; i++) { itoa(i, szSection, 10); Setting.GetString("Ui", szSection, "", s_SoundFileName[i], sizeof(s_SoundFileName[i])); } return true; }
void KUiSelPlayerNearby::LoadScheme(const char* pScheme) { if (m_pSelf) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI); if (Ini.Load(Buff)) { m_pSelf->LoadScheme(&Ini); } } }
void KUiTaskNote_Personal::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_PERSONAL); if (Ini.Load(Buff)) { KWndPage::Init(&Ini, "Main"); m_BtnSave.Init(&Ini, "SaveBtn"); m_Editor.Init(&Ini, "Editor"); m_ScrollBar.Init(&Ini, "EditorScroll"); } }
//载入界面方案 void KUiHeaderControlBar::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; if (m_pSelf) { sprintf(Buff, "%s\\"SCHEME_INI, pScheme); if (Ini.Load(Buff)) { m_pSelf->Init(&Ini, "Main"); } } }
//载入界面方案 void KMouseOver::LoadScheme(const char* pScheme) { if (pScheme == NULL) return; char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI); if (Ini.Load(Buff)) { Ini.GetInteger("Main", "ImgWidth", 0, &m_nImgWidth); Ini.GetInteger("Main", "ImgHeight", 0, &m_nImgHeight); Ini.GetInteger("Main", "Indent", 0, &m_nIndent); Ini.GetInteger("Main", "Font", 0, &m_nFontSize); if(m_nImgWidth < 0) m_nImgWidth = 0; if(m_nImgHeight < 0) m_nImgWidth = 0; if(m_nFontSize < 8) m_nFontSize = 8; int nValue; Ini.GetInteger("Main", "ImgType", 0, &nValue); if (nValue == 1) { m_Image.nType = ISI_T_BITMAP16; m_Image.bRenderStyle = IMAGE_RENDER_STYLE_OPACITY; } else { m_Image.nType = ISI_T_SPR; m_Image.bRenderStyle = IMAGE_RENDER_STYLE_ALPHA; m_Image.Color.Color_b.a = 255; } m_Image.uImage = 0; m_Image.nISPosition = IMAGE_IS_POSITION_INIT; Ini.GetString("Main", "Image", "" , m_Image.szImage, sizeof(m_Image.szImage)); Ini.GetInteger("Main", "Frame", 0, &nValue); m_Image.nFrame = nValue; Ini.GetString("Main", "TitleBgColor", "0, 0, 0", Buff, sizeof(Buff)); m_uTitleBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000); Ini.GetString("Main", "PropBgColor", "0, 0, 0", Buff, sizeof(Buff)); m_uPropBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000); Ini.GetString("Main", "DescBgColor", "0, 0, 0", Buff, sizeof(Buff)); m_uDescBgColor = ((GetColor(Buff) & 0xffffff) | 0x0a000000); Update((m_nLeft + m_nWndWidth) / 2, m_nTop); } }
//--------------------------------------------------------------------------- // 功能: 从排序文件中把排序信息读取出来 // 参数: // lpszFileName: 排序文件名 // *cActionName: 用于获取动作的各种信息 // nPartNum:部件的数量 // 返回: 读取成功与否 //--------------------------------------------------------------------------- BOOL CSortTable::GetTable(char *lpszFileName, CActionName *cActionName, int nPartNum) { if ( !lpszFileName || !lpszFileName[0]) return FALSE; char szBuf[FILE_NAME_LENGTH]; KIniFile SortIni; // g_SetFilePath(RES_INI_FILE_PATH); g_UnitePathAndName(RES_INI_FILE_PATH, lpszFileName, szBuf); if ( !SortIni.Load(szBuf) ) return FALSE; return GetTable(&SortIni, cActionName, nPartNum); }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiNewPlayerStartMsg::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_NEWENTERINFO); if (Ini.Load(Buff)) { KWndShowAnimate::Init(&Ini, "Main"); m_List .Init(&Ini, "List"); m_AdvanceList .Init(&Ini, "List"); m_NewerBtn .Init(&Ini, "NewerBtn"); m_AdvanceBtn .Init(&Ini, "AdvanceNewerBtn"); m_Ok .Init(&Ini, "Ok"); } }
// ------------------------------------------------------------------------- // 功能 : 载入界面方案 // ------------------------------------------------------------------------- void KUiStoreBox::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_ITEM); if (m_pSelf && Ini.Load(Buff)) { m_pSelf->Init(&Ini, "Main"); m_pSelf->m_Money.Init(&Ini, "Money"); m_pSelf->m_GetMoneyBtn.Init(&Ini, "GetMoneyBtn"); m_pSelf->m_CloseBtn.Init(&Ini, "CloseBtn"); m_pSelf->m_ItemBox.Init(&Ini, "ItemBox"); m_pSelf->m_ItemBox.EnableTracePutPos(true); } }
BOOL KInlinePicSink::Init(iRepresentShell* pShell) { m_pRepShell = pShell; if (!m_pRepShell) return FALSE; KIniFile ini; #define CHAR_BUFFER_LEN 32 char szBuffer[CHAR_BUFFER_LEN * 2], szIndex[8]; int nPicCount = 0, i = 0; KUiImageRef CurrentImg; KImageParam Param; if (!ini.Load(CHAT_FACE_INI_FILE)) return FALSE; //ini.GetString("Main", "Path", "\\spr\\Ui\\聊天\\表情", szPath, CHAR_BUFFER_LEN); ini.GetInteger("List", "Count", 0, &nPicCount); if (nPicCount > MAX_SYSTEM_INLINE_PICTURES) nPicCount = MAX_SYSTEM_INLINE_PICTURES; for (i = 0; i < nPicCount; i++) { sprintf(szIndex, "Face%d", i + 1); if (!ini.GetString(szIndex, "Spr", "", szBuffer, CHAR_BUFFER_LEN)) { _ASSERT(0); break; } IR_InitUiImageRef(CurrentImg); CurrentImg.nFlipTime = 0; CurrentImg.nInterval = 0; CurrentImg.nNumFrames = 0; strncpy(CurrentImg.szImage, szBuffer, sizeof(CurrentImg.szImage)); CurrentImg.szImage[sizeof(CurrentImg.szImage) - 1] = 0; CurrentImg.bRenderFlag = RUIMAGE_RENDER_FLAG_REF_SPOT; CurrentImg.nType = ISI_T_SPR; memset(&Param, 0, sizeof(Param)); pShell->GetImageParam(CurrentImg.szImage, &Param, CurrentImg.nType); m_Images.push_back(CurrentImg); m_ImageParams.push_back(Param); } if (FAILED(m_pRepShell->AdviseRepresent(this))) return FALSE; if (FAILED(AdviseEngine(this))) return FALSE; return TRUE; }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiSelDlg::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_SELDLG); if (Ini.Load(Buff)) { KWndImage:: Init(&Ini, "Main"); for (int i = 0; i < KUISEL_MAX_OPTION; i++) { sprintf(Buff, "Option_%d", i); m_OptionBtn[i].Init(&Ini, Buff); } m_IlluminateTxt.Init(&Ini, "InfoText"); } }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiSelServer::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_SELSERV); if (Ini.Load(Buff)) { KWndShowAnimate::Init(&Ini, "Main"); m_List .Init(&Ini, "List"); m_ScrollBar.Init(&Ini, "Scroll"); m_Login .Init(&Ini, "Login"); m_Cancel .Init(&Ini, "Cancel"); Ini.GetString("Main", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg)); } }
//重新初始化界面 void KUiHeaderControlBar::DefaultScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; if (m_pSelf) { sprintf(Buff, "%s\\"SCHEME_INI, pScheme); if (Ini.Load(Buff)) { int nValue1, nValue2; Ini.GetInteger("Main", "Left", 0, &nValue1); Ini.GetInteger("Main", "Top", 0, &nValue2); m_pSelf->SetPosition(nValue1, nValue2); } } }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiESCDlg::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_INIT); if (Ini.Load(Buff)) { Init(&Ini, "Main"); m_ContinueGameBtn.Init(&Ini, "ContiumeGame"); m_OptionsBtn.Init(&Ini, "Options"); //m_ExitBtn.Init(&Ini, "CloseGame"); m_ExitGameBtn.Init(&Ini, "ExitGame"); m_HelpBtn.Init(&Ini, "GameHelp"); //m_TaskBtn.Init(&Ini, "GameTask"); } }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiInformation::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI); if (Ini.Load(Buff)) { KWndShowAnimate::Init(&Ini, "Main"); m_Information .Init(&Ini, "Info"); m_FirstBtn .Init(&Ini, "FirstBtn"); m_SecondBtn.Init(&Ini, "SecondBtn"); m_FirstBtn.GetPosition(&m_nOrigFirstBtnXPos, 0); m_FirstBtn.GetSize(&m_nCentreBtnXPos, 0); m_nCentreBtnXPos = (m_Width - m_nCentreBtnXPos) / 2; } }
// ------------------------------------------------------------------------- // 功能 : 载入界面方案 // ------------------------------------------------------------------------- void KUiStall::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_ITEM); if (m_pSelf && Ini.Load(Buff)) { m_pSelf->Init(&Ini, "Main"); m_pSelf->m_CloseBtn.Init(&Ini, "CloseBtn"); m_pSelf->m_ItemBox.Init(&Ini, "ItemBox"); m_pSelf->m_Owner.Init(&Ini, "Owner"); m_pSelf->m_ItemBox.EnableTracePutPos(false); m_pSelf->m_ItemBox.EnablePickPut(false); } }
static KItemDropRate * g_GenItemDropRate(char * szDropIniFile) { if ((!szDropIniFile)|| (!szDropIniFile[0])) return NULL; KIniFile IniFile; if (IniFile.Load(szDropIniFile)) { KItemDropRate * pnewDrop = new KItemDropRate; IniFile.GetInteger("Main", "Count", 0, &pnewDrop->nCount); IniFile.GetInteger("Main", "RandRange", 0, &pnewDrop->nMaxRandRate); IniFile.GetInteger("Main", "MagicRate", 0, &pnewDrop->nMagicRate); IniFile.GetInteger("Main", "MoneyRate", 20, &pnewDrop->nMoneyRate); IniFile.GetInteger("Main", "MoneyScale", 50, &pnewDrop->nMoneyScale); IniFile.GetInteger("Main", "MinItemLevelScale", 20, &pnewDrop->nMinItemLevelScale); IniFile.GetInteger("Main", "MaxItemLevelScale", 10, &pnewDrop->nMaxItemLevelScale); IniFile.GetInteger("Main", "MaxItemLevel", 10, &pnewDrop->nMaxItemLevel); IniFile.GetInteger("Main", "MinItemLevel", 1, &pnewDrop->nMinItemLevel); if(pnewDrop->nCount <= 0) { delete pnewDrop; return NULL; } pnewDrop->pItemParam = new KItemDropRate::KItemParam[pnewDrop->nCount]; char szSection[10]; KItemDropRate::KItemParam * pItemParam = pnewDrop->pItemParam; for(int i = 0; i < pnewDrop->nCount; i ++, pItemParam ++) { sprintf(szSection, "%d", i + 1); IniFile.GetInteger(szSection, "Genre", 0, &(pItemParam->nGenre)); IniFile.GetInteger(szSection, "Detail", 0, &(pItemParam->nDetailType)); IniFile.GetInteger(szSection, "Particular", 0, &(pItemParam->nParticulType)); IniFile.GetInteger(szSection, "RandRate", 0, &(pItemParam->nRate)); } return pnewDrop; } else { printf("无法找到%s\n", szDropIniFile); return NULL; } return NULL; }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiGetString::LoadScheme(const char* pScheme) { if (m_pSelf) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI); if (Ini.Load(Buff)) { m_pSelf->Init(&Ini, "Main"); m_pSelf->m_Title.Init(&Ini, "Title"); m_pSelf->m_StringEdit.Init(&Ini, "StringInput"); m_pSelf->m_OkBtn.Init(&Ini, "OkBtn"); m_pSelf->m_CancelBtn.Init(&Ini, "CancelBtn"); } } }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiLogin::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_LOGIN); if (Ini.Load(Buff)) { KWndShowAnimate::Init(&Ini, "Main"); m_Account .Init(&Ini, "Account"); m_PassWord.Init(&Ini, "Password"); m_Login .Init(&Ini, "Login"); m_Cancel .Init(&Ini, "Cancel"); m_RememberAccount.Init(&Ini, "Remember"); m_InvisibleLogin.Init(&Ini, "Invisible"); Ini.GetString("Main", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg)); } }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiInit::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_INIT); if (Ini.Load(Buff)) { KWndShowAnimate::Init(&Ini, "Main"); m_EnterGame. Init(&Ini, "EnterGame"); m_GameConfig. Init(&Ini, "GameConfig"); m_DesignerList. Init(&Ini, "DesignerList"); // m_AutoLogin. Init(&Ini, "AutoLogin"); m_ExitGame. Init(&Ini, "ExitGame"); Ini.GetString("Main", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg)); } }
/********************************************************************* * 功能:载入界面方案 **********************************************************************/ void KUiPopupPasswordQuery::LoadScheme(const char* pScheme) { if(ms_pSelf) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, POPUP_PASSWORD_QUERY_INI); if (Ini.Load(Buff)) { ms_pSelf->Init(&Ini, "Main"); ms_pSelf->m_Password.Init(&Ini, "Password"); ms_pSelf->m_Confirm.Init(&Ini, "BtnConfirm"); } /*--------------------*/ } /*--------------------*/ }
//-------------------------------------------------------------------------- // 功能:载入窗口的界面方案 //-------------------------------------------------------------------------- void KUiNewPlayer2::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_NEWPLAYER2); if (Ini.Load(Buff)) { Init(&Ini, "Main"); m_PropertyShow. Init(&Ini, "PropertyShow"); m_Gold. Init(&Ini, "Gold"); m_Wood. Init(&Ini, "Wood"); m_Water. Init(&Ini, "Water"); m_Fire. Init(&Ini, "Fire"); m_Earth. Init(&Ini, "Earth"); m_OK. Init(&Ini, "OK"); m_Cancel. Init(&Ini, "Cancel"); } }
//设置图形 void KUiLoginBackGround::SetConfig(const char* pszConfig) { if (m_pSelf == NULL || pszConfig == NULL || pszConfig[0] == 0 || strcmp(pszConfig, m_pSelf->m_szConfig) == 0) { return; } strncpy(m_pSelf->m_szConfig, pszConfig, sizeof(m_pSelf->m_szConfig)); char Buff[256]; KIniFile Ini; g_UiBase.GetCurSchemePath(Buff, 256); strcat(Buff, "\\"); strcat(Buff, SCHEME_INI); if (Ini.Load(Buff)) m_pSelf->LoadScheme(&Ini); }
// ------------------------------------------------------------------------- // 函数 : KUiSelPlayer::LoadScheme // 功能 : 载入界面方案 // ------------------------------------------------------------------------- void KUiSelPlayer::LoadScheme(const char* pScheme) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_SELPLAYER); if (Ini.Load(Buff)) { Init(&Ini, "SelRole"); // 窗口背景数据 Ini.GetString("SelRole", "LoginBg", "", m_szLoginBg, sizeof(m_szLoginBg)); Ini.GetString("SelRole", "PlayerImgPrefix", "", m_szPlayerImgPrefix, sizeof(m_szPlayerImgPrefix)); Buff[0] = '\0'; // 清空缓存 m_btnOk.Init(&Ini, "Ok"); m_btnCancel.Init(&Ini, "Cancel"); m_btnDel.Init(&Ini, "Del"); m_btnNew.Init(&Ini, "New"); m_ButterflyWnd.Init(&Ini, "Butterfly"); m_player[0].Init(&Ini, "Player"); m_Name[0].Init(&Ini, "Name"); m_Level[0].Init(&Ini, "Level"); m_PlayerInfoBg[0].Init(&Ini, "PlayerInfoBg"); for (int i = 1; i < MAX_PLAYER_PER_ACCOUNT; i ++) { m_player[0].Clone(&m_player[i]); m_Name[0].Clone(&m_Name[i]); m_Level[0].Clone(&m_Level[i]); m_PlayerInfoBg[0].Clone(&m_PlayerInfoBg[i]); } Ini.GetInteger("SelRole", "Player2Pos_0", 0, &m_ChildWndXOffset[0]); Ini.GetInteger("SelRole", "Player2Pos_1", 0, &m_ChildWndXOffset[1]); Ini.GetInteger("SelRole", "Player3Pos_0", 0, &m_ChildWndXOffset[2]); Ini.GetInteger("SelRole", "Player3Pos_1", 0, &m_ChildWndYOffset); Ini.GetInteger("SelRole", "Player3Pos_2", 0, &m_ChildWndXOffset[3]); m_player[0].GetPosition(&m_ChildPos[0], NULL); m_Name[0].GetPosition(&m_ChildPos[1], NULL); m_Level[0].GetPosition(&m_ChildPos[2], NULL); m_PlayerInfoBg[0].GetPosition(&m_ChildPos[3], NULL); m_LifeTimeText.Init(&Ini, "LifeTime"); } }
// Load the face void KUiTaskNote::LoadScheme(const char* pScheme) { if (m_pSelf) { char Buff[128]; KIniFile Ini; sprintf(Buff, "%s\\%s", pScheme, SCHEME_INI_TASKNOTE); if (Ini.Load(Buff)) { m_pSelf->Init(&Ini, "Main"); m_pSelf->m_BtnSystem.Init(&Ini, "SystemBtn"); m_pSelf->m_BtnPersonal.Init(&Ini, "PersonalBtn"); m_pSelf->m_BtnClose.Init(&Ini, "CloseBtn"); m_pSelf->m_SystemPad.LoadScheme(pScheme); m_pSelf->m_PersonalPad.LoadScheme(pScheme); } } }
//-------------------------------------------------------------------------- // 功能:获取服务器区域的列表 //-------------------------------------------------------------------------- KLoginServer* KLogin::GetServerRegionList(int& nCount, int& nAdviceChoice) { KLoginServer* pServers = NULL; nCount = 0; nAdviceChoice = 0; KIniFile File; int i; if (File.Load(SERVER_LIST_FILE)) { int nReadCount = 0; char szKey[32]; File.GetInteger("List", "RegionCount", 0, &nReadCount); if (nReadCount > 0) { pServers = (KLoginServer*)malloc(sizeof(KLoginServer) * nReadCount); if (pServers) { for (i = 0; i < nReadCount; i++) { sprintf(szKey, "Region_%d", i); if (File.GetString("List", szKey, "", pServers[nCount].Title, sizeof(pServers[nCount].Title)) && pServers[nCount].Title[0]) { nCount ++; } } if (nCount == 0) { free(pServers); pServers = NULL; } } } } if (m_Choices.nServerRegionIndex < 0 || m_Choices.nServerRegionIndex >= nCount) m_Choices.nServerRegionIndex = 0; nAdviceChoice = m_Choices.nServerRegionIndex; return pServers; }
//初始化 void KUiSelPlayerNearby::Initialize() { AddChild(&m_PlayerList); AddChild(&m_ListScroll); m_PlayerList.SetScrollbar(&m_ListScroll); AddChild(&m_InputEdit); AddChild(&m_RefreshBtn); AddChild(&m_CancelBtn); Wnd_AddWindow(this); char Buffer[256]; g_UiBase.GetCurSchemePath(Buffer, sizeof(Buffer)); strcat(Buffer, "\\"SCHEME_INI); KIniFile Ini; if (Ini.Load(Buffer)) { LoadScheme(&Ini); } }