public void InitSessionUser(PokerMatchType matchType) { UserID = GlobalVariable.LoginUser.ID.ToString(); NickName = GlobalVariable.LoginUser.NickName; Face = GlobalVariable.LoginUser.Face; Vip = GlobalVariable.LoginUser.Vip; Gold = GlobalVariable.LoginUser.Gold; MatchType = matchType; }
void OnPokerTypeClicked(GameObject sender) { SoundManager.Instance.PlaySound("音效/按钮"); PokerMatchType matchType = PokerMatchType.GreenHands; if (sender.name == "pokertype1") { matchType = PokerMatchType.GreenHands; } else if (sender.name == "pokertype2") { matchType = PokerMatchType.Primary; } else if (sender.name == "pokertype3") { matchType = PokerMatchType.Intermediate; } else if (sender.name == "pokertype4") { matchType = PokerMatchType.Advanced; } else if (sender.name == "pokertype5") { matchType = PokerMatchType.Earl; } if (matchType == PokerMatchType.GreenHands && (GlobalVariable.LoginUser.Gold < 100 || GlobalVariable.LoginUser.Gold > 5000)) { App.Instance.HintBox.Show("新手 100—5000金币准许进入"); return; } if (matchType == PokerMatchType.Primary && (GlobalVariable.LoginUser.Gold < 1000 || GlobalVariable.LoginUser.Gold > 80000)) { App.Instance.HintBox.Show("初级 1000-8w 金币准许进入"); return; } if (matchType == PokerMatchType.Intermediate && (GlobalVariable.LoginUser.Gold < 5000 || GlobalVariable.LoginUser.Gold > 200000)) { App.Instance.HintBox.Show("中级 5000-20w 金币准许进入"); return; } if (matchType == PokerMatchType.Advanced && (GlobalVariable.LoginUser.Gold < 20000 || GlobalVariable.LoginUser.Gold > 800000)) { App.Instance.HintBox.Show("高级 2w-80w 金币准许进入"); return; } if (matchType == PokerMatchType.Earl && GlobalVariable.LoginUser.Gold < 100000) { App.Instance.HintBox.Show("伯爵 10w+ 金币准许进入"); return; } App.Instance.PageGroup.ShowPage("Page_Poker", true, matchType); }
protected override void Init() { base.Init(); EventListener.Get(BtnExit.gameObject).onClick = OnBtnExitClicked; EventListener.Get(BtnChangeTable.gameObject).onClick = OnBtnChangeTableClicked; EventListener.Get(BtnMsg.gameObject).onClick = OnBtnMsgClicked; SendCommand.InitClient(); foreach (var p in PlayerUIList) { p.Hide(); } BattleUICtr.Hide(); OperationUICtr.Hide(); BattleWaiting.gameObject.SetActive(true); MatchType = this.GetPar <PokerMatchType>(0); SendCommand.InitSessionUser(MatchType); this.Invoke("BattleStart", 2); }
public void Join(string accountID, string nickName, string face, int vip, int gold, PokerMatchType matchType, string exceptionCode) { PokerBattleground bg = PokerBattlegroundManager.Instance.JoinBattle(accountID, nickName, face, gold, vip, matchType, exceptionCode); ToPokerCleintCommand.SendToClient(PokerCommand.JoinBack, bg.Battle); }
public PokerBattleground JoinBattle(string accountID, string nickName, string face, int gold, int vip, PokerMatchType matchType, string exceptionCode) { lock (BattlegroundPoolLock) { PokerBattleground battleground = null; foreach (var b in BattlegroundPool) { if (b.Battle.Sides.Any(c => c.AccountID == accountID)) { battleground = b; } break; } if (battleground != null) { return(battleground); } //不存在就查找匹配 foreach (var b in BattlegroundPool) { if (exceptionCode != "" && exceptionCode == b.Battle.ID) { continue; } if (b.MatchType != matchType) { continue; } if (b.Battle.IsStarted) { continue; } if (b.Battle.Sides.Count >= 5) { continue; } battleground = b; break; } if (battleground == null) { battleground = new PokerBattleground(); battleground.MatchType = matchType; //确定底注 switch (matchType) { case PokerMatchType.GreenHands: battleground.Battle.CurrentNoteNum = 10; break; case PokerMatchType.Primary: battleground.Battle.CurrentNoteNum = 20; break; case PokerMatchType.Intermediate: battleground.Battle.CurrentNoteNum = 40; break; case PokerMatchType.Advanced: battleground.Battle.CurrentNoteNum = 80; break; case PokerMatchType.Earl: battleground.Battle.CurrentNoteNum = 200; break; } BattlegroundPool.Add(battleground); } //查找空桌 int nullDesktop = 1; for (int i = 1; i < 5; i++) { if (!battleground.Battle.Sides.Any(c => c.Order == i)) { nullDesktop = i; break; } } battleground.Battle.Sides.Add(new PokerSide() { AccountID = accountID, NickName = nickName, Face = face, Gold = gold, Vip = vip, Order = nullDesktop }); return(battleground); } }