コード例 #1
0
    private void __OnRegistered(ZG.Network.Node node)
    {
        if (node == null || __playerNames == null || __playerMap == null)
        {
            return;
        }

        string playerName;

        if (!__playerNames.TryGetValue(node.index, out playerName))
        {
            return;
        }

        Player player;

        if (!__playerMap.TryGetValue(playerName, out player))
        {
            return;
        }

        if (player.index >= 0 && player.index < 4)
        {
            if (__roomMap == null)
            {
                return;
            }

            Room room;
            if (!__roomMap.TryGetValue(player.roomName, out room) || room == null)
            {
                return;
            }

            Room.Player temp = room.Get(player.index);
            if (temp == null)
            {
                temp       = new Room.Player(room);
                temp.index = player.index;
            }

            temp.instance = node == null ? null : node.GetComponent <MahjongServerPlayer>();
        }
    }