Exemplo n.º 1
0
    // Start
    void Start()
    {
        chatInputEnabled = true;
        entries          = new List <ChatMessage>();
        members          = new List <ChatMember>();
        myMessages       = new List <string>();
        myMessages.Add("");

        inGameLobby = this.GetComponent <InGameLobby>();

#if UNITY_EDITOR
        if (!Application.CanStreamedLevelBeLoaded("Client"))
        {
            this.AddEntry("<size=32><color=red>WARNING: CLIENT SCENE DOES NOT EXIST!</color></size>");
        }
#endif

        // Listen to lobby events
        Lobby.AddListener(this);
    }
Exemplo n.º 2
0
 // Start
 void Start()
 {
     inGameLobby = this.GetComponent <InGameLobby>();
     Lobby.AddListener(this);
 }
Exemplo n.º 3
0
    // Setup
    void Start()
    {
        LogManager.System.GenerateReport();

        if (Application.genuineCheckAvailable && !Application.genuine)
        {
            LogManager.General.LogError("Client files have been modified, quitting.");
            Application.Quit();
            return;
        }

        // Cursor
        Cursor.SetCursor(cursorIcon, cursorHotSpot, cursorMode);

        SetupApplicationForLobby();
        gameLobby           = GetComponent <InGameLobby>();
        clientVersionNumber = GetComponent <Version>().versionNumber;
        intro               = GetComponent <Intro>();
        introEnabled        = intro.enabled;
        textFieldHeight     = GUILayout.Height(24);
        popupMenu           = null;
        accountNotActivated = false;

        // FOR TESTING ONLY
#if UNITY_EDITOR
        if (!Application.CanStreamedLevelBeLoaded("Client"))
        {
            editorAutoLogin = false;
            LogManager.General.LogError("<color=red>YOU FORGOT TO ADD THE CLIENT SCENE IN THE BUILD SETTINGS</color>");
        }

        if (editorAutoLogin)
        {
            intro.enabled = false;
            introEnabled  = false;
        }

        retrieveLobbyIP = false;
        lobbyHost       = editorLobbyHost;
#endif

        // Retrieve lobby IP
        if (retrieveLobbyIP)
        {
            StartCoroutine(NetworkHelper.DownloadIPAndPort(lobbyIpURL, (host, port) => {
                lobbyHost = host;
                lobbyPort = port;

                ConnectToLobby();
            }));
        }

        // Retrieve changelog
        WWW changeLogRequest = new WWW(changeLogURL);
        StartCoroutine(DownloadChangeLog(changeLogRequest));

        // Public key
        NetworkHelper.InitPublicLobbyKey();

        // Receive lobby events
        Lobby.AddListener(this);

        // Add this class as a listener to different account events.
        AccountManager.OnAccountLoggedIn   += OnAccountLoggedIn;
        AccountManager.OnAccountLoggedOut  += OnAccountLoggedOut;
        AccountManager.OnAccountRegistered += OnAccountRegistered;
        AccountManager.OnLogInFailed       += OnLogInFailed;
        AccountManager.OnRegisterFailed    += OnRegisterFailed;

        // Connect to lobby
        if (!retrieveLobbyIP)
        {
            ConnectToLobby();
        }
    }