示例#1
0
    public override void OnStartHost()
    {
        base.OnStartHost();

        SwitchPanel(LobbyPanel);
        ColorsInUse.Clear();
    }
示例#2
0
    public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
    {
        base.OnMatchCreate(success, extendedInfo, matchInfo);

        CurrentMatchInfo = matchInfo;
        ColorsInUse.Clear();
    }
示例#3
0
    //[Command]
    //public static void CmdClientReadyToggle(uint connectionID, bool setReady)
    //{

    //    //toggle ready state of a client
    //    if (setReady)
    //        NetworkServer.SetClientReady(NetworkServer.connections[connectionID]);
    //    else
    //        NetworkServer.SetClientNotReady(NetworkServer.connections[connectionID]);
    //}

    public Color FirstAvailablePlayerColor()
    {
        foreach (var color in Colors)
        {
            if (ColorsInUse.Contains(color))
            {
                continue;
            }
            return(color);
        }
        return(Color.white);
    }
示例#4
0
 public void UpdateAvailableColors(LobbyPlayer player, Color color)
 {
     if (!ColorsInUse.Remove(player.PlayerColor) && player.PlayerColor != Color.white)
     {
         Debug.LogError("Tried to make a color available that was already available." + player.PlayerColor.GetName());
     }
     if (ColorsInUse.Contains(color))
     {
         Debug.LogError("Tried to make an unavailable color unavailable..." + color.GetName());
     }
     else
     {
         ColorsInUse.Add(color);
     }
 }
示例#5
0
    //leave lobby and return to multiplayer screen
    public void LeaveLobby()
    {
        if (CurrentlyMatchmaking)
        {
            if (matchMaker != null)
            {
                matchMaker.DestroyMatch(CurrentMatchInfo.networkId, 0, OnDestroyMatch);
            }
            StopHost();
            ColorsInUse.Clear();
        }
        else if (NetworkServer.active)
        {
            StopHost();
        }
        else
        {
            StopClient();
        }

        SwitchPanel(MultiplayerPanel);
    }