/// <summary> /// 处理是否接受挑战支付界面按键事件. /// </summary> void HandleShiFouJieShouTiaoZhan_ZhiFuEnterBtEvent() { UnityLog("HandleShiFouJieShouTiaoZhan_ZhiFuEnterBtEvent -> m_BtState ==== " + m_BtState); switch (m_BtState) { case BtState.TongYi: { //清理最后一个结束游戏玩家的数据. SSGameDataCtrl.GetInstance().CleanLastOverPlayerData(); //激活该玩家. SSGameDataCtrl.GetInstance().SetActivePlayer(m_PlayerIndex, true); //删除等待对方同意PK. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveDengDaiDuiFangTongYiPK(); //删除对方不敢应战,请继续等待. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveDuiFangBuYingZhan_JiXuDengDai(); //同意购买挑战对方道具. SSGameDataCtrl.GetInstance().m_PlayerData[(int)m_PlayerIndex].IsJieShouTiaoZhan = true; //删除购买挑战对方道具界面. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouJieShouTiaoZhanPanel(); //删除挑战对方道具支付界面. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouJieShouTiaoZhan_ZhiFuPanel(); if (SSGameDataCtrl.GetInstance().m_PlayerData[(int)m_PlayerIndex].GameState == SSGameDataCtrl.PlayerGameState.YouXiQian) { //游戏前. //产生开始双人PK提示. SSGameDataCtrl.GetInstance().m_SSUIRoot.SpawnKaiShiShuangRenPK(); } else { //游戏中. //产生购买复活道具界面. SSGameDataCtrl.GetInstance().m_SSUIRoot.SpawnGameFuHuoDaoJuPanel(m_PlayerIndex); } break; } case BtState.JuJue: { //拒绝购买挑战对方道具. //删除挑战对方道具支付界面. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouJieShouTiaoZhan_ZhiFuPanel(); //解锁挑战对方道具购买界面. SSGameDlgUI dlg = SSGameDataCtrl.GetInstance().m_SSUIRoot.m_SSGameDlgManage.FindGameDlgByType(GameDlgState.ShiFouJieShouTiaoZhan); if (dlg != null) { dlg.SetIsLockPanel(false); } break; } } }
/// <summary> /// 处理是否重新开始游戏支付界面按键事件(继续游戏支付界面). /// </summary> void HandleShiFouChongXinKaiShi_ZhiFuEnterBtEvent() { UnityLog("HandleShiFouChongXinKaiShi_ZhiFuEnterBtEvent -> m_BtState ==== " + m_BtState); switch (m_BtState) { case BtState.TongYi: { //同意购买重新开始游戏道具(继续游戏界面). //删除购买重新开始游戏道具界面(继续游戏界面). SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouChongXinKaiShiPanel(); //删除重新开始游戏道具支付界面(继续游戏支付界面). SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouChongXinKaiShi_ZhiFuPanel(); //激活该玩家. SSGameDataCtrl.GetInstance().SetActivePlayer(m_PlayerIndex, true); //恢复玩家的游戏数据. SSGameDataCtrl.GetInstance().m_PlayerData[(int)m_PlayerIndex].Score = SSGameDataCtrl.GetInstance().m_LastOverPlayerData.Score; SSGameDataCtrl.GetInstance().m_PlayerData[(int)m_PlayerIndex].IsTongYiJiXuGame = true; //SSGameDataCtrl.GetInstance().m_BallSpawnArray[(int)m_PlayerIndex].IndexCreatBallJieDuan = SSGameDataCtrl.GetInstance().m_LastOverPlayerData.IndexCreatBallJieDuan; //产生复活道具界面. SSGameDataCtrl.GetInstance().m_SSUIRoot.SpawnGameFuHuoDaoJuPanel(m_PlayerIndex); //删除等待对方同意PK. SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveDengDaiDuiFangTongYiPK(); break; } case BtState.JuJue: { //拒绝购买重新开始游戏道具(继续游戏). //删除重新开始游戏道具支付界面(继续游戏支付界面). SSGameDataCtrl.GetInstance().m_SSUIRoot.RemoveGameShiFouChongXinKaiShi_ZhiFuPanel(); //解锁重新开始游戏(继续游戏)道具购买界面. SSGameDlgUI dlg = SSGameDataCtrl.GetInstance().m_SSUIRoot.m_SSGameDlgManage.FindGameDlgByType(GameDlgState.ShiFouChongXinKaiShi); if (dlg != null) { dlg.SetIsLockPanel(false); } break; } } }
/// <summary> /// 产生游戏对话框文本信息UI. /// </summary> public void SpawnGameDlgUI(SSGameDlgUI.GameDlgState dlgState, SSGameDataCtrl.PlayerIndex playerIndex, Transform uiParent) { DlgData dlgDt = m_DlgDtList.Find((dt) => { return(dt.m_DlgState.Equals(dlgState)); }); if (dlgDt != null) { UnityLogWarning("SpawnGameDlgUI -> The DlgUI have been created! dlgState ==== " + dlgState); return; } string uiPrefabPath = ""; switch (dlgState) { case SSGameDlgUI.GameDlgState.ShiFouJieShouTiaoZhan: { uiPrefabPath = "Prefabs/GUI/GameDlgInfo/ShiFouJieShouTiaoZhan"; break; } case SSGameDlgUI.GameDlgState.ShiFouChongXinKaiShi: { uiPrefabPath = "Prefabs/GUI/GameDlgInfo/ShiFouChongXinKaiShi"; break; } case SSGameDlgUI.GameDlgState.FuHuoDaoJu_ZhiFu: { uiPrefabPath = "Prefabs/GUI/FuHuoDaoJu/FuHuoDaoJu_ZhiFu"; break; } case SSGameDlgUI.GameDlgState.LanKuangFangDa_ZhiFu: { uiPrefabPath = "Prefabs/GUI/LanKuangFangDa/LanKuangFangDa_ZhiFu"; break; } case SSGameDlgUI.GameDlgState.LanQiuJianSu_ZhiFu: { uiPrefabPath = "Prefabs/GUI/LanQiuJianSu/LanQiuJianSu_ZhiFu"; break; } case SSGameDlgUI.GameDlgState.ShiFouJieShouTiaoZhan_ZhiFu: { uiPrefabPath = "Prefabs/GUI/GameDlgInfo/ShiFouJieShouTiaoZhan_zhiFu"; break; } case SSGameDlgUI.GameDlgState.ShiFouChongXinKaiShi_ZhiFu: { uiPrefabPath = "Prefabs/GUI/GameDlgInfo/ShiFouChongXinKaiShi_zhiFu"; break; } default: { UnityLogWarning("SpawnGameDlgUI -> have not registered textState ==== " + dlgState); return; } } GameObject gmDataPrefab = (GameObject)Resources.Load(uiPrefabPath); if (gmDataPrefab != null) { UnityLog("SpawnGameDlgUI -> dlgState ==== " + dlgState); GameObject obj = (GameObject)Instantiate(gmDataPrefab, uiParent); SSGameDlgUI dlgUI = obj.GetComponent <SSGameDlgUI>(); dlgUI.Init(playerIndex, dlgState); m_DlgDtList.Add(new DlgData(dlgState, dlgUI)); } else { UnityLogWarning("SpawnGameDlgUI -> gmDataPrefab was null, dlgState ==== " + dlgState); } }
public DlgData(SSGameDlgUI.GameDlgState dlgState, SSGameDlgUI dlgUI) { m_DlgState = dlgState; m_GameDlgUI = dlgUI; }