Пример #1
0
 public void Start()
 {
     if (!NetworkClient.active && !NetworkServer.active && this.networkManager.matchMaker == null)
     {
         this.initialMenu.SetActive(true);
         this.optionsMenu.SetActive(true);
         this.LANHost.SetActive(false);
         this.LANClientReady.SetActive(false);
         this.LANClientNotReady.SetActive(false);
         this.LANClientNotConnected.SetActive(false);
         //this.endGameMenu.SetActive(false);
         EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();
         if (enableEditorObj != null)
         {
             enableEditorObj.TurnOffCanvasGroup();
         }
     }
     else
     {
         if (NetworkServer.active)
         {
             this.LANClientNotConnected.SetActive(false);
             this.initialMenu.SetActive(false);
             this.optionsMenu.SetActive(false);
             this.LANClientNotReady.SetActive(false);
             this.LANClientReady.SetActive(false);
             this.LANHost.SetActive(true);
             //this.endGameMenu.SetActive(false);
             EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();
             if (enableEditorObj != null)
             {
                 enableEditorObj.TurnOffCanvasGroup();
             }
         }
         else if (NetworkClient.active)
         {
             this.initialMenu.SetActive(false);
             this.optionsMenu.SetActive(false);
             this.LANHost.SetActive(false);
             this.unitAttributeEditor.SetActive(false);
             this.LANClientNotConnected.SetActive(false);
             //this.endGameMenu.SetActive(false);
             EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();
             if (enableEditorObj != null)
             {
                 enableEditorObj.TurnOffCanvasGroup();
             }
             if (ClientScene.ready)
             {
                 this.LANClientReady.SetActive(true);
             }
             else
             {
                 this.LANClientNotReady.SetActive(true);
             }
         }
     }
 }
Пример #2
0
    public void StartLANHost()
    {
        this.PreInitialization();

        this.networkManager.StartHost();
        this.initialMenu.SetActive(false);
        this.optionsMenu.SetActive(false);
        this.LANClientReady.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANHost.SetActive(true);
        this.LANClientNotConnected.SetActive(false);
        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null)
        {
            enableEditorObj.TurnOffCanvasGroup();
        }

        this.PreUnitAttributesInitialization();

        MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();

        if (stuffs != null)
        {
            Camera minimapCamera = stuffs.GetComponent <Camera>();
            minimapCamera.enabled      = true;
            stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
        }

        string name = this.playerNameField.text;

        if (name.Length > 0)
        {
            GameMetricLogger.instance.playerName = name;
        }
        else
        {
            GameMetricLogger.instance.playerName = "Player";
        }

        if (Taskbar.Instance != null)
        {
            Taskbar.Instance.ShowTaskbar(true);
        }

        GameMetricLogger.instance.difficultyEquations = this.difficultyDropdown.options[this.difficultyDropdown.value].text;
        GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics);
    }
Пример #3
0
    public void StopLANClient()
    {
        if (NetworkClient.active)
        {
            this.networkManager.StopClient();
        }
        this.LANClientReady.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANClientNotConnected.SetActive(false);
        this.initialMenu.SetActive(true);
        this.optionsMenu.SetActive(true);
        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null && enableEditorObj.isCustomOptionSelected)
        {
            enableEditorObj.TurnOnCanvasGroup();
        }

        GameMetricLogger.DisableLoggerHotkey();
        GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsOver);
    }
Пример #4
0
    public void StopLANHost()
    {
        //NOTE(Thompson): This is the official method of resetting the LAN session if the
        //player wants to play a new LAN session after ending a previous LAN session.
        SceneManager.LoadScene("new_multiplayer");

        //NOTE(Thompson): When reloading a scene, the GUIs are not reset to its initial states. Therefore
        //the following reinitialization codes are necessary.
        this.networkManager.StopHost();
        this.LANHost.SetActive(false);
        this.LANClientReady.SetActive(false);
        this.LANClientNotReady.SetActive(false);
        this.LANClientNotConnected.SetActive(false);
        this.initialMenu.SetActive(true);
        this.optionsMenu.SetActive(true);
        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null && enableEditorObj.isCustomOptionSelected)
        {
            enableEditorObj.TurnOnCanvasGroup();
        }

        MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>();

        if (stuffs != null)
        {
            stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>();
            Camera minimapCamera = stuffs.GetComponent <Camera>();
            minimapCamera.enabled = false;
        }

        if (Taskbar.Instance != null)
        {
            Taskbar.Instance.ShowTaskbar(false);
        }

        GameMetricLogger.DisableLoggerHotkey();
        //GameMetricLogger.SetGameLogger(GameLoggerOptions.StopGameMetrics);
    }
Пример #5
0
    public void StartLANClient(InputField inputField)
    {
        this.PreInitialization();

        this.networkManager.networkAddress = "localhost";
        if (inputField.text.Length > 0)
        {
            this.networkManager.networkAddress = inputField.text;
        }
        this.networkManager.StartClient();
        this.LANClientReady.SetActive(false);
        this.LANClientNotConnected.SetActive(false);

        //NOTE(Thompson): If you want to know why we don't' check the main camera for PostRenderer,
        //and disable it here, it is because only when the connection is established between server
        //and client, the PostRenderer component will then be added to the main camera.
        //That is when PostRenderer is available for us to enable/disable. So, for now, we do not do
        //anything here, and disable the PostRenderer in the NewSpawner.Start().

        if (!ClientScene.ready)
        {
            this.LANClientNotReady.SetActive(true);
        }

        EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren <EnableAttributeEditor>();

        if (enableEditorObj != null)
        {
            enableEditorObj.TurnOffCanvasGroup();
        }

        this.Invoke("PreUnitAttributesInitialization", 1f);

        if (Taskbar.Instance != null)
        {
            Taskbar.Instance.ShowTaskbar(true);
        }
    }