Example #1
0
        public void OnCurPlayer(ISFSObject response)
        {
            LastTime = JhFunc.GetTimeStamp(false);

            CurrenPlayer = response.GetInt("p");
            CurRound     = response.GetInt("round");
            CdTime       = response.GetInt("cd");
            SingleBet    = response.GetInt("minGold");

            if (response.ContainsKey("look"))
            {
                IsCanLook = response.GetBool("look");
            }
            if (response.ContainsKey("compare"))
            {
                IsCanCompare = response.GetBool("compare");
            }
            if (response.ContainsKey("giveup"))
            {
                IsCanGiveUp = response.GetBool("giveup");
            }

            JhUserInfo curUser = GetPlayerInfo <JhUserInfo>(CurrenPlayer, true);

            if (response.ContainsKey("gzyz"))
            {
                curUser.IsGzyz = response.GetBool("gzyz");
            }

            ISFSObject sendObj = SFSObject.NewInstance();

            sendObj.PutInt("Chair", GetLocalSeat(CurrenPlayer));
            SetSfsUserContrl(sendObj);
            sendObj.PutDouble("CdTime", CdTime);
            sendObj.PutInt("SingleBet", SingleBet);
            if (CurrenPlayer == SelfSeat)
            {
                if (!curUser.IsGzyz && IsAutoFollow)
                {
                    sendObj.PutDouble("CdTime", 2.0f);
                }
            }

            SetCurrenPlayerBeatMinAndMax(curUser, sendObj);

            EventObj.SendEvent("PlayersViewEvent", "CurrPlayer", sendObj);


            sendObj.PutInt("MaxLun", maxRound);
            sendObj.PutInt("CurLun", CurRound);
            EventObj.SendEvent("TableViewEvent", "CurrPlayer", sendObj);
        }
Example #2
0
        protected void OnAutoFollow()
        {
            IsAutoFollow = !IsAutoFollow;
            ISFSObject sendObj = SFSObject.NewInstance();

            if (IsAutoFollow)
            {
                //判断当前用户是否是自己
                if (CurrenPlayer == SelfSeat)
                {
                    EventObj.SendEvent("ServerEvent", "FollowReq", null);
                }
            }
            else
            {
                if (CurrenPlayer == SelfSeat)
                {
                    sendObj.PutDouble("CdTime", CdTime - (double)(JhFunc.GetTimeStamp(false) - LastTime) / 1000.0f);
                }
            }
            sendObj.PutBool("IsCurrPlayer", CurrenPlayer == SelfSeat);
            sendObj.PutBool("IsAutoFollow", IsAutoFollow);
            SetSfsUserContrl(sendObj);
            EventObj.SendEvent("PlayersViewEvent", "AutoFollow", sendObj);
        }
Example #3
0
 public void PutDouble(ISFSObject data, string key, double item)
 {
     if (sendEncrypted)
     {
         data.PutByteArray(key, provider.EncryptDouble(item));
     }
     else
     {
         data.PutDouble(key, item);
     }
 }
Example #4
0
 public void PutDouble(ISFSObject data, string key, double item)
 {
     if (sendEncrypted)
     {
         data.PutByteArray(key, provider.EncryptDouble(item));
     }
     else
     {
         data.PutDouble(key, item);
     }
 }
Example #5
0
    public void toSFSObject(ISFSObject data)
    {
        data.PutFloat("x", position.x);
        data.PutFloat("y", position.y);
        data.PutFloat("z", position.z);

        data.PutFloat("rx", rotation.eulerAngles.x);
        data.PutFloat("ry", rotation.eulerAngles.y);
        data.PutFloat("rz", rotation.eulerAngles.z);

        data.PutDouble("time", timeStamp);
    }
Example #6
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);
        }