示例#1
0
        public Room(int index, Mahjong.ShuffleType shuffleType, MahjongRoomType roomType)
        {
            __index = index;

            __type = shuffleType;

            __mahjong = new Mahjong();
            switch (roomType)
            {
            case MahjongRoomType.Normal:
                __mahjong.rule = new Rule();
                break;

            case MahjongRoomType.Hand258:
                __mahjong.rule = new Rule258();
                break;
            }
        }
示例#2
0
    public void CreateRoom(Mahjong.ShuffleType shuffleType, MahjongRoomType roomType)
    {
        if (__client == null)
        {
            return;
        }

        if (__client.isConnected)
        {
            __client.RegisterHandler((short)MahjongNetworkMessageType.Room, __OnRoom);
            __client.Send((short)MahjongNetworkMessageType.Create, new MahjongRoomMessage(shuffleType, roomType));

            __roomMessage = null;
        }
        else if (__nameMessage == null && __roomMessage == null)
        {
            __roomMessage = new MahjongRoomMessage(shuffleType, roomType);

            Create();
        }
    }
示例#3
0
    public int CreateRoom(string name, Mahjong.ShuffleType shuffleType, MahjongRoomType roomType)
    {
        if (__roomMap == null)
        {
            __roomMap = new Dictionary <string, Room>();
        }
        else if (__roomMap.ContainsKey(name))
        {
            return(-1);
        }

        int roomIndex = nextRoomIndex;

        if (__roomNames == null)
        {
            __roomNames = new Pool <string>();
        }

        __roomNames.Insert(roomIndex, name);

        __roomMap[name] = new Room(roomIndex, shuffleType, roomType);

        return(roomIndex);
    }
示例#4
0
 void Start()
 {
     __shuffleType = Mahjong.ShuffleType.All;
     __roomType    = MahjongRoomType.Normal;
 }
示例#5
0
 public MahjongRoomMessage(Mahjong.ShuffleType shuffleType, MahjongRoomType roomType)
 {
     this.shuffleType = shuffleType;
     this.roomType    = roomType;
 }