コード例 #1
0
    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));
    }
コード例 #2
0
 public static void Save(string name, MicrobeEditor state)
 {
     InternalSaveHelper(SaveInformation.SaveType.Manual, MainGameState.MicrobeEditor, save =>
     {
         save.SavedProperties = state.CurrentGame;
         save.MicrobeEditor   = state;
     }, () => state, name);
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
    public static void AutoSave(MicrobeEditor editor)
    {
        if (!Settings.Instance.AutoSaveEnabled)
        {
            return;
        }

        // TODO: implement
        _ = editor;
    }
コード例 #5
0
 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;
 }
コード例 #6
0
    /// <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);
    }
コード例 #7
0
    /// <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;
    }
コード例 #8
0
    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);
    }
コード例 #9
0
    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,
        });
    }
コード例 #10
0
    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));
    }
コード例 #11
0
    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;
    }
コード例 #12
0
 public void Init(MicrobeEditor editor)
 {
     this.editor = editor ?? throw new ArgumentNullException(nameof(editor));
 }