protected override void OnActivateTool() { base.OnActivateTool(); ToolMenu.Instance.PriorityScreen.Show(); if (BlueprintsState.HasBlueprints()) { GridCompositor.Instance.ToggleMajor(true); } if (BlueprintsState.HasBlueprints()) { BlueprintsState.VisualizeBlueprint(Grid.PosToXY(PlayerController.GetCursorPos(KInputManager.GetMousePos())), BlueprintsState.SelectedBlueprint); if (visualizer != null) { Destroy(visualizer); visualizer = null; } } else { CreateVisualizer(); } }
public static void ReloadBlueprints(bool ingame) { BlueprintsState.LoadedBlueprints.Clear(); LoadFolder(GetBlueprintDirectory()); if (ingame && BlueprintsState.HasBlueprints()) { BlueprintsState.ClearVisuals(); BlueprintsState.VisualizeBlueprint(Grid.PosToXY(PlayerController.GetCursorPos(KInputManager.GetMousePos())), BlueprintsState.SelectedBlueprint); } }
protected override void OnActivateTool() { base.OnActivateTool(); gameObject.AddComponent <UseBlueprintToolInput>(); gameObject.GetComponent <UseBlueprintToolInput>().ParentTool = this; ToolMenu.Instance.PriorityScreen.Show(true); if (BlueprintsState.HasBlueprints()) { GridCompositor.Instance.ToggleMajor(true); } if (BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_RELOAD.IsActive()) { int oldBlueprintCount = BlueprintsState.LoadedBlueprints.Count; Utilities.ReloadBlueprints(true); int blueprintCountDelta = BlueprintsState.LoadedBlueprints.Count - oldBlueprintCount; PopFXManager.Instance.SpawnFX(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_LOADEDBLUEPRINTS), Mathf.Abs(blueprintCountDelta) + " " + (blueprintCountDelta >= 0 ? Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_LOADEDBLUEPRINTS_ADDITIONAL) : Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_LOADEDBLUEPRINTS_FEWER)), BlueprintsState.LoadedBlueprints.Count), null, PlayerController.GetCursorPos(KInputManager.GetMousePos()), BlueprintsAssets.BLUEPRINTS_CONFIG_FXTIME * 4); } if (BlueprintsState.HasBlueprints()) { BlueprintsState.VisualizeBlueprint(Grid.PosToXY(PlayerController.GetCursorPos(KInputManager.GetMousePos())), BlueprintsState.SelectedBlueprint); if (visualizer != null) { Destroy(visualizer); visualizer = null; } } else { CreateVisualizer(); } }
public override void UpdateHoverElements(List <KSelectable> hoveredObjects) { HoverTextScreen screenInstance = HoverTextScreen.Instance; HoverTextDrawer drawer = screenInstance.BeginDrawing(); drawer.BeginShadowBar(false); DrawTitle(screenInstance, drawer); drawer.NewLine(26); drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20); drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_CLICK), Styles_Instruction.Standard); drawer.AddIndent(8); drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20); drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_BACK), Styles_Instruction.Standard); drawer.NewLine(32); if (BlueprintsState.HasBlueprints()) { if (BlueprintsState.SelectedFolder.BlueprintCount > 0) { drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEFOLDERS), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLEFOLDER_UP.GetStringFormatted(), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLEFOLDER_DOWN.GetStringFormatted()), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEBLUEPRINTS), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLEBLUEPRINT_LEFT.GetStringFormatted(), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLEBLUEPRINT_RIGHT.GetStringFormatted()), Styles_Instruction.Standard); drawer.NewLine(32); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDERBLUEPRINT), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_FOLDER.GetStringFormatted()), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAMEBLUEPRINT), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_RENAME.GetStringFormatted()), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_DELETEBLUEPRINT), BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_DELETE.GetStringFormatted()), Styles_Instruction.Standard); if (PrefabErrorCount > 0) { drawer.NewLine(32); drawer.DrawIcon(screenInstance.GetSprite("iconWarning"), 18); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ERRORMESSAGE), PrefabErrorCount), Styles_Instruction.Selected); } drawer.NewLine(32); drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_SELECTEDBLUEPRINT), BlueprintsState.SelectedBlueprint.FriendlyName, BlueprintsState.SelectedFolder.SelectedBlueprintIndex + 1, BlueprintsState.SelectedFolder.BlueprintCount, BlueprintsState.SelectedFolder.Name, BlueprintsState.SelectedBlueprintFolderIndex + 1, BlueprintsState.LoadedBlueprints.Count), Styles_Instruction.Standard); } else { drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDEREMPTY), BlueprintsState.SelectedFolder.Name), Styles_Instruction.Standard); } } else { drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NOBLUEPRINTS), Styles_Instruction.Standard); } drawer.EndShadowBar(); drawer.EndDrawing(); }
public override void UpdateHoverElements(List <KSelectable> hoveredObjects) { HoverTextScreen screenInstance = HoverTextScreen.Instance; HoverTextDrawer drawer = screenInstance.BeginDrawing(); drawer.BeginShadowBar(); DrawTitle(screenInstance, drawer); drawer.NewLine(); drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20); drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_CLICK, Styles_Instruction.Standard); drawer.AddIndent(8); drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20); drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_BACK, Styles_Instruction.Standard); drawer.NewLine(32); if (BlueprintsState.HasBlueprints()) { if (BlueprintsState.SelectedFolder.BlueprintCount > 0) { drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEFOLDERS, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleFoldersNextAction.GetKAction()) + "]"), UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleFoldersPrevAction.GetKAction()) + "]")), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEBLUEPRINTS, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleBlueprintsNextAction.GetKAction()) + "]"), UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleBlueprintsPrevAction.GetKAction()) + "]")), Styles_Instruction.Standard); drawer.NewLine(32); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDERBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCreateFolderAction.GetKAction()) + "]")), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAMEBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsRenameAction.GetKAction()) + "]")), Styles_Instruction.Standard); drawer.NewLine(20); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_DELETEBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsDeleteAction.GetKAction()) + "]")), Styles_Instruction.Standard); if (prefabErrorCount > 0) { drawer.NewLine(32); drawer.DrawIcon(screenInstance.GetSprite("iconWarning")); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_ERRORMESSAGE, prefabErrorCount), Styles_Instruction.Selected); } drawer.NewLine(32); drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_SELECTEDBLUEPRINT, BlueprintsState.SelectedBlueprint.FriendlyName, BlueprintsState.SelectedFolder.SelectedBlueprintIndex + 1, BlueprintsState.SelectedFolder.BlueprintCount, BlueprintsState.SelectedFolder.Name, BlueprintsState.SelectedBlueprintFolderIndex + 1, BlueprintsState.LoadedBlueprints.Count), Styles_Instruction.Standard); } else { drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDEREMPTY, BlueprintsState.SelectedFolder.Name), Styles_Instruction.Standard); } } else { drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_USE_NOBLUEPRINTS, Styles_Instruction.Standard); } drawer.EndShadowBar(); drawer.EndDrawing(); }