/// <summary> /// 小结算管理 处理小结算一系列显示 /// </summary> /// <param name="seatList"></param> public void RoomOpenPokerSettle(TransferData data) { NiuNiu.Room CurrentRoom = data.GetValue <NiuNiu.Room>("CurrentRoom"); UIInteraction_NiuNiu.Instance.SwitchOpenPokerBtn(CurrentRoom);//开牌按钮 StartCoroutine("RoomOpenPokerSettleAni", CurrentRoom); }
/// <summary> /// 加载窗口 (暂用于 刚进入游戏时 加载已有窗口) /// </summary> /// <param name="data"></param> private void SetEnterRoomView(object[] obj) { NiuNiu.Room room = RoomNiuNiuProxy.Instance.CurrentRoom; NiuNiu.Seat seat = RoomNiuNiuProxy.Instance.PlayerSeat; switch (room.roomStatus) { case NN_ENUM_ROOM_STATUS.IDLE: break; case NN_ENUM_ROOM_STATUS.READY: break; case NN_ENUM_ROOM_STATUS.BEGIN: break; case NN_ENUM_ROOM_STATUS.RSETTLE: break; case NN_ENUM_ROOM_STATUS.DEAL: break; case NN_ENUM_ROOM_STATUS.POUR: break; case NN_ENUM_ROOM_STATUS.LOOKPOCKER: break; case NN_ENUM_ROOM_STATUS.DISSOLVE: //弹出是否同意解散窗口 或者 已同意人数窗口 if (seat.Dissolve == NN_ENUM_SEAT_DISSOLVE.NOP) { //计算倒计时 long time = room.serverTime; long currTime = TimeUtil.GetTimestamp(); float countdownTime = (time - currTime) + GlobalInit.Instance.TimeDistance * 0.001f; countdownTime = Mathf.Clamp(countdownTime, 0, 5); //加载是否同意解散窗口 UIViewManager.Instance.ShowMessage("提示", "有人发起解散房间,是否同意", MessageViewType.OkAndCancel, ClientSendAgreeDisbandRoom, ClientSendRefuseDisbandRoom, countdownTime, AutoClickType.Cancel); } else if (seat.Dissolve == NN_ENUM_SEAT_DISSOLVE.AGREE && seat.Dissolve == NN_ENUM_SEAT_DISSOLVE.DISAGREE) { //加载人数窗口 LoadDisbandSumView(RoomNiuNiuProxy.Instance.agreeDissolveCount, RoomNiuNiuProxy.Instance.CurrentRoom.serverTime); } break; case NN_ENUM_ROOM_STATUS.HOG: break; case NN_ENUM_ROOM_STATUS.GAMEOVER: break; default: break; } }
/// <summary> /// 发牌 处理发牌显示 /// </summary> /// <param name="data"></param> public void SetDeal(TransferData data) { isPlayDrawPokerAni = true; InitAllPokerPos();//还原所有手牌位置 NiuNiu.Room CurrentRoom = data.GetValue <NiuNiu.Room>("Room"); StartCoroutine("DealAni", CurrentRoom); }
IEnumerator DelayedLoadRankList(NiuNiu.Room room) { yield return(new WaitForSeconds(delayPopupGameOverTime)); //调用 //NetDispatcher.Instance.Dispatch(NN_ROOM_DISMISS_SUCCEED.CODE);//准备退出房间 NiuNiuGameCtrl.Instance.OpenView(UIWindowType.RankList_NiuNiu);//准备退出房间 }
//加载UIRoot后 展示房间全部信息 public void InitEnterRoomUI(NiuNiu.Room currentRoom, NiuNiu.Seat playerSeat, int playerNumber) { Debug.Log("房间初始化--置空"); for (int i = 0; i < playersItem.Length; i++) { playersItem[i].InfoItem(); } Debug.Log(" //----------------------设置房间初始玩家信息-------------------------------"); for (int i = 0; i < currentRoom.SeatList.Count; i++) { Debug.Log(currentRoom.SeatList[i].Pos); } Debug.Log(currentRoom.roomId); //跟换背景桌面 Debug.Log(" //-------------------" + currentRoom.superModel); m_BG[0].gameObject.SetActive(currentRoom.superModel == Room.SuperModel.CommonRoom); m_BG[1].gameObject.SetActive(currentRoom.superModel == Room.SuperModel.PassionRoom); for (int i = 0; i < playersItem.Length; i++) { playersItem[i].superModel = currentRoom.superModel; } //设置房间初始玩家信息 应该是全部信息 SetEnterRoomUI(currentRoom.SeatList, currentRoom.roomStatus); //初始化交互显影 UIInteraction_NiuNiu.Instance.InitAll(currentRoom.roomModel, currentRoom.superModel); //(currentRoom, playerSeat, playerNumber); //初始化房间固有信息 UIItemRoomInfo_NiuNiu.Instance.SetUI(RoomNiuNiuProxy.Instance.CurrentRoom.roomId, 0); UIItemRoomInfo_NiuNiu.Instance.SetRoomConfig(RoomNiuNiuProxy.Instance.CurrentRoom.Config); //根据此时状态 弹出对应窗口 SetEnterRoomView(currentRoom, playerSeat); //JuYou.JuYouSceneCtrl }
IEnumerator DealAni(NiuNiu.Room CurrentRoom) { //-------牛头动画---- const string prefabName = "TaurenAni"; string prefabPath = string.Format("download/{0}/prefab/uiprefab/uiitems/{1}.drb", ConstDefine.GAME_NAME, prefabName); GameObject go = AssetBundleManager.Instance.LoadAssetBundle <GameObject>(prefabPath, prefabName); go = UnityEngine.Object.Instantiate(go); go.SetParent(m_EffectContainer.transform); yield return(new WaitForSeconds(1.6f)); /*if(CurrentRoom.superModel == Room.SuperModel.CommonRoom) */ UIInteraction_NiuNiu.Instance.SwitchOpenPokerBtn(CurrentRoom);//开牌按钮 for (int i = 0; i < CurrentRoom.SeatList.Count; i++) { if (CurrentRoom.SeatList[i] != null && CurrentRoom.SeatList[i].PlayerId > 0) { if (CurrentRoom.SeatList[i].PokerList[0].index != 0) { SetDealAni(CurrentRoom.SeatList[i]); //设置发牌动画 } } } }
//===================================================================================================== //--------------------------------- #region #endregion #region /// <summary> /// 抢庄动画 /// </summary> /// <param name="data"></param> public void SetRobBankerAni(TransferData data) { NiuNiu.Room CurrentRoom = data.GetValue <NiuNiu.Room>("CurrentRoom"); //关闭 for (int i = 0; i < CurrentRoom.SeatList.Count; i++) { if (CurrentRoom.SeatList[i].PlayerId > 0) { playersItem[CurrentRoom.SeatList[i].Index].SetChooseBankerHint(false); } } bool isOnOff = data.GetValue <bool>("isOnOff"); if (isOnOff) { StartCoroutine("RobBankerAni", CurrentRoom); } else { StopCoroutine("RobBankerAni"); } }
//------------------------------------------------------------------------ //刷新窗口 显示房间状态对应窗口 public void SetEnterRoomView(NiuNiu.Room currRoom, Seat seat) { //发送消息NiuNiuGameCtrl UIDispatcher.Instance.Dispatch("SetEnterRoomView_NiuNiu"); }
/// <summary> /// 游戏结束 处理游戏结束一系列 /// </summary> public void GameOver(TransferData data) { NiuNiu.Room room = data.GetValue <NiuNiu.Room>("CurrentRoom"); StartCoroutine("DelayedLoadRankList", room); }
/// <summary> /// 处理允许开始下一局 /// </summary> /// <param name="data"></param> public void NextGame(TransferData data) { NiuNiu.Room room = data.GetValue <NiuNiu.Room>("CurrentRoom"); InitAllPokerPos(); //还原所有手牌位置 SetEnterRoomUI(room.SeatList, room.roomStatus); //刷新房间显示 }
//公开牌型动画 IEnumerator RoomOpenPokerSettleAni(NiuNiu.Room room)//NN_ENUM_ROOM_STATUS roomStatus { List <NiuNiu.Seat> seatList = room.SeatList; NN_ENUM_ROOM_STATUS roomStatus = room.roomStatus; NiuNiu.Seat playerSeat = null; for (int i = 0; i < seatList.Count; i++) { if (seatList[i].Index == 0) { playerSeat = seatList[i]; break; } } //yield return 0; for (int i = 0; i < seatList.Count; i++) { if (seatList[i] != null && seatList[i].PlayerId > 0 && seatList[i].PockeType != 0 && !seatList[i].IsBanker) { RoomOpenPokerSettleAniPerform(seatList[i], roomStatus); } else { continue; } yield return(new WaitForSeconds(PokerTypeAniIntervalTime)); } //显示庄的各种动画 for (int i = 0; i < seatList.Count; i++) { if (seatList[i].IsBanker) { // RoomOpenPokerSettleAniPerform(seatList[i], roomStatus); yield return(new WaitForSeconds(PokerTypeAniIntervalTime)); break; } } #if IS_WANGQUE //显示通杀 通赔 PlayTongCompensateKill(seatList); #endif //显示金币移动 GoldFlowCtrl_NiuNiu.Instance.GoldFlowAni(seatList); #if IS_CANGZHOU if (room.superModel == Room.SuperModel.CommonRoom) { //每局小结算 yield return(new WaitForSeconds(popupUnitAni)); NiuNiuGameCtrl.Instance.OpenView(UIWindowType.UnitSettlement_NiuNiu);//管理器调用 } #endif //#if IS_WANGQUE // if (room.superModel == Room.SuperModel.PassionRoom) // { // const string prefabName = "UIItemSeniorSettle_NiuNiu"; // string prefabPath = string.Format("download/{0}/prefab/uiprefab/uiitems/{1}.drb", ConstDefine.GAME_NAME, prefabName); // GameObject go = AssetBundleManager.Instance.LoadAssetBundle<GameObject>(prefabPath, prefabName); // go = UnityEngine.Object.Instantiate(go); // go.SetParent(m_EffectContainer.transform); // go.GetComponent<UIItemSeniorSettle_NiuNiu>().SetUI(playerSeat !=null ? playerSeat.Earnings:0); // } //#endif }