示例#1
0
 public void SetRoomInfo(RoomInfo info)
 {
     RoomType = info.RoomType;
     if (info.RoomType == EnRoomType.YuLe)
     {
         SetSharBtnActive(false);
     }
 }
示例#2
0
        public void ParseData(ISFSObject data)
        {
            if (data.ContainsKey(RequestKeyOther.KeyRoomID))
            {
                RoomID = data.GetInt(RequestKeyOther.KeyRoomID);
            }
            if (data.ContainsKey(RequestKeyOther.KeyRoomOnlyId))
            {
                RoomIdOnly = data.GetLong(RequestKeyOther.KeyRoomID);
            }
            else
            {
                RoomIdOnly = RoomID;
            }
            if (data.ContainsKey("maxRound"))
            {
                MaxRound = data.GetInt("maxRound");
            }

            if (data.ContainsKey(RequestKeyOther.KeyQuan))
            {
                CurrRound   = data.GetInt(RequestKeyOther.KeyQuan) + 1;
                IsQuanExist = true;
                QuanNum     = data.GetInt(RequestKeyOther.KeyQuan) + 1;
            }
            else if (data.ContainsKey(RequestKeyOther.KeyRound))
            {
                if (data.ContainsKey(RequestKeyOther.KeySeq))
                {
                    CurrRound = data.GetInt(RequestKeyOther.KeyRound);
                }
                else
                {
                    CurrRound = data.GetInt(RequestKeyOther.KeyRound) + 1;
                }
            }

            string strCarge = data.GetUtfString(RequestKeyOther.KeyCargs);

            Cargs = strCarge;
            string[] strkey = keys.Split(',');
            value = new int[strkey.Length];
            for (int i = 0; i < strkey.Length; i++)
            {
                string str            = strkey[i];
                int    findStartIndex = strCarge.IndexOf(str);
                if (findStartIndex < 0)
                {
                    continue;
                }

                int    startIndex = findStartIndex + str.Length + 1;
                int    endIndex   = strCarge.IndexOf(",", startIndex);
                string strVal     = strCarge.Substring(startIndex, endIndex - startIndex);
                value[i] = int.Parse(strVal);
            }

            if (data.ContainsKey("pcards"))
            {
                string cardsStr = data.GetUtfString("pcards");
                char[] cards    = cardsStr.ToArray();
                SysCards = new List <int>();
                for (int i = 0; i < cards.Length / 2; i++)
                {
                    string card      = new string(new[] { cards[i * 2], cards[i * 2 + 1] });
                    int    cardValue = Convert.ToInt32(card, 16);
                    SysCards.Add(cardValue);
                }

                SysCards.Sort((a, b) =>
                {
                    if (a > b)
                    {
                        return(1);
                    }
                    if (a < b)
                    {
                        return(-1);
                    }
                    return(0);
                });
            }

            if (data.ContainsKey("quan"))
            {
                GameLoopType = EnGameLoopType.circle;
            }
            else
            {
                GameLoopType = EnGameLoopType.round;
            }

            if (data.ContainsKey("rule"))
            {
                _rule = data.GetUtfString("rule");
            }

            if (data.ContainsKey("gtype"))
            {
                var type = data.GetInt("gtype");
                if (type >= 0)
                {
                    RoomType = EnRoomType.YuLe;
                }
                else
                {
                    RoomType = EnRoomType.FanKa;
                }
            }

            //金币赔率
            if (data.ContainsKey("showGoldRate"))
            {
                UtilData.ShowGoldRate = data.GetInt("showGoldRate");
            }

            //设置血战麻将出牌时间, 换三张时间, 断门时间
            if (OutCardTime != 0)
            {
                GameConfig.OutCardTime = OutCardTime;
            }
            if (HuanTime != 0)
            {
                GameConfig.HuanTime = HuanTime;
            }
            if (DuanTime != 0)
            {
                GameConfig.DuanTime = DuanTime;
            }

            if (AutoReady == 1)
            {
                UtilData.IsAutoPrepare = true;
            }

            if (data.ContainsKey("cargs2"))
            {
                ISFSObject sfs = data.GetSFSObject("cargs2");
                Huanshen = sfs.ContainsKey("-huanshen");
            }

            if (data.ContainsKey("consumeNum"))
            {
                ConsumeNum = data.GetInt("consumeNum");
            }

            if (data.ContainsKey("consumeType  "))
            {
                ConsumeType = data.GetUtfString("consumeType");
            }
        }