/* * ██╗ █████╗ ███╗ ██╗ ██████╗██╗ ██╗███████╗███╗ ██╗████████╗ * ██║ ██╔══██╗████╗ ██║ ██╔════╝██║ ██║██╔════╝████╗ ██║╚══██╔══╝ * ██║ ███████║██╔██╗ ██║ ██║ ██║ ██║█████╗ ██╔██╗ ██║ ██║ * ██║ ██╔══██║██║╚██╗██║ ██║ ██║ ██║██╔══╝ ██║╚██╗██║ ██║ * ███████╗██║ ██║██║ ╚████║ ╚██████╗███████╗██║███████╗██║ ╚████║ ██║ * ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝ */ //Turning on/off menu public void TurnOnLANClientMenu() { this.initialMenu.SetActive(false); this.optionsMenu.SetActive(false); this.unitAttributeEditor.SetActive(false); this.LANHost.SetActive(false); this.LANClientNotConnected.SetActive(true); GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsOver); }
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); }
public void TurnOffLANClientMenu() { this.initialMenu.SetActive(false); this.optionsMenu.SetActive(false); this.unitAttributeEditor.SetActive(false); this.LANHost.SetActive(false); this.LANClientReady.SetActive(false); this.LANClientNotReady.SetActive(false); this.LANClientNotConnected.SetActive(false); //EnableAttributeEditor enableEditorObj = this.optionsMenu.GetComponentInChildren<EnableAttributeEditor>(); //if (enableEditorObj != null) { // enableEditorObj.TurnOffCanvasGroup(); //} GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsPlaying); }
/*** * ███████╗███╗ ██╗██████╗ ██████╗ █████╗ ███╗ ███╗███████╗ * ██╔════╝████╗ ██║██╔══██╗ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝ * █████╗ ██╔██╗ ██║██║ ██║ ██║ ███╗███████║██╔████╔██║█████╗ * ██╔══╝ ██║╚██╗██║██║ ██║ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ * ███████╗██║ ╚████║██████╔╝ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗ * ╚══════╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ * */ public void SetEndGameSession() { //if (!(this.endGameMenu.activeSelf || this.endGameMenu.activeInHierarchy)) { //} //this.endGameMenu.SetActive(true); this.initialMenu.SetActive(false); this.optionsMenu.SetActive(false); this.LANClientNotConnected.SetActive(false); this.LANClientNotReady.SetActive(false); this.LANClientReady.SetActive(false); this.LANHost.SetActive(false); this.unitAttributeEditor.SetActive(false); GameMetricLogger.SetGameLogger(GameLoggerOptions.StopGameMetrics); GameMetricLogger.ShowPrintLog(); }
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); }
private void PreUnitAttributesInitialization() { GameObject obj = GameObject.Find("Temporary Unit Attributes"); if (obj == null) { obj = this.temporaryUnitAttributesObject; } if (obj != null) { UnitAttributes myAttributes = null; GameObject[] playerUnitAttributes = GameObject.FindGameObjectsWithTag("UnitAttributes"); for (int i = 0; i < playerUnitAttributes.Length; i++) { NetworkIdentity identity = playerUnitAttributes[i].GetComponent <NetworkIdentity>(); if (identity.hasAuthority) { myAttributes = playerUnitAttributes[i].GetComponent <UnitAttributes>(); UnitAttributes tempAttr = obj.GetComponent <UnitAttributes>(); myAttributes.CopyFrom(tempAttr); break; } } if (myAttributes != null) { GameObject[] gameUnits = GameObject.FindGameObjectsWithTag("Unit"); foreach (GameObject unit in gameUnits) { NetworkIdentity identity = unit.GetComponent <NetworkIdentity>(); if (identity != null && identity.hasAuthority) { GameUnit gameUnit = unit.GetComponent <GameUnit>(); gameUnit.unitAttributes = myAttributes; } } } GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsPlaying); } }
public void SingleStartHost() { DropdownFix[] fixes = GameObject.FindObjectsOfType <DropdownFix>(); int values = 0; for (int i = 0; i < fixes.Length; i++) { values += fixes[i].value; } if (values <= 0) { //Start Game button is now interactable only when player hasn't chosen a preset. return; } //Note(Thompson): Player is always index 1. //Note(Thompson): Obtain the A.I. level difficulty. GameMetricLogger.instance.levelDifficulty = fixes[0].value; //Note(Thompson): Check if the Player dropdown value is 5. If not, and is above 0, return difficulty equation used. Else, return a full range of custom equations used. GameMetricLogger.SetDifficultyEquation(ConvertCustomToEquations(fixes[1].value, fixes[1].options[fixes[1].value].text)); GameMetricLogger.SetPlayerName("Player"); if (this.attributePanelGroup != null) { this.attributePanelGroup.alpha = 0f; this.attributePanelGroup.blocksRaycasts = false; this.attributePanelGroup.interactable = false; } GameObject minimapCameraObject = GameObject.FindGameObjectWithTag("Minimap"); Camera minimapCamera = minimapCameraObject.GetComponent <Camera>(); if (minimapCamera != null && !minimapCamera.enabled) { minimapCamera.enabled = true; } if (this.playerObject != null) { this.playerObject.SetActive(true); } if (this.AIPlayer != null) { //AI attribute manager. AIAttributeManager attributeManager = this.AIPlayer.GetComponentInChildren <AIAttributeManager>(); if (attributeManager != null) { Debug.Log("It works!"); } //AI Unit spawning. GameObject obj = MonoBehaviour.Instantiate(this.AIUnitPrefab) as GameObject; obj.transform.SetParent(this.AIUnits.transform); obj.transform.position = this.GetStartPosition().position; AIUnit unit = obj.GetComponent <AIUnit>(); //AI manager spawning. AIManager AImanager = this.AIPlayer.GetComponentInChildren <AIManager>(); if (AImanager != null) { unit.unitManager = AImanager; if (attributeManager != null && attributeManager.attributePanelUI != null) { DifficultyGroup group = attributeManager.attributePanelUI.aiCalibrationDifficulty; AImanager.UpdateDifficulty(group.GetDifficulty()); } unit.SetTeam(AImanager.teamFaction); AImanager.Activate(); } } this.playerUmbrellaObject = GameObject.FindGameObjectWithTag("Player"); if (this.playerUmbrellaObject != null) { this.HumanPlayer = this.playerUmbrellaObject; Transform unitUmbrellaTransform = this.playerUmbrellaObject.transform.GetChild(0); this.HumanUnits = unitUmbrellaTransform.gameObject; } SetupPlayerUnits(); if (!this.isNetworkActive) { this.StartHost(); } this.enablePauseGameMenu = true; this.notReady = false; if (Taskbar.Instance != null) { Taskbar.Instance.ShowTaskbar(true); } GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics); GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsPlaying); GameMetricLogger.EnableLoggerHotkey(); }
public void SetClientReady() { if (!ClientScene.ready) { if (ClientScene.Ready(this.networkManager.client.connection)) { Camera cam = Camera.main.GetComponent <Camera>(); PostRenderer renderer = cam.GetComponent <PostRenderer>(); if (renderer != null) { renderer.enabled = true; } MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>(); if (stuffs != null) { Camera minimapCamera = stuffs.GetComponent <Camera>(); minimapCamera.enabled = true; stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>(); } this.LANClientReady.SetActive(false); this.LANClientNotReady.SetActive(false); GameMetricLogger.EnableLoggerHotkey(); NewSpawner[] spawners = GameObject.FindObjectsOfType <NewSpawner>(); foreach (NewSpawner spawn in spawners) { if (spawn != null && spawn.hasAuthority) { NewSpawner.Instance.CmdSetReadyFlag(ClientScene.ready && !NetworkServer.active); } } GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics); } else { this.LANClientReady.SetActive(false); this.LANClientNotReady.SetActive(true); } if (ClientScene.localPlayers.Count == 0) { ClientScene.AddPlayer(0); } } else { this.LANClientReady.SetActive(false); this.LANClientNotReady.SetActive(false); Camera cam = Camera.main.GetComponent <Camera>(); PostRenderer renderer = cam.GetComponent <PostRenderer>(); if (renderer != null) { renderer.enabled = true; } MinimapStuffs stuffs = GameObject.FindObjectOfType <MinimapStuffs>(); if (stuffs != null) { Camera minimapCamera = stuffs.GetComponent <Camera>(); minimapCamera.enabled = true; stuffs.playerCameraPanning = Camera.main.GetComponent <CameraPanning>(); } this.LANClientReady.SetActive(false); this.LANClientNotReady.SetActive(false); string name = this.playerNameField.text; if (name.Length > 0) { GameMetricLogger.instance.playerName = name; } else { GameMetricLogger.instance.playerName = "Player"; } GameMetricLogger.instance.difficultyEquations = this.difficultyDropdown.options[this.difficultyDropdown.value].text; GameMetricLogger.EnableLoggerHotkey(); NewSpawner[] spawners = GameObject.FindObjectsOfType <NewSpawner>(); foreach (NewSpawner spawn in spawners) { if (spawn != null && spawn.hasAuthority) { NewSpawner.Instance.CmdSetReadyFlag(ClientScene.ready && !NetworkServer.active); } } GameMetricLogger.SetGameLogger(GameLoggerOptions.StartGameMetrics); } Canvas canvas = GameObject.FindObjectOfType <Canvas>(); TooltipLocator loc = canvas.GetComponent <TooltipLocator>(); if (loc != null) { loc.tooltip.SetToolTipHidden(true); } }