void freeUse_HeroClick(EventContext evt) { UI_PlayerSimpleInfo playerSimpleInfo = evt.sender as UI_PlayerSimpleInfo; if (selectedCards[0].isValidTarget(game, getFreeUseInfo <FreeUse>(), playerSimpleInfo.Player, out string invalidInfo))//是否是可以选中的目标? { selectedPlayers.Clear(); selectedPlayers.Add(playerSimpleInfo.Player); //TODO:支持选择多个玩家 //if (selectedPlayers.Contains(playerSimpleInfo.Player)) // selectedPlayers.Remove(playerSimpleInfo.Player); //else // selectedPlayers.Add(playerSimpleInfo.Player); flushSelectPlayer(); checkFreeUseAble(); } else { selectedPlayers.Clear(); flushSelectPlayer(); checkFreeUseAble(); if (!string.IsNullOrEmpty(invalidInfo)) { m_UseTip.text = invalidInfo; } } }
public override void ConstructFromXML(XML xml) { base.ConstructFromXML(xml); m_ChooseHero = this.GetControllerAt(0); m_Request = this.GetControllerAt(1); m_ChangeSeatController = this.GetControllerAt(2); m_PlayerInfo0 = (UI_PlayerSimpleInfo)this.GetChildAt(1); m_PlayerInfo1 = (UI_PlayerSimpleInfo)this.GetChildAt(2); m_PlayerInfo2 = (UI_PlayerSimpleInfo)this.GetChildAt(3); m_PlayerInfo3 = (UI_PlayerSimpleInfo)this.GetChildAt(4); m_PlayerInfo4 = (UI_PlayerSimpleInfo)this.GetChildAt(5); m_PlayerInfo5 = (UI_PlayerSimpleInfo)this.GetChildAt(6); m_PlayerInfo6 = (UI_PlayerSimpleInfo)this.GetChildAt(7); m_PlayerInfo7 = (UI_PlayerSimpleInfo)this.GetChildAt(8); m_EventDeckCount = (GTextField)this.GetChildAt(13); m_ActionDeckCount = (GTextField)this.GetChildAt(17); m_MainSize = (UI_MainSize)this.GetChildAt(19); m_RoundInfo = (GTextField)this.GetChildAt(20); m_TurnInfo = (GTextField)this.GetChildAt(21); m_NowEvent = (UI_Card)this.GetChildAt(26); m_DelayAction = (GList)this.GetChildAt(27); m_ActionDropDeck = (GTextField)this.GetChildAt(29); m_EventDropDeckCount = (GTextField)this.GetChildAt(32); m_PlayerHero = (UI_Card)this.GetChildAt(34); m_GameInfo = (UI_Log)this.GetChildAt(36); m_Hand = (UI_HandCards)this.GetChildAt(37); m_SetEvent = (UI_Card)this.GetChildAt(38); m_NowTheme = (GComponent)this.GetChildAt(41); m_ThemeDeckCount = (GTextField)this.GetChildAt(46); m_ActivePlayer = (GTextField)this.GetChildAt(48); m_TimeBar = (GProgressBar)this.GetChildAt(50); m_NowAction = (UI_Card)this.GetChildAt(51); m_UseTip = (GTextField)this.GetChildAt(62); m_skills = (GList)this.GetChildAt(63); m_useCard = (GButton)this.GetChildAt(65); m_Endturn = (GButton)this.GetChildAt(66); m_freeUse = (GGroup)this.GetChildAt(67); m_choose_y = (GButton)this.GetChildAt(69); m_choose_n = (GButton)this.GetChildAt(70); m_chooseCard = (GGroup)this.GetChildAt(71); m_choiceList = (GList)this.GetChildAt(73); m_takeChoice = (GGroup)this.GetChildAt(74); m_requestList = (GList)this.GetChildAt(76); m_ChooseRequest = (GGroup)this.GetChildAt(77); m_limitUse = (GButton)this.GetChildAt(78); m_limitUseCancel = (GButton)this.GetChildAt(79); m_forward = (GButton)this.GetChildAt(81); m_backward = (GButton)this.GetChildAt(82); m_setcard = (GButton)this.GetChildAt(83); m_chooseDirection = (GGroup)this.GetChildAt(84); m_HeroChooseWindow = (UI_ChooseHero)this.GetChildAt(86); m_ChangeSeatPanel = (UI_ChangeSeat)this.GetChildAt(87); Init(); }
private void SimpleInfo_Init() { playersSimpleInfo = new UI_PlayerSimpleInfo[8]; for (int i = 0; i < 8; i++) { int k = i; UI_PlayerSimpleInfo uI_PlayerSimpleInfo = GetChild("PlayerInfo" + i) as UI_PlayerSimpleInfo; playersSimpleInfo[i] = uI_PlayerSimpleInfo; playersSimpleInfo[i].changeStateOnClick = false; } }
void freeUse_HeroClick(EventContext evt) { UI_PlayerSimpleInfo playerSimpleInfo = evt.sender as UI_PlayerSimpleInfo; Log.Debug(playerSimpleInfo.Player.Name); if (selectedPlayers.Contains(playerSimpleInfo.Player)) { selectedPlayers.Remove(playerSimpleInfo.Player); } else { selectedPlayers.Add(playerSimpleInfo.Player); } flushSelectPlayer(); checkUseAble(); }