示例#1
0
 public static bool CompareRoomInfo(RoomInfos playerinfo,RoomInfos otherroom)
 {
     if (playerinfo.rule == otherroom.rule && playerinfo.banListType == otherroom.banListType
         && playerinfo.mode == otherroom.mode && playerinfo.isNoCheckDeck == otherroom.isNoCheckDeck
         && playerinfo.isNoShuffleDeck == otherroom.isNoShuffleDeck && playerinfo.enablePriority == otherroom.enablePriority
         && playerinfo.startLp == otherroom.startLp && playerinfo.timer == otherroom.timer && otherroom.hasStarted == false && otherroom.isLocked == false)
     {
         string[] players = otherroom.playerList;
         if (GameMode(otherroom.mode) == "Tag")
         {
             if (players.Length < 4)
                 return true;
             else
                 return false;
         }
         else
         {
             if (players.Length < 2)
                 return true;
             else
                 return false;
         }
     }
     else
     {
         return false;
     }
 }
示例#2
0
        public static RoomInfos FromName(string roomname, bool started)
        {
            RoomInfos infos = new RoomInfos();

            // if (roomname.Length < 15) return null;

            string rules = roomname.Substring(0, 7);

            if (!int.TryParse(rules[0].ToString(), out infos.rule))
                return null;
            if (!int.TryParse(rules[1].ToString(), out infos.mode))
                return null;
            if (!int.TryParse(rules[2].ToString(), out infos.banListType))
                return null;
            if (!int.TryParse(rules[3].ToString(), out infos.timer))
                return null;
            infos.enablePriority = rules[4] == 'T' || rules[4] == '1';
            infos.isNoCheckDeck = rules[5] == 'T' || rules[5] == '1';
            infos.isNoShuffleDeck = rules[6] == 'T' || rules[6] == '1';

            string data = roomname.Substring(7, roomname.Length - 7);

            if (!data.Contains(",")) return null;

            string[] list = data.Split(',');

            if (!int.TryParse(list[0], out infos.startLp))
                return null;
            infos.startHand = 5;
            infos.drawCount = 1;

            if (list[1] == "RL" || list[1] == "UL")
                infos.isLocked = true;

            if (list[1] == "R" || list[1] == "RL")
                infos.isRanked = true;
            else
                infos.isRanked = false;

            infos.roomName = list[2];

            //infos.Players = players;
            infos.hasStarted = started;

            return infos;
        }