public static void ReloadBlueprints(bool ingame) { BlueprintsState.LoadedBlueprints.Clear(); string[] blueprintFiles = Directory.GetFiles(GetBlueprintDirectory()); foreach (string blueprintFile in blueprintFiles) { if (blueprintFile.EndsWith(".blueprint") || blueprintFile.EndsWith(".json")) { Blueprint blueprint = new Blueprint(blueprintFile); if (blueprint.ReadBinary() && !blueprint.IsEmpty()) { BlueprintsState.LoadedBlueprints.Add(blueprint); } else if (blueprint.ReadJSON() && !blueprint.IsEmpty()) { BlueprintsState.LoadedBlueprints.Add(blueprint); } } } if (ingame && BlueprintsState.LoadedBlueprints.Count > 0) { BlueprintsState.SelectedBlueprintIndex = 0; BlueprintsState.ClearVisuals(); BlueprintsState.VisualizeBlueprint(Grid.PosToXY(PlayerController.GetCursorPos(KInputManager.GetMousePos())), BlueprintsState.SelectedBlueprint); } }
protected override void OnDeactivateTool(InterfaceTool newTool) { base.OnDeactivateTool(newTool); BlueprintsState.ClearVisuals(); ToolMenu.Instance.PriorityScreen.Show(false); GridCompositor.Instance.ToggleMajor(false); }
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); } }
public void DeleteBlueprint() { blueprint = null; gameObject.GetComponent <SnapshotToolHoverCard>().UsingSnapshot = false; ToolMenu.Instance.toolParameterMenu.gameObject.SetActive(true); ToolMenu.Instance.PriorityScreen.Show(false); BlueprintsState.ClearVisuals(); CreateVisualizer(); }
protected override void OnDeactivateTool(InterfaceTool newTool) { base.OnDeactivateTool(newTool); BlueprintsState.ClearVisuals(); blueprint = null; ToolMenu.Instance.toolParameterMenu.gameObject.SetActive(true); ToolMenu.Instance.PriorityScreen.Show(false); GridCompositor.Instance.ToggleMajor(false); }
protected override void OnDeactivateTool(InterfaceTool newTool) { base.OnDeactivateTool(newTool); if (gameObject.GetComponent <UseBlueprintToolInput>() != null) { Destroy(gameObject.GetComponent <UseBlueprintToolInput>()); } BlueprintsState.ClearVisuals(); ToolMenu.Instance.PriorityScreen.Show(false); }
public void DeleteBlueprint() { blueprint = null; gameObject.GetComponent <SnapshotToolHoverCard>().UsingSnapshot = false; MultiToolParameterMenu.Instance.PopulateMenu(DefaultParameters); MultiToolParameterMenu.Instance.ShowMenu(); ToolMenu.Instance.PriorityScreen.Show(false); BlueprintsState.ClearVisuals(); CreateVisualizer(); }
protected override void OnDeactivateTool(InterfaceTool newTool) { base.OnDeactivateTool(newTool); if (gameObject.GetComponent <SnapshotToolInput>() != null) { Destroy(gameObject.GetComponent <SnapshotToolInput>()); } BlueprintsState.ClearVisuals(); blueprint = null; ToolMenu.Instance.toolParameterMenu.gameObject.SetActive(true); ToolMenu.Instance.PriorityScreen.Show(false); }
public void Update() { if ((ParentTool?.hasFocus ?? false) && BlueprintsState.LoadedBlueprints.Count > 0) { bool blueprintChanged = false; if (Input.GetKeyDown(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_RENAME)) { FileNameDialog blueprintNameDialog = Utilities.CreateBlueprintRenameDialog(); SpeedControlScreen.Instance.Pause(false); blueprintNameDialog.onConfirm = delegate(string blueprintName) { BlueprintsState.SelectedBlueprint.Rename(blueprintName.Substring(0, blueprintName.Length - 4)); BlueprintsState.SelectedBlueprint.Write(); blueprintNameDialog.Deactivate(); SpeedControlScreen.Instance.Unpause(false); }; blueprintNameDialog.Activate(); } else if (Input.GetKeyDown(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_DELETE)) { BlueprintsState.SelectedBlueprint.DeleteFile(); BlueprintsState.LoadedBlueprints.RemoveAt(BlueprintsState.SelectedBlueprintIndex); if (BlueprintsState.SelectedBlueprintIndex >= BlueprintsState.LoadedBlueprints.Count) { BlueprintsState.SelectedBlueprintIndex = BlueprintsState.LoadedBlueprints.Count - 1; } blueprintChanged = true; } if (BlueprintsState.LoadedBlueprints.Count > 1) { if (Input.GetKeyDown(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLELEFT)) { if (--BlueprintsState.SelectedBlueprintIndex < 0) { BlueprintsState.SelectedBlueprintIndex = BlueprintsState.LoadedBlueprints.Count - 1; } blueprintChanged = true; } else if (Input.GetKeyDown(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLERIGHT)) { if (++BlueprintsState.SelectedBlueprintIndex >= BlueprintsState.LoadedBlueprints.Count) { BlueprintsState.SelectedBlueprintIndex = 0; } blueprintChanged = true; } } if (blueprintChanged) { BlueprintsState.ClearVisuals(); if (BlueprintsState.LoadedBlueprints.Count > 0) { BlueprintsState.VisualizeBlueprint(Grid.PosToXY(PlayerController.GetCursorPos(KInputManager.GetMousePos())), BlueprintsState.SelectedBlueprint); } else { UseBlueprintTool.Instance.CreateVisualizer(); } } } }