예제 #1
0
파일: PlayerSelf.cs 프로젝트: rfHu/poker
        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);
        }
예제 #2
0
파일: UserDetail.cs 프로젝트: rfHu/poker
    public void OnGamerData()
    {
        var go = PoolMan.Spawn("PartnerList");

        go.GetComponent <DOPopup>().Show();
        go.GetComponent <PartnerList>().Init(Uid);
    }
예제 #3
0
파일: GamerListObj.cs 프로젝트: rfHu/poker
    public void OnGamerOptionClick()
    {
        var go = PoolMan.Spawn("GamerOption");

        go.GetComponent <DOPopup>().Show();
        go.GetComponent <GamerOption>().Init(enterLimit, seatLimit, talkLimit, uid, true);
    }
예제 #4
0
파일: UserDetail.cs 프로젝트: rfHu/poker
    public void OnGamerOptionClick()
    {
        var transform = PoolMan.Spawn("GamerOption");

        transform.GetComponent <DOPopup>().Show();
        transform.GetComponent <GamerOption>().Init(enterLimit, seatLimit, talkLimit, Uid);
    }
예제 #5
0
    public void OnClick()
    {
        var transform = PoolMan.Spawn(RoomMessagePrefab);

        transform.GetComponent <DOPopup>().Show();
        transform.GetComponent <RoomMessage>().Init();
    }
예제 #6
0
파일: RoomMessage.cs 프로젝트: rfHu/poker
    public void GamerListPage()
    {
        GetComponent <DOPopup>().Close();
        var go = PoolMan.Spawn("GamerList");

        go.GetComponent <DOPopup>().Show();
    }
예제 #7
0
파일: RoomMessage.cs 프로젝트: rfHu/poker
    public void OwnerPage()
    {
        GetComponent <DOPopup>().Close();
        var go = PoolMan.Spawn("OwnerPanel");

        go.GetComponent <DOPopup>().Show();
        go.GetComponent <OwnerPanel>().Init();
    }
예제 #8
0
파일: PlayerBase.cs 프로젝트: rfHu/poker
        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);
        }
예제 #9
0
    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);
    }
예제 #10
0
파일: InsuranceOuts.cs 프로젝트: rfHu/poker
    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);
            });
        }
    }
예제 #11
0
파일: Avatar.cs 프로젝트: rfHu/poker
    void onClick()
    {
        if (string.IsNullOrEmpty(Uid))
        {
            return;
        }

        var userPopup = PoolMan.Spawn("User");

        userPopup.GetComponent <UserDetail>().Init(Uid);
    }
예제 #12
0
    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);
        }
    }
예제 #13
0
    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);
        }
    }
예제 #14
0
 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);
     });
 }
예제 #15
0
    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();
    }
예제 #16
0
파일: UserRemark.cs 프로젝트: rfHu/poker
    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);
        });
    }
예제 #17
0
    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();
        }
    }
예제 #18
0
    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);
    }
예제 #19
0
    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);
    }
예제 #20
0
파일: MenuPopup.cs 프로젝트: rfHu/poker
    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();
        }
    }
예제 #21
0
    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);
    }
예제 #22
0
 public void OnClickHoldCardPage()
 {
     PoolMan.Spawn(HoldCardPagePrefab);
 }
예제 #23
0
파일: Controller.cs 프로젝트: rfHu/poker
    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();
        // });
    }
예제 #24
0
파일: ModalHelper.cs 프로젝트: rfHu/poker
    public static ModalHelper Create()
    {
        var transform = PoolMan.Spawn("Modal");

        return(transform.GetComponent <ModalHelper>());
    }
예제 #25
0
파일: UserDetail.cs 프로젝트: rfHu/poker
    public void OnRemark()
    {
        var transform = PoolMan.Spawn("UserRemark");

        transform.GetComponent <UserRemark>().Show(Uid, remark);
    }
예제 #26
0
    public void ShowMenu()
    {
        var popup = PoolMan.Spawn(MenuPrefab);

        popup.GetComponent <DOPopup>().Show();
    }
예제 #27
0
 public void OnShowRecalls()
 {
     PoolMan.Spawn(RecallPagePrefab);
 }
예제 #28
0
파일: UserRemark.cs 프로젝트: rfHu/poker
 public void OnReturn()
 {
     PoolMan.Spawn("User").GetComponent <UserDetail>().Init(Uid);
 }
예제 #29
0
    public void OnClickExpressionPage()
    {
        var expressionPage = PoolMan.Spawn("ExpressionPage");

        expressionPage.GetComponent <DOPopup>().Show();
    }
예제 #30
0
 public void SharkEmo2()
 {
     PoolMan.Spawn("Emoticon/Emo15_Shark").SetParent(G.UICvs.transform, false);
 }