void SetActiveZhengZaiChuPiaoUI(PlayerEnum indexPlayer, bool isActive) { //if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) //{ // //没有激活任何玩家. // return; //} int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("SetActiveZhengZaiChuPiaoUI -> index was wrong! index ==== " + index); return; } if (m_CaiPiaoInfoArray[index] != null) { SSCaiPiaoInfo caiPiaoInfo = m_CaiPiaoInfoArray[index].GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfo != null) { caiPiaoInfo.SetActiveZhengZaiChuPiao(isActive); } else { UnityLogWarning("SetActiveZhengZaiChuPiaoUI -> caiPiaoInfo was null!"); } } }
/// <summary> /// 创建玩家彩票数量UI界面. /// </summary> void CreatCaiPiaoInfoPanel(PlayerEnum indexPlayer, bool isShowCaiPiaoInfo = false) { if (isShowCaiPiaoInfo == true) { //强制显示彩票界面. } else { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有激活任何玩家. return; } } int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("CreatCaiPiaoInfoPanel -> index was wrong! index ==== " + index); return; } GameObject gmDataPrefab = (GameObject)Resources.Load("Prefabs/GUI/CaiPiaoUI/CaiPiaoInfo"); if (gmDataPrefab != null) { if (m_CaiPiaoInfoArray[index] == null) { if (m_PlayerUIParent[index] != null) { UnityLog("CreatCaiPiaoInfoPanel -> isShowCaiPiaoInfo == " + isShowCaiPiaoInfo); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_PlayerUIParent[index]); m_CaiPiaoInfoArray[index] = obj.GetComponent <SSGameNumUI>(); SetActiveZhengZaiChuPiaoUI(indexPlayer, true); SSCaiPiaoInfo caiPiaoInfoCom = obj.GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfoCom != null) { caiPiaoInfoCom.Init(indexPlayer); } } else { UnityLogWarning("CreatCaiPiaoInfoPanel -> m_PlayerUIParent was wrong! index ==== " + index); } } } else { UnityLogWarning("CreatCaiPiaoInfoPanel -> gmDataPrefab was null"); } }
/// <summary> /// 初始化彩票数字动画播放逻辑. /// </summary> public void InitCaiPiaoAnimation(float timeVal, PlayerEnum indexPlayer) { if (XkGameCtrl.GetInstance().m_GamePlayerAiData.IsActiveAiPlayer == true) { //没有激活任何玩家. return; } int indexVal = (int)indexPlayer - 1; if (m_CaiPiaoInfoArray[indexVal] != null) { SSCaiPiaoInfo caiPiaoInfo = m_CaiPiaoInfoArray[indexVal].GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfo != null) { caiPiaoInfo.InitCaiPiaoAnimation(timeVal, indexPlayer); } else { UnityLogWarning("InitCaiPiaoAnimation -> caiPiaoInfo was null............"); } } }
/// <summary> /// 删除玩家彩票数量UI. /// </summary> void RemoveCaiPiaoInfoPanel(PlayerEnum indexPlayer) { int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("RemoveCaiPiaoInfoPanel -> index was wrong! index ==== " + index); return; } if (m_CaiPiaoInfoArray[index] != null) { UnityLog("RemoveCaiPiaoInfoPanel -> index ==== " + index); RemovePlayerCaiPiaoChengJiu(indexPlayer); //Destroy(m_CaiPiaoInfoArray[index].gameObject); SSCaiPiaoInfo caiPiaoInfoCom = m_CaiPiaoInfoArray[index].GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfoCom != null) { caiPiaoInfoCom.RemoveSelf(indexPlayer); } } }
public void ShowPlayerCaiPiaoInfo(PlayerEnum indexPlayer, int num, bool isPlayCaiPiaoNumAni = false, bool isShowCaiPiaoInfo = false) { int index = (int)indexPlayer - 1; if (index < 0 || index > 2) { UnityLogWarning("ShowPlayerCaiPiaoInfo -> index was wrong! index ==== " + index); return; } if (num <= 0) { //删除玩家彩票UI信息. if (IsRemoveCaiPiaoInfo[index] == false) { IsRemoveCaiPiaoInfo[index] = true; StartCoroutine(DelayRemoveCaiPiaoInfoPanle(indexPlayer)); } if (m_CaiPiaoInfoArray[index] != null) { //显示彩票数量UI. m_CaiPiaoInfoArray[index].ShowNumUI(num); } } else { if (IsRemoveCaiPiaoInfo[index] == true) { //重置信息. IsRemoveCaiPiaoInfo[index] = false; } if (m_CaiPiaoInfoArray[index] == null) { //创建彩票数据信息. CreatCaiPiaoInfoPanel(indexPlayer, isShowCaiPiaoInfo); } if (m_CaiPiaoInfoArray[index] != null) { if (isShowCaiPiaoInfo == true) { //显示彩票数量UI. m_CaiPiaoInfoArray[index].SetActive(true); m_CaiPiaoInfoArray[index].ShowNumUI(num); } else { if (isPlayCaiPiaoNumAni == false) { //没有播放彩票缩放动画. //隐藏彩票数字. m_CaiPiaoInfoArray[index].SetActive(false); } } if (isPlayCaiPiaoNumAni == true) { //播放彩票数字缩放动画. SSCaiPiaoInfo caiPiaoInfoCom = m_CaiPiaoInfoArray[index].GetComponent <SSCaiPiaoInfo>(); if (caiPiaoInfoCom != null) { caiPiaoInfoCom.PlayCaiPiaoNumSuoFangAnimation(); } } if (m_CaiPiaoBuZuArray[index] != null) { //彩票不足UI有显示. SetActiveZhengZaiChuPiaoUI(indexPlayer, false); } } } }