Exemplo n.º 1
0
        int GetCdTime(ISFSObject gameInfo)
        {
            int dif = (int)(gameInfo.GetLong("ct") - gameInfo.GetLong("st"));
            int cd  = gameInfo.GetInt("cd");

            return(cd - dif);
        }
Exemplo n.º 2
0
        public void BeginGiveCards(ISFSObject responseData)
        {
            var gdata = App.GetGameData <BrnnGameData>();

            Pg  = new[] { 0, 0, 0, 0 };
            Bpg = new[] { 0, 0, 0, 0 };
            if (responseData.ContainsKey("total"))
            {
                gdata.GetPlayerInfo().CoinA = responseData.GetLong("total");
            }
            if (responseData.ContainsKey("pg"))
            {
                Pg = responseData.GetIntArray("pg");
            }
            if (responseData.ContainsKey("bpg"))
            {
                Bpg = responseData.GetIntArray("bpg");
            }
            gdata.ResultUserTotal   = responseData.ContainsKey("win") ? responseData.GetInt("win") : 0;
            gdata.ResultBnakerTotal = responseData.ContainsKey("bwin") ? responseData.GetLong("bwin") : 0;
            Cards = responseData.GetSFSArray("cards");

            Nn = responseData.GetSFSArray("nn");
            BeginClone();
            InvokeRepeating("ReadyGiveCards", 0, 0.1f);
        }
Exemplo n.º 3
0
        protected override void InitGameData(ISFSObject gameInfo)
        {
            OwnerId     = gameInfo.ContainsKey("ownerId") ? gameInfo.GetInt("ownerId") : -1;
            _rule       = gameInfo.ContainsKey("rule") ? gameInfo.GetUtfString("rule") : "";
            IsGameStart = gameInfo.ContainsKey(RequestKey.KeyPlaying) && gameInfo.GetBool(RequestKey.KeyPlaying);
            _rejoin     = gameInfo.ContainsKey("rejoin") && gameInfo.GetBool("rejoin");
            if (IsGameStart && _rejoin)
            {
                _color1     = gameInfo.GetIntArray("color1");
                _color2     = gameInfo.GetIntArray("color2");
                _color3     = gameInfo.GetIntArray("color3");
                _color4     = gameInfo.GetIntArray("color4");
                _curSpeaker = gameInfo.ContainsKey("curP") ? gameInfo.GetInt("curP") : -1;

                _cd = gameInfo.ContainsKey("cd") ? gameInfo.GetInt("cd") : -1;
                _st = gameInfo.ContainsKey("st") ? gameInfo.GetLong("st") : -1;
                _ct = gameInfo.ContainsKey("ct") ? gameInfo.GetLong("ct") : -1;


                _hup      = gameInfo.ContainsKey("hup") ? gameInfo.GetUtfString("hup") : "";
                _svt      = gameInfo.ContainsKey("svt") ? gameInfo.GetLong("svt") : 0;
                _hupstart = gameInfo.ContainsKey("hupstart") ? gameInfo.GetLong("hupstart") : 0;

                _killDragon = gameInfo.ContainsKey("killDragon") ? gameInfo.GetBoolArray("killDragon") : null;
                _isDragon   = gameInfo.ContainsKey("isDragon") ? gameInfo.GetBoolArray("isDragon") : null;
            }
        }
Exemplo n.º 4
0
        protected override void InitGameData(ISFSObject gameInfo)
        {
            base.InitGameData(gameInfo);
            var user = gameInfo.GetSFSObject(RequestKey.KeyUser);

            //金币
            _totalGold = user.GetLong(RequestKey.KeyTotalGold);
            //总下注
            _totalBets     = 0;
            HistoryResults = new LSResult[LSConstant.History_Lenth];
            //历史索引
            History_Index = gameInfo.GetInt(LSConstant.KeyHistoryIndex);
            //Debug.LogError("历史索引是"+History_Index);
            //开始时间
            StartTime = gameInfo.GetLong(LSConstant.KeyGameStartTime);
            //现在时间
            NowTime = gameInfo.GetLong(RequestCmd.GetServerTime);
            //游戏CD
            CDTime = gameInfo.GetInt(LSConstant.KeyCDTime);
            //获得实际剩余时间
            GetShowTime();
            //ShowTime = 29;
            //当前的游戏状态
            GlobalELswcGameStatu = (ELswcGameState)gameInfo.GetInt(LSConstant.KeyGameStatus);
            //GlobalGameStatu = GameState.Empyt;
            //历史记录
            AnalysisHistorys(gameInfo.GetIntArray(LSConstant.KeyHistoryResult));
            //动物位置初始化(只在游戏开始时初始化一次)
            AnimalStartPos   = new int[LSConstant.Num_AnimalItemNumber];
            AnimalStartPos   = gameInfo.GetIntArray(LSConstant.KeyAnimalsPosition);
            Animals          = new LSAnimalType[LSConstant.Num_AnimalItemNumber];
            AnimalRandomSeed = gameInfo.GetInt(LSConstant.KeyRound);
            GetAnimalRandomNumber();
            //颜色区域数据初始化
            Colors = new LSColorType[LSConstant.Num_ColorItemNumber];
            SetColorsPosition(gameInfo.GetIntArray(LSConstant.KeyColorPosition));
            //倍率初始化
            PeiLvs = new int[LSConstant.Num_BetNumber];
            SetPeilvs(gameInfo.GetIntArray(LSConstant.KeyRates));
            //下注区域初始化
            Bets    = new int[LSConstant.Num_BetNumber];
            PerBets = new int[LSConstant.Num_BetNumber];
            //上局倍数
            Mulpitle = gameInfo.GetInt(LSConstant.KeyMultiple);
            //最后结果初始化
            LastResult = new LS_Detail_Result {
                ShowResults = new List <int>()
            };
            var gameMgr = App.GetGameManager <LswcGamemanager>();

            gameMgr.ColorItemControl.InitItems();
            gameMgr.AnimalItemCtrl.InitItems();
            gameMgr.UIManager.InitUImanager();
            SetDetialResult(LastTurnTableIndex, ShowTime, Mulpitle, 0);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 初始化 房间
        /// </summary>
        public void InitRoom(ISFSObject gameInfo)
        {
            var gdata = App.GetGameData <SssGameData>();

            if (gameInfo.ContainsKey("showGoldRate"))
            {
                gdata.ShowGoldRate = gameInfo.GetInt("showGoldRate");
            }

            if (gameInfo.ContainsKey("rule"))
            {
                RoomRuleView.InitRoomRuleInfo(gameInfo);
            }

            if (gameInfo.ContainsKey("ownerId"))
            {
                _ownerId = gameInfo.GetInt("ownerId");
            }

            RoomInfo.ShowRoomInfo(gameInfo);
            //获取房间配置
            if (gdata.IsRoomGame)
            {
                WeiXinInviteBtn.ChatInviteBtn.SetActive(!gdata.IsPlayed);
                HistoryMgr.MaxCount = gameInfo.GetInt("maxRound");
            }
            else
            {
                WeiXinInviteBtn.ChatInviteBtn.SetActive(false);
            }

            if (gameInfo.ContainsKey("state"))
            {
                int state = gameInfo.GetInt("state");
                if (state > 1)
                {
                    int cd            = gameInfo.GetInt("cd");
                    int remainingTime = GetRemainingTime(cd, gameInfo);
                    ClockCd.BeginCountDown(remainingTime, (int)gameInfo.GetLong("st"), false);     //开始记时
                    Debug.Log("<color=#00FF2BFF>" + "重连服务器时间擢" + gameInfo.GetLong("ct") + "</color>");
                    YxClockManager.BeginToCountDown(remainingTime);
                }
            }

            if (ChoiseWay != null)
            {
                int len = ChoiseWay.Length;
                for (int i = 0; i < len; i++)
                {
                    ChoiseWay[i].Init();
                }
            }
        }
Exemplo n.º 6
0
        public void CheckReJion(ISFSObject requestData)
        {
            var st = requestData.GetLong("st");
            var ct = requestData.GetLong("ct");

            if (st != 0)
            {
                if (ct - st < 14)
                {
                    App.GetGameData <Bjl3DGameData>().GameConfig.GameState = 5;
                    TheStateUI.StateShow(5);
                }
            }
        }
Exemplo n.º 7
0
        protected virtual void CheckReJion(ISFSObject requestData)
        {
            int cd = requestData.GetInt("cd");
            var st = requestData.GetLong("st");
            var ct = requestData.GetLong("ct");

            if (st != 0)
            {
                var gdata = App.GetGameData <MdxGameData>();
                if (ct - st < cd)
                {
                    gdata.BeginBet = true;
                }
            }
        }
Exemplo n.º 8
0
 public virtual void BeginGiveCards(ISFSObject responseData)
 {
     var gdata = App.GetGameData<BrttzGameData>();
     if (responseData.ContainsKey(Parameter.Bpg))
     {
         Bpg = responseData.GetIntArray(Parameter.Bpg);
     }
     if (responseData.ContainsKey(Parameter.Total))
     {
         gdata.GetPlayerInfo().CoinA = responseData.GetLong(Parameter.Total);
     }
     gdata.ResultUserTotal = responseData.ContainsKey(Parameter.Win) ? responseData.GetInt(Parameter.Win) : 0;
     gdata.ResultBnakerTotal = responseData.ContainsKey(Parameter.Bwin) ? responseData.GetLong(Parameter.Bwin) : 0;
     CardsValue = responseData.GetSFSArray(Parameter.Cards);
 }
Exemplo n.º 9
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            YxDebug.Log("------> RemoteServer: OnServerResponse() CMDID = rqst and type = " + type + "" + "! \n");
            switch ((RequestCmd)type)
            {
            case RequestCmd.CmdStartGame:
                YxDebug.Log("开始游戏");
                CanQuit = false;
                Facade.Instance <MusicManager>().Stop();
                App.GetGameData <OverallData>().SetResponseData(response);
                StopAllCoroutines();
                EventDispatch.Dispatch((int)EventID.GameEventId.PlayInsertCoinsAnim);
                EventDispatch.Dispatch((int)EventID.GameEventId.StartRollJetton);
                EventDispatch.Dispatch((int)EventID.GameEventId.GetIconOrder);
                //播放滚动声音
                break;

            case RequestCmd.CmdCaiChiChange:
                YxDebug.Log("彩池变化");
                long caichi = response.GetLong("caichi");
                EventDispatch.Dispatch((int)EventID.GameEventId.AlterPotGold, new EventData(caichi));
                break;

            case RequestCmd.CmdGetMessageWhenWin:
                YxDebug.Log("中彩通知");
                var data = response.GetUtfString("data");
                StartCoroutine(ShowNotice(data));
                break;
            }
        }
Exemplo n.º 10
0
    public void UpdatePlayerInfo(ISFSObject data, Color myColor)
    {
        String colorName = "";
        long time = data.GetLong("time");
        int s,m,h;
        string formattedTime;

        if(myColor == Color.red)
            colorName = "red";
        if(myColor == Color.green)
            colorName = "green";
        if(myColor == Color.cyan)
            colorName = "cyan";
        if(myColor == Color.magenta)
            colorName = "magenta";
        if(myColor == Color.yellow)
            colorName = "yellow";

        int newtime = (int) time/1000;
        s = (int) newtime%60;
        m = (int) (newtime/60)%60;
        h = (int) (newtime/3600)%24;
        formattedTime = string.Format("{0:00}:{1:00}:{2:00}",h,m,s);

        GameObject stats = GameObject.Find("StatLabels");
        stats.transform.FindChild("Name").GetComponent<UILabel>().text = data.GetUtfString("name");
        stats.transform.FindChild("Color").GetComponent<UILabel>().text = colorName;
        stats.transform.FindChild("Color").GetComponent<UILabel>().color = myColor;
        stats.transform.FindChild("Money").GetComponent<UILabel>().text = data.GetInt("money").ToString();
        stats.transform.FindChild("Timer").GetComponent<UILabel>().text = formattedTime;
    }
Exemplo n.º 11
0
        /// <summary>
        /// 设置庄家信息
        /// </summary>
        public void SetBankerInfo(ISFSObject data)
        {
            YxBaseGameUserInfo bankerInfo = null;

            if (data == null)
            {
                bankerInfo = new YxBaseGameUserInfo
                {
                    NickM        = "系统",
                    CoinA        = 1147483647,
                    Seat         = -1,
                    TotalCount   = 0,
                    WinTotalCoin = 0
                };
                Banker.SetMaxCoin(1147483646);
                Banker.Info = bankerInfo;
            }
            else
            {
                var newBanker = new YxBaseGameUserInfo();
                newBanker.Parse(data);
                newBanker.NickM = data.GetUtfString("username");
                var oldBnaker = Banker.Info;
                if (oldBnaker == null || oldBnaker.NickM != newBanker.NickM)
                {
                    YxDebug.Log("重置庄家信息!!");
                    newBanker.NickM        = data.GetUtfString("username");
                    newBanker.CoinA        = data.GetLong("ttgold");
                    newBanker.TotalCount   = 0;
                    newBanker.WinTotalCoin = 0;
                    bankerInfo             = newBanker;
                    Banker.Info            = bankerInfo;
                }
            }
        }
Exemplo n.º 12
0
    // Creating NetworkTransform from SFS object
    public static NetworkTransform FromSFSObject(ISFSObject data)
    {
        NetworkTransform trans         = new NetworkTransform();
        ISFSObject       transformData = data.GetSFSObject("transform");

        float x = Convert.ToSingle(transformData.GetDouble("x"));
        float y = Convert.ToSingle(transformData.GetDouble("y"));
        float z = Convert.ToSingle(transformData.GetDouble("z"));

        float rx = Convert.ToSingle(transformData.GetDouble("rx"));
        float ry = Convert.ToSingle(transformData.GetDouble("ry"));
        float rz = Convert.ToSingle(transformData.GetDouble("rz"));

        trans.position      = new Vector3(x, y, z);
        trans.angleRotation = new Vector3(rx, ry, rz);

        if (transformData.ContainsKey("t"))
        {
            trans.TimeStamp = Convert.ToDouble(transformData.GetLong("t"));
        }
        else
        {
            trans.TimeStamp = 0;
        }

        return(trans);
    }
Exemplo n.º 13
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            YxDebug.Log("------> RemoteServer: OnServerResponse() CMDID = rqst and type = " + type + "" + "! \n");
            var eventCenter = Facade.EventCenter;

            switch ((Mx97RequestCmd)type)
            {
            case Mx97RequestCmd.CmdIdStartGame:
            {
                App.GetGameData <Mx97GlobalData>().SetStartData(response);

                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.SwitchBtnWhenStart);
                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.StartScrollAni);
            }
            break;

            case Mx97RequestCmd.CmdIdJackpotChange:
            {
                // 更新奖池
                App.GetGameData <Mx97GlobalData>().Caichi = response.GetLong("caichi");
                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.RefreshJackpot);
            }
            break;

                /*   //目前不需要Notice
                 * case Mx97RequestCmd.CmdIdGetMessage:
                 * {
                 * Facade.Instance<MusicManager>().Play("Winning");
                 * var data = response.GetUtfString("data");
                 * StartCoroutine(ShowNotice(data));
                 * }
                 * break;
                 */
            }
        }
Exemplo n.º 14
0
        private void RefreshSelf(ISFSObject response)
        {
            var gdata = App.GetGameData <BtwGameData>();

            gdata.ThisCanInGold = gdata.GetPlayerInfo().CoinA;
            var banker = gdata.BankerPlayer;

            if (response.ContainsKey("bankerGold"))
            {
                banker.Coin = response.GetLong("bankerGold");
            }
            if (response.ContainsKey("total"))
            {
                App.GameData.GetPlayer().Coin = response.GetLong("total");
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 设置玩家信息
        /// </summary>
        /// <param name="response"></param>
        /// <param name="isBuy"></param>
        public void SetUserInfo(ISFSObject response, bool isBuy = true)
        {
            Player player;

            if (response.ContainsKey(RequestKey.KeySeat))
            {
                var seat = response.GetInt(RequestKey.KeySeat);
                player = PlayersBatterys[seat];
            }
            else
            {
                player = PlayersBatterys.UserSelf;
            }

            var coin = response.GetInt(RequestKey.KeyCoin);

            if (isBuy)
            {
                player.BuyCoin(coin);
            }
            else
            {
                player.RetrieveCoin();
            }
            var totalCoin  = response.ContainsKey(RequestKey.KeyGold) ? response.GetLong(RequestKey.KeyGold) : 0;
            var bottomView = GameSystemUI.BottomView;

            App.GetGameData <FishGameData>().TotalCoin = totalCoin;
            if (bottomView != null)
            {
                bottomView.SetUserCoin(totalCoin);
            }
        }
Exemplo n.º 16
0
        public void SetNumOnResult(ISFSObject response)
        {
            var gdata = App.GetGameData <BrttzGameData>();

            gdata.CurrentCanInGold = response.ContainsKey("bankerGold") ? response.GetLong("bankerGold") : 1147483647;
            _num = gdata.CurrentCanInGold;
        }
Exemplo n.º 17
0
        protected override void InitGameData(ISFSObject gameInfo)
        {
            OwnerId = gameInfo.ContainsKey("ownerId") ? gameInfo.GetInt("ownerId") : -1;

            MaxUserCnt = gameInfo.GetInt("playerNum");

            IsGameStart = gameInfo.ContainsKey(RequestKey.KeyPlaying) && gameInfo.GetBool(RequestKey.KeyPlaying);

            if (IsGameStart)
            {
                BankerSeat = gameInfo.GetInt(JhRequestConstKey.KeyBanker);
                if (gameInfo.ContainsKey("currentP"))
                {
                    gameInfo.GetSFSObject(RequestKey.KeyUser).PutInt("currentP", gameInfo.GetInt("currentP"));
                    CurrenPlayer = gameInfo.GetInt("currentP");
                }

                TotalBet = gameInfo.ContainsKey("totalBet") ? gameInfo.GetInt("totalBet") : 0;

                LastTime = gameInfo.GetLong("lasttime");

                CdTime = gameInfo.GetInt("cdTime");

                IsCanCompare = gameInfo.ContainsKey(JhRequestConstKey.KeyCompare) &&
                               gameInfo.GetBool(JhRequestConstKey.KeyCompare);

                IsCanLook = gameInfo.ContainsKey(JhRequestConstKey.KeyLook) &&
                            gameInfo.GetBool(JhRequestConstKey.KeyLook);

                IsCanGiveUp = gameInfo.ContainsKey(JhRequestConstKey.KeyGiveUp) &&
                              gameInfo.GetBool(JhRequestConstKey.KeyGiveUp);

                SingleBet = gameInfo.ContainsKey("minGold") ? gameInfo.GetInt("minGold") : AnteRate[0];

                CurRound = gameInfo.GetInt("jhround");
            }
            ReadyOutTime = gameInfo.GetInt("");
            maxRound     = gameInfo.GetInt("maxLun");

            BiPaiBeiShu = gameInfo.GetInt("bpbeishu");

            if (gameInfo.ContainsKey("status"))
            {
                RStatus = (RoomStatus)gameInfo.GetInt("status");
            }

            HupUp.FrashHupUpUser();

            IsCreatRoom = CreateRoomInfo != null;


            if (gameInfo.ContainsKey("readyCd"))
            {
                int readyCd = gameInfo.GetInt("readyCd");
                if (readyCd > 0)
                {
                    OnStartTime(readyCd);
                }
            }
        }
Exemplo n.º 18
0
 private void RefreshSelf(ISFSObject response)
 {
     if (response.ContainsKey("gold"))
     {
         App.GameData.GetPlayer().Coin = response.GetLong("gold");
     }
 }
Exemplo n.º 19
0
        public void ShowTableResultInfo(ISFSObject responseData)
        {
            ShowPanel();
            int myWin = 0;

            if (responseData.ContainsKey("win"))
            {
                myWin = responseData.GetInt("win");
                SetResultLabel(myWin, MyResult);
            }
            if (responseData.ContainsKey("bwin"))
            {
                var bankerWin = responseData.GetLong("bwin");
                SetResultLabel(bankerWin, BankerResult);
            }
            if (responseData.ContainsKey("bpg"))
            {
                var  wins     = responseData.GetIntArray("bpg");
                long usersWin = 0;
                foreach (var w in wins)
                {
                    usersWin += w;
                }
                SetResultLabel(-usersWin, PlayersResult);
            }
        }
Exemplo n.º 20
0
        //public void RefreshResultInfo(ISFSObject responseData)
        //{
        //    gameObject.SetActive(true);
        //    int win = responseData.GetInt("win");
        //    if (win < 0)
        //    {
        //        AudioPlay.Instance.PlaySounds("lose");
        //    }
        //    else
        //    {
        //        AudioPlay.Instance.PlaySounds("win");
        //    }
        //    var gdata = App.GetGameData<GlobalData>();
        //    gdata.CurrentUser.Gold = responseData.GetLong("total");
        //    gdata.CurrentUser.TodayWin = responseData.GetInt("todayWin");
        //    gdata.CurrentUser.Forbiden = responseData.ContainsKey("forbiden") && responseData.GetBool("forbiden");
        //    gdata.CurrentUser.Msg = responseData.ContainsKey("msg") ? responseData.GetUtfString("msg") : "--";
        //    int[] pg = responseData.GetIntArray("pg");

        //    var minCount = Mathf.Min(pg.Length, ResultLabel.Length);
        //    for (var i = 0; i < minCount; i++)
        //    {
        //        ResultLabel[i].text = pg[i] >= 0 ? "+ " + pg[i] : "" + pg[i];
        //    }
        //    SumLabel.text = win >= 0 ? "+ " + win : "" + win;

        //    Invoke("ShowWindow",5f);
        //}


        /// <summary>
        /// 刷新结算界面数据
        /// </summary>
        /// <param name="responseData"></param>
        public void RefreshResultInfo(ISFSObject responseData)
        {
            _selfWin.text = responseData.GetInt("win").ToString();
            _selfWin.MakePixelPerfect();
            _bankerWin.text = responseData.GetLong("bwin").ToString();
            _bankerWin.MakePixelPerfect();
        }
Exemplo n.º 21
0
        /// <summary>
        /// 重连显示解散房间投票
        /// </summary>
        /// <param name="gameInfo">重连信息</param>
        public void ShowDismissOnRejion(ISFSObject gameInfo)
        {
            int passTime = (int)(gameInfo.GetLong("hupnow") - gameInfo.GetLong("hupstart"));

            ShowRoomDismiss(passTime);

            if (gameInfo.ContainsKey("hup"))
            {
                string[] hupPlayers = gameInfo.GetUtfString("hup").Split(',');
                for (int i = 0; i < hupPlayers.Length; i++)
                {
                    int id = int.Parse(hupPlayers[i]);
                    UpdateDismissInfo(id, 3);
                }
            }
        }
Exemplo n.º 22
0
        internal void AddResult(ISFSObject response)
        {
            var  diceVals = response.GetIntArray("dices");
            bool bwin     = response.GetLong("bwin") > 0;

            AddResult(diceVals, bwin);
        }
Exemplo n.º 23
0
        private void OnCurrPlayer(object data)
        {
            AddBeat.Hide();
            foreach (JhPlayer jhPlayer in Players)
            {
                jhPlayer.ResetHeadClick();
            }


            ISFSObject sendObj      = (ISFSObject)data;
            int        chair        = sendObj.GetInt("Chair");
            double     cdTime       = sendObj.GetDouble("CdTime");
            int        singleBet    = sendObj.GetInt("SingleBet");
            long       playerGold   = sendObj.GetLong("PlayerGold");
            bool       isGzyz       = sendObj.ContainsKey("IsGzyz") && sendObj.GetBool("IsGzyz");
            bool       isAutoFollow = sendObj.ContainsKey("IsAutoFollow") && sendObj.GetBool("IsAutoFollow");

            AddBeat.SetBetShow(singleBet, playerGold);

            foreach (JhPlayer jhPlayer in Players)
            {
                jhPlayer.ResetTimer();
            }

            SetUserContrl(chair, sendObj);

            SetCurrChair(chair, cdTime, 0, !isGzyz && isAutoFollow);
        }
Exemplo n.º 24
0
 public void fromSFSObject(ISFSObject estimacion)
 {
     user = estimacion.GetUtfString("user");
     valorEstimacion = estimacion.GetFloat("valorEstimacion");
     descripcion = estimacion.GetUtfString("descripcion");
     id_UserStory = estimacion.GetLong("id_Story");
 }
Exemplo n.º 25
0
        private void DispatchRequest(ISFSObject requestObject)
        {
            IMessage message = new Message();

            if (requestObject.IsNull(CONTROLLER_ID))
            {
                throw new SFSCodecError("Request rejected: No Controller ID in request!");
            }
            if (requestObject.IsNull(ACTION_ID))
            {
                throw new SFSCodecError("Request rejected: No Action ID in request!");
            }
            message.Id      = Convert.ToInt32(requestObject.GetShort(ACTION_ID));
            message.Content = requestObject.GetSFSObject(PARAM_ID);
            message.IsUDP   = requestObject.ContainsKey(UDP_PACKET_ID);
            if (message.IsUDP)
            {
                message.PacketId = requestObject.GetLong(UDP_PACKET_ID);
            }
            int         @byte      = requestObject.GetByte(CONTROLLER_ID);
            IController controller = bitSwarm.GetController(@byte);

            if (controller == null)
            {
                throw new SFSError("Cannot handle server response. Unknown controller, id: " + @byte);
            }
            controller.HandleMessage(message);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 大结算周边信息处理
        /// </summary>
        /// <param name="data"></param>
        private void InfoAbout(ISFSObject data)
        {
            if (_roundInfo)
            {
                var now   = data.GetInt("round");
                var total = data.GetInt("maxRound");
                _roundInfo.text = string.Format("{0}/{1}", now, total);
            }
            if (_nowTime)
            {
                var      time    = data.GetLong("svt");
                DateTime nowTime = GetSvtTime(time);
                _nowTime.text = nowTime.ToString("yyyy-MM-dd hh:mm:ss");
            }
            if (_ruleInfo)
            {
                _ruleInfo.text = _gameInfo.GetUtfString("rule");
            }

            if (_roomerInfo)
            {
                _roomerInfo.text = _gameInfo.GetUtfString("roomName");
            }

            if (_roomId)
            {
                _roomId.text = _gameInfo.GetInt("rid").ToString();
            }
        }
Exemplo n.º 27
0
 public static long TryGetLong(this ISFSObject data, string key)
 {
     if (data.ContainsKey(key))
     {
         return(data.GetLong(key));
     }
     return(0);
 }
Exemplo n.º 28
0
        /// <summary>
        /// 初始化房间信息
        /// </summary>
        /// <param name="data">数据</param>
        void InitRoomInfo(ISFSObject data)
        {
            TimeLabel.text = "对战时间: " + ToRealTime(data.GetLong("svt"));

            RoomInfo roomInfo = App.GetGameManager <SssGameManager>().RoomInfo;

            GameInfoLabel.text = string.Format("房间号:{0} 十三水-{1}局-好友同玩", roomInfo.RoomID, roomInfo.MaxRound);
        }
Exemplo n.º 29
0
        protected void CheckReJion(ISFSObject requestData)
        {
            var st = requestData.GetLong("st");
            var ct = requestData.GetLong("ct");

            if (st != 0)
            {
                if (ct - st < 15)
                {
                    CardsCtrl.ReSetPonits();
                    App.GetGameData <BtwGameData>().BeginBet = true;
                    BetCtrl.ShowChip();
                }
                ShowNumCtrl.SetNum(requestData);
                WaitWin.Show();
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// 初始化房间信息
        /// </summary>
        /// <param name="data">数据</param>
        void InitRoomInfo(ISFSObject data)
        {
            TimeLabel.text = "对战时间: " + ToRealTime(data.GetLong("svt"));

            RoomInfo roomInfo = App.GetGameManager <SssjpGameManager>().RoomInfo;

            GameInfoLabel.text = string.Format("房间号:{0} {1}", roomInfo.RoomID, roomInfo.RuleInfo);
        }
Exemplo n.º 31
0
 public static long TryGetInLong(ISFSObject obj, string key)
 {
     if (key != null && obj.ContainsKey(key))
     {
         return(obj.GetLong(key));
     }
     return(UtilDef.DefInt);
 }
Exemplo n.º 32
0
 public void SetResponseData(ISFSObject sfsObject)
 {
     _response.ParseData(sfsObject);
     _pour            = sfsObject.GetInt("ante");
     GetPlayer().Coin = _userGold - (_pour * _ante * Line);
     GetPlayer().UpdateView();
     _userGold = sfsObject.GetLong("ttgold");
 }
Exemplo n.º 33
0
    private void HandleServerTime(ISFSObject dt)
    {
        if (!gotServerTime)
        {
            gotServerTime = true;
            Debug.Log("Got teh sync");
        }

        //Debug.Log("server time");
        long time = dt.GetLong("t");
        TimeManager.Instance.Synchronize(Convert.ToDouble(time));

        if (waitingForServerResponse)
        {
            startCountDownToGame();
        }
    }
Exemplo n.º 34
0
 public long GetLong(ISFSObject data, string key)
 {
     if (receiveEncrypted)
     {
         return provider.DecryptLong(data.GetByteArray(key));
     }
     else
     {
         return data.GetLong(key);
     }
 }
Exemplo n.º 35
0
 // Synchronize the time from server
 private void HandleServerTime(ISFSObject dt)
 {
     long time = dt.GetLong("t");
     TimeManager.Instance.Synchronize(Convert.ToDouble(time));
 }