public void ChangeTURNState(TOURNAMENT_MATCH_LIST pkMatch) { for (int i = 0; i < this.m_liMatchList.Count; i++) { UIListItemContainer item = this.m_lbBattleMatchInfo.GetItem(i); if (item != null) { TextField textField = item.GetElement(this.PLAYER1) as TextField; if (textField != null && textField.GetText().Equals(pkMatch.m_szPlayer[0])) { Label label = item.GetElement(this.TURN) as Label; if (label != null) { if (pkMatch.m_nStartTurnAlly == 0) { label.SetText(pkMatch.m_szPlayer[0]); } else if (pkMatch.m_nStartTurnAlly == 1) { label.SetText(pkMatch.m_szPlayer[1]); } else { label.SetText("RANDOM"); } } } } } }
public void UpdateTournamentMatchInfoFromListBox(TOURNAMENT_MATCH_LIST pkMatch) { for (int i = 0; i < this.m_liMatchList.Count; i++) { UIListItemContainer item = this.m_lbBattleMatchInfo.GetItem(i); if (item != null) { Label label = item.GetElement(this.MATCHINDEX) as Label; if (label != null) { int num = int.Parse(label.GetText()); if (num == pkMatch.nIndex) { TextField textField = item.GetElement(this.PLAYER1) as TextField; if (textField != null && !textField.GetText().Equals(pkMatch.m_szPlayer[0])) { pkMatch.m_szPlayer[0] = textField.GetText(); } textField = (item.GetElement(this.PLAYER2) as TextField); if (textField != null && !textField.GetText().Equals(pkMatch.m_szPlayer[1])) { pkMatch.m_szPlayer[1] = textField.GetText(); } textField = (item.GetElement(this.OBSERVER) as TextField); if (textField != null && !textField.GetText().Equals(pkMatch.m_szObserver)) { pkMatch.m_szObserver = textField.GetText(); } } } } } }
public void SetMatchList(GS_TOURNAMENT_MATCHLIST_INFO pkInfo) { if (pkInfo == null) { return; } if (this.m_liMatchList == null) { return; } TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = new TOURNAMENT_MATCH_LIST(); tOURNAMENT_MATCH_LIST.nIndex = pkInfo.nIndex; tOURNAMENT_MATCH_LIST.m_szPlayer[0] = TKString.NEWString(pkInfo.szCharName1); tOURNAMENT_MATCH_LIST.ePlayerState[0] = (eTOURNAMENT_PLAYER_STATE)pkInfo.nPlayerState1; tOURNAMENT_MATCH_LIST.m_szPlayer[1] = TKString.NEWString(pkInfo.szCharName2); tOURNAMENT_MATCH_LIST.ePlayerState[1] = (eTOURNAMENT_PLAYER_STATE)pkInfo.nPlayerState2; tOURNAMENT_MATCH_LIST.m_szObserver = TKString.NEWString(pkInfo.szObserver); tOURNAMENT_MATCH_LIST.m_nWinCount[0] = pkInfo.nWinCount1; tOURNAMENT_MATCH_LIST.m_nWinCount[1] = pkInfo.nWinCount2; tOURNAMENT_MATCH_LIST.bUseLoddy = pkInfo.bUseLobby; tOURNAMENT_MATCH_LIST.m_nStartTurnAlly = pkInfo.i32FirstTurn; if (this.m_nLastIndex < tOURNAMENT_MATCH_LIST.nIndex) { this.m_nLastIndex = tOURNAMENT_MATCH_LIST.nIndex; } this.m_liMatchList.Add(tOURNAMENT_MATCH_LIST); }
public void OnClickMatch(IUIObject obj) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = obj.Data as TOURNAMENT_MATCH_LIST; if (tOURNAMENT_MATCH_LIST != null) { if (tOURNAMENT_MATCH_LIST.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_MATCH) { GS_TOURNAMENT_STATE_UPDATE_REQ gS_TOURNAMENT_STATE_UPDATE_REQ = new GS_TOURNAMENT_STATE_UPDATE_REQ(); TKString.StringChar(tOURNAMENT_MATCH_LIST.m_szPlayer[0], ref gS_TOURNAMENT_STATE_UPDATE_REQ.szPlayerName); gS_TOURNAMENT_STATE_UPDATE_REQ.nMatchState = 2; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_TOURNAMENT_STATE_UPDATE_REQ, gS_TOURNAMENT_STATE_UPDATE_REQ); } else if (tOURNAMENT_MATCH_LIST.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_BATTLE) { GS_TOURNAMENT_STATE_UPDATE_REQ gS_TOURNAMENT_STATE_UPDATE_REQ2 = new GS_TOURNAMENT_STATE_UPDATE_REQ(); TKString.StringChar(tOURNAMENT_MATCH_LIST.m_szPlayer[0], ref gS_TOURNAMENT_STATE_UPDATE_REQ2.szPlayerName); gS_TOURNAMENT_STATE_UPDATE_REQ2.nMatchState = 8; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_TOURNAMENT_STATE_UPDATE_REQ, gS_TOURNAMENT_STATE_UPDATE_REQ2); } else if (tOURNAMENT_MATCH_LIST.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_LOBBY) { GS_TOURNAMENT_STATE_UPDATE_REQ gS_TOURNAMENT_STATE_UPDATE_REQ3 = new GS_TOURNAMENT_STATE_UPDATE_REQ(); TKString.StringChar(tOURNAMENT_MATCH_LIST.m_szPlayer[0], ref gS_TOURNAMENT_STATE_UPDATE_REQ3.szPlayerName); gS_TOURNAMENT_STATE_UPDATE_REQ3.nMatchState = 4; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_TOURNAMENT_STATE_UPDATE_REQ, gS_TOURNAMENT_STATE_UPDATE_REQ3); } } }
public void OnDeleteMatchOK(object a_oObject) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = a_oObject as TOURNAMENT_MATCH_LIST; if (tOURNAMENT_MATCH_LIST == null) { return; } this.UpdateMatchInfoToServer(tOURNAMENT_MATCH_LIST, true); }
public void OnClickTurnR(IUIObject obj) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = obj.Data as TOURNAMENT_MATCH_LIST; if (tOURNAMENT_MATCH_LIST != null && tOURNAMENT_MATCH_LIST.m_nStartTurnAlly != 2) { tOURNAMENT_MATCH_LIST.m_nStartTurnAlly = 2; this.ChangeTURNState(tOURNAMENT_MATCH_LIST); this.UpdateMatchInfoToServer(tOURNAMENT_MATCH_LIST, false); } }
public void OnClickUpdateMatch(IUIObject obj) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = obj.Data as TOURNAMENT_MATCH_LIST; if (tOURNAMENT_MATCH_LIST != null) { this.UpdateTournamentMatchInfoFromListBox(tOURNAMENT_MATCH_LIST); this.ChangeTURNState(tOURNAMENT_MATCH_LIST); this.UpdateMatchInfoToServer(tOURNAMENT_MATCH_LIST, false); } }
public void UpdateMatchInfoToServer(TOURNAMENT_MATCH_LIST pkMatchInfo, bool bDelete) { GS_TOURNAMENT_MATCH_UPDATE_REQ gS_TOURNAMENT_MATCH_UPDATE_REQ = new GS_TOURNAMENT_MATCH_UPDATE_REQ(); gS_TOURNAMENT_MATCH_UPDATE_REQ.nIndex = pkMatchInfo.nIndex; TKString.StringChar(pkMatchInfo.m_szPlayer[0], ref gS_TOURNAMENT_MATCH_UPDATE_REQ.szCharName1); TKString.StringChar(pkMatchInfo.m_szPlayer[1], ref gS_TOURNAMENT_MATCH_UPDATE_REQ.szCharName2); TKString.StringChar(pkMatchInfo.m_szObserver, ref gS_TOURNAMENT_MATCH_UPDATE_REQ.szObserver); gS_TOURNAMENT_MATCH_UPDATE_REQ.i32FirstTurn = pkMatchInfo.m_nStartTurnAlly; gS_TOURNAMENT_MATCH_UPDATE_REQ.bUseLobby = pkMatchInfo.bUseLoddy; gS_TOURNAMENT_MATCH_UPDATE_REQ.bDelete = bDelete; SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_TOURNAMENT_MATCH_UPDATE_REQ, gS_TOURNAMENT_MATCH_UPDATE_REQ); }
public void ChangeButtonState(TOURNAMENT_MATCH_LIST pkMatch) { for (int i = 0; i < this.m_liMatchList.Count; i++) { UIListItemContainer item = this.m_lbBattleMatchInfo.GetItem(i); if (item != null) { TextField textField = item.GetElement(this.PLAYER1) as TextField; if (textField != null && textField.GetText().Equals(pkMatch.m_szPlayer[0])) { UIButton uIButton = item.GetElement(this.BUTTON) as UIButton; if (uIButton != null) { if (pkMatch.eMatchState != eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_NONE) { if (pkMatch.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_MATCH) { uIButton.enabled = true; uIButton.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2391")); } else if (pkMatch.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_READY) { uIButton.enabled = false; uIButton.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2422")); } else if (pkMatch.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_LOBBY) { uIButton.enabled = true; uIButton.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2765")); } else if (pkMatch.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_BATTLE) { uIButton.enabled = true; uIButton.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2392")); } else if (pkMatch.eMatchState == eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_LOBBY_WAIT) { uIButton.enabled = false; uIButton.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2766")); } } else { uIButton.enabled = false; uIButton.SetText(string.Empty); } } } } } }
public void OnClickDELETE(IUIObject obj) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = obj.Data as TOURNAMENT_MATCH_LIST; if (tOURNAMENT_MATCH_LIST != null) { MsgBoxUI msgBoxUI = NrTSingleton <FormsManager> .Instance.LoadForm(G_ID.MSGBOX_DLG) as MsgBoxUI; string empty = string.Empty; NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromMessageBox("216"), "charname1", tOURNAMENT_MATCH_LIST.m_szPlayer[0], "charname2", tOURNAMENT_MATCH_LIST.m_szPlayer[1] }); msgBoxUI.SetMsg(new YesDelegate(this.OnDeleteMatchOK), tOURNAMENT_MATCH_LIST, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1795"), empty, eMsgType.MB_OK_CANCEL, 2); } }
public void AddMatchInfo(bool bUseLobby) { TOURNAMENT_MATCH_LIST tOURNAMENT_MATCH_LIST = new TOURNAMENT_MATCH_LIST(); tOURNAMENT_MATCH_LIST.nIndex = this.m_nLastIndex + 1; this.m_nLastIndex++; tOURNAMENT_MATCH_LIST.m_szPlayer[0] = "Player" + tOURNAMENT_MATCH_LIST.nIndex.ToString() + "_1"; tOURNAMENT_MATCH_LIST.ePlayerState[0] = eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_NONE; tOURNAMENT_MATCH_LIST.m_szPlayer[1] = "Player" + tOURNAMENT_MATCH_LIST.nIndex.ToString() + "_2"; tOURNAMENT_MATCH_LIST.ePlayerState[1] = eTOURNAMENT_PLAYER_STATE.eTOURNAMENT_PLAYER_STATE_NONE; tOURNAMENT_MATCH_LIST.m_szObserver = "OBSERVER" + tOURNAMENT_MATCH_LIST.nIndex.ToString(); tOURNAMENT_MATCH_LIST.m_nWinCount[0] = 0; tOURNAMENT_MATCH_LIST.m_nWinCount[1] = 0; tOURNAMENT_MATCH_LIST.m_nStartTurnAlly = 0; tOURNAMENT_MATCH_LIST.bUseLoddy = bUseLobby; this.m_liMatchList.Add(tOURNAMENT_MATCH_LIST); NewListItem newListItem = new NewListItem(this.m_lbBattleMatchInfo.ColumnNum, true, string.Empty); string tournamentStateToString = this.GetTournamentStateToString(tOURNAMENT_MATCH_LIST.ePlayerState[0]); newListItem.SetListItemData(7, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2387"), null, null, null); newListItem.SetListItemData(8, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2388"), null, null, null); newListItem.SetListItemData(9, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2389"), null, null, null); newListItem.SetListItemData(10, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2390"), null, null, null); newListItem.SetListItemData(this.STATE1, tournamentStateToString, null, null, null); tournamentStateToString = this.GetTournamentStateToString(tOURNAMENT_MATCH_LIST.ePlayerState[1]); newListItem.SetListItemData(this.STATE2, tournamentStateToString, null, null, null); newListItem.SetListItemData(this.BUTTON, string.Empty, tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickMatch), null); newListItem.SetListItemData(this.PLAYER1, tOURNAMENT_MATCH_LIST.m_szPlayer[0], null, null, null); newListItem.SetListItemData(this.PLAYER2, tOURNAMENT_MATCH_LIST.m_szPlayer[1], null, null, null); newListItem.SetListItemData(this.OBSERVER, tOURNAMENT_MATCH_LIST.m_szObserver, null, null, null); newListItem.SetListItemData(this.BUTTON_UPDATE, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2420"), tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickUpdateMatch), null); newListItem.SetListItemData(this.MATCHINDEX, tOURNAMENT_MATCH_LIST.nIndex.ToString(), null, null, null); if (tOURNAMENT_MATCH_LIST.m_nStartTurnAlly == 0) { newListItem.SetListItemData(this.TURN, tOURNAMENT_MATCH_LIST.m_szPlayer[0], null, null, null); } else if (tOURNAMENT_MATCH_LIST.m_nStartTurnAlly == 1) { newListItem.SetListItemData(this.TURN, tOURNAMENT_MATCH_LIST.m_szPlayer[1], null, null, null); } else { newListItem.SetListItemData(this.TURN, "RANDOM", null, null, null); } newListItem.SetListItemData(18, "1", tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickTurn1), null); newListItem.SetListItemData(19, "2", tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickTurn2), null); newListItem.SetListItemData(20, "R", tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickTurnR), null); newListItem.SetListItemData(this.WINCOUNT1, tOURNAMENT_MATCH_LIST.m_nWinCount[0].ToString(), null, null, null); newListItem.SetListItemData(this.WINCOUNT2, tOURNAMENT_MATCH_LIST.m_nWinCount[1].ToString(), null, null, null); newListItem.SetListItemData(this.DELETEBUTTON, string.Empty, tOURNAMENT_MATCH_LIST, new EZValueChangedDelegate(this.OnClickDELETE), null); if (bUseLobby) { newListItem.SetListItemData(this.LOBBY, NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2764"), null, null, null); } else { newListItem.SetListItemData(this.LOBBY, string.Empty, null, null, null); } newListItem.SetListItemEnable(this.LOBBY, bUseLobby); this.m_lbBattleMatchInfo.Add(newListItem); this.m_lbBattleMatchInfo.RepositionItems(); this.UpdateTournamentMatchInfoFromListBox(tOURNAMENT_MATCH_LIST); this.ChangeTURNState(tOURNAMENT_MATCH_LIST); this.UpdateMatchInfoToServer(tOURNAMENT_MATCH_LIST, false); }