示例#1
0
    void FindRefs()
    {
        if (connectUI == null)
        {
            GameObject con = GameObject.Find("ConnectUI");
            if (con != null)
            {
                connectUI = con.GetComponent <ConnectUI>();
                                #if !UNITY_WEBGL
                connectUI.Init(defaultHost, defaultTcpPort);
                                #else
                connectUI.Init(defaultHost, defaultWsPort);
                                #endif
            }
        }

        if (gameLogic == null)
        {
            GameObject game = GameObject.Find("GameLogic");
            if (game != null)
            {
                gameLogic = game.GetComponent <GameLogic>();
            }
        }

        if (lobbyUI == null)
        {
            GameObject lobby = GameObject.Find("LobbyUI");
            if (lobby != null)
            {
                lobbyUI = lobby.GetComponent <LobbyUI>();
            }
        }
    }