//private Utilities.HookKeys keysHook; //private bool notFirstCallBack = false; public MainForm(MainControler mainControler, Config config, string appName) { InitializeComponent(); this.Text = appName; this.mainControler = mainControler; statusTimer.Enabled = false; statusTimer.Tick += new EventHandler(StatusTimerEvent); mainControler.LayerManager.FirstLayerAdded += new LayerManager.LayerAddedDelegate(LayerManager_FirstLayerAdded); mainControler.LayerManager.LayerAdded += new LayerManager.LayerAddedDelegate(layerAdded); mainControler.LayerManager.LayerChanged += new LayerManager.LayerChangedDelegate(LayerManager_LayerChanged); mainControler.SettingsLoaded += new MainControler.SettingsLoadedDelegate(mainControler_SettingsLoaded); this.config = config; // Menus toolMenu = new ToolMenu(this); drawMenu = new DrawMenu(this); fileMenu = new FileMenu(mainControler); addMenu = new AddMenu(mainControler); undoMenu = new UndoMenu(mainControler); this.layerListView.ContextMenu = new LayerMenu(this); ToolbarMaker.DisplayResolution = mainControler.DisplayResolution; //this.keysHook = new GravurGIS.Utilities.HookKeys(); //this.keysHook.HookEvent += new HookKeys.HookEventHandler(keysHook_HookEvent); //this.keysHook.Start(); }
public static void Postfix(ToolMenu __instance) { for (int i = 0; i < __instance.basicTools.Count; ++i) { if (__instance.basicTools[i].text == "Cancel") { __instance.basicTools[i] = AdvancedFiltrationAssets.ADVANCEDFILTERMENU_CANCEL_TOOLCOLLECTION; } if (__instance.basicTools[i].text == "Deconstruct") { __instance.basicTools[i] = AdvancedFiltrationAssets.ADVANCEDFILTERMENU_DECONSTRUCT_TOOLCOLLECTION; } if (__instance.basicTools[i].text == "Priority") { __instance.basicTools[i] = AdvancedFiltrationAssets.ADVANCEDFILTERMENU_PRIORITIZE_TOOLCOLLECTION; } if (__instance.basicTools[i].text == "Empty Pipe") { __instance.basicTools[i] = AdvancedFiltrationAssets.ADVANCEDFILTERMENU_EMPTYPIPE_TOOLCOLLECTION; } } }
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 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); }
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 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!"); } }
/// <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)); }
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); }
private void NameBoxESP() { for (var P = 0; P < Provider.clients.ToArray().Length; P++) { var newPlayerSteam = Provider.clients.ToArray()[P]; if ((newPlayerSteam != null) && !newPlayerSteam.player.life.isDead) { var camera = Camera.main; var location = newPlayerSteam.player.transform.position; var vector3 = camera.WorldToScreenPoint(location); if (vector3.z > 0) { float DiffrentPlayerDistance = (float)Math.Round(ToolMenu.GetDistance(newPlayerSteam.player.gameObject.transform.position), 0); if (DiffrentPlayerDistance > 2) { if (DiffrentPlayerDistance <= EspDistance) { var vector2 = Camera.main.WorldToScreenPoint(location + new Vector3(0f, 1.7f, 0f)); var y = Mathf.Abs((float)(vector3.y - vector2.y)); var x = y / 2f; Esp.DrawBox(new Vector2(vector2.x - (x / 2f), Screen.height - vector2.y), new Vector2(x, y), 1f, Color.red); Esp.DrawString(new Vector2(vector3.x, Screen.height - vector3.y), string.Format("{0} [{1}M]", newPlayerSteam.playerID.playerName, DiffrentPlayerDistance), Color.red, true, 12); } } } } } }
/// <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 Postfix(ToolMenu __instance, List <Sprite> ___icons) { __instance.gameObject.AddComponent <ToolMenuInputManager>(); ___icons.Add(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE); ___icons.Add(BlueprintsAssets.BLUEPRINTS_USE_ICON_SPRITE); ___icons.Add(BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_SPRITE); }
public static void Prefix(ToolMenu __instance) { __instance.basicTools.Add(BlueprintsAssets.BLUEPRINTS_CREATE_TOOLCOLLECTION); __instance.basicTools.Add(BlueprintsAssets.BLUEPRINTS_USE_TOOLCOLLECTION); __instance.basicTools.Add(BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLCOLLECTION); Utilities.ReloadBlueprints(false); }
// Use this for initialization void Start() { Debug.Log(QualitySettings.GetQualityLevel().ToString()); if (QualitySettings.GetQualityLevel() >= 4) { Debug.Log("CaptureRes: 2048"); captureResolution = 1024; } if (QualitySettings.GetQualityLevel() == 5) { Debug.Log("CaptureAA: 2"); captureAASetting = 2; } else if (QualitySettings.GetQualityLevel() > 5) { Debug.Log("CaptureAA: 4"); captureAASetting = 1; } _toolMenu = GetComponent <ToolMenu>(); captureCamera = transform.Find("CaptureCamera").GetComponent <Camera>(); captureTexture = new Texture2D(captureResolution, captureResolution, TextureFormat.ARGB32, true); captureRenderer = captureTarget.GetComponent <MeshRenderer>(); renderTexturePool = new RenderTexture[2]; for (int i = 0; i < 2; ++i) { renderTexturePool[i] = new RenderTexture(captureResolution, captureResolution, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default); renderTexturePool[i].antiAliasing = captureAASetting; renderTexturePool[i].Create(); } splineTool = new SplineTool(this, _splineRenderTarget, _line, circleCursor); splineTool.SetSplineJaggedness(false); stampTool = new StampTool(this, _stampPrefab); meterTool = new MeterTool(this, _line, meterCursor); eraserTool = new EraserTool(this, eraserSprite, eraserCursor); activeTool = splineTool; activeTool.Activate(); float mapWHratio = 16.0f / 9.0f; int screenWidth = Screen.width; screenWidth -= screenWidth / 20; screenWidth = (int)Mathf.Min(captureResolution * 1.25f, screenWidth); int height = (int)(screenWidth / mapWHratio); UIImageTransform.sizeDelta = new Vector2(screenWidth, height); backups = new Color32[backupCount][]; for (int i = 0; i < backupCount; ++i) { backups[i] = new Color32[captureResolution * captureResolution]; } }
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); }
//如果点击的是工具菜单按钮 private void FrmMain_SysBottomClick(object sender, SysButtonEventArgs e) { Point l = PointToScreen(e.SysButton.Location); l.Y += e.SysButton.Size.Height + 1; switch (e.SysButton.Name) { case "SysTool": ToolMenu.Show(l); break; case "SysMsg": FrmFeedBack frmFeedBack = new FrmFeedBack(); frmFeedBack.ShowDialog(); break; default: break; } }
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(ToolMenu __instance, List <Sprite> ___icons) { ___icons.Add(BlueprintsAssets.BLUEPRINTS_CREATE_ICON_SPRITE); ___icons.Add(BlueprintsAssets.BLUEPRINTS_USE_ICON_SPRITE); ___icons.Add(BlueprintsAssets.BLUEPRINTS_SNAPSHOT_ICON_SPRITE); }
public static void Postfix(ToolMenu __instance, List <Sprite> ___icons) { ___icons.Add(PliersAssets.PLIERS_ICON_SPRITE); }
public static void Prefix(ToolMenu __instance) { __instance.basicTools.Add(PliersAssets.PLIERS_TOOLCOLLECTION); }
public static void Postfix(ToolMenu __instance, List <Sprite> ___icons) { __instance.gameObject.AddComponent <ToolMenuInputManager>(); ___icons.Add(PliersAssets.PLIERS_ICON_SPRITE); }
public static void Postfix(ToolMenu __instance, List <Sprite> ___icons) { ___icons.Add(InspectToolAssets.InspectToolIcon); }
private void ResetProps() { ToolsList = new ObservableCollection <ToolMenu>(); CurrentSelectedTool = new ToolMenu(); ContentData = new ObservableCollection <View>(); }
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; }
public static ToolMenu SetCommand(this ToolMenu toolsMenu, Command command) { toolsMenu.Command = command; return(toolsMenu); }