Example #1
0
 protected override void OnAwake()
 {
     base.OnAwake();
     AnteRate.Clear();
     AnteRate.Add(1);
     AnteRate.Add(2);
     AnteRate.Add(4);
 }
Example #2
0
        public void OnFapai(ISFSObject data)
        {
            RStatus = RoomStatus.FaPai;

            SingleBet = AnteRate[0];

            LastTime = JhFunc.GetTimeStamp(false);

            BankerSeat = data.GetInt(JhRequestConstKey.KeyBanker);
            int[] playing = data.GetIntArray(JhRequestConstKey.KeyPlayings);

            int[] playingChair = new int[playing.Length];
            for (int i = 0; i < playing.Length; i++)
            {
                playingChair[i] = GetLocalSeat(playing[i]);
                JhUserInfo uInfo = GetPlayerInfo <JhUserInfo>(playing[i], true);
                uInfo.IsPlayingGame = true;
                uInfo.CoinA        -= SingleBet;
                TotalBet           += SingleBet;
                uInfo.AllBeat      += SingleBet;
            }


            ISFSObject sendObj = SFSObject.NewInstance();

            sendObj.PutInt("Banker", GetLocalSeat(BankerSeat));
            sendObj.PutIntArray("Playing", playingChair);
            sendObj.PutInt("ChipValue", SingleBet);
            sendObj.PutInt("ChipIndex", AnteRate.IndexOf(SingleBet));
            sendObj.PutInt("SingleBet", SingleBet);
            EventObj.SendEvent("PlayersViewEvent", "Fapai", sendObj);

            SendGameStatusToTableView();

            EventObj.SendEvent("SoundEvent", "PlayerEffect", new JhSound.SoundData(JhSound.EnAudio.Card));
        }
Example #3
0
        protected void SendGameStatusToPlayerView()
        {
            ISFSObject sendObj   = SFSObject.NewInstance();
            ISFSArray  sendArray = SFSArray.NewInstance();

            foreach (var info in UserInfoDict)
            {
                JhUserInfo userInfo = (JhUserInfo)info.Value;
                if (userInfo != null)
                {
                    ISFSObject obj = userInfo.GetSfsObject(RStatus);
                    obj.PutInt("Chair", GetLocalSeat(userInfo.Seat));
                    sendArray.AddSFSObject(obj);
                }
            }
            sendObj.PutBool("isShowTimeTip", CoustemTime > 0);

            if (RStatus > RoomStatus.CanStart)
            {
                sendObj.PutInt("CurChair", GetLocalSeat(CurrenPlayer));
                sendObj.PutDouble("CdTime", CdTime);
                sendObj.PutLong("LastTime", LastTime);

                if (CurrenPlayer == SelfSeat)
                {
                    JhUserInfo curUser = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true);
                    if (!curUser.IsGzyz && IsAutoFollow)
                    {
                        sendObj.PutDouble("CdTime", 2.0f);
                    }
                }

                JhUserInfo currP = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true);
                SetCurrenPlayerBeatMinAndMax(currP, sendObj);

                sendObj.PutInt("Banker", GetLocalSeat(BankerSeat));

                if (TotalBet != 0)
                {
                    ISFSArray betArray = SFSArray.NewInstance();
                    int       ttBet    = TotalBet;
                    for (int i = AnteRate.Count - 1; i >= 0; i--)
                    {
                        if (ttBet >= AnteRate[i])
                        {
                            ISFSObject arrO = SFSObject.NewInstance();
                            arrO.PutInt("ChipValue", AnteRate[i]);
                            arrO.PutInt("ChipIndex", i);
                            arrO.PutInt("ChipCnt", ttBet / AnteRate[i]);
                            betArray.AddSFSObject(arrO);
                            ttBet = ttBet % AnteRate[i];
                        }
                    }
                    sendObj.PutSFSArray("ChipList", betArray);
                }
            }

            sendObj.PutSFSArray("Players", sendArray);
            sendObj.PutIntArray("Antes", AnteRate.ToArray());
            sendObj.PutInt("SingleBet", SingleBet);
            sendObj.PutBool("IsPlaying", RStatus > RoomStatus.CanStart && RStatus != RoomStatus.Over);

            SetSfsUserContrl(sendObj);

            EventObj.SendEvent("PlayersViewEvent", "Status", sendObj);
        }