private static void ModLocalizedHandler(string languageCode) { BlueprintsAssets.BLUEPRINTS_CREATE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( (string)Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_NAME), BlueprintsAssets.BLUEPRINTS_CREATE_ICON_NAME, BlueprintsAssets.BLUEPRINTS_CREATE_OPENTOOL.GetKAction(), BlueprintsAssets.BLUEPRINTS_CREATE_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_TOOLTIP), "{Hotkey}"), true ); BlueprintsAssets.BLUEPRINTS_USE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( (string)Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAME), BlueprintsAssets.BLUEPRINTS_USE_ICON_NAME, BlueprintsAssets.BLUEPRINTS_USE_OPENTOOL.GetKAction(), BlueprintsAssets.BLUEPRINTS_USE_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_TOOLTIP), "{Hotkey}"), true ); BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLCOLLECTION = ToolMenu.CreateToolCollection( (string)Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_NAME), BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_NAME, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_OPENTOOL.GetKAction(), BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_TOOLTIP), "{Hotkey}"), false ); }
public static void OnLoad() { Assembly currentAssembly = Assembly.GetExecutingAssembly(); string currentAssemblyDirectory = Path.GetDirectoryName(currentAssembly.Location); PliersAssets.PLIERS_PATH_CONFIGFILE = currentAssemblyDirectory + "/config.json"; PliersAssets.PLIERS_PATH_KEYCODESFILE = currentAssemblyDirectory + "/keycodes.txt"; IOUtilities.CreateKeycodeHintFile(); if (File.Exists(PliersAssets.PLIERS_PATH_CONFIGFILE)) { IOUtilities.ReadConfig(); } else { IOUtilities.CreateDefaultConfig(); } PliersAssets.PLIERS_ICON_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Pliers.image_wirecutter_button.dds"), 32, 32); PliersAssets.PLIERS_ICON_SPRITE.name = PliersAssets.PLIERS_ICON_NAME; PliersAssets.PLIERS_VISUALIZER_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Pliers.image_wirecutter_visualizer.dds"), 256, 256); PliersAssets.PLIERS_TOOLCOLLECTION = ToolMenu.CreateToolCollection(PliersAssets.PLIERS_NAME, PliersAssets.PLIERS_ICON_NAME, Action.NumActions, PliersAssets.PLIERS_TOOLNAME, PliersAssets.PLIERS_TOOLTIP, false); Debug.Log("Pliers Loaded: Version " + currentAssembly.GetName().Version); }
/// <summary> /// Applied after CreateBasicTools runs. /// </summary> /// <param name="__instance">The basic tool list.</param> internal static void Postfix(ToolMenu __instance) { PUtil.LogDebug("Adding BulkChangeTool to basic tools"); __instance.basicTools.Add(ToolMenu.CreateToolCollection(BulkChangeStrings. TOOL_TITLE, BulkChangeStrings.TOOL_ICON_NAME, BulkChangeAction.GetKAction(), typeof(BulkChangeTool).Name, BulkChangeStrings.TOOL_DESCRIPTION, false)); }
private static void ModLocalizedHandler(string languageCode) { BlueprintsAssets.BLUEPRINTS_CREATE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_NAME).String, BlueprintsAssets.BLUEPRINTS_CREATE_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_CREATE_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_TOOLTIP), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_CREATE)), true ); BlueprintsAssets.BLUEPRINTS_USE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAME).String, BlueprintsAssets.BLUEPRINTS_USE_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_USE_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_TOOLTIP), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_RELOAD)), true ); BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLCOLLECTION = ToolMenu.CreateToolCollection( Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_NAME).String, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLNAME, string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_TOOLTIP), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_SNAPSHOT)), false ); }
/// <summary> /// Applied after CreateBasicTools runs. /// </summary> internal static void Postfix(ToolMenu __instance) { var filteredSweep = ToolMenu.CreateToolCollection(STRINGS.UI.TOOLS. MARKFORSTORAGE.NAME, SweepByTypeStrings.TOOL_ICON_NAME, PUtil.TryParseEnum( "Clear", Action.Clear), nameof(FilteredClearTool), STRINGS.UI.TOOLTIPS. CLEARBUTTON, false); var tools = __instance.basicTools; int n = tools.Count; bool replaced = false; for (int i = 0; i < n && !replaced; i++) { // Replace by icon since it is a top level member if (tools[i].icon == "icon_action_store") { PUtil.LogDebug("Replacing sweep tool {0:D} with filtered sweep".F(i)); tools[i] = filteredSweep; replaced = true; } } // If no tool match found, log a warning if (!replaced) { PUtil.LogWarning("Could not install filtered sweep tool!"); } }
public static void Prefix(ToolMenu __instance) { __instance.basicTools.Add(ToolMenu.CreateToolCollection( BlueprintsStrings.STRING_BLUEPRINTS_CREATE_NAME, BlueprintsAssets.BLUEPRINTS_CREATE_ICON_NAME, BlueprintsCreateAction.GetKAction(), nameof(CreateBlueprintTool), string.Format(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_TOOLTIP, "{Hotkey}"), true )); __instance.basicTools.Add(ToolMenu.CreateToolCollection( BlueprintsStrings.STRING_BLUEPRINTS_USE_NAME, BlueprintsAssets.BLUEPRINTS_USE_ICON_NAME, BlueprintsUseAction.GetKAction(), typeof(UseBlueprintTool).Name, string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_TOOLTIP, "{Hotkey}"), true )); __instance.basicTools.Add(ToolMenu.CreateToolCollection( BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_NAME, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_NAME, BlueprintsSnapshotAction.GetKAction(), typeof(SnapshotTool).Name, string.Format(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_TOOLTIP, "{Hotkey}"), false )); Utilities.ReloadBlueprints(false); }
/// <summary> /// Applied after CreateSandBoxTools runs. /// </summary> internal static void Postfix(ToolMenu __instance) { if (!Enum.TryParse("SandboxDestroy", out Action destroyAction)) { destroyAction = Action.SandboxDestroy; } var filteredDestroy = ToolMenu.CreateToolCollection(SandboxToolsStrings. TOOL_DESTROY_NAME, SandboxToolsStrings.TOOL_DESTROY_ICON, destroyAction, nameof(FilteredDestroyTool), SandboxToolsStrings.TOOL_DESTROY_TOOLTIP, false); var tools = __instance.sandboxTools; int n = tools.Count; bool replaced = false; for (int i = 0; i < n && !replaced; i++) { // Replace by icon since it is a top level member if (tools[i].icon == "destroy") { PUtil.LogDebug("Replacing destroy tool {0:D} with filtered destroy". F(i)); tools[i] = filteredDestroy; replaced = true; } } // If no tool match found, log a warning if (!replaced) { PUtil.LogWarning("Could not install filtered destroy tool!"); } }
private static void ModLocalizedHandler(string languageCode) { PliersAssets.PLIERS_TOOLCOLLECTION = ToolMenu.CreateToolCollection( Strings.Get(PliersStrings.STRING_PLIERS_NAME).String, PliersAssets.PLIERS_ICON_NAME, Action.NumActions, PliersAssets.PLIERS_TOOLNAME, string.Format(Strings.Get(PliersStrings.STRING_PLIERS_TOOLTIP).String, PliersAssets.PLIERS_KEYBIND_TOOL.GetStringFormatted()), false ); }
private static void ModLocalizedHandler(string languageCode) { PliersAssets.PLIERS_TOOLCOLLECTION = ToolMenu.CreateToolCollection( (string)Strings.Get(PliersStrings.STRING_PLIERS_NAME), PliersAssets.PLIERS_ICON_NAME, PliersAssets.PLIERS_OPENTOOL.GetKAction(), PliersAssets.PLIERS_TOOLNAME, string.Format(Strings.Get(PliersStrings.STRING_PLIERS_TOOLTIP).String, "{Hotkey}"), false ); }
public static void Prefix(ToolMenu __instance) { __instance.basicTools.Add(ToolMenu.CreateToolCollection( PliersStrings.STRING_PLIERS_NAME, PliersAssets.PLIERS_ICON_NAME, PliersAssets.PLIERS_OPENTOOL.GetKAction(), PliersAssets.PLIERS_TOOLNAME, string.Format(PliersStrings.STRING_PLIERS_TOOLTIP, "{Hotkey}"), false )); }
internal static void Postfix() { ReadOptions(); var position = Mathf.Clamp(SandboxConduitToolSettings.Instance.ToolPosition, 0, ToolMenu.Instance.sandboxTools.Count); var name = SandboxConduitToolStrings.TOOL_NAME; var tooltip = SandboxConduitToolStrings.TOOL_TOOLTIP; var tc = ToolMenu.CreateToolCollection(name, "icon_action_empty_pipes", PAction.GetKAction(), nameof(SandboxConduitTool), tooltip, largeIcon: false); ToolMenu.Instance.sandboxTools.Insert(position, tc); }
internal static void Postfix(ToolMenu __instance) { ReadOptions(); var position = Mathf.Clamp(InspectToolSettings.Instance.ToolPosition, 0, __instance.basicTools.Count); var name = InspectToolStrings.TOOL_NAME; var tooltip = InspectToolStrings.TOOL_TOOLTIP; var largeIcon = InspectToolSettings.Instance.LargeIcon; var tc = ToolMenu.CreateToolCollection(name, InspectToolStrings.TOOL_ICON_SPRITE_NAME, PAction.GetKAction(), nameof(InspectTool), tooltip, largeIcon); __instance.basicTools.Insert(position, tc); }
public static void OnLoad() { Assembly currentAssembly = Assembly.GetExecutingAssembly(); string currentAssemblyDirectory = Path.GetDirectoryName(currentAssembly.Location); BlueprintsAssets.BLUEPRINTS_PATH_CONFIGFILE = currentAssemblyDirectory + "/config.json"; BlueprintsAssets.BLUEPRINTS_PATH_KEYCODESFILE = currentAssemblyDirectory + "/keycodes.txt"; IOUtilities.CreateKeycodeHintFile(); if (File.Exists(BlueprintsAssets.BLUEPRINTS_PATH_CONFIGFILE)) { IOUtilities.ReadConfig(); } else { IOUtilities.CreateDefaultConfig(); } BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_createblueprint_button.dds"), 32, 32); BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE.name = BlueprintsAssets.BLUEPRINTS_CREATE_ICON_NAME; BlueprintsAssets.BLUEPRINTS_CREATE_VISUALIZER_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_createblueprint_visualizer.dds"), 256, 256); BlueprintsAssets.BLUEPRINTS_USE_ICON_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_useblueprint_button.dds"), 32, 32); BlueprintsAssets.BLUEPRINTS_USE_ICON_SPRITE.name = BlueprintsAssets.BLUEPRINTS_USE_ICON_NAME; BlueprintsAssets.BLUEPRINTS_USE_VISUALIZER_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_useblueprint_visualizer.dds"), 256, 256); BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_snapshot_button.dds"), 32, 32); BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_SPRITE.name = BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_NAME; BlueprintsAssets.BLUEPRINTS_SNAPSHOT_VISUALIZER_SPRITE = Utilities.CreateSpriteDXT5(Assembly.GetExecutingAssembly().GetManifestResourceStream("Blueprints.image_snapshot_visualizer.dds"), 256, 256); BlueprintsAssets.BLUEPRINTS_CREATE_TOOLCOLLECTION = ToolMenu.CreateToolCollection(BlueprintsAssets.BLUEPRINTS_CREATE_NAME, BlueprintsAssets.BLUEPRINTS_CREATE_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_CREATE_TOOLNAME, BlueprintsAssets.BLUEPRINTS_CREATE_TOOLTIP, true); BlueprintsAssets.BLUEPRINTS_USE_TOOLCOLLECTION = ToolMenu.CreateToolCollection(BlueprintsAssets.BLUEPRINTS_USE_NAME, BlueprintsAssets.BLUEPRINTS_USE_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_USE_TOOLNAME, BlueprintsAssets.BLUEPRINTS_USE_TOOLTIP, true); BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLCOLLECTION = ToolMenu.CreateToolCollection(BlueprintsAssets.BLUEPRINTS_SNAPSHOT_NAME, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_NAME, Action.NumActions, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLNAME, BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLTIP, false); Debug.Log("Blueprints Loaded: Version " + currentAssembly.GetName().Version); }
public static void Postfix(PlayerController __instance) { List <InterfaceTool> interfaceTools = new List <InterfaceTool>(__instance.tools); GameObject afmCancelTool = new GameObject(AdvancedFiltrationAssets.ADVANCEDFILTERMENU_CANCEL_TOOLNAME, typeof(AdvancedFilterMenuCancelTool)); afmCancelTool.transform.SetParent(__instance.gameObject.transform); afmCancelTool.gameObject.SetActive(true); afmCancelTool.gameObject.SetActive(false); interfaceTools.Add(afmCancelTool.GetComponent <InterfaceTool>()); GameObject afmDeconstructTool = new GameObject(AdvancedFiltrationAssets.ADVANCEDFILTERMENU_DECONSTRUCT_TOOLNAME, typeof(AdvancedFilterMenuDeconstructTool)); afmDeconstructTool.transform.SetParent(__instance.gameObject.transform); afmDeconstructTool.gameObject.SetActive(true); afmDeconstructTool.gameObject.SetActive(false); interfaceTools.Add(afmDeconstructTool.GetComponent <InterfaceTool>()); GameObject afmPrioritizeTool = new GameObject(AdvancedFiltrationAssets.ADVANCEDFILTERMENU_PRIORITIZE_TOOLNAME, typeof(AdvancedFilterMenuPrioritizeTool)); afmPrioritizeTool.transform.SetParent(__instance.gameObject.transform); afmPrioritizeTool.gameObject.SetActive(true); afmPrioritizeTool.gameObject.SetActive(false); interfaceTools.Add(afmPrioritizeTool.GetComponent <InterfaceTool>()); GameObject afmEmptyPipeTool = new GameObject(AdvancedFiltrationAssets.ADVANCEDFILTERMENU_EMPTYPIPE_TOOLNAME, typeof(AdvancedFilterMenuEmptyPipeTool)); afmEmptyPipeTool.transform.SetParent(__instance.gameObject.transform); afmEmptyPipeTool.gameObject.SetActive(true); afmEmptyPipeTool.gameObject.SetActive(false); interfaceTools.Add(afmEmptyPipeTool.GetComponent <InterfaceTool>()); __instance.tools = interfaceTools.ToArray(); AdvancedFiltrationAssets.ADVANCEDFILTERMENU_CANCEL_TOOLCOLLECTION = ToolMenu.CreateToolCollection( STRINGS.UI.TOOLS.CANCEL.NAME, "icon_action_cancel", Action.BuildingCancel, AdvancedFiltrationAssets.ADVANCEDFILTERMENU_CANCEL_TOOLNAME, STRINGS.UI.TOOLTIPS.CANCELBUTTON, true ); AdvancedFiltrationAssets.ADVANCEDFILTERMENU_DECONSTRUCT_TOOLCOLLECTION = ToolMenu.CreateToolCollection( STRINGS.UI.TOOLS.DECONSTRUCT.NAME, "icon_action_deconstruct", Action.BuildingDeconstruct, AdvancedFiltrationAssets.ADVANCEDFILTERMENU_DECONSTRUCT_TOOLNAME, STRINGS.UI.TOOLTIPS.DECONSTRUCTBUTTON, true ); AdvancedFiltrationAssets.ADVANCEDFILTERMENU_PRIORITIZE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( STRINGS.UI.TOOLS.PRIORITIZE.NAME, "icon_action_prioritize", Action.Prioritize, AdvancedFiltrationAssets.ADVANCEDFILTERMENU_PRIORITIZE_TOOLNAME, STRINGS.UI.TOOLTIPS.PRIORITIZEBUTTON, true ); AdvancedFiltrationAssets.ADVANCEDFILTERMENU_EMPTYPIPE_TOOLCOLLECTION = ToolMenu.CreateToolCollection( STRINGS.UI.TOOLS.EMPTY_PIPE.NAME, "icon_action_empty_pipes", Action.EmptyPipe, AdvancedFiltrationAssets.ADVANCEDFILTERMENU_EMPTYPIPE_TOOLNAME, STRINGS.UI.TOOLS.EMPTY_PIPE.TOOLTIP, false ); AdvancedFiltrationAssets.Options = POptions.ReadSettings <AdvancedFilterMenuOptions>() ?? new AdvancedFilterMenuOptions(); AdvancedFilterMenuCancelTool.Instance.OverlaySynced = AdvancedFiltrationAssets.Options.CancelToolSync; AdvancedFilterMenuDeconstructTool.Instance.OverlaySynced = AdvancedFiltrationAssets.Options.DeconstructToolSync; AdvancedFilterMenuPrioritizeTool.Instance.OverlaySynced = AdvancedFiltrationAssets.Options.PrioritizeSync; AdvancedFilterMenuEmptyPipeTool.Instance.OverlaySynced = AdvancedFiltrationAssets.Options.EmptyPipeSync; }