public void OnGUI() { if (StatMaster.SimulationState >= SimulationState.GlobalSimulation || StatMaster.inMenu || StatMaster.isMainMenu || (StatMaster.SimulationState == SimulationState.SpectatorMode && StatMaster.isMP)) { return; } if (hudToggle) { foreach (var kvp in this.restrictedBlocksDic) { kvp.Value.currentCount = 0; kvp.Value.highestPowerValue = 0; } this.weakPointCount = 0; if (StatMaster.isMP) { LJTMachine.MachineDic[PlayerMachine.GetLocal()].HasCompliance = this.hasCompliance; } this.windowRect = GUILayout.Window(32575339, this.windowRect, new GUI.WindowFunction(this.MainWindow), LocalisationFile.GetTranslatedString("Title")); if (this.uf) { this.windowRect2 = GUILayout.Window(32575340, this.windowRect2, new GUI.WindowFunction(this.UsageAndFunction), LocalisationFile.GetTranslatedString("UF")); } if (this.playerStats) { this.windowRect3 = GUILayout.Window(32575341, this.windowRect3, new GUI.WindowFunction(this.StatusWindow), LocalisationFile.GetTranslatedString("PlayerStats")); } } }
void AddTankTypeMenu(Block block) { MMenu tankTypeMenu = block.InternalObject.AddMenu(new MMenu("tankTypeMenu", 5, Enum.GetNames(typeof(TankType)).ToList(), false)); tankTypeMenu.ValueChanged += tankTypeInt => { if (!StatMaster.levelSimulating) { if (block.Machine == PlayerMachine.GetLocal()) { MachineInspector.Instance.SetTankType((TankType)tankTypeInt); StartCoroutine(this.SetTankTypeCoroutine(block.Machine, tankTypeInt)); } } }; MachineInspector.Instance.OnTypeChangeFromGUI += x => { if (block.Machine == PlayerMachine.GetLocal()) { tankTypeMenu.SetValue(x); tankTypeMenu.ApplyValue(); block.InternalObject.OnSave(new XDataHolder()); } }; }
private void DisplayRemainingRocketCount() { if (!DisplayRocketCount) { return; } if (cameraController == null) { return; } if (cameraController.activeCamera == null) { return; } if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson) { if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out groupedRockets)) { string textString = ""; foreach (var group in groupedRockets) { textString += KeyCodeConverter.GetKey(group.Key).ToString() + ": " + group.Value.Count + Environment.NewLine; } GUI.Box(counterRect, LanguageManager.Instance.CurrentLanguage.RemainingRockets + Environment.NewLine + textString, groupedRocketsCounterStyle); } } }
public void UpdateRocketFiredStatus(TimedRocket rocket) { if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out Dictionary <KeyCode, HashSet <TimedRocket> > groupedRockets)) { RocketScript rocketScript = rocket.GetComponent <RocketScript>(); if (rocketScript != null) { if (groupedRockets.TryGetValue(rocketScript.GroupFireKey.GetKey(0), out HashSet <TimedRocket> rockets)) { rockets.Remove(rocket); } } } }
private void OnGUI() { if (iAmLockedByRocket && DisplayWarning) { if (cameraController != null) { if (cameraController.activeCamera != null) { if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson) { DrawBorder(); GUI.Box(warningRect, "Missile Alert", missileWarningStyle); } } } } if (DisplayRocketCount) { if (cameraController != null) { if (cameraController.activeCamera != null) { if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson) { if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out Dictionary <KeyCode, HashSet <TimedRocket> > groupedRockets)) { string textString = ""; foreach (var group in groupedRockets) { textString += KeyCodeConverter.GetKey(group.Key).ToString() + ": " + group.Value.Count + Environment.NewLine; } GUI.Box(counterRect, LanguageManager.remainingRockets + Environment.NewLine + textString, groupedRocketsCounterStyle); } } } } } }
public void Update() { if (BlockMapper.IsOpen) { this.refresh |= BlockMapper.CurrentInstance != this.blockMapper; if (this.refresh) { this.blockMapper = BlockMapper.CurrentInstance; this.refresh &= this.blockMapper.IsBlock; if (this.refresh) { this.block = this.blockMapper.Block; this.blockCount = PlayerMachine.GetLocal().GetBlocksOfType((int)this.block.Prefab.Type).Count; this.refresh &= this.machineInspector.regulation.ChildBlockRestriction.TryGetValue((int)this.block.Prefab.Type, out BlockRestriction blockRestriction); if (this.refresh) { this.selectors = this.blockMapper.GetComponentsInChildren <SliderSelector>(); this.holders = this.blockMapper.GetComponentsInChildren <SliderHolder>(); switch (this.block.Prefab.Type) { case BlockType.Cannon: this.min = blockRestriction.minPower; this.max = blockRestriction.maxPowers[this.blockCount - 1]; this.sliderSelector = this.selectors[0]; this.sliderHolder = this.holders[0]; break; case BlockType.ShrapnelCannon: case BlockType.WaterCannon: this.min = blockRestriction.minPower; this.max = blockRestriction.maxPowers[0]; this.sliderSelector = this.selectors[0]; this.sliderHolder = this.holders[0]; break; case BlockType.CogMediumPowered: case BlockType.Wheel: case BlockType.LargeWheel: this.min = blockRestriction.minPower; this.max = blockRestriction.maxPowers[0]; this.sliderSelector = this.selectors[0]; this.sliderHolder = this.holders[0]; break; case BlockType.Rocket: this.min = blockRestriction.minPower; this.max = blockRestriction.maxPowers[0]; this.sliderSelector = this.selectors[1]; this.sliderHolder = this.holders[1]; break; default: return; } this.mSlider = this.sliderSelector.Slider; this.sliderName = this.mSlider.DisplayName; this.key = this.mSlider.Key; this.value = this.mSlider.Value; if (this.blockCount <= blockRestriction.maxNum && this.blockCount > 0) { this.sliderSelector.Slider = new MSlider(this.sliderName, this.key, this.value, this.min, this.max, null, null, true, false); this.sliderSelector.Value = value; this.sliderHolder.SetValue(value); } } } } this.refresh = false; } }
void FixedUpdate() { if (!StatMaster.levelSimulating) { if (playerGroupedRockets.Count > 0) { playerGroupedRockets.Clear(); } } if (PlayerMachine.GetLocal() != null) { if (PlayerMachine.GetLocal().InternalObject.isSimulating) { if (isFirstFrame) { isFirstFrame = launchStarted = false; cameraController = FindObjectOfType <FixedCameraController>(); rocketTargetDict.Clear(); } } else { if (!isFirstFrame) { if (playerGroupedRockets.ContainsKey(PlayerMachine.GetLocal().InternalObject.PlayerID)) { playerGroupedRockets.Remove(PlayerMachine.GetLocal().InternalObject.PlayerID); } rocketTargetDict.Clear(); isFirstFrame = true; } } } if (!isFirstFrame) { if (PlayerMachine.GetLocal() != null && rocketTargetDict != null && !isFirstFrame) { if (rocketTargetDict.Count == 0) { iAmLockedByRocket = false; } else { foreach (var rocketTargetPair in rocketTargetDict) { if (PlayerMachine.GetLocal() != null) { if (rocketTargetPair.Value == (StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0)) { iAmLockedByRocket = true; break; } else { iAmLockedByRocket = false; } } else { iAmLockedByRocket = false; } } } } } }