Exemplo n.º 1
0
        private void RenderSaveProfileMenu()
        {
            if (ImGui.BeginPopupModal("Save Profile", WindowFlags.AlwaysAutoResize))
            {
                currentFileName = ImGuiExtension.InputText("File Name", currentFileName, 100, InputTextFlags.AlwaysInsertMode);
                if (currentFileName != null && currentFileName.Length > 0)
                {
                    if (ImGui.Button("Save"))
                    {
                        BaseTreeRoutinePlugin <BuildYourOwnRoutineSettings, BaseTreeCache> .SaveSettingFile <Profile.LoadedProfile>(Plugin.ProfileDirectory + currentFileName, Plugin.Settings.LoadedProfile);

                        currentFileName = "";
                        ImGui.CloseCurrentPopup();
                    }
                    ImGui.SameLine();
                }

                if (ImGui.Button("Cancel"))
                {
                    currentFileName = "";
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
        }
Exemplo n.º 2
0
        private void RenderSaveProfileMenu()
        {
            if (ImGui.BeginPopupModal($"Save Profile", WindowFlags.AlwaysAutoResize))
            {
                currentFileName = ImGuiExtension.InputText("File Name", currentFileName, 100, InputTextFlags.AlwaysInsertMode);
                if (!String.IsNullOrEmpty(currentFileName))
                {
                    if (ImGui.Button("Save"))
                    {
                        LoadedProfile profileToSave = LoadSaveTrigger != null
                            ? new LoadedProfile()
                        {
                            Composite = LoadSaveTrigger
                        }
                            : Plugin.Settings.LoadedProfile;

                        BaseTreeRoutinePlugin <BuildYourOwnRoutineSettings, BaseTreeCache> .SaveSettingFile <Profile.LoadedProfile>(Plugin.ProfileDirectory + currentFileName, profileToSave);

                        currentFileName = "";
                        forceOpenSave   = false;
                        ImGui.CloseCurrentPopup();
                    }
                    ImGui.SameLine();
                }

                if (ImGui.Button("Cancel"))
                {
                    currentFileName = "";
                    forceOpenSave   = false;
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
        }
Exemplo n.º 3
0
        private void RenderLoadProfileMenu()
        {
            if (ImGui.BeginPopupModal("Load Profile", WindowFlags.AlwaysAutoResize))
            {
                string[] files = Directory.GetFiles(Plugin.ProfileDirectory);

                if (files == null || files.Length == 0)
                {
                    ImGui.Text("No profiles in profile directory.");
                    currentlySelectedProfile = -1;
                }
                else
                {
                    ImGui.Combo("Files", ref currentlySelectedProfile, files.Select(x => Path.GetFileName(x)).ToArray());
                }

                if (currentlySelectedProfile >= 0 && ImGui.Button("Load"))
                {
                    Profile.LoadedProfile loadedProfile = BaseTreeRoutinePlugin <BuildYourOwnRoutineSettings, BaseTreeCache> .LoadSettingFile <Profile.LoadedProfile>(files[currentlySelectedProfile]);

                    if (loadedProfile == null || loadedProfile.Name == null)
                    {
                        StartNewOKMenu("Profile did not load properly");
                    }
                    else
                    {
                        Plugin.Settings.LoadedProfile = loadedProfile;
                        Plugin.CreateAndStartTreeFromLoadedProfile();

                        currentlySelectedProfile = -1;
                        ImGui.CloseCurrentPopup();
                    }
                }
                // Render the menu from loading profile
                RenderOkMenu();

                if (ImGui.Button("Cancel"))
                {
                    currentlySelectedProfile = -1;
                    ImGui.CloseCurrentPopup();
                }

                ImGui.EndPopup();
            }
        }