public override void HandleSync(ISFSObject obj)
 {
     if(obj.ContainsKey("gate_state")){
         int newState = obj.GetInt("gate_state");
         open = (newState == 0) ? true : false;
     }
 }
Пример #2
0
 public void ReceiveMoveDirection(ISFSObject obj, bool clearBuffer = false)
 {
     if(obj.ContainsKey("char_mov")){
         if(clearBuffer){
             if(moveDirInterpolator != null){
                 moveDirInterpolator.ClearBuffer();
             }
         }
         ReceiveMoveDirection(CharPosEffComp.MoveDirFromSFSObject(obj));
     }
 }
Пример #3
0
 public void ReceiveResultant(ISFSObject obj, bool clearBuffer = false)
 {
     if(obj.ContainsKey("char_pos")){
         if(clearBuffer){
             if(resultantInterpolator != null){
                 resultantInterpolator.ClearBuffer();
             }
         }
         ReceiveResultant(CharPosEffComp.ResultantFromSFSObject(obj));
     }
 }
Пример #4
0
 public void GetGameInfoOnCheck(ISFSObject data)
 {
     if (data.ContainsKey(Parameter.Dices))
     {
         DicesNums = data.GetIntArray(Parameter.Dices);
     }
     var count = DicesNums.Length;
     for (int i = 0; i < count; i++)
     {
         DicePoint += DicesNums[i];
     }
 }
Пример #5
0
 /// <summary>
 /// 显示结果面板
 /// </summary>
 /// <param name="param"></param>
 internal void ShowResultPanel(ISFSObject param, List <KeyValuePair <int, int> > fenZhangData, bool isRunOut = false)
 {
     _showParent.TrySetComponentValue(true);
     FreshBtn();
     _isRunOut   = isRunOut;
     _isBaoExist = param.ContainsKey(RequestKey.KeyChongBao);
     YxDebug.LogError(string.Format("冲宝标识是:{0}", _isBaoExist));
     _isQingfengExist = Data.BootEnv.ContainsKey(ConstantData.RuleQingFeng);
     Init(param, fenZhangData);
     GameTable.GameTable.Instance.Reset();
     Manager.ResetReadyState();
 }
Пример #6
0
        public List <UserMatchInfo> GetCardsInfoList(ISFSObject info)
        {
            var handCardInfoList = new List <UserMatchInfo>();

            if (info.ContainsKey("playerinfo"))
            {
                ISFSArray infoArray = info.GetSFSArray("playerinfo");
                handCardInfoList.AddRange(from ISFSObject item in infoArray select GetCardsInfo(item));
            }

            return(handCardInfoList);
        }
Пример #7
0
        /// <summary>
        /// 是否包含这些key
        /// </summary>
        /// <param name="keys"></param>
        /// <param name="isfObjData"></param>
        /// <returns></returns>
        public static bool IsServDataContainAllKey(string[] keys, ISFSObject isfObjData)
        {
            for (int i = 0; i < keys.Length; i++)
            {
                if (!isfObjData.ContainsKey(keys[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #8
0
 public static void TryGetValueWitheKey(ISFSObject data, out ISFSObject value, string key)
 {
     if (data.ContainsKey(key))
     {
         value = data.GetSFSObject(key);
     }
     else
     {
         value = new SFSObject();
         TryGetLog(key);
     }
 }
Пример #9
0
 public static void TryGetValueWitheKey(ISFSObject data, out bool value, string key)
 {
     if (data.ContainsKey(key))
     {
         value = data.GetBool(key);
     }
     else
     {
         value = false;
         TryGetLog(key);
     }
 }
Пример #10
0
        public override void InitRoom(ISFSObject gameInfo)
        {
            base.InitRoom(gameInfo);
            if (gameInfo.ContainsKey("isRub"))
            {
                IsRub = gameInfo.GetBool("isRub");
            }

            //获取房间配置
            if (gameInfo.ContainsKey("rid"))
            {
                bool played = gameInfo.GetBool("playing");
                Debug.LogError(played);
                WeiChatInvite.SetWeiChatBtnActive(!played);
            }

            if (RuleViewMgr != null)
            {
                RuleViewMgr.SetRuleViewInfo(gameInfo);
            }
        }
Пример #11
0
 public static void TryGetValueWitheKey(ISFSObject data, out long value, string key)
 {
     if (data.ContainsKey(key))
     {
         value = data.GetLong(key);
     }
     else
     {
         value = 0;
         TryGetLog(key);
     }
 }
Пример #12
0
 public void DecryptParameters(ISFSObject parameters)
 {
     if (parameters.ContainsKey(ENCRYPTED_PARAMETER))
     {
         string utfString  = parameters.GetUtfString(ENCRYPTED_PARAMETER);
         string utfString2 = parameters.GetUtfString(utfString);
         byte[] bytes      = Convert.FromBase64String(utfString2);
         byte[] bytes2     = Decrypt(bytes);
         string @string    = Encoding.UTF8.GetString(bytes2);
         parameters.PutUtfString(utfString, @string);
     }
 }
Пример #13
0
        /// <summary>
        /// 如果有人出牌
        /// </summary>
        /// <param name="args"></param>
        protected override void OnTypeOutCard(DdzbaseEventArgs args)
        {
            //_mayoutCdsTemp = null;
            //与ResetHdCds,AddHdCds,RemoveHdCds相关
            base.OnTypeOutCard(args);

            _lastOutData = args.IsfObjData;
            _isMyTurn    = CheckMyTurn(_lastOutData);

            //自己出牌,移除手中的牌
            if (_lastOutData.ContainsKey(RequestKey.KeySeat) &&
                _lastOutData.GetInt(RequestKey.KeySeat) == App.GameData.SelfSeat)
            {
                if (_lastOutData.ContainsKey(RequestKey.KeyCards))
                {
                    var cards = _lastOutData.GetIntArray(RequestKey.KeyCards);
                    if (cards != null && cards.Length > 0)
                    {
                        HdCdctrlInstance.RemoveHdCds(cards);
                    }
                }
                RepositionAllHdCds();
            }

            if (_isMyTurn)
            {
                GetPromptCardsGroup(_lastOutData);
                if (AutoState)
                {
                    AutoFollow();
                }
                else
                {
                    OnOthersOutCds();
                }
                return;
            }

            HideAllBtns();
        }
Пример #14
0
        /// <summary>
        /// 设置玩家GPS信息
        /// </summary>
        /// <param name="data"></param>
        public void CheckGpsInfo(ISFSObject data)
        {
            int userId = data.GetInt("uid");
            var users  = App.GetGameData <PaiJiuGameData>().PlayerList;

            for (int i = 0, max = users.Length; i < max; i++)
            {
                PaiJiuPlayer paiJiuPlayer = (PaiJiuPlayer)users[i];
                if (paiJiuPlayer == null)
                {
                    continue;
                }
                if (paiJiuPlayer.Info != null && paiJiuPlayer.Info.Id == userId && paiJiuPlayer.gameObject.activeInHierarchy)
                {
                    if ((data.ContainsKey("gpsx") && data.ContainsKey("gpsy")) || (data.ContainsKey("x") && data.ContainsKey("y")))
                    {
                        paiJiuPlayer.GpsX       = data.ContainsKey("gpsx") ? data.GetFloat("gpsx") : data.GetFloat("x");
                        paiJiuPlayer.GpsY       = data.ContainsKey("gpsy") ? data.GetFloat("gpsy") : data.GetFloat("y");
                        paiJiuPlayer.HasGpsInfo = true;

                        if (data.ContainsKey("country") && paiJiuPlayer.Info != null)
                        {
                            paiJiuPlayer.Info.Country = data.GetUtfString("country");
                        }
                    }
                    else
                    {
                        paiJiuPlayer.GpsX       = -1f;
                        paiJiuPlayer.GpsY       = -1f;
                        paiJiuPlayer.HasGpsInfo = false;
                    }
                }
            }
        }
Пример #15
0
        public void InitGameInfo(ISFSObject gameInfo)
        {
            var gdata = App.GetGameData <DuifenGlobalData>();

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

            if (gameInfo.ContainsKey("playing"))
            {
                gdata.IsGameing = gameInfo.GetBool("playing");
            }

            if (gameInfo.ContainsKey("cargs2"))
            {
                BetMgr.PanDuan(gameInfo);
            }

            if (gameInfo.ContainsKey("minbet"))
            {
                SpeakMgr.MinBetValue = gameInfo.GetInt("minbet");
            }

            if (gameInfo.ContainsKey("ownerId"))
            {
                gdata.OwnerId = gameInfo.GetInt("ownerId");
            }
        }
Пример #16
0
 public void OnOperate_Namj(ISFSObject data)
 {
     if (ParseOperate(data))
     {
         if (data.ContainsKey("qiduitings"))
         {
             var list = DataCenter.OneselfData.TingList;
             DataCenter.OneselfData.SetTinglist(data.GetIntArray("qiduitings"));
             GameCenter.Shortcuts.MahjongQuery.Do(p => p.ShowQueryTip(list));
         }
         Dispatch();
     }
 }
Пример #17
0
        /// <summary>
        /// 设置当前玩家
        /// </summary>
        /// <param name="data"></param>
        public void SetCurPlayer(ISFSObject data)
        {
            var curOpSeat = ConstantData.IntDefValue;

            SfsHelper.Parse(data, ConstantData.KeyCurrentPlayer, ref curOpSeat);
            CurOpUser = GetPlayer <PludoGamePlayer>(curOpSeat, true);
            if (data.ContainsKey(ConstantData.KeyControlDiceTime))
            {
                var canuseTime = ConstantData.IntDefValue;
                SfsHelper.Parse(data, ConstantData.KeyControlDiceTime, ref canuseTime);
                CurUserInfo.SetControlDiceTime(canuseTime);
            }
        }
Пример #18
0
        private void InitOthers(ISFSObject gameInfo, ref int maxPoint)
        {
            if (!gameInfo.ContainsKey("users"))
            {
                return;
            }
            ISFSArray users = gameInfo.GetSFSArray("users");

            foreach (ISFSObject user in users)
            {
                InitOne(user, ref maxPoint);
            }
        }
Пример #19
0
        /// <summary>
        /// 检查是否显示加倍icon
        /// </summary>
        /// <param name="data">重连时获得的消息数据</param>
        private void CheckShowJiabeiIcon(ISFSObject data)
        {
            if (UserDataTemp == null)
            {
                return;
            }

            var thisUserSeat = UserDataTemp.GetInt(RequestKey.KeySeat);

            //先查是不是自己
            if (data.ContainsKey(RequestKey.KeyUser))
            {
                var user = data.GetSFSObject(RequestKey.KeyUser);
                if (user.GetInt(RequestKey.KeySeat) == thisUserSeat && user.GetInt(NewRequestKey.KeyRate) > 1)
                {
                    ShowJiaBeiSp.SetActive(true);
                    return;
                }
            }

            //检查显示加倍图标
            if (data.ContainsKey(RequestKey.KeyUserList))
            {
                var users = data.GetSFSArray(RequestKey.KeyUserList);
                var len   = users.Count;
                for (int i = 0; i < len; i++)
                {
                    var user = users.GetSFSObject(i);
                    if (user.GetInt(RequestKey.KeySeat) != thisUserSeat)
                    {
                        continue;
                    }
                    if (user.GetInt(NewRequestKey.KeyRate) > 1)
                    {
                        ShowJiaBeiSp.SetActive(true);
                    }
                }
            }
        }
Пример #20
0
 public static void TryGetValueWitheKey(ISFSObject data, out int[] value, string key)
 {
     if (data.ContainsKey(key))
     {
         int[] arr = data.GetIntArray(key);
         value = (int[])arr.Clone();
     }
     else
     {
         value = new int[0];
         TryGetLog(key);
     }
 }
Пример #21
0
 public override void Parse(ISFSObject userData)
 {
     base.Parse(userData);
     Cards         = userData.ContainsKey("cards") ? userData.GetIntArray("cards") : null;
     FoldNum       = userData.ContainsKey("foldNum") ? userData.GetInt("foldNum") : -1;
     CardLen       = userData.ContainsKey("cardLen") ? userData.GetInt("cardLen") : -1;
     FoldCards     = userData.ContainsKey("foldCards") ? userData.GetIntArray("foldCards") : null;
     ActiveCards   = userData.ContainsKey("activeCards") ? userData.GetIntArray("activeCards") : null;
     IsTrusteeship = userData.ContainsKey("trusteeship") && userData.GetBool("trusteeship");//
     FoldScore     = userData.ContainsKey("foldScore") ? userData.GetInt("foldScore") : -1;
 }
Пример #22
0
 /// <summary>
 /// 跟庄
 /// </summary>
 /// <param name="data"></param>
 private void OnGenzhuang(ISFSObject data)
 {
     if (data.ContainsKey("genZhuang"))
     {
         var gold      = data.GetIntArray("genZhuang");
         var chairGold = new int[gold.Length];
         for (int i = 0; i < gold.Length; i++)
         {
             var chair = MahjongUtility.GetChair(i);
             chairGold[chair] = gold[i];
         }
     }
 }
Пример #23
0
        public virtual void ParseData(ISFSObject data)
        {
            if (data.ContainsKey(RequestKeyOther.KeyTType))
            {
                _type = data.GetInt(RequestKeyOther.KeyTType);
            }
            else if (data.ContainsKey(RequestKey.KeyType))
            {
                _type = data.GetInt(RequestKey.KeyType);
            }

            if (data.ContainsKey(RequestKey.KeyOpCard))
            {
                Card = data.GetInt(RequestKey.KeyOpCard);
            }
            else if (data.ContainsKey(RequestKey.KeyCard))
            {
                Card = data.GetInt(RequestKey.KeyCard);
            }

            if (data.ContainsKey("from"))
            {
                _fromSeat = data.GetInt("from");
            }

            if (data.ContainsKey("dan"))
            {
                _dan = true;
            }

            if (data.ContainsKey(RequestKey.KeySeat))
            {
                _seat = data.GetInt(RequestKey.KeySeat);
            }

            if (data.ContainsKey(RequestKey.KeyCards))
            {
                int[] values = data.GetIntArray(RequestKey.KeyCards);
                foreach (int value in values)
                {
                    CardDatas.Add(value);
                }
                UtilFunc.OutPutList(CardDatas, "吃碰杠 " + _type);
            }

            SetCard();
            SetCardDatas();
            SetAllCardDatas();
        }
Пример #24
0
        private LocomotionActionEvent locomotionActionEventFromProps(int playerId, ISFSObject props)
        {
            LocomotionActionEvent result = default(LocomotionActionEvent);

            result.SessionId = getSessionId(playerId);
            result.Type      = (LocomotionAction)props.GetByte("a");
            result.Position  = SmartFoxGameServerClientShared.deserializeVec3(props, "p");
            result.Timestamp = props.GetLong("t");
            if (props.ContainsKey("d"))
            {
                result.Direction = SmartFoxGameServerClientShared.deserializeVec3(props, "d");
            }
            if (props.ContainsKey("v"))
            {
                result.Velocity = SmartFoxGameServerClientShared.deserializeVec3(props, "v");
            }
            if (props.ContainsKey("o"))
            {
                result.Object = mt.JsonService.Deserialize <ActionedObject>(props.GetUtfString("o"));
            }
            return(result);
        }
Пример #25
0
 private void Result(ISFSObject responseData)
 {
     if (TheTalk == null)
     {
         return;
     }
     foreach (ISFSObject i in responseData.GetSFSArray("winplayers"))
     {
         var str = "[FFFFFF]" + i.GetUtfString("nick") + "[FFFFFF]赢了" + i.GetInt("win") + "[FFFFFF]金币。";
         TheTalk.AddTalkText(str, "全体成员");
     }
     if (responseData.ContainsKey("coupon") && responseData.GetInt("coupon") > 0)
     {
         var str = "[FFFFFF]恭喜您上局获得了[CCCC00]" + responseData.GetInt("coupon") + "[FF0000]奖券";
         TheTalk.AddTalkText(str, "全体成员");
     }
     if (responseData.ContainsKey("yqt") && responseData.GetInt("yqt") > 0)
     {
         var str = "[FFFFFF]恭喜您上局获得了[CCCC00]" + responseData.GetInt("yqt") + "[FF0000]银券通";
         TheTalk.AddTalkText(str, "全体成员");
     }
 }
Пример #26
0
 public override void OnGetGameInfo(ISFSObject requestData)
 {
     ShowNumCtrl.Init();
     UserListCtrl.RefreshBanker(requestData);
     CheckReJion(requestData);
     ProgressCtrl.SetNum(requestData);
     RefreshUserInfo();
     BetCtrl.InitChips();
     if (requestData.ContainsKey("bround"))
     {
         App.GetGameData <BtwGameData>().BankerPlayer.SetBankerTime(requestData.GetInt("bround"));
     }
 }
Пример #27
0
        public void PanDuan(ISFSObject data)
        {
            ISFSObject responseData = null;

            if (data.ContainsKey("cargs2"))
            {
                responseData = data.GetSFSObject("cargs2");
            }

            if (responseData == null)
            {
                return;
            }

            //如果包含此字段,则是由后台设置筹码的面值和个数,数据格式为: 1#2#3#4#...
            if (responseData.ContainsKey("-anteRate"))
            {
                bool   couldSet = true;
                string str      = responseData.GetUtfString("-anteRate");


                //处理筹码的面值
                string[] tempStr = str.Split('#');

                int[] array = new int[tempStr.Length > AddBetBtns.Length ? AddBetBtns.Length : tempStr.Length];

                for (int i = 0; i < array.Length; i++)
                {
                    if (!Int32.TryParse(tempStr[i], out array[i]))
                    {
                        com.yxixia.utile.YxDebug.YxDebug.LogError(
                            "=== There is some string count not be changed to int!! === ");
                        couldSet = false;
                        break;
                    }
                }

                if (couldSet)
                {
                    SetAddBtns(array);
                }
                else
                {
                    SetDefaultAddBtn();
                }
            }
            else
            {
                SetDefaultAddBtn();
            }
        }
Пример #28
0
 /// <summary>
 /// 设置游戏数据
 /// </summary>
 public void GetAllDatas(ISFSObject data)
 {
     //设置游戏数据
     mDataMap.ExIterationAction((item) => { item.Value.SetData(data); });
     //第一次庄家位子
     if (data.ContainsKey("bank0"))
     {
         FristBankerSeat = data.GetInt("bank0");
     }
     //重连
     IsReconect = data.TryGetBool(ProtocolKey.KeyRejoin);
     if (IsReconect)
     {
         CpgData cpg;
         int     outCard = 0;
         //根据用户的麻将 算出剩余的麻将个数
         MahjongUserInfo userInfo;
         for (int i = 0; i < Players.CurrPlayerCount; i++)
         {
             userInfo = Players[i];
             if (!userInfo.ExIsNullOjbect())
             {
                 outCard += userInfo.UserHardCardNum;
                 outCard += userInfo.OutCards.Count;
                 for (int j = 0; j < userInfo.CpgDatas.Count; j++)
                 {
                     cpg      = userInfo.CpgDatas[j];
                     outCard += cpg.MahjongCount;
                 }
                 GameCenter.DataCenter.LeaveMahjongCnt = GameCenter.DataCenter.Room.MahjongCount - outCard;
             }
         }
         int seq  = data.GetInt(ProtocolKey.KeySeq);
         int seq2 = data.GetInt(ProtocolKey.KeySeq2);
         if (seq != seq2)//不相等 当前用户在抓牌
         {
             OldOpSeat = (CurrOpSeat + MaxPlayerCount - 1) % MaxPlayerCount;
             List <int> currOutCard = Players[OldOpChair].OutCards;
             if (currOutCard.Count > 0 && currOutCard[currOutCard.Count - 1] != ThrowoutCard)
             {
                 OldOpSeat = MiscUtility.DefValue;
             }
             ReconectCardState = 0;
         }
         else//相等的时候 用户已经打牌 等待别人响应
         {
             OldOpSeat         = CurrOpSeat;
             ReconectCardState = 1;
         }
     }
 }
Пример #29
0
        public void InitChips(ISFSObject data)
        {
            int ante;
            var responseData = data;

            if (data.ContainsKey("cargs2"))
            {
                responseData = data.GetSFSObject("cargs2");
            }

            if (responseData == null)
            {
                return;
            }


            if (!Int32.TryParse(responseData.GetUtfString("-ante"), out ante) || ante <= 0)
            {
                com.yxixia.utile.YxDebug.YxDebug.LogError("=== Ante is wrong!! ===");
                ante = 1;
            }

            App.GetGameData <PaiJiuGameData>().Ante = ante;

            //如果包含此字段,则是由后台设置筹码的面值和个数,数据格式为: 1#2#3#4#...
            if (responseData.ContainsKey("-anteRate") && ante > 0)
            {
                bool   couldSet = true;
                string str      = responseData.GetUtfString("-anteRate");

                //处理筹码的面值
                string[] tempStr = str.Split('#');

                int[] array = new int[tempStr.Length > AddBetBtns.Length ? AddBetBtns.Length : tempStr.Length];

                for (int i = 0; i < array.Length; i++)
                {
                    if (!Int32.TryParse(tempStr[i], out array[i]))
                    {
                        com.yxixia.utile.YxDebug.YxDebug.LogError("=== There is some string count not be changed to int!! === ");
                        couldSet = false;
                        break;
                    }
                }

                if (couldSet)
                {
                    SetAddBtns(array);
                }
            }
        }
Пример #30
0
 private bool ParseOperate(ISFSObject data)
 {
     mOpMenuCache.Clear();
     if (data.ContainsKey(RequestKey.KeySeat))
     {
         int seat = data.GetInt(RequestKey.KeySeat);
         //不是自己的op
         if (DataCenter.OneselfData.Seat != seat)
         {
             return(false);
         }
     }
     if (data.ContainsKey(ProtocolKey.KeyOp))
     {
         int opMenu = data.GetInt(ProtocolKey.KeyOp);
         DataCenter.OperateMenu = opMenu;
         if (opMenu != 0)
         {
             //解析按钮列表菜單
             for (int i = 0; i < mOpMenu.Length; i++)
             {
                 if (GameUtils.BinaryCheck(mOpMenu[i], opMenu))
                 {
                     mOpMenuCache.Add(new KeyValuePair <int, bool>(mOpMenu[i], true));
                 }
             }
         }
     }
     else
     {
         DataCenter.OperateMenu = 0;
     }
     //上听自动打牌
     AutoThrowout();
     //听牌
     OnTingCard(data);
     return(true);
 }
Пример #31
0
        /// <summary>
        /// 初始化房间信息
        /// </summary>
        public virtual void InitRoom(ISFSObject gameInfo)
        {
            var gdata = App.GetGameData <FillpitGameData>();

            gdata.IsDoubleGame = gameInfo.ContainsKey("dr") && gameInfo.GetBool("dr");
            gdata.IsLanDi      = gameInfo.ContainsKey("lastlandi") && gameInfo.GetBool("lastlandi");

            //获取房间配置
            if (gameInfo.ContainsKey("rid"))
            {
                gdata.IsRoomGame = true;
                bool played = gameInfo.GetInt("round") > 0;
                gdata.IsPlayed   = played;
                gdata.RoomPlayed = gameInfo.ContainsKey("roomPlayed") && gameInfo.GetBool("roomPlayed");
                WeiChatInvite.SetWeiChatBtnActive(!played);
                RoomInfo.ShowRoomInfo(gameInfo);
            }

            //获取低注值
            if (gameInfo.ContainsKey("ante"))
            {
                gdata.BaseAnte = gameInfo.GetInt("ante");

                gdata.MaxPoolNum = gameInfo.GetInt("betLimit");
                if (gameInfo.GetBool("playing"))
                {
                    gdata.IsGameing = gameInfo.GetBool("playing");

                    //当前谁说话
                    if (gameInfo.ContainsKey("current"))
                    {
                        gdata.CurAnte = gameInfo.GetInt("current");
                        App.GetGameManager <FillpitGameManager>().Speaker(gameInfo.GetInt("current"));
                    }
                }
            }

            if (gameInfo.ContainsKey("cargs2"))
            {
                ISFSObject carg = gameInfo.GetSFSObject("cargs2");
                if (carg.ContainsKey("-hideN"))
                {
                    DealerMgr.HideN = int.Parse(carg.GetUtfString("-hideN"));
                }
                if (carg.ContainsKey("-turnresult"))
                {
                    SummaryMgr.ShowTurnResult = !carg.GetUtfString("-turnresult").Equals("0");
                }
            }

            BetMgr.SetAddBtns();
            MenuMgr.OnInitRoom(gameInfo);
        }
Пример #32
0
        public void AnalysisData(ISFSObject requestData)
        {
            ShowParent.SetActive(true);
            RoomNum.text = App.GetGameData <TtzGameData>().RoomType.ToString(CultureInfo.InvariantCulture);
            var currentRound = requestData.ContainsKey("round") ? requestData.GetInt("round") : 0;
            var maxRound     = requestData.ContainsKey("maxRound") ? requestData.GetInt("maxRound") : 0;

            CurrentRound.text = string.Format("{0}/{1}局", currentRound, maxRound);
            CurrentTime.text  = DateTime.Now.ToString("yyyy-MM-dd  HH:mm");
            var users = requestData.ContainsKey("users") ? requestData.GetSFSArray("users") : null;

            if (users == null)
            {
                return;
            }
            for (var i = 0; i < users.Count; i++)
            {
                var user = users.GetSFSObject(i);
                var nick = user.ContainsKey("nick") ? user.GetUtfString("nick") : null;
                if (nick == null)
                {
                    continue;
                }
                var gold = user.ContainsKey("gold") ? user.GetInt("gold") : 0;
                var id   = user.ContainsKey("id") ? user.GetInt("id") : 0;
                var obj  = YxWindowUtils.CreateItem(GameOverItem, GameOverGrid.transform);
                obj.GetComponent <GameOverItem>().InitData(nick, gold);
                if (_maxGold >= gold)
                {
                    continue;
                }
                _maxGold = gold;
                _maxUser = i;
            }
            GameOverGrid.transform.GetChild(_maxUser).GetComponent <GameOverItem>().BigWinner.SetActive(true);
            GameOverGrid.Reposition();
            GameOverGrid.repositionNow = true;
        }
 public override void HandleSync(ISFSObject obj)
 {
     if(obj.ContainsKey("trigger_state")){
         int newState = obj.GetInt("trigger_state");
         switch(newState){
         case 0:
             state = TriggerState.LEFT;
             break;
         case 1:
             state = TriggerState.MIDDLE;
             break;
         case 2:
             state = TriggerState.RIGHT;
             break;
         }
     }
 }
    public void ReceiveStatus(ISFSObject sObj)
    {
        if(!sObj.ContainsKey(NetSyncObjCharacter.statusDS)){
            Debug.LogError("no status init");
            return;
        }

        ISFSObject statusObj = sObj.GetSFSObject(NetSyncObjCharacter.statusDS);

        if(statusObj.ContainsKey("currentHP")){
            component.HP = statusObj.GetFloat("currentHP");
            Debug.Log ("Receiving HP Change : " + component.HP);
        }

        if(statusObj.ContainsKey("team")){
            component.Team = statusObj.GetInt("team");
            Debug.Log ("Team Change: " + component.Team);
        }
    }
Пример #35
0
 public override bool FromSFSObject(ISFSObject data)
 {
     bool retVal = false;
     try
     {
         if (data.ContainsKey("id"))
         {
             id = GetLong(data, "id");
         }
         else
         {
             throw new Exception("SFSObject did not contain character id");
         }
         name = GetString(data, "name");
         level = GetInt(data, "level");
         retVal = true;
     }
     catch (Exception e)
     {
         Debug.Log(e);
     }
     return retVal;
 }
Пример #36
0
 public bool TryGetDouble(ISFSObject data, string key, out double value)
 {
     if (data.ContainsKey(key))
     {
         value = GetDouble(data, key);
         return true;
     }
     value = 0d;
     return false;
 }
Пример #37
0
 public bool TryGetBool(ISFSObject data, string key, out bool value)
 {
     if (data.ContainsKey(key))
     {
         value = GetBool(data, key);
         return true;
     }
     value = false;
     return false;
 }
Пример #38
0
 public bool TryGetString(ISFSObject data, string key, out string value)
 {
     if (data.ContainsKey(key))
     {
         value = GetString(data, key);
         return true;
     }
     value = "";
     return false;
 }
Пример #39
0
 public bool TryGetInt(ISFSObject data, string key, out int value)
 {
     if (data.ContainsKey(key))
     {
         value = GetInt(data, key);
         return true;
     }
     value = 0;
     return false;
 }
Пример #40
-1
        /// <summary>
        /// 初始化用户信息
        /// </summary>
        /// <param name="gameInfo"></param>
        public void InitUser(ISFSObject gameInfo)
        {
            if (gameInfo.ContainsKey("user"))
            {
                var data = gameInfo.GetSFSObject("user");
                InitUserGameState(data);
                bool selfReadyState = data.ContainsKey("state") && data.GetBool("state");
                SettingMenu.OnSelfReady(selfReadyState);
            }

            //初始化其他玩家信息
            if (gameInfo.ContainsKey("users"))
            {
                //初始化每个玩家的信息
                ISFSArray users = gameInfo.GetSFSArray(RequestKey.KeyUserList);
                foreach (ISFSObject user in users)
                {
                    InitUserGameState(user);
                }

                ResultMgr.DoResult();
            }
            var gdata = App.GetGameData <SssGameData>();

            //初始化庄家标识
            if (gameInfo.ContainsKey("banker"))
            {
                int bankerSeat = gameInfo.GetInt("banker");
                gdata.BankerSeat    = bankerSeat;
                gdata.IsBankerModel = true;
                gdata.GetPlayer <SssPlayer>(bankerSeat, true).SetBankerMarkActive();
            }

            if (gdata.ShowAutoReadyTime)
            {
                int lastTime = GetRemainingTime(gdata.ReadyTime, gameInfo);
                gdata.GetPlayer <SelfPanel>().CountDownReadyTime(lastTime);
            }
        }