public void Init(MicrobeEditor editor) { this.editor = editor ?? throw new ArgumentNullException(nameof(editor)); // Fade out for that smooth satisfying transition TransitionManager.Instance.AddScreenFade(Fade.FadeType.FadeOut, 0.5f); TransitionManager.Instance.StartTransitions(editor, nameof(MicrobeEditor.OnFinishTransitioning)); }
public static void Save(string name, MicrobeEditor state) { InternalSaveHelper(SaveInformation.SaveType.Manual, MainGameState.MicrobeEditor, save => { save.SavedProperties = state.CurrentGame; save.MicrobeEditor = state; }, () => state, name); }
/// <summary> /// Quick save from the microbe editor /// </summary> /// <param name="state">Data to include in save</param> public static void QuickSave(MicrobeEditor state) { InternalSaveHelper(SaveInformation.SaveType.QuickSave, MainGameState.MicrobeEditor, save => { save.SavedProperties = state.CurrentGame; save.MicrobeEditor = state; }, () => state); }
public static void AutoSave(MicrobeEditor editor) { if (!Settings.Instance.AutoSaveEnabled) { return; } // TODO: implement _ = editor; }
public MicrobeEditorAction(MicrobeEditor editor, int cost, Action <MicrobeEditorAction> redo, Action <MicrobeEditorAction> undo, IMicrobeEditorActionData data = null) { this.editor = editor; Cost = cost; this.redo = redo; this.undo = undo; Data = data; }
/// <summary> /// Quick save from the microbe editor /// </summary> /// <param name="editor">Data to include in save</param> public static void QuickSave(MicrobeEditor editor) { var stopwatch = Stopwatch.StartNew(); var save = CreateSaveObject(MainGameState.MicrobeEditor, SaveInformation.SaveType.QuickSave); save.SavedProperties = editor.CurrentGame; save.MicrobeEditor = editor; PerformSave(save, SaveInformation.SaveType.QuickSave, stopwatch); }
/// <summary> /// Destroys the save game states. Use if not attaching the loaded save to the scene tree /// </summary> public void DestroyGameStates() { GameState = MainGameState.Invalid; MicrobeStage?.QueueFree(); MicrobeStage = null; MicrobeEditor?.QueueFree(); MicrobeEditor = null; }
public static void AutoSave(MicrobeEditor state) { if (!Settings.Instance.AutoSaveEnabled) { return; } InternalSaveHelper(SaveInformation.SaveType.AutoSave, MainGameState.MicrobeEditor, save => { save.SavedProperties = state.CurrentGame; save.MicrobeEditor = state; }, () => state); }
public void ApplyChanges(MicrobeEditor editor) { // Force some compound to be selected if (compounds.Selected == -1) { compounds.Selected = 0; } // TODO: make an undoable action storedOrganelle.SetCustomUpgradeObject(new ChemoreceptorUpgrades { TargetCompound = shownChoices[compounds.Selected], SearchRange = (float)maximumDistance.Value, SearchAmount = (float)minimumAmount.Value, LineColour = colour.Color, }); }
public void ApplyChanges(MicrobeEditor editor) { if (storedOrganelle == null || shownChoices == null) { GD.PrintErr("Chemoreceptor upgrade GUI was not opened properly"); return; } // Force some compound to be selected if (compounds.Selected == -1) { compounds.Selected = 0; } // TODO: make an undoable action storedOrganelle.SetCustomUpgradeObject(new ChemoreceptorUpgrades(shownChoices[compounds.Selected], (float)maximumDistance.Value, (float)minimumAmount.Value, colour.Color)); }
public void OpenForOrganelle(OrganelleTemplate organelle, string upgraderScene, MicrobeEditor editor) { var scene = GD.Load <PackedScene>(upgraderScene); if (scene == null) { GD.PrintErr($"Failed to load upgrader scene for organelle of type {organelle.Definition.InternalName}"); return; } var instance = scene.Instance(); upgrader = (IOrganelleUpgrader)instance; organelleSpecificContent.FreeChildren(); organelleSpecificContent.AddChild(instance); popup.PopupCenteredShrink(); scrollContainer.ScrollVertical = 0; upgrader.OnStartFor(organelle); storedEditor = editor; }
public void Init(MicrobeEditor editor) { this.editor = editor ?? throw new ArgumentNullException(nameof(editor)); }