protected override YxBaseGameUserInfo OnInitUser(ISFSObject userData) { var userInfo = new BjlUserInfo(); userInfo.Parse(userData); return(userInfo); }
public override void GameResponseStatus(int type, ISFSObject response) { var gdata = App.GetGameData <BjlGameData>(); switch (type) { case RequestType.Reward: var self = gdata.GetPlayer(); self.Coin -= 100; break; case RequestType.Bet: BetCtrl.Bet(response); ShowNumCtrl.RefreshNum(response); break; case RequestType.BeginBet: gdata.BeginBet = true; ResetGame(); ProgressCtrl.PlayClock(response.ContainsKey("cd") ? response.GetInt("cd") : 12, SetStopBet); //重新设置注的层 if (gdata.CurrentBanker != null) { var banker = gdata.CurrentBanker; banker.TotalCount++; banker.UpdateView(); if (gdata.BankSeat < 0) { var bankerInfo = new BjlUserInfo { NickM = "系统庄", Seat = -1, CoinA = long.MaxValue, TotalCount = 0, WinTotalCoin = 0 }; gdata.CurrentBanker.Info = bankerInfo; banker.UpdateView(); } if (gdata.SelfSeat != gdata.BankSeat) { BetCtrl.ShowChip(); } else { YxMessageBox.Show(new YxMessageBoxData { Msg = "您是本局的庄家!", Delayed = 2 }); } BankerCtrl.RefreshBanker(); } else { BetCtrl.ShowChip(); } WaitWin.Hide(); break; case RequestType.EndBet: SetStopBet(); gdata.BeginBet = false; BetCtrl.HideChip(); WaitWin.Hide(); break; case RequestType.GiveCards: ProgressCtrl.Hide(); CardsCtrl.BeginGiveCards(response); ShowNumCtrl.GroupRefreshNum(response); WaitWin.Hide(); break; case RequestType.Result: gdata.SetGameStatus(YxEGameStatus.Normal); gdata.IsGaming = false; Result(response); ResultWin.UpdateView(response); ResultWin.Show(); gdata.GetPlayerInfo <BjlUserInfo>().SimpleParse(response); gdata.GetPlayer().UpdateView(); if (App.GameKey.Equals("bjlb")) { BankerCtrl.SetApplyBankerBtnActive(false); } WaitWin.Hide(); break; case RequestType.BankerList: if (App.GameKey.Equals("bjlb")) { UserListCtrl.RefreshBanker(response); } break; case RequestType.GroupBet: BetCtrl.GroupBet(response); ShowNumCtrl.GroupRefreshNum(response); break; default: YxDebug.Log("RequestType : " + type); break; } OnGetPlayers(response); }
/// <summary> /// 刷新banker数据 /// </summary> /// <param name="responseData"></param> public virtual void RefreshBanker(ISFSObject responseData) { if (!responseData.ContainsKey("bankers")) { return; } var banbers = responseData.GetSFSArray("bankers"); var b = responseData.GetInt("banker"); var bankTotal = responseData.ContainsKey("bankTotal") ? responseData.GetLong("bankTotal") : 0; var bankerLens = banbers.Count; BankersInfo = new YxBaseGameUserInfo[bankerLens]; var gdata = App.GetGameData <BjlGameData>(); gdata.BankSeat = b; var curBanker = gdata.CurrentBanker; var isHaveMe = false; var selfInfo = gdata.GetPlayerInfo(); if (bankerLens < 1)//系统庄 { SetBankerType(); var sysBanker = new BjlUserInfo { NickM = "系统庄", Seat = -1, CoinA = long.MaxValue, WinTotalCoin = bankTotal }; SetBankerType(); if (curBanker != null) { curBanker.UpdateView(sysBanker); } if (_gridBankers != null) { _gridBankers.gameObject.SetActive(false); } RefreahAll(UserListType.Banker); return; } var index = 0; if (curBanker == null) { return; } var bankerInfo = curBanker.GetInfo <BjlUserInfo>(); //遍历庄家 foreach (ISFSObject banber in banbers) { var bseat = banber.GetInt("seat"); var ttGold = banber.GetLong("ttgold"); //同步本地数据 YxBaseGameUserInfo user = gdata.GetPlayerInfo(bseat, true); if (user == null) { continue; } user.CoinA = ttGold; BankersInfo[index++] = user; if (user.Seat == b) { if (bankerInfo == null || bankerInfo.Seat != b || bankerInfo.NickM != user.NickM) //换庄家以后局数重新开始计数 { user.TotalCount = 0; } else { user.TotalCount = bankerInfo.TotalCount; } user.WinTotalCoin = bankTotal; curBanker.UpdateView(user); } if (selfInfo.Seat == user.Seat) { isHaveMe = true; } } SetBankerType(isHaveMe, b); RefreahAll(UserListType.Banker); }