SendLobbyData() public static method

public static SendLobbyData ( NetworkCode, code ) : void
code NetworkCode,
return void
Exemplo n.º 1
0
 /*-----------------------------------------------------------------------------------------------------------------
 *  -- FUNCTION: SetAman
 *  --
 *  -- DATE: April 04, 2016
 *  --
 *  -- DESIGNER: Spenser Lee
 *  --
 *  -- PROGRAMMER: Spenser Lee & Jerry Jia
 *  --
 *  -- INTERFACE: void SetAman()
 *  --
 *  -- RETURNS: void
 *  --
 *  -- NOTES:
 *  -- On click function to inidicate whether or not the current player has aman status.
 *  -----------------------------------------------------------------------------------------------------------------*/
 public void SetAman()
 {
     // NOTE:: This can only be called when either the player has already selected to be the aman, which he can deselect it
     //		  or no one on the team has selected aman. Functionality handled over network
     GameData.AllyKingID = aman_toggle.isOn ? GameData.MyPlayer.PlayerID : -1;
     LobbyNetwork.SendLobbyData(NetworkCode.AmanSelection);
 }
Exemplo n.º 2
0
 /*-----------------------------------------------------------------------------------------------------------------
 *  -- FUNCTION: StartGame
 *  --
 *  -- DATE: April 04, 2016
 *  --
 *  -- DESIGNER: Spenser Lee
 *  --
 *  -- PROGRAMMER: Spenser Lee
 *  --
 *  -- INTERFACE: void StartGame()
 *  --
 *  -- RETURNS: void
 *  --
 *  -- NOTES:
 *  -- On click function for starting the game.
 *  -----------------------------------------------------------------------------------------------------------------*/
 public void StartGame()
 {
     if (GameData.AllyKingID != -1 && GameData.EnemyKingID != -1)
     {
         LobbyNetwork.SendLobbyData(NetworkCode.GameStart);
     }
     team_select_panel.SetActive(false);
 }
Exemplo n.º 3
0
    /*-----------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: LeaveLobby
    *  --
    *  -- DATE: April 04, 2016
    *  --
    *  -- DESIGNER: Spenser Lee & Jerry Jia
    *  --
    *  -- PROGRAMMER: Spenser Lee & Jerry Jia
    *  --
    *  -- INTERFACE: void LeaveLobby()
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- On click function to leave the lobby. Sends necessary netorking messages to disconnect from the server
    *  -- and clears the lobby menu UI as necessary.
    *  -----------------------------------------------------------------------------------------------------------------*/
    public void LeaveLobby()
    {
        GameData.LobbyData.Remove(GameData.MyPlayer.PlayerID);
        LobbyNetwork.SendLobbyData(NetworkCode.PlayerLeftLobby);
        if (LobbyNetwork.connected)
        {
            LobbyNetwork.connected = false;
            NetworkingManager.TCP_DisposeClient();
        }
        foreach (Transform slot in team1_list.transform)
        {
            slot.gameObject.SetActive(false);
        }

        foreach (Transform slot in team2_list.transform)
        {
            slot.gameObject.SetActive(false);
        }
        Back();
    }
Exemplo n.º 4
0
    /*-----------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: SelectTeam
    *  --
    *  -- DATE: April 04, 2016
    *  --
    *  -- DESIGNER: Spenser Lee
    *  --
    *  -- PROGRAMMER: Spenser Lee
    *  --
    *  -- INTERFACE: void SelectTeam(int team)
    *  --              team:   the team number
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- On click function for selecting a team. Sends a network packet indicating which team was selected.
    *  -----------------------------------------------------------------------------------------------------------------*/
    public void SelectTeam(int team)
    {
        team_select_panel.SetActive(false);

        if (GameData.MyPlayer.TeamID != team && GameData.MyPlayer.TeamID > 0)
        {
            int temp = GameData.AllyKingID;
            GameData.AllyKingID  = GameData.EnemyKingID;
            GameData.EnemyKingID = temp;
        }

        GameData.MyPlayer.TeamID = team;
        LobbyNetwork.SendLobbyData(NetworkCode.TeamChangeRequest);
        _team_set = true;

        if (_class_set == false)
        {
            class_select_panel.SetActive(true);
        }
    }
Exemplo n.º 5
0
    /*-----------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: SelectClass
    *  --
    *  -- DATE: April 04, 2016
    *  --
    *  -- DESIGNER: Spenser Lee
    *  --
    *  -- PROGRAMMER: Spenser Lee
    *  --
    *  -- INTERFACE: void SelectClass(int value)
    *  --              value:   class value
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- On click function for selecting a class. Enables/disables the necessary class information panels and sends
    *  -- a netork packet indicating which class was selected.
    *  -----------------------------------------------------------------------------------------------------------------*/
    public void SelectClass(int value)
    {
        class_select_panel.SetActive(false);

        switch (value)
        {
        case 1:
            soldier_panel.SetActive(true);
            mage_panel.SetActive(false);
            ninja_panel.SetActive(false);
            aman_panel.SetActive(false);
            break;

        case 2:
            soldier_panel.SetActive(false);
            mage_panel.SetActive(false);
            ninja_panel.SetActive(true);
            aman_panel.SetActive(false);
            break;

        case 3:
            soldier_panel.SetActive(false);
            mage_panel.SetActive(true);
            ninja_panel.SetActive(false);
            aman_panel.SetActive(false);
            break;

        case 4:
            soldier_panel.SetActive(false);
            mage_panel.SetActive(false);
            ninja_panel.SetActive(false);
            aman_panel.SetActive(true);
            break;
        }
        GameData.MyPlayer.ClassType = (ClassType)value;
        LobbyNetwork.SendLobbyData(NetworkCode.ClassChangeRequest);

        _class_set = true;
    }
Exemplo n.º 6
0
    /*-----------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: JoinLobby
    *  --
    *  -- DATE: April 04, 2016
    *  --
    *  -- DESIGNER: Spenser Lee
    *  --
    *  -- PROGRAMMER: Spenser Lee
    *  --
    *  -- INTERFACE: void JoinLobby()
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- Function called when a player attemps to join the lobby. User inputs a name and IP address, then attempts to
    *  -- connect to the server.
    *  -----------------------------------------------------------------------------------------------------------------*/
    public void JoinLobby()
    {
        string name = _GetInputText("NameInput");

        _host_ip    = _GetInputText("IPInput");
        GameData.IP = _host_ip;
        if (Application.platform != RuntimePlatform.LinuxPlayer)
        {
            _SwitchMenu(MenuStates.Lobby);
            return;
        }

        if (!(name.Length == 0) && name.Length <= 12 && !(_host_ip.Length == 0))
        {
            GameData.MyPlayer.Username = name;
            if (!LobbyNetwork.Connect(_host_ip))
            {
                return;
            }
            LobbyNetwork.SendLobbyData(NetworkCode.PlayerJoinedLobby);
            _SwitchMenu(MenuStates.Lobby);
        }
    }
Exemplo n.º 7
0
 /*-----------------------------------------------------------------------------------------------------------------
 *  -- FUNCTION: SetReady
 *  --
 *  -- DATE: April 04, 2016
 *  --
 *  -- DESIGNER: Spenser Lee
 *  --
 *  -- PROGRAMMER: Spenser Lee & Jerry Jia
 *  --
 *  -- INTERFACE: void SetReady()
 *  --
 *  -- RETURNS: void
 *  --
 *  -- NOTES:
 *  -- On click function to change ready status in the lobby. Sends a netorking packet to update ready status.
 *  -----------------------------------------------------------------------------------------------------------------*/
 public void SetReady()
 {
     GameData.MyPlayer.Ready = (ready_toggle.isOn ? true : false);
     LobbyNetwork.SendLobbyData(NetworkCode.ReadyRequest);
 }