/// <summary> /// 开局 /// </summary> /// <param name="room"></param> /// <param name="isPlayAnimation"></param> public void Begin(RoomEntity room, bool isPlayAnimation) { //CompassCtrl.Instance.SetNormal(); //<--------------指南针控制 //UIItemTingTip.Instance.Close(); //m_UISceneMaJiang3DView.Begin(); //m_UIScenePaiJiu3DView. //设置开局的 //====================初始化墙==================== InitWall(isPlayAnimation); //===================摸牌======================= if (!isPlayAnimation) { for (int i = 0; i < room.SeatList.Count; i++) { SeatEntity seat = room.SeatList[i]; //桌面上的牌 for (int j = 0; j < seat.TablePokerList.Count; j++) { MaJiangCtrl_JuYou majiang = MahJongManager_JuYou.Instance.DrawMaJiang(seat.Index, seat.TablePokerList[j]); //清空摸到手里的已出过的牌 if (seat.TablePokerList.Count > 0) { m_Seats[seat.Index].OnSeatDiscardPoker(); } //if (seat.TablePokerList.Count > 0) MahJongManager_JuYou.Instance.ClearDicTable(seat.Index); } List <MaJiangCtrl_JuYou> majiangs = new List <MaJiangCtrl_JuYou>(); //手里的牌 for (int j = 0; j < seat.PokerList.Count; ++j) { if (seat == RoomJuYouProxy.Instance.PlayerSeat) { AppDebug.Log(string.Format("---PlayerSeat---------重连房间座位手牌{0}", seat.PokerList[j].ToChinese())); } MaJiangCtrl_JuYou majiang = null; majiang = MahJongManager_JuYou.Instance.DrawMaJiang(seat.Index, seat.PokerList[j]); majiangs.Add(majiang); } m_Seats[seat.Index].DrawPoker(majiangs, true); } } else { //// 清空手牌 // for (int i = 0; i < room.SeatList.Count; i++) // { // SeatCtrl_JuYou seatCtrl = m_Seats[room.SeatList[i].Index]; // if (seatCtrl != null) seatCtrl.OnSeatDiscardPoker(); // } //其他动画 m_UISceneJuYou3DView.Begin(RoomJuYouProxy.Instance.CurrentRoom); //StartCoroutine(BeginAnimation(/*isReplay*/)); } }
/// <summary> /// 设置小结算窗口 /// </summary> /// <param name="seatList"></param> public void Settle(RoomEntity room) { List <SeatEntity> seatList = room.SeatList; //m_fCountDown = countdown; m_isAutoClick = true; if (room.currentLoop == room.maxLoop) { m_isAutoClick = false; m_TextCountDown.gameObject.SetActive(false); m_NextGameBtn.gameObject.SetActive(false); } //加载详细信息 //根据人数加载结算Item LoadConclusionItem(seatList); //设置自动关闭 ////播放胜利失败动画 //if (seatList.Count > 0) //{ // VictoryFailureAni(seat); //} //StartCoroutine("ConclusionAni"); }
public void BaoZhaGuo(RoomEntity room) { AudioEffectManager.Instance.Play(ConstDefine_JuYou.AudioZhaGuo, Vector3.zero, false); if (room.isBaoGuo) { //爆锅 List <SeatEntity> seatList = room.SeatList; for (int i = 0; i < seatList.Count; i++) { if (seatList[i].PlayerId > 0 && seatList[i].isJoinGame) { SeatEntity seat = seatList[i]; UIDispatcher.Instance.Dispatch(ConstDefine_JuYou.ObKey_SendRoomGoldChanged); PlayUIAnimation(ConstDefine_JuYou.UIAniGoldMove_JuYou, m_GoldContainer.position, m_seatHeadPos[seatList[i].Index].position, seatList[i].Earnings, true, () => { UIDispatcher.Instance.Dispatch(ConstDefine_JuYou.ObKey_SendSeatGoldChanged, new object[] { seat }); } ); } } } }
/// <summary> ///开启8局结算 /// </summary> public void SetUI(RoomEntity room) { m_isAutoClick = true; //设置微信分享显影 SetWeiXinShartBtn(); //根据人数加载结算Item LoadConclusionItem(room); }
/// <summary> /// 房间信息变更 (base中已注册 若要改变 需覆盖该方法) /// </summary> /// <param name="obj"></param> private void OnRoomInfoChanged(TransferData data) { Debug.Log("子类UIItemPaiJiuRoomInfo"); RoomEntity entity = data.GetValue <RoomEntity>("Room"); ShowLoop(entity.currentLoop, entity.maxLoop); ////房间底注由 初始及动画更新 //SetBaseScore(entity.baseScore); }
/// <summary> /// 重建房间 /// </summary> /// <param name="room"></param> private void ReBuildRoom(RoomEntity room) { if (RoomJuYouProxy.Instance.CurrentRoom.roomStatus == ROOM_STATUS.GAME) { Begin(room, false); } //====================确认当前游戏状态===================== RoomJuYouProxy.Instance.SendRoomInfoChangeNotify(); }
/// <summary> /// 每次结算 /// </summary> public void EverytimeSettle(RoomEntity room) { for (int i = 0; i < room.SeatList.Count; i++) { if (room.SeatList[i].PlayerId > 0) { m_Seats[room.SeatList[i].Index].AloneSettle(room.SeatList[i].Earnings); //飘分 } } PlayUIAnimation(room.isBaoGuo? ConstDefine_JuYou.UIAniBaoGuo_JuYou : ConstDefine_JuYou.UIAniZhaGuo_JuYou); //加载爆锅炸锅 m_goldManager.BaoZhaGuo(room); StartCoroutine(SettleInfo()); }
void LoadConclusionItem(RoomEntity room) { itemInfoList = room.SeatList; for (int i = 0; i < _mountPoint.childCount; i++) { GameObject go = _mountPoint.GetChild(0).gameObject; Destroy(go); } int goldMin = 0; int goldMax = 0; for (int i = 0; i < itemInfoList.Count; i++) { if (itemInfoList[i].PlayerId <= 0) { continue; } if (itemInfoList[i].Gold < goldMin) { goldMin = itemInfoList[i].Gold; } if (itemInfoList[i].Gold > goldMax) { goldMax = itemInfoList[i].Gold; } } for (int i = 0; i < itemInfoList.Count; i++) { if (itemInfoList[i] == null || itemInfoList[i].PlayerId <= 0) { continue; } GameObject go = Instantiate(_itemConclusionTemplate, _mountPoint); go.SetActive(true); //设置其中具体信息 go.GetComponent <UIItemSettleSeatInfo_JuYou>().SetUI(itemInfoList[i]); if (itemInfoList[i].Gold <= goldMin) { go.GetComponent <UIItemSettleSeatInfo_JuYou>().SetRichMan(true); } if (itemInfoList[i].Gold >= goldMax) { go.GetComponent <UIItemSettleSeatInfo_JuYou>().SetDaYingJia(true); } } }
/// <summary> /// 下底注 /// </summary> public void PutBaseScore(RoomEntity room) { List <SeatEntity> seatList = room.SeatList; for (int i = 0; i < seatList.Count; i++) { if (seatList[i].PlayerId > 0) { SeatEntity seat = seatList[i]; PlayUIAnimation(ConstDefine_JuYou.UIAniGoldMove_JuYou, m_seatHeadPos[seatList[i].Index].position, m_GoldContainer.position, 10, true , () => { UIDispatcher.Instance.Dispatch(ConstDefine_JuYou.ObKey_SendRoomGoldChanged); UIDispatcher.Instance.Dispatch(ConstDefine_JuYou.ObKey_SendSeatGoldChanged, new object[] { seat }); } ); } } }
/// <summary> /// 设置开始按钮 /// </summary> /// <param name="currentRoom"></param> /// <param name="seat"></param> private void SetStartBtn(RoomEntity currentRoom, SeatEntity seat) { int isReadySum = 0; if (seat.IsBanker) { for (int i = 0; i < currentRoom.SeatList.Count; i++) { if (currentRoom.SeatList[i] != null && currentRoom.SeatList[i].PlayerId > 0) { if (currentRoom.SeatList[i].isReady) { ++isReadySum; } } } } m_ButtonStart.gameObject.SetActive(currentRoom.roomStatus == ROOM_STATUS.IDLE && seat.IsBanker && isReadySum >= 2); }
/// <summary> /// 座位信息变更回调 /// </summary> /// <param name="obj"></param> private void OnSeatInfoChanged(TransferData data) { SeatEntity seat = data.GetValue <SeatEntity>("Seat"); //座位 bool isPlayer = data.GetValue <bool>("IsPlayer"); //是否自己 ROOM_STATUS roomStatus = data.GetValue <ROOM_STATUS>("RoomStatus"); //房间状态 RoomEntity currentRoom = data.GetValue <RoomEntity>("CurrentRoom"); //当前房间 SeatEntity BankerSeat = data.GetValue <SeatEntity>("BankerSeat"); //庄家座位 SeatEntity ChooseBankerSeat = data.GetValue <SeatEntity>("ChooseBankerSeat"); //当前选庄座位 if (isPlayer) { Debug.Log("自己座位准备状态:" + seat.seatStatus.ToString()); m_ButtonReady.gameObject.SetActive(!seat.isReady && seat.seatStatus == SEAT_STATUS.IDLE); m_ButtonShare.gameObject.SetActive(roomStatus == ROOM_STATUS.IDLE); //设置开始按钮 SetStartBtn(currentRoom, seat); if (!SystemProxy.Instance.IsInstallWeChat) { m_ButtonShare.gameObject.SetActive(false); } //m_CancelAuto.gameObject.SetActive(seat.IsTrustee); //=================================设置下注按钮================================================================================= // 是庄 自己未下注 不是庄 自己未下注 庄家已下注 // m_Operater.NoticeJetton(roomStatus == ROOM_STATUS.POUR && (BankerSeat != null) && ((seat.IsBanker && seat.Pour <= 0) || ((seat.Pour <= 0) && (!seat.IsBanker) && BankerSeat.Pour > 0)), seat); m_Operater.NoticeJetton(roomStatus == ROOM_STATUS.GAME && seat.seatStatus == SEAT_STATUS.POUR, seat, currentRoom.baseScore); //RoomJuYouProxy //=================================设置选庄================================================================================= //选庄按钮 // m_Operater.ChooseBanker(roomStatus == ROOM_STATUS.CHOOSEBANKER && currentRoom.ChooseBankerSeat != null && currentRoom.ChooseBankerSeat == seat); } }
/// <summary> /// UI开局 /// </summary> public void Begin(RoomEntity room) { m_goldManager.PutBaseScore(room); }
/// <summary> /// 设置房间第注 由初始及动画事件变更 /// </summary> /// <param name="data"></param> private void OnRoomGoldChanged(TransferData data) { RoomEntity entity = data.GetValue <RoomEntity>("Room"); SetBaseScore(entity.baseScore); }
/// <summary> /// 初始化房间 /// </summary> /// <param name="prRoom"></param> public void InitRoom(JY_ROOM prRoom) { //RoomMaJiangProxy.Instance CurrentRoom = new RoomEntity() { currentLoop = prRoom.loop, maxLoop = prRoom.maxLoop, roomId = prRoom.roomId, //matchId = prRoom.matchId, roomStatus = prRoom.status, baseScore = prRoom.baseScore, }; //房间配置 CurrentRoom.Config.Clear(); for (int i = 0; i < prRoom.settingIdCount(); ++i) { cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(prRoom.getSettingId(i)); if (settingEntity != null) { CurrentRoom.Config.Add(settingEntity); } } //RoomPaiJiuProxy //创建座位 CurrentRoom.SeatList = new List <SeatEntity>(); for (int i = 0; i < prRoom.seatListCount(); i++) { JY_SEAT jySeat = prRoom.getSeatList(i); SeatEntity seat = new SeatEntity(); //手牌 for (int j = 0; j < jySeat.pokerListCount(); j++) { seat.PokerList.Add(new Poker()); } seat.SetSeat(jySeat); CurrentRoom.SeatList.Add(seat); if (seat.IsBanker) { BankerSeat = seat; } } //(时间戳) if (prRoom.hasUnixtime()) { CurrentRoom.Unixtime = prRoom.unixtime; } CalculateSeatIndex(); PeopleCounting(); }