public override void Clear() { base.Clear(); for (int i = 0; i < tehaiList.Count; i++) { PlayerUI.CollectMahjongPai(tehaiList[i]); } tehaiList.Clear(); }
public override void Clear() { base.Clear(); foreach (var kv in mahjongYama) { PlayerUI.CollectMahjongPai(kv.Value); } mahjongYama.Clear(); }
public void Hide() { for (int i = 0; i < kazePaiList.Count; i++) { PlayerUI.CollectMahjongPai(kazePaiList[i]); } kazePaiList.Clear(); gameObject.SetActive(false); }
public override void Clear() { base.Clear(); // clear all hai. for (int i = 0; i < _allHais.Count; i++) { PlayerUI.CollectMahjongPai(_allHais[i]); } _allHais.Clear(); }
public override void Clear() { base.Clear(); // clear all hai. for (int i = 0; i < _allHais.Count; i++) { PlayerUI.CollectMahjongPai(_allHais[i]); } _allHais.Clear(); AllHouUI.instance._cuurIndex = 0; }
void ClearMahjongList(List <MahjongPai> list) { if (list == null) { return; } for (int i = 0; i < list.Count; i++) { PlayerUI.CollectMahjongPai(list[i]); } list.Clear(); }
public override void Clear() { base.Clear(); // clear all pai. for (int i = 0; i < fuuroHais.Count; i++) { MahjongPai pai = fuuroHais[i]; PlayerUI.CollectMahjongPai(pai); } fuuroHais.Clear(); curMaxPosX = 0; }
// handle ui event. public void OnHandleEvent(UIEventType evtID, object[] args) { switch (evtID) { case UIEventType.Init_Game: // game init / { Clear(); Init(); HideAllHudPanel(); } break; case UIEventType.Select_ChiiCha: { selectChiiChanPanel.Show(); } break; case UIEventType.Init_PlayerInfoUI: { List <Player> players = Model.PlayerList; for (int i = 0; i < players.Count; i++) { Player player = players[i]; PlayerUI ui = playerUIDict[i]; ui.SetKaze(player.JiKaze); ui.SetTenbou(player.Tenbou); ui.Reach(false); ui.SetOyaKaze(i == Model.OyaIndex); ui.BindPlayer(player); if (player.JiKaze == Model.getManKaze()) { playerInputPanel.BindPlayer(player); playerInputPanel.SetOwnerPlayerUI(ui); } } } break; case UIEventType.SetYama_BeforeHaipai: { // Yama. Hai[] yamaHais = Model.Yama.getYamaHais(); for (int i = 0; i < 4; i++) { Dictionary <int, Hai> haiDict = new Dictionary <int, Hai>(); int[] indexRange = getStartEndOfYamaUIOfPlayer(i); for (int h = indexRange[0]; h <= indexRange[1]; h++) { haiDict.Add(h, yamaHais[h]); } playerUIDict[i].SetYamaHais(haiDict, indexRange[0], indexRange[1]); } //TestYama(); } break; case UIEventType.DisplayKyokuInfo: { string kyokuStr = (string)args[0]; string honbaStr = (string)args[1]; kyokuInfoPanel.Show(kyokuStr, honbaStr); } break; case UIEventType.Select_Wareme: { Sai[] sais = Model.Saifuri(); saifuriPanel.Show(sais[0].Num, sais[1].Num); } break; case UIEventType.SetUI_AfterHaipai: // 配牌 / { /// set game info. gameInfo.SetKyoku(Model.getBaKaze(), Model.Kyoku); gameInfo.SetReachCount(Model.ReachBou); gameInfo.SetHonba(Model.HonBa); gameInfo.SetRemain(Model.getTsumoRemainCount()); int totalPickHaiCount = (4 * 3 + 1) * Model.PlayerList.Count; /// set yama. int waremeIndex = Model.Wareme; int tsumoHaiStartIndex = waremeIndex + totalPickHaiCount; //Debug.Log(string.Format("remove yamahai in range[{0},{1}]", waremeIndex+1, tsumoHaiStartIndex % Yama.YAMA_HAIS_MAX)); for (int i = waremeIndex + 1; i <= tsumoHaiStartIndex; i++) { int index = i % Yama.YAMA_HAIS_MAX; int p = findPlayerForYamahaiIndex(index); MahjongPai pai = playerUIDict[p].PickUpYamaHai(index); PlayerUI.CollectMahjongPai(pai); } /// set tehais. int PlayerCount = Model.PlayerList.Count; for (int i = 0; i < PlayerCount; i++) { Player player = Model.PlayerList[i]; PlayerUI ui = playerUIDict[i]; ui.SetTehai(player.Tehai.getJyunTehai()); ui.SetTehaiVisiable(!player.IsAI); playerUIDict_Kaze[player.JiKaze] = ui; } /// set init Dora. int showIndex = waremeIndex - 5; if (showIndex < 0) { showIndex += Yama.YAMA_HAIS_MAX; } int pi = findPlayerForYamahaiIndex(showIndex); playerUIDict[pi].ShowYamaHai(showIndex); // set Wareme. showIndex = waremeIndex - 13; if (showIndex < 0) { showIndex += Yama.YAMA_HAIS_MAX; } pi = findPlayerForYamahaiIndex(showIndex); playerUIDict[pi].SetWareme(showIndex); } break; case UIEventType.DisplayMenuList: { // TODO: shouldn't use Model too frequently // if menu is for HandleSuteHai, set sute hai shining. if (Model.CurrentRequest == ERequest.Handle_SuteHai && Model.ActivePlayer.Action.MenuList.Count > 0) { if (hasShining == false) { shiningKaze = Model.FromKaze; playerUIDict_Kaze[shiningKaze].SetShining(true); hasShining = true; } } playerInputPanel.Show(); } break; case UIEventType.HideMenuList: { playerInputPanel.Hide(); // if menu is for HandleSuteHai, set sute hai not shining. if (hasShining) { playerUIDict_Kaze[shiningKaze].SetShining(false); hasShining = false; } } break; case UIEventType.PickTsumoHai: { gameInfo.SetRemain(Model.getTsumoRemainCount()); Player activePlayer = (Player)args[0]; int lastPickIndex = (int)args[1]; Hai newHai = (Hai)args[2]; int yamaPlayerIndex = findPlayerForYamahaiIndex(lastPickIndex); MahjongPai pai = playerUIDict[yamaPlayerIndex].PickUpYamaHai(lastPickIndex); PlayerUI.CollectMahjongPai(pai); PlayerUI playerUI = playerUIDict_Kaze[activePlayer.JiKaze]; playerUI.PickHai(newHai, true, !activePlayer.IsAI); SetManInputEnable(!activePlayer.IsAI && !activePlayer.IsReach); } break; case UIEventType.PickRinshanHai: { Player activePlayer = (Player)args[0]; int lastPickRinshanIndex = (int)args[1]; Hai newHai = (Hai)args[2]; int newDoraHaiIndex = (int)args[3]; int yamaPlayerIndex = findPlayerForYamahaiIndex(lastPickRinshanIndex); MahjongPai pai = playerUIDict[yamaPlayerIndex].PickUpYamaHai(lastPickRinshanIndex); PlayerUI.CollectMahjongPai(pai); PlayerUI playerUI = playerUIDict_Kaze[activePlayer.JiKaze]; playerUI.PickHai(newHai, true, !activePlayer.IsAI); // open a omote dora hai int omoteDoraPlayerIndex = findPlayerForYamahaiIndex(newDoraHaiIndex); playerUIDict[omoteDoraPlayerIndex].ShowYamaHai(newDoraHaiIndex); SetManInputEnable(!activePlayer.IsAI && !activePlayer.IsReach); } break; case UIEventType.SuteHai: { UIAnimWillEndAfter(SuteHaiAnimationTime); Player activePlayer = (Player)args[0]; int sutehaiIndex = (int)args[1]; //Hai suteHai = (Hai)args[2]; bool isTedashi = (bool)args[3]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SuteHai(sutehaiIndex); ui.SetTedashi(isTedashi); // needn't sort hais if sute the last one. if (sutehaiIndex < activePlayer.Tehai.getJyunTehaiCount()) { ui.SortTehai(activePlayer.Tehai.getJyunTehai(), SuteHaiAnimationTime); } SetManInputEnable(false); // play a sute hai sound AudioManager.Get().PlaySFX(AudioConfig.GetSEPath(ESeType.SuteHai)); } break; case UIEventType.Reach: { UIAnimWillEndAfter(ReachAnimationTime); Player activePlayer = (Player)args[0]; int sutehaiIndex = (int)args[1]; //Hai suteHai = (Hai)args[2]; bool isTedashi = (bool)args[3]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SuteHai(sutehaiIndex); ui.SetTedashi(isTedashi); ui.Reach(); ui.Speak(ECvType.Reach); // needn't sort hais if sute the last one. if (sutehaiIndex < activePlayer.Tehai.getJyunTehaiCount()) { ui.SortTehai(activePlayer.Tehai.getJyunTehai(), SuteHaiAnimationTime); } ui.Info.SetReach(true); ui.Info.SetTenbou(activePlayer.Tenbou); gameInfo.SetReachCount(Model.ReachBou); SetManInputEnable(false); } break; case UIEventType.Kakan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; //Hai kakanHai = (Hai)args[1]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros()); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Ankan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros()); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.DaiMinKan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros()); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Pon: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros()); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Pon); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Chii_Left: case UIEventType.Chii_Center: case UIEventType.Chii_Right: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros()); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Chii); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Ron_Agari: { UIAnimWillEndAfter(AgariAnimationTime); List <EKaze> ronPlayers = (List <EKaze>)args[0]; EKaze fromKaze = (EKaze)args[1]; Hai ronHai = (Hai)args[2]; for (int i = 0; i < ronPlayers.Count; i++) { PlayerUI ui = playerUIDict_Kaze[ronPlayers[i]]; ui.PickHai(ronHai, true, false); ui.SetTehaiVisiable(true); ui.Speak(ECvType.Ron); } PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); // show out all players' tehai ShowAllPlayerTehai(); } break; case UIEventType.Tsumo_Agari: { UIAnimWillEndAfter(AgariAnimationTime); Player activePlayer = (Player)args[0]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SetTehaiVisiable(true); ui.Speak(ECvType.Tsumo); // show out all players' tehai ShowAllPlayerTehai(); } break; case UIEventType.Display_Agari_Panel: { List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[0]; agariPanel.Show(agariList); } break; case UIEventType.RyuuKyoku: { ERyuuKyokuReason reason = (ERyuuKyokuReason)args[0]; List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[1]; ShowAllPlayerTehai(); ryuuKyokuPanel.Show(reason, agariList); } break; case UIEventType.End_Game: { List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[0]; gameOverPanel.Show(agariList); } break; } }
// handle ui event. public void OnHandleEvent(UIEventType evtID, object[] args) { //Debug.Log ("OnHandleEvent("+evtID+")"); switch (evtID) { case UIEventType.Init_Game: // game init / { Clear(); Init(); HideAllHudPanel(); } break; case UIEventType.Select_ChiiCha: { if (selectChiiChanPanel) { selectChiiChanPanel.Show(); } //Play BGM AudioManager.Get().BgmVolume = 0.2f; AudioManager.Get().PlayBGM(); } break; case UIEventType.Init_PlayerInfoUI: { List <Player> players = Model.PlayerList; for (int i = 0; i < players.Count; i++) { Player player = players[i]; PlayerUI ui = playerUIDict[i]; ui.SetKaze(player.JiKaze); //ui.SetTenbou( player.Tenbou ); ui.Reach(false); ui.SetOyaKaze(i == Model.OyaIndex); ui.BindPlayer(player); if (player.JiKaze == Model.getManKaze()) { if (playerInputPanel) { playerInputPanel.BindPlayer(player); playerInputPanel.SetOwnerPlayerUI(ui); } if (hudPanel) { string str = ResManager.getString("kaze_" + player.JiKaze.ToString().ToLower()); hudPanel.setWindTxt(str); } } } } break; case UIEventType.SetYama_BeforeHaipai: { // Yama. Hai[] yamaHais = Model.Yama.getYamaHais(); for (int i = 0; i < 4; i++) { Dictionary <int, Hai> haiDict = new Dictionary <int, Hai>(); int[] indexRange = getStartEndOfYamaUIOfPlayer(i); for (int h = indexRange[0]; h <= indexRange[1]; h++) { haiDict.Add(h, yamaHais[h]); } playerUIDict[i].SetYamaHais(haiDict, indexRange[0], indexRange[1]); playerUIDict [i].SetYamaPlayerIndex(i); playerUIDict [i].SetHouPlayerIndex(i); } //TestYama(); } break; case UIEventType.DisplayKyokuInfo: { string kyokuStr = (string)args[0]; string honbaStr = (string)args[1]; if (kyokuInfoPanel) { kyokuInfoPanel.Show(kyokuStr, honbaStr); } if (hudPanel) { hudPanel.SetKyokoTxt(kyokuStr, honbaStr); } } break; case UIEventType.Select_Wareme: { Sai[] sais = Model.Saifuri(); if (saifuriPanel) { //saifuriPanel.Show (sais [0].Num, sais [1].Num, sais [2].Num); saifuriPanel.ShowPanel(); //擲骰子 Dice.Instance.ThrowDices(sais); // play a throw dice sound AudioManager.Get().PlaySFX(AudioConfig.GetSEPath(ESeType.Dice)); } } break; case UIEventType.SetUI_AfterHaipai: // 配牌 { /* * if (gameInfo) { * /// set game info. * gameInfo.SetKyoku (Model.getBaKaze (), Model.Kyoku); * gameInfo.SetReachCount (Model.ReachBou); * gameInfo.SetHonba (Model.HonBa); * gameInfo.SetRemain (Model.getTsumoRemainCount ()); * } */ if (hudPanel) { string str = "kyoku_" + Model.getBaKaze().ToString().ToLower() + '_' + Model.Kyoku.ToString(); //Debug.Log(str); string honbaStr = string.Empty; string kyokuStr = string.Empty; kyokuStr = ResManager.getString(str); //Debug.Log(kyokuStr); //string kazeStr = ResManager.getString( "kaze_" + logicOwner.getBaKaze().ToString().ToLower() ); //kyokuStr = kazeStr + logicOwner.Kyoku.ToString() + ResManager.getString("kyoku"); if (Model.HonBa > 0) { honbaStr = Model.HonBa.ToString() + ResManager.getString("honba"); } hudPanel.SetKyokoTxt(kyokuStr, honbaStr); } int totalPickHaiCount = (4 * 4) * Model.PlayerList.Count; //Debug.Log ("totalPickHaiCount="+totalPickHaiCount); /// set yama. int waremeIndex = Model.Wareme; //waremeIndex = 0; //Debug.Log ("waremeIndex="+waremeIndex); int tsumoHaiStartIndex = waremeIndex + totalPickHaiCount; //Debug.Log(string.Format("remove yamahai in range[{0},{1}]", waremeIndex, tsumoHaiStartIndex % Yama.YAMA_HAIS_MAX)); for (int i = waremeIndex; i <= tsumoHaiStartIndex; i++) { int index = i % Yama.YAMA_HAIS_MAX; int p = findPlayerForYamahaiIndex(index); MahjongPai pai = playerUIDict[p].PickUpYamaHai(index); PlayerUI.CollectMahjongPai(pai); } /// set tehais. int PlayerCount = Model.PlayerList.Count; for (int i = 0; i < PlayerCount; i++) { Player player = Model.PlayerList[i]; if (playerUIDict.Count > i) { PlayerUI ui = playerUIDict [i]; ui.SetPlayerUIndex(i); ui.SetTehai(player.Tehai.getJyunTehai()); ui.SetTehaiVisiable(!player.IsAI); playerUIDict_Kaze [player.JiKaze] = ui; } } /// set init Dora. //int showIndex = waremeIndex - 5; //if( showIndex < 0 ) // showIndex += Yama.YAMA_HAIS_MAX; //int pi = findPlayerForYamahaiIndex(showIndex); //playerUIDict[pi].ShowYamaHai(showIndex); // set Wareme. //showIndex = waremeIndex-16; //if( showIndex < 0 ) // showIndex += Yama.YAMA_HAIS_MAX; //pi = findPlayerForYamahaiIndex(showIndex); //playerUIDict[pi].SetWareme(showIndex); } break; case UIEventType.DisplayMenuList: { // TODO: shouldn't use Model too frequently // if menu is for HandleSuteHai, set sute hai shining. if (Model.CurrentRequest == ERequest.Handle_SuteHai && Model.ActivePlayer.Action.MenuList.Count > 0) { if (hasShining == false) { shiningKaze = Model.FromKaze; playerUIDict_Kaze[shiningKaze].SetShining(true); hasShining = true; } } playerInputPanel.Show(); } break; case UIEventType.HideMenuList: { if (playerInputPanel) { playerInputPanel.Hide(); } if (panelCountDown) { panelCountDown.Hide(); } // if menu is for HandleSuteHai, set sute hai not shining. if (hasShining) { playerUIDict_Kaze[shiningKaze].SetShining(false); hasShining = false; } } break; case UIEventType.PickTsumoHai: { //if(gameInfo) // gameInfo.SetRemain( Model.getTsumoRemainCount() ); Player activePlayer = (Player)args[0]; int lastPickIndex = (int)args[1]; Hai newHai = (Hai)args[2]; string name = ResManager.getMagjongName(newHai.Kind, newHai.Num); string wind = ResManager.getString("kaze_" + activePlayer.JiKaze.ToString().ToLower()); Debug.Log("[" + wind + "]" + activePlayer.Name + "摸到了" + name); //Debug.Log ("剩餘:"+Model.getTsumoRemainCount ()); if (hudPanel) { hudPanel.SetRemainCount(Model.getTsumoRemainCount()); } int yamaPlayerIndex = findPlayerForYamahaiIndex(lastPickIndex); //Debug.Log ("lastPickIndex="+lastPickIndex); if (playerUIDict.Count > yamaPlayerIndex) { MahjongPai pai = playerUIDict [yamaPlayerIndex].PickUpYamaHai(lastPickIndex); PlayerUI.CollectMahjongPai(pai); } PlayerUI playerUI = playerUIDict_Kaze[activePlayer.JiKaze]; playerUI.PickHai(newHai, true, !activePlayer.IsAI); SetManInputEnable(!activePlayer.IsAI && !activePlayer.IsReach); } break; case UIEventType.PickRinshanHai: { Player activePlayer = (Player)args[0]; int lastPickRinshanIndex = (int)args[1]; Hai newHai = (Hai)args[2]; int newDoraHaiIndex = (int)args[3]; int yamaPlayerIndex = findPlayerForYamahaiIndex(lastPickRinshanIndex); MahjongPai pai = playerUIDict[yamaPlayerIndex].PickUpYamaHai(lastPickRinshanIndex); PlayerUI.CollectMahjongPai(pai); PlayerUI playerUI = playerUIDict_Kaze[activePlayer.JiKaze]; playerUI.PickHai(newHai, true, !activePlayer.IsAI); // open a omote dora hai int omoteDoraPlayerIndex = findPlayerForYamahaiIndex(newDoraHaiIndex); playerUIDict[omoteDoraPlayerIndex].ShowYamaHai(newDoraHaiIndex); SetManInputEnable(!activePlayer.IsAI && !activePlayer.IsReach); } break; case UIEventType.SuteHai: { //出牌 UIAnimWillEndAfter(SuteHaiAnimationTime); Player activePlayer = (Player)args[0]; int sutehaiIndex = (int)args[1]; //Hai suteHai = (Hai)args[2]; bool isTedashi = (bool)args[3]; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SuteHai(sutehaiIndex); ui.SetTedashi(isTedashi); // needn't sort hais if sute the last one. if (sutehaiIndex < activePlayer.Tehai.getJyunTehaiCount()) { ui.SortTehai(activePlayer.Tehai.getJyunTehai(), SuteHaiAnimationTime); } SetManInputEnable(false); // play a sute hai sound //AudioManager.Get().PlaySFX( AudioConfig.GetSEPath(ESeType.SuteHai) ); } break; case UIEventType.Reach: { //聽牌 UIAnimWillEndAfter(ReachAnimationTime); Player activePlayer = (Player)args[0]; int sutehaiIndex = (int)args[1]; //Hai suteHai = (Hai)args[2]; bool isTedashi = (bool)args[3]; Debug.Log(activePlayer.Name + "聽牌"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SuteHai(sutehaiIndex); ui.SetTedashi(isTedashi); ui.Reach(); ui.Speak(ECvType.Reach); // needn't sort hais if sute the last one. if (sutehaiIndex < activePlayer.Tehai.getJyunTehaiCount()) { ui.SortTehai(activePlayer.Tehai.getJyunTehai(), SuteHaiAnimationTime); } //ui.Info.SetReach(true); //ui.Info.SetTenbou( activePlayer.Tenbou ); //if(gameInfo) // gameInfo.SetReachCount( Model.ReachBou ); if (panelPlayers) { panelPlayers.ShowListener(ui.Index); } SetManInputEnable(false); } break; case UIEventType.Kakan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; //Hai kakanHai = (Hai)args[1]; Debug.Log(activePlayer.Name + "喊了槓"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros(), activePlayer.IsAI); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); if (panelPlayers) { panelPlayers.ShowKan(ui.Index); } SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Ankan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; Debug.Log(activePlayer.Name + "喊了暗槓"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros(), activePlayer.IsAI); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); if (panelPlayers) { panelPlayers.ShowKan(ui.Index); } SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.DaiMinKan: { UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; Debug.Log(activePlayer.Name + "喊了大明槓"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros(), activePlayer.IsAI); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Kan); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); if (panelPlayers) { panelPlayers.ShowKan(ui.Index); } SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Pon: { //碰 UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; Debug.Log(activePlayer.Name + "喊了碰!!!"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros(), activePlayer.IsAI); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Pon); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); if (panelPlayers) { panelPlayers.ShowPon(ui.Index); } SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Chii_Left: case UIEventType.Chii_Center: case UIEventType.Chii_Right: { //吃牌 UIAnimWillEndAfter(NakiAnimationTime); Player activePlayer = (Player)args[0]; EKaze fromKaze = (EKaze)args[1]; Debug.Log(activePlayer.Name + "喊了吃!!!"); PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.UpdateFuuro(activePlayer.Tehai.getFuuros(), activePlayer.IsAI); ui.SetTehai(activePlayer.Tehai.getJyunTehai(), true); ui.Speak(ECvType.Chii); PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); if (panelPlayers) { panelPlayers.ShowChii(ui.Index); } SetManInputEnable(!activePlayer.IsAI); } break; case UIEventType.Ron_Agari: { //胡牌 UIAnimWillEndAfter(AgariAnimationTime); List <EKaze> ronPlayers = (List <EKaze>)args[0]; EKaze fromKaze = (EKaze)args[1]; Hai ronHai = (Hai)args[2]; for (int i = 0; i < ronPlayers.Count; i++) { PlayerUI ui = playerUIDict_Kaze[ronPlayers[i]]; Debug.Log(ui.OwnerPlayer.Name + " 胡牌"); RecordPreTedasi._instance.RonPlayerIndex = ui.OwnerPlayer.Order; ui.PickHai(ronHai, true, false); ui.SetTehaiVisiable(true); ui.Speak(ECvType.Ron); //if (panelPlayers) //{ // 已改為顯示 Winnerpanel // panelPlayers.ShowRon(ui.Index); //} } PlayerUI fromUI = playerUIDict_Kaze[fromKaze]; fromUI.SetNaki(); // show out all players' tehai ShowAllPlayerTehai(); winnerPanel.Initialize(); } break; case UIEventType.Tsumo_Agari: { //自摸 UIAnimWillEndAfter(AgariAnimationTime); Player activePlayer = (Player)args[0]; Debug.Log(activePlayer.Name + "自摸!!!"); RecordPreTedasi._instance.TsumoPlayerIndex = activePlayer.Order; PlayerUI ui = playerUIDict_Kaze[activePlayer.JiKaze]; ui.SetTehaiVisiable(true); ui.Speak(ECvType.Tsumo); // show out all players' tehai ShowAllPlayerTehai(); winnerPanel.Initialize(); } break; case UIEventType.Display_Agari_Panel: { List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[0]; winnerPanel.Hide(); if (agariPanel) { agariPanel.Show(agariList); } } break; case UIEventType.RyuuKyoku: { ERyuuKyokuReason reason = (ERyuuKyokuReason)args[0]; List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[1]; ShowAllPlayerTehai(); if (ryuuKyokuPanel) { ryuuKyokuPanel.Show(reason, agariList); } } break; case UIEventType.Display_Arrow_Panel: //顯示輪到誰介面 { int index = (int)args[0]; if (panelPlayers) { panelPlayers.ShowArrow(index); } } break; case UIEventType.Display_Throwpai_Panel: //顯示丟出什麼牌介面 { int i = (int)args[0]; Hai h = (Hai)args[1]; if (panelPlayers) { panelPlayers.ShowPai(i, h); } } break; case UIEventType.Display_Homeba_Panel: //顯示莊家圖示 { int idx = (int)args[0]; if (panelPlayers) { panelPlayers.ShowHomeba(idx); } } break; case UIEventType.Display_Countdown_Panel: //顯示countdown { int num = (int)args[0]; if (panelCountDown) { panelCountDown.Show(num); } } break; case UIEventType.End_Game: { List <AgariUpdateInfo> agariList = (List <AgariUpdateInfo>)args[0]; if (gameOverPanel) { gameOverPanel.Show(agariList); } } break; } }