Example #1
0
    //m_msgOutBuffer needs to be set to null on broadcast stop
    public void endBroadcast()
    {
        //StopClient();
        playerInput.SetActive(true);
        LoadCanvas.SetActive(true);
        serverInput.SetActive(true);
        serverB.SetActive(true);
        clientB.SetActive(true);
        endB.SetActive(true);
        LobbyCanvas.SetActive(true);
        StartCanvas.SetActive(true);
        //StopBroadcast();
        try
        {
            Debug.Log("stophost");
            NetworkLobbyManager.singleton.StopHost();
        }
        catch
        {
            Debug.Log("No Server In Lobby");
        }

        try
        {
            Debug.Log("stop client");
            NetworkLobbyManager.singleton.StopClient();
        }
        catch
        {
            Debug.Log("No Client In Lobby");
        }


        SceneManager.LoadScene("offline");
    }
Example #2
0
 private void Awake()
 {
     // Try to find missing canvas references
     if (!_lobbyCanvas)
     {
         GameObject lobby = GameObject.Find("LobbyCanvas");
         if (lobby)
         {
             _lobbyCanvas = lobby.GetComponent <LobbyCanvas>();
         }
     }
     if (!_roomCanvas)
     {
         GameObject room = GameObject.Find("RoomCanvas");
         if (room)
         {
             _roomCanvas = room.GetComponent <RoomCanvas>();
         }
     }
     if (!_loginCanvas)
     {
         GameObject login = GameObject.Find("LoginCanvas");
         if (login)
         {
             _loginCanvas = login.GetComponent <LoginCanvas>();
         }
     }
 }
Example #3
0
 public void startServer()
 {
     //gamename:playername:numon server:
     if (serverNameInput.text.Length < 1 || playerNameInput.text.Length < 1 || serverNameInput.text.Contains(":") || playerNameInput.text.Contains(":"))
     {
         Debug.Log("Server and Player Name must be filled and can't contain the symbol ':'");
     }
     else
     {
         playerInput.SetActive(false);
         serverInput.SetActive(false);
         serverB.SetActive(false);
         clientB.SetActive(false);
         endB.SetActive(true);
         LoadCanvas.SetActive(false);
         LobbyCanvas.SetActive(true);
         StartCanvas.SetActive(false);
         Initialize();
         broadcastData = serverNameInput.text + ":" + playerNameInput.text + ":" + 0;
         StartAsServer();
         NetworkLobbyManager.singleton.matchName = serverNameInput.text;
         netmanager.playerName = playerNameInput.text;
         NetworkLobbyManager.singleton.StartHost();
     }
 }
Example #4
0
 private void Awake()
 {
     Instance = this;
     nameDuration.SetActive(false);
     blockClick.SetActive(false);
     optionRect.SetActive(false);
 }
Example #5
0
    public void OnClickLeaveLobby()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;
        GameObject roomCanvasObj  = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;


        LobbyCanvas       lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
        CurrentRoomCanvas roomCanvas  = roomCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.gameObject.SetActive(false);
        roomCanvas.gameObject.SetActive(false);
    }
Example #6
0
    private void Start()
    {
        blockRaycastRoom = GameObject.Find("BlockRaycastDoubleClickRoom");
        blockRaycastRoom.SetActive(false);
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
    }
    void Start()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
        Button      button      = GetComponent <Button>();

        button.onClick.AddListener(() => lobbyCanvas.OnClick_JoinRoom(RoomNameText.text));
    }
Example #8
0
    //LOBBY-----------------------------------------------------------------
    public void OnClickJoinLobby()
    {
        PhotonNetwork.JoinLobby(TypedLobby.Default);
        PhotonNetwork.automaticallySyncScene = false;

        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;
        GameObject roomCanvasObj  = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;


        LobbyCanvas       lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
        CurrentRoomCanvas roomCanvas  = roomCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.gameObject.SetActive(true);
        roomCanvas.gameObject.SetActive(true);
    }
Example #9
0
 public void LobbyConnection()
 {
     PhotonNetwork.playerName = myUsername.text;
     if (PhotonNetwork.connected)
     {
         PhotonNetwork.JoinLobby();
         myText.text = "Joined Lobby";
         LobbyCanvas.SetActive(true);
         LoginCanvas.SetActive(false);
     }
     else
     {
         PhotonNetwork.ConnectUsingSettings(VERSION);
     }
 }
Example #10
0
    public void ListGames()
    {
        lobby.gameObject.SetActive(true);
        MenuPlay.gameObject.SetActive(false);
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }

        LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();

        lobbyCanvas.getit();
    }
Example #11
0
 public void startClient()
 {
     StopAllCoroutines();
     StartCoroutine(CleanUp());
     StartCanvas.SetActive(true);
     LoadCanvas.SetActive(false);
     LobbyCanvas.SetActive(false);
     playerInput.SetActive(false);
     serverInput.SetActive(false);
     serverB.SetActive(false);
     clientB.SetActive(false);
     endB.SetActive(true);
     Initialize();
     netmanager.playerName = playerNameInput.text;
     StartAsClient();
 }
Example #12
0
    // Use this for initialization
    private void Start()
    {
        //get the LobbyCanvas GameObject in Main Canvas
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.lobbyCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        //get the lobbyCanvas srcipt in lobbyCanvas Object
        LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas> ();
        //Add button listener and call the LobbyCanvas.OnClickJoinRoom function by pressed the button
        Button button = GetComponent <Button> ();

        button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomName));
    }
Example #13
0
    // set up a listener
    private void Start()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;

        //This shouldn't happen but if it does then we have a check
        if (lobbyCanvasObj == null)
        {
            return;
        }

        LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas> ();


        Button button = GetComponent <Button> ();

        button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text));
    }
Example #14
0
    private void Start()
    {
        //Getting the Lobby Canvas object

        GameObject LobbyCanvasObj = MainMPCanvasManager.Instance.LobbyCanvas.gameObject;

        if (LobbyCanvasObj == null)
        {
            return;
        }

        LobbyCanvas lobbyCanvas = LobbyCanvasObj.GetComponent <LobbyCanvas>();

        //Get the Room Name text
        Button button = GetComponent <Button>();

        button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text));
    }
Example #15
0
    // Start is called before the first frame update
    private void Start()
    {
        GameObject LobbyCanvasObject = MainCanvasManager.Instance.LobbyCanvas.gameObject;

        if (LobbyCanvasObject == null)
        {
            return;
        }

        LobbyCanvas lobbyCanvas = LobbyCanvasObject.GetComponent <LobbyCanvas>();

        Button button = GetComponent <Button>();

        if (button == null)
        {
            print("button is null");
        }
        button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text));
    }
Example #16
0
    public override void NetworkStart()
    {
        // init vars
        readyPlayers = new List <ulong>();

        // Find the canvas.
        canvas = FindObjectOfType <LobbyCanvas>();
        canvas.initialize();

        // UI
        canvas.updatePlayerBarsOnServer(readyPlayers);
        canvas.initHostPanel(IsHost);

        // Destroy main menu music
        GameObject music = GameObject.FindGameObjectWithTag("MenuMusic");

        if (music != null)
        {
            Destroy(music);
        }

        if (IsServer)
        {
            // Call callbacks to track connections
            NetworkingManager.Singleton.OnClientConnectedCallback  += ConnectionCallbackOnServer;
            NetworkingManager.Singleton.OnClientDisconnectCallback += ConnectionCallbackOnServer;

            // Create persistent GameInfo object to pass to GameManager
            gameInfo = new GameObject("GameInfo").AddComponent <GameInfo>();
            DontDestroyOnLoad(gameInfo.gameObject);

            connected = NetworkingManager.Singleton.ConnectedClientsList.Count;
            TellClientsToUpdateUI();
        }

        if (IsClient)
        {
            // Timeout after 5 minutes in lobby
            Invoke("OnDisconnectButton", 300);
        }
    }
Example #17
0
    public void Awake()
    {
        Initialize();
        glControl   = this.transform.GetComponent <GameListController>();
        playerInput = GameObject.Find("PlayerName");
        serverInput = GameObject.Find("ServerName");
        serverB     = GameObject.Find("Server Broadcast");
        clientB     = GameObject.Find("Client Broadcast");
        endB        = GameObject.Find("End Broadcast");
        LoadCanvas  = GameObject.Find("LoadCanvas");
        LobbyCanvas = GameObject.Find("LobbyCanvas");
        StartCanvas = GameObject.Find("StartCanvas");

        transform.GetChild(3).gameObject.SetActive(false);
        netmanager     = GetComponent <MyNetworkManager>();
        thisNetworkDis = this.gameObject;
        endB.SetActive(false);
        LoadCanvas.SetActive(false);
        LobbyCanvas.SetActive(false);
        serverNameInput = serverInput.transform.GetChild(1).GetComponent <Text>();
        playerNameInput = playerInput.transform.GetChild(1).GetComponent <Text>();
    }
Example #18
0
 // Use this for initialization
 void Start()
 {
     lobbyCanvas = this;
 }