static public void Init(Player player, Seat seat) { var transform = PoolMan.Spawn("PlayerSelf", seat.transform); transform.GetComponent <RectTransform>().anchoredPosition = Vector3.zero; transform.GetComponent <PlayerSelf>().init(player, seat); }
public void OnGamerData() { var go = PoolMan.Spawn("PartnerList"); go.GetComponent <DOPopup>().Show(); go.GetComponent <PartnerList>().Init(Uid); }
public void OnGamerOptionClick() { var go = PoolMan.Spawn("GamerOption"); go.GetComponent <DOPopup>().Show(); go.GetComponent <GamerOption>().Init(enterLimit, seatLimit, talkLimit, uid, true); }
public void OnGamerOptionClick() { var transform = PoolMan.Spawn("GamerOption"); transform.GetComponent <DOPopup>().Show(); transform.GetComponent <GamerOption>().Init(enterLimit, seatLimit, talkLimit, Uid); }
public void OnClick() { var transform = PoolMan.Spawn(RoomMessagePrefab); transform.GetComponent <DOPopup>().Show(); transform.GetComponent <RoomMessage>().Init(); }
public void GamerListPage() { GetComponent <DOPopup>().Close(); var go = PoolMan.Spawn("GamerList"); go.GetComponent <DOPopup>().Show(); }
public void OwnerPage() { GetComponent <DOPopup>().Close(); var go = PoolMan.Spawn("OwnerPanel"); go.GetComponent <DOPopup>().Show(); go.GetComponent <OwnerPanel>().Init(); }
private void setPrChips(int value) { var chip = PoolMan.Spawn("UpChip"); chip.SetParent(theSeat.transform, false); chip.GetComponent <RectTransform>().localScale = Vector3.one; chip.SetAsLastSibling(); chip.GetComponent <ChipsGo>().Create(theSeat, player); }
public static SelfCards Create(GameObject prefab, Player player) { var transform = PoolMan.Spawn(prefab); var sc = transform.GetComponent <SelfCards>(); sc.player = player; sc.addEvents(); return(sc); }
private void renderCards(List <int> outs) { foreach (var cardNum in outs) { var transform = PoolMan.Spawn("InsureCard", CardList); transform.SetAsLastSibling(); var card = transform.GetComponent <CardContainer>().CardInstance; card.Show(cardNum); var toggle = transform.GetComponent <Toggle>(); toggle.onValueChanged.RemoveAllListeners(); // 先移除事件 transform.GetComponent <Toggle>().isOn = true; togglesDict.Add(cardNum, toggle); if (caller.mustBuy || !caller.isBuyer) { toggle.interactable = false; } else { toggle.interactable = true; } toggle.onValueChanged.AddListener((isOn) => { if (isOn) { SelectedOuts.Add(cardNum); } else { SelectedOuts.Remove(cardNum); } SelectedText.text = SelectedOuts.Count.ToString(); if (SelectedOuts.Count >= togglesDict.Count) { SetCheckAllToggle(true); } else { SetCheckAllToggle(false); } if (caller.SelectedCount == 0) { toggle.isOn = true; } caller.OnSelectedChange(this); }); } }
void onClick() { if (string.IsNullOrEmpty(Uid)) { return; } var userPopup = PoolMan.Spawn("User"); userPopup.GetComponent <UserDetail>().Init(Uid); }
private void setupAllinPlayers(List <object> allinPlayers, int maxPercent) { AllinTitle.text = "落后玩家(" + allinPlayers.Count + ")"; foreach (var obj in allinPlayers) { var data = obj as Dictionary <string, object>; var playerMes = PoolMan.Spawn("InsureAllInPlayer", AllinPlayersParent.transform); playerMes.GetComponent <AllInPlayer>().Init(data, maxPercent); } }
public void Back() { GetComponent <DOPopup>().Close(); if (fromList) { var go = PoolMan.Spawn("GamerList"); go.GetComponent <DOPopup>().Show(); } else { var userPopup = PoolMan.Spawn("User"); userPopup.GetComponent <UserDetail>().Init(uid); } }
private void AskPartnersData() { HTTP.Get("/check-partner", new Dictionary <string, object>() { { "a_uid", aimUid[0] }, { "b_uid", aimUid[1] }, { "room_id", GameData.Shared.Room.Value }, }, (data) => { var partnerData = PoolMan.Spawn("PartnerData"); partnerData.GetComponent <DOPopup>().Show(); var dataDic = Json.Decode(data) as Dictionary <string, object>; partnerData.GetComponent <PartnerData>().Init(dataDic); }); }
public void ScorePage() { Transform target; if (GameData.Shared.Type.Value == GameType.MTT) { target = PoolMan.Spawn(MTTScorePagePrefab); } else { target = PoolMan.Spawn(ScorePagePrefab); } target.GetComponent <DOPopup>().Show(); }
public void OnSave() { if (requesting) { return; } requesting = true; HTTP.Post("/remark", new Dictionary <string, object> { { "user_id", Uid }, { "remark", Input.text } }, (_) => { requesting = false; PoolMan.Spawn("User").GetComponent <UserDetail>().Init(Uid); }); }
public void OnClick() { var type = GameData.Shared.Type.Value; if (type == GameType.SNG) { var SNGMsgPage = PoolMan.Spawn("SNGMsgPage"); SNGMsgPage.GetComponent <DOPopup>().Show(); SNGMsgPage.GetComponent <SNGMsgPage>().Init(); } else if (type == GameType.MTT) { var MTTMsgPage = PoolMan.Spawn("MTTMsg"); MTTMsgPage.GetComponent <DOPopup>().Show(); MTTMsgPage.GetComponent <MTTMsgPage.MTTMsg>().Init(); } }
void Awake() { RxSubjects.TakeCoin.Subscribe((e) => { if (e.Data != null) { GameData.Shared.Coins = e.Data.Int("coins"); } //根据类别生成不同预制体 Transform transform; if (!GameData.Shared.IsMatch()) { transform = PoolMan.Spawn("Supplement"); } else { transform = PoolMan.Spawn("JoinMatch"); } transform.GetComponent <DOPopup>().Show(() => { var player = GameData.Shared.GetMyPlayer(); if (player.Index == -1 || player.Bankroll.Value > 0) { return; } Connect.Shared.Emit("unseat"); }); }).AddTo(this); RxSubjects.Bye.Subscribe((e) => { var type = e.Data.Int("type"); if (type == 2) { PokerUI.ConflictAlert(); } else if (type == 3) { PokerUI.DisAlert("您已被房主踢出牌局"); } }).AddTo(this); }
public static Transform Spawn() { if (instance == null) { var ins = PoolMan.Spawn("OP", G.UICvs.transform); instance = ins; } else { if (PoolMan.IsSpawned(instance)) { // skip } else { PoolMan.Spawn("OP", G.UICvs.transform); } } return(instance); }
public void OnRebuyAddon() { if (!GameData.MatchData.CanBuyLv()) { return; } var go = PoolMan.Spawn("RebuyOrAddon"); go.GetComponent <DOPopup>().Show(); var ins = go.GetComponent <RebuyOrAddon>(); if (GameData.MatchData.CanRebuyLv()) { ins.Rebuy(); } else { ins.AddOn(); } }
void Start() { GameData.Shared.ShowAudit.Subscribe((show) => { if (!show) { if (auditMsg != null) { auditMsg.GetComponent <DOPopup>().Close(); auditMsg = null; } return; } auditMsg = PoolMan.Spawn("AuditMsg").GetComponent <AuditMsg>(); auditMsg.GetComponent <AuditMsg>().Click = () => { Commander.Shared.Audit(); }; auditMsg.GetComponent <DOPopup>().Show(modal: false, singleton: false); }).AddTo(this); }
public void OnClickHoldCardPage() { PoolMan.Spawn(HoldCardPagePrefab); }
private void registerEvents() { // 只允许初始化一次 if (isReady) { return; } GameData.Shared.LeftTime.Subscribe((value) => { if (!GameData.Shared.GameStarted.Value) { setText(TimeLeftGo, "未开始"); return; } setText(TimeLeftGo, _.SecondStr(value)); if (GameData.Shared.IsMatch()) { return; } if (value > 5 * 60) { hasShowEnding = false; } else { if (!hasShowEnding) { PokerUI.Toast("牌局将在5分钟内结束"); } hasShowEnding = true; } }).AddTo(this); RxSubjects.UnSeat.Subscribe((e) => { var uid = e.Data.String("uid"); if (uid == GameData.Shared.Uid && e.Data.Int("type") == 2) { PokerUI.Alert("您已连续3次超时,先站起来休息下吧~"); } }).AddTo(this); GameData.Shared.Ante.Subscribe((value) => { setBBText(); }).AddTo(this); GameData.Shared.Straddle.Subscribe((value) => { setBBText(); }).AddTo(this); GameData.Shared.PlayerCount.Where((value) => value > 0).Subscribe((value) => { setupSeats(value); }).AddTo(this); RxSubjects.Connecting.Subscribe((stat) => { LoadingModal.transform.SetAsLastSibling(); LoadingModal.SetActive(stat); }).AddTo(this); RxSubjects.Seating.Subscribe((action) => { foreach (var go in Seats) { var seat = go.GetComponent <Seat>(); if (action) { seat.Hide(); } else if (!GameData.Shared.Players.ContainsKey(seat.Index)) { seat.Show(); } } ExpressionButton.SetActive(action); }).AddTo(this); subsPublicCards(); subsPlayer(); subsRoomSetting(); RxSubjects.GameReset.Subscribe((_) => { infoGo.SetActive(false); PokerUI.DestroyElements(); }).AddTo(this); RxSubjects.Emoticon.Subscribe((e) => { if (GameSetting.emoticonClose) { return; } int fromSeatIndex = e.Data.Int("seat"); int toSeatIndex = e.Data.Int("toseat"); int pid = e.Data.Int("pid"); int[] canTurnEmo = { 4, 5, 6, 7, 10, 12 }; bool isToMe = false; var fromSeatPos = new Vector2(0, 1920); var toSeat = Seats[0]; foreach (var seat in Seats) { if (seat.GetComponent <Seat>().Index == fromSeatIndex && fromSeatIndex > -1) { fromSeatPos = seat.GetComponent <RectTransform>().anchoredPosition; } if (seat.GetComponent <Seat>().Index == toSeatIndex) { toSeat = seat; if (toSeatIndex == GameData.Shared.FindPlayerIndex(GameData.Shared.Uid)) { isToMe = true; } } } var em = PoolMan.Spawn("Emoticon/Emo" + pid); em.GetComponent <Emoticon>().Init(fromSeatPos, toSeat, isToMe, canTurnEmo.Contains(pid)); }).AddTo(this); var expressions = new Dictionary <string, Transform>(); RxSubjects.Expression.Subscribe((e) => { var expressionName = e.Data.String("expression"); var uid = e.Data.String("uid"); if (expressions.ContainsKey(uid)) { PoolMan.Despawn(expressions[uid]); expressions.Remove(uid); } var expression = PoolMan.Spawn("Expression"); expressions[uid] = expression; // 保存起来 Transform parent; if (uid == GameData.Shared.Uid) { parent = ExpressionButton.transform; //有可能出现点击表情时,玩家已经站起的现象 if (!parent.gameObject.activeInHierarchy) { return; } } else { var seatIndex = e.Data.Int("seat"); var aimSeat = Seats[0]; foreach (var seat in Seats) { if (seat.GetComponent <Seat>().Index == seatIndex) { aimSeat = seat; break; } } parent = aimSeat.GetComponentInChildren <PlayerOppo>().transform; } expression.GetComponent <Expression>().SetTrigger(expressionName, parent, () => { expressions.Remove(uid); }); }).AddTo(this); RxSubjects.MatchLook.Subscribe((e) => { if (GameData.Shared.Type.Value != GameType.MTT) { return; } var state = e.Data.Int("match_state"); // 比赛未开始 if (state < 10) { return; } var myself = e.Data.Dict("myself"); if (myself.Int("rank") >= 0) { PokerUI.ToastThenExit("您已被淘汰"); } }).AddTo(this); RxSubjects.MatchRank.Subscribe((json) => { // 输了之后以游客身份旁观 GameData.Shared.IsMatchState = false; var SNGWinner = PoolMan.Spawn("MatchWinner"); SNGWinner.GetComponent <DOPopup>().ShowModal(new Color(0, 0, 0, 0.6f), closeOnClick: false); SNGWinner.GetComponent <MatchWinner>().Init(json.Data); }).AddTo(this); RxSubjects.ShowAudio.Where(isGuest).Subscribe((json) => { var N = JSON.Parse(json); var name = N["name"].Value; SpkText.ShowMessage(String.Format("{0}发送了一段语音", name)); }).AddTo(this); RxSubjects.SendChat.Where(isGuest).Subscribe((json) => { var N = JSON.Parse(json); var name = N["name"].Value; var text = N["text"].Value; SpkText.ShowMessage(String.Format("{0}: {1}", name, text)); }).AddTo(this); RxSubjects.Award27.Subscribe((e) => { var win27Emo = PoolMan.Spawn("Win27Emo"); win27Emo.transform.SetParent(G.UICvs.transform, false); win27Emo.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; }).AddTo(this); RxSubjects.GameOver.Subscribe((e) => { if (GameData.Shared.IsMatch()) { return; } var type = GameData.Shared.Type.Value; var count = GameData.Shared.PublicCards.Count; if (count < 5 && type != GameType.KingThree) { SeeLeftCard.SetActive(true); } else if (count < 3 && type == GameType.KingThree) { SeeLeftCard.SetActive(true); } }).AddTo(this); RxSubjects.GameStart.Subscribe((e) => { gameReload(); infoGo.SetActive(false); }).AddTo(this); RxSubjects.Look.Subscribe((e) => { gameReload(); if (GameData.Shared.InGame) { infoGo.SetActive(false); } }).AddTo(this); RxSubjects.Pass.Subscribe((e) => { var type = GameData.Shared.Type.Value; if (!GameData.Shared.IsMatch()) { var msg = "记分牌带入成功"; if (GameData.Shared.InGame) { msg += "(下一手生效)"; } PokerUI.Toast(msg); } else if (type == GameType.SNG) { PokerUI.Toast("报名成功"); } else if (type == GameType.MTT) { var inc = e.Data.Int("inc_bankroll"); PokerUI.Toast(string.Format("成功购买{0}记分牌(下一手生效)", inc)); } }).AddTo(this); RxSubjects.SomeOneSeeCard.Subscribe((e) => { var name = e.Data.String("name"); var go = (GameObject)GameObject.Instantiate(SeeCardTips, G.UICvs.transform); var cvg = go.GetComponent <CanvasGroup>(); var text = go.transform.Find("Text").GetComponent <Text>(); text.text = String.Format("<color=#4FC3F7FF>{0}</color>看了剩余公共牌", name); go.SetActive(true); cvg.alpha = 0; go.transform.SetParent(SeeCardTable.transform); cvg.DOFade(1, 0.2f).OnComplete(() => { Observable.Timer(TimeSpan.FromSeconds(2.5)).Subscribe((tmp) => { cvg.DOFade(0, 0.2f).OnComplete(() => { Destroy(go); }); }).AddTo(this); }); }).AddTo(this); RxSubjects.ToInsurance.Subscribe((e) => { GameData.Shared.InsuranceState.Value = true; var InsurancePopup = PoolMan.Spawn("Insurance"); InsurancePopup.GetComponent <Insurance>().Init(e.Data, true); }).AddTo(this); RxSubjects.ShowInsurance.Subscribe((e) => { var InsurancePopup = PoolMan.Spawn("Insurance"); InsurancePopup.GetComponent <Insurance>().Init(e.Data, false); }).AddTo(this); RxSubjects.RaiseBlind.Subscribe((e) => { var bb = e.Data.Int("big_blind"); var cd = e.Data.Int("blind_countdown"); GameData.Shared.BB = bb; GameData.Shared.LeftTime.OnNext(cd); GameData.Shared.Ante.Value = e.Data.Int("ante"); setBBText(); PokerUI.Toast(string.Format("盲注已升至{0}/{1}", bb / 2, bb)); if (GameData.Shared.Type.Value == GameType.MTT) { var lv = e.Data.Int("blind_lv"); // 下一级别无法重购 if (lv == GameData.MatchData.LimitLv - 2) { PokerUI.Toast("本级别过后将无法再重购"); } else if (lv == GameData.MatchData.LimitLv - 1) { PokerUI.Toast("本级别过后将无法再增购"); } } }).AddTo(this); RxSubjects.OffScore.Subscribe((e) => { var type = e.Data.Int("type"); if (type == 0) { PokerUI.Toast("您已提前下分,将在本局结束后结算"); return; } if (type != 1) { return; } var name = e.Data.String("name"); var avatar = e.Data.String("avatar"); var dt = e.Data.Dict("data"); var takecoin = dt.Int("takecoin"); var profit = dt.Int("bankroll") - takecoin; PoolMan.Spawn("OffScore").GetComponent <OffScore>().Show(avatar, takecoin, profit); // 已下分,bankroll为0 GameData.Shared.Bankroll.Value = 0; }).AddTo(this); RxSubjects.ToAddOn.Subscribe((e) => { var go = PoolMan.Spawn("RebuyOrAddon"); go.GetComponent <DOPopup>().Show(closeOnClick: false); go.GetComponent <RebuyOrAddon>().AddOn(true); }).AddTo(this); RxSubjects.ToRebuy.Subscribe((e) => { var go = PoolMan.Spawn("RebuyOrAddon"); go.GetComponent <DOPopup>().Show(closeOnClick: false); go.GetComponent <RebuyOrAddon>().Rebuy(true); }).AddTo(this); RxSubjects.GameEnd.Subscribe((e) => { // 关闭连接 Connect.Shared.CloseImmediate(); if (MatchWinner.IsSpawned) { return; } // 获取roomID,调用ExitCb后无法获取 var roomID = GameData.Shared.Room.Value; var matchID = GameData.Shared.MatchID; var ID = ""; var page = ""; // 清理 External.Instance.ExitCb(() => { switch (GameData.Shared.Type.Value) { case GameType.SNG: ID = roomID; page = "record_sng.html"; break; case GameType.MTT: ID = matchID; page = "record_mtt.html"; break; default: ID = roomID; page = "record.html"; break; } Commander.Shared.GameEnd(ID, page); }); }).AddTo(this); RxSubjects.MTTMatch.Subscribe((e) => { if (GameData.Shared.Type.Value != GameType.MTT) { return; } var type = e.Data.Int("type"); if (type == 3) { var player = GameData.Shared.GetMyPlayer(); if (player.IsValid()) { return; } var roomId = e.Data.String("data"); Connect.Shared.Enter(roomId, () => { getRoomEnter(); }); } else if (type == 6) { PokerUI.Toast("即将进入钱圈"); } }).AddTo(this); // Connect.Shared.Enter(GameData.Shared.Room.Value, () => { // getRoomEnter(); // }); }
public static ModalHelper Create() { var transform = PoolMan.Spawn("Modal"); return(transform.GetComponent <ModalHelper>()); }
public void OnRemark() { var transform = PoolMan.Spawn("UserRemark"); transform.GetComponent <UserRemark>().Show(Uid, remark); }
public void ShowMenu() { var popup = PoolMan.Spawn(MenuPrefab); popup.GetComponent <DOPopup>().Show(); }
public void OnShowRecalls() { PoolMan.Spawn(RecallPagePrefab); }
public void OnReturn() { PoolMan.Spawn("User").GetComponent <UserDetail>().Init(Uid); }
public void OnClickExpressionPage() { var expressionPage = PoolMan.Spawn("ExpressionPage"); expressionPage.GetComponent <DOPopup>().Show(); }
public void SharkEmo2() { PoolMan.Spawn("Emoticon/Emo15_Shark").SetParent(G.UICvs.transform, false); }