public static void ResetPosition() { if (Application.loadedLevelName == "MainMenu") { ModUI.ShowMessage("Please use this when you are in game!", "Reset CD positions"); } else { Quaternion e = Quaternion.Euler(new Vector3(0, 0, 0)); foreach (GameObject go in GameObject.FindObjectsOfType <GameObject>()) { if (go.activeSelf) { if (go.name == "cd(item4)") { if (!go.GetComponent <CD>().inPlayer&& !go.GetComponent <CD>().inCase) { go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f); go.transform.rotation = e; } } else if (go.name == "cd case(item4)") { go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f); go.transform.rotation = e; } else if (go.name == "CD Rack(item4)") { go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f); go.transform.rotation = e; } } } } }
public void refindGameManager() { if (this.fGameManager == null) { this.log("Lost the game manager, trying to find."); this.fGameManager = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>(); if (this.fGameManager == null) { this.log("Could not find game manager, trying to instantiate."); this.fGameManager = new GameObject().AddComponent <FengGameManagerMKII>(); if (this.lastViewId > 0) { this.fGameManager.photonView.viewID = this.lastViewId; } else { this.fGameManager.photonView.viewID = PhotonNetwork.AllocateViewID(); } } else { this.lastViewId = fGameManager.photonView.viewID; } if (this.modUI == null) { GameObject go = new GameObject(); go.name = "ModUI"; GameObject.DontDestroyOnLoad(go); this.modUI = go.GetComponent <ModUI>(); } } }
/// <summary> /// Intersects mouse ray with marker bounds. /// </summary> /// <returns><c>true</c>if mouse ray intersects with marker <c>false</c> otherwise</returns> internal bool IntersectRay() { Camera currentCamera = Camera.main; Ray mouseRay = currentCamera.ScreenPointToRay(Input.mousePosition); float hitH = TrafficManagerTool.GetAccurateHitHeight(); Vector3 pos = Position; float mouseH = ModUI.GetTrafficManagerTool(false).MousePosition.y; if (hitH < mouseH - TrafficManagerTool.MAX_HIT_ERROR) { // For metros use projection on the terrain. pos = TerrainPosition; } else if (hitH - pos.y > TrafficManagerTool.MAX_HIT_ERROR) { // if marker is projected on road plane above then modify its height pos.y = hitH; } Bounds bounds = new Bounds(Vector3.zero, Vector3.one * Radius) { center = pos, }; return(bounds.IntersectRay(mouseRay)); }
/// <summary> /// Performs a check to see if the mod loader version is the same as the currently supported version. /// </summary> private void performModLoaderVersionCheck() { // Written, 03.08.2018 // Modloader supported version check. if (SUPPORTED_MODLOADER_VERSION != ModLoader.MSCLoader_Ver) { if (!MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError) { ModUI.ShowMessage( String.Format("<b>[{0} <color=orange>v{1}]</color></b> - NOTE: modloader v{2} may not be <color=orange>compatible</color>.\r\nSupported " + "modloader version is <color=orange>v{3}</color>.", Name, Version, ModLoader.MSCLoader_Ver, SUPPORTED_MODLOADER_VERSION), "ModLoader Version not supported."); MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError = true; MoControlsSaveData.loadedSaveData.saveSettings(); } print("<color=orange>Warning</color> <color=grey>Supported modloader version is <b>v" + SUPPORTED_MODLOADER_VERSION + "</b>; you're running version <b>" + ModLoader.MSCLoader_Ver + "</b>. May not be compatible with current version.</color>.", DebugTypeEnum.partial); } else { print("<color=grey>Running supported modloader version, <color=green>" + SUPPORTED_MODLOADER_VERSION + "</color></color>", DebugTypeEnum.full); if (MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError) { MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError = false; MoControlsSaveData.loadedSaveData.saveSettings(); } } }
/// <summary> /// Represents a debug/release mode check. /// </summary> private void performDebugCheck() { // Written, 28.12.2018 #if DEBUG if (isReleaseVersion) { ModUI.ShowMessage("<color=orange>Warning</color>: Debug Configuration invaild. Was this intentional Tommo? (dev message)" + "\r\n" + "\r\nRelease version: " + isReleaseVersion + "\r\nDebug Config: True", "<color=orange>Warning</color>: <b>Incorrect Debug/Releaase Configuration</b>"); } #else if (!isReleaseVersion) { ModUI.ShowMessage("<color=orange>Warning</color>: Release Configuration invaild" + "\r\nWas this intentional Tommo? (dev message)" + "\r\n" + "\r\nRelease version: " + isReleaseVersion + "\r\nDebug Config: False", "<color=orange>Warning</color>: <b>Incorrect Release/Debug Configuration</b>"); } #endif }
public static void ToggleTrafficLight(ushort nodeId) { ToggleTrafficLightsTool toggleTool = ModUI.GetTrafficManagerTool()?.GetSubTool(ToolMode.ToggleTrafficLight) as ToggleTrafficLightsTool; toggleTool?.ToggleTrafficLight(nodeId, ref nodeId.ToNode(), false); }
private void CheckForOldFiles() { int filesDeletedCounter = 0; if (File.Exists(old_dllFilePath)) { filesDeletedCounter++; File.Delete(old_dllFilePath); } if (File.Exists(old_xmlFilePath)) { filesDeletedCounter++; File.Delete(old_xmlFilePath); } if (File.Exists(old_assetsBundleFilePath)) { filesDeletedCounter++; File.Delete(old_assetsBundleFilePath); } if (filesDeletedCounter > 0) { ModUI.ShowMessage( $"Old api files have been deleted\n" + $"{filesDeletedCounter} of {3} have been deleted\n" + $"If you did an update before it is now finished", "ScrewablePartAPI Updater"); } }
/// <summary> /// Changes the input for a control defined in <see cref="changeInputResult"/> to the provided input string, <paramref name="inInput"/>. /// </summary> /// <param name="inInput">The input to assign.</param> internal void changeInput(string inInput) { // Written, 09.07.2018 if (!changeInputResult.isModKeybind) { // Treat as a game control. PlayerModeEnum?playerMode = changeInputResult?.mode; if (playerMode == null) { bool mistake = true; ModUI.ShowYesNoMessage("Player Mode was null, is that right?", "Mistake?", delegate() { mistake = false; }); if (!mistake) { if (changeInputResult.index == 1) { cInput.ChangeKey(changeInputResult.controlName, inInput, cInput.GetText(changeInputResult.controlName, 2)); } else { cInput.ChangeKey(changeInputResult.controlName, cInput.GetText(changeInputResult.controlName, 1), inInput); } currentControls = loadControlInputsFromCInput(); } MoControlsMod.print("Player mode wasa null while attempting to change input..", DebugTypeEnum.full); } else { setGameControl((PlayerModeEnum)playerMode, changeInputResult.controlName, changeInputResult.index, inInput); MoControlsMod.print("Player mode was equal to <b>" + changeInputResult.mode + "</b> whiling setting '" + changeInputResult.controlName + "' to '" + inInput + "'.", DebugTypeEnum.full); MoControlsSaveData.loadedSaveData.saveSettings(); } } else { // Treat as a mod keybind. Keybind modKeybind = Keybind.Get(changeInputResult.mod).Where(kb => kb.ID == changeInputResult.controlName).First(); if (changeInputResult.index == 1) { modKeybind.Modifier = (KeyCode)Enum.Parse(typeof(KeyCode), inInput); } else { modKeybind.Key = (KeyCode)Enum.Parse(typeof(KeyCode), inInput); } ModSettings_menu.SaveModBinds(changeInputResult.mod); MoControlsMod.print("saved <i>" + modKeybind.Mod.Name + "</i> mod keybinds.", DebugTypeEnum.full); } setChangeInput(); }
public static void SetAllowLaneChangesWhileGoingStraight(bool value) { Options.allowLaneChangesWhileGoingStraight = value; if (_allowLaneChangesWhileGoingStraightToggle != null) { _allowLaneChangesWhileGoingStraightToggle.isChecked = value; } Constants.ManagerFactory.JunctionRestrictionsManager.UpdateAllDefaults(); ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void Postfix(Event e) { if (ToolsModifierControl.toolController.CurrentTool.GetType() != typeof(TrafficManagerTool)) { if (UI.SubTools.PrioritySigns.MassEditOverlay.IsActive) { ModUI.GetTrafficManagerTool(true).OnToolGUIImpl(e); } } }
public static void Postfix(Event e) { if (LoadingExtension.PlayMode && !TrafficManagerTool.IsCurrentTool) { if (UI.SubTools.PrioritySigns.MassEditOverlay.IsActive) { ModUI.GetTrafficManagerTool(true).OnToolGUIImpl(e); } } }
public static void Postfix(RenderManager.CameraInfo cameraInfo) { if (ToolsModifierControl.toolController.CurrentTool.GetType() != typeof(TrafficManagerTool)) { if (UI.SubTools.PrioritySigns.MassEditOverlay.IsActive) { ModUI.GetTrafficManagerTool(true).RenderOverlayImpl(cameraInfo); } RoadSelectionPanels.Root.RenderOverlay(); } }
public static void Open() { if (File.Exists(Directory.GetCurrentDirectory() + "/MOP_LOG.txt")) { Process.Start(Directory.GetCurrentDirectory() + "/MOP_LOG.txt"); } else { ModUI.ShowMessage("No MOP log has been found, because no crash log has been generated yet.", "MOP"); } }
public static void SetJunctionRestrictionsOverlay(bool newValue) { Options.junctionRestrictionsOverlay = newValue; if (_junctionRestrictionsOverlayToggle != null) { _junctionRestrictionsOverlayToggle.isChecked = newValue; } ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void SetPrioritySignsOverlay(bool newPrioritySignsOverlay) { Options.prioritySignsOverlay = newPrioritySignsOverlay; if (_prioritySignsOverlayToggle != null) { _prioritySignsOverlayToggle.isChecked = newPrioritySignsOverlay; } ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void Postfix(RenderManager.CameraInfo cameraInfo) { if (TMPELifecycle.PlayMode && !TrafficManagerTool.IsCurrentTool) { if (UI.SubTools.PrioritySigns.MassEditOverlay.IsActive) { ModUI.GetTrafficManagerTool()?.RenderOverlayImpl(cameraInfo); } RoadSelectionPanels.Root.RenderOverlay(); } }
public static void SetTimedLightsOverlay(bool newTimedLightsOverlay) { Options.timedLightsOverlay = newTimedLightsOverlay; if (_timedLightsOverlayToggle != null) { _timedLightsOverlayToggle.isChecked = newTimedLightsOverlay; } ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void OpenOutputLog() { if (File.Exists(Application.dataPath + "/output_log.txt")) { Process.Start(Application.dataPath + "/output_log.txt"); } else { ModUI.ShowMessage("File \"output_log.txt\" doesn't exist.", "MOP"); } }
/// <summary> /// When options which affect subtools or overlays are toggled, /// all subtools are reinitialised to ensure they reflect the change. /// </summary> internal static void ReinitialiseSubTools() { if (TMPELifecycle.Instance.Deserializing || ModUI.Instance == null) { Log._Debug("OptionsManager.ReinitialiseSubTools() - Ignoring; Deserialising or ModUI is null"); return; } Log.Info("OptionsManager.ReinitialiseSubTools()"); ModUI.GetTrafficManagerTool()?.InitializeSubTools(); }
public static void Postfix(Event e) { if (TMPELifecycle.PlayMode && !TrafficManagerTool.IsCurrentTool) { if (UI.SubTools.PrioritySigns.MassEditOverlay.IsActive) { ModUI. GetTrafficManagerTool()?.OnToolGUIImpl(e); } } }
public static void SetParkingRestrictionsOverlay(bool newParkingRestrictionsOverlay) { Options.parkingRestrictionsOverlay = newParkingRestrictionsOverlay; if (_parkingRestrictionsOverlayToggle != null) { _parkingRestrictionsOverlayToggle.isChecked = newParkingRestrictionsOverlay; } ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
private static void OnSpeedLimitsOverlayChanged(bool newSpeedLimitsOverlay) { if (!Options.IsGameLoaded()) { return; } Log._Debug($"speedLimitsOverlay changed to {newSpeedLimitsOverlay}"); Options.speedLimitsOverlay = newSpeedLimitsOverlay; ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
private static void OnParkingRestrictionsOverlayChanged(bool newParkingRestrictionsOverlay) { if (!Options.IsGameLoaded()) { return; } Log._Debug($"parkingRestrictionsOverlay changed to {newParkingRestrictionsOverlay}"); Options.parkingRestrictionsOverlay = newParkingRestrictionsOverlay; ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void SetBanRegularTrafficOnBusLanes(bool value) { Options.banRegularTrafficOnBusLanes = value; if (_banRegularTrafficOnBusLanesToggle != null) { _banRegularTrafficOnBusLanesToggle.isChecked = value; } VehicleRestrictionsManager.Instance.ClearCache(); ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
private static void OnConnectedLanesOverlayChanged(bool newValue) { if (!Options.IsGameLoaded()) { return; } Log._Debug($"connectedLanesOverlay changed to {newValue}"); Options.connectedLanesOverlay = newValue; ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void DrawNodeCircle(RenderManager.CameraInfo cameraInfo, ushort nodeId, bool warning = false, bool alpha = false) { DrawNodeCircle( cameraInfo: cameraInfo, nodeId: nodeId, color: ModUI.GetTrafficManagerTool().GetToolColor(warning, error: false), alpha: alpha); // TODO: Potentially we do not need to refer to a TrafficManagerTool object }
public static void SetAllowFarTurnOnRed(bool newValue) { Options.allowFarTurnOnRed = newValue; if (_allowFarTurnOnRedToggle != null) { _allowFarTurnOnRedToggle.isChecked = newValue; } Constants.ManagerFactory.JunctionRestrictionsManager.UpdateAllDefaults(); ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
public static void SetAllowEnterBlockedJunctions(bool value) { Options.allowEnterBlockedJunctions = value; if (_allowEnterBlockedJunctionsToggle != null) { _allowEnterBlockedJunctionsToggle.isChecked = value; } Constants.ManagerFactory.JunctionRestrictionsManager.UpdateAllDefaults(); ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
private static void OnBanRegularTrafficOnBusLanesChanged(bool newValue) { if (!Options.IsGameLoaded()) { return; } Log._Debug($"banRegularTrafficOnBusLanes changed to {newValue}"); Options.banRegularTrafficOnBusLanes = newValue; VehicleRestrictionsManager.Instance.ClearCache(); ModUI.GetTrafficManagerTool(false)?.InitializeSubTools(); }
private void OnToggleOsdButtonClicked(U.UButton button) { bool value = !GlobalConfig.Instance.Main.KeybindsPanelVisible; GlobalConfig.Instance.Main.KeybindsPanelVisible = value; GlobalConfig.WriteConfig(); Log._Debug($"Toggle value of KeybindsPanelVisible to {value}"); // Refer to the TrafficManager tool asking it to request help from the current tool ModUI.GetTrafficManagerTool().RequestOnscreenDisplayUpdate(); }