Пример #1
0
 /// <summary>
 /// Triggered when the Mod Options button is clicked.
 /// </summary>
 public void OnModOptions(GameObject _)
 {
     if (path != null)
     {
         // Close current dialog if open
         CloseDialog();
         // Ensure that it is on top of other screens (which may be +100 modal)
         var pDialog = new PDialog("ModOptions")
         {
             Title = POptions.DIALOG_TITLE.text.F(modSpec.title), Size = POptions.
                                                                         SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors.
                                                                                                                                   OptionsBackground, DialogClosed = OnOptionsSelected
         }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, POptions.TOOLTIP_OK).
         AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL,
                   POptions.TOOLTIP_CANCEL);
         // For each option, add its UI component to panel
         pDialog.Body.Spacing   = 3;
         pDialog.Body.BackColor = PUITuning.Colors.DialogDarkBackground;
         foreach (var entry in optionEntries)
         {
             pDialog.Body.AddChild(entry.GetUIEntry());
         }
         options = POptions.ReadSettings(path, optionsType);
         if (options == null)
         {
             CreateOptions();
         }
         // Manually build the dialog so the options can be updated after realization
         var obj = pDialog.Build();
         UpdateOptions();
         dialog = obj.GetComponent <KScreen>();
         dialog.Activate();
     }
 }
Пример #2
0
 /// <summary>
 /// Triggered when the Mod Options button is clicked.
 /// </summary>
 public void OnModOptions(GameObject _)
 {
     if (path != null)
     {
         // Close current dialog if open
         CloseDialog();
         // Ensure that it is on top of other screens (which may be +100 modal)
         var pDialog = new PDialog("ModOptions")
         {
             Title = POptions.DIALOG_TITLE.text.F(modSpec.title), Size = POptions.
                                                                         SETTINGS_DIALOG_SIZE, SortKey = 150.0f, DialogBackColor = PUITuning.Colors.
                                                                                                                                   OptionsBackground, DialogClosed = OnOptionsSelected
         }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, POptions.TOOLTIP_OK);
         pDialog.AddButton("manual", POptions.BUTTON_MANUAL, POptions.TOOLTIP_MANUAL).
         AddButton(PDialog.DIALOG_KEY_CLOSE, STRINGS.UI.CONFIRMDIALOG.CANCEL,
                   POptions.TOOLTIP_CANCEL);
         PPanel body = pDialog.Body, current;
         var    margin = body.Margin;
         // For each option, add its UI component to panel
         body.Spacing = 10;
         body.Margin  = new RectOffset(0, 0, 0, 0);
         // Display all categories
         foreach (var catEntries in optionCategories)
         {
             string category = catEntries.Key;
             current = new PPanel("Entries_" + category)
             {
                 Alignment = TextAnchor.UpperCenter, Spacing = 5,
                 BackColor = PUITuning.Colors.DialogDarkBackground,
                 FlexSize  = new Vector2(1.0f, 0.0f), Margin = margin
             };
             AddCategoryHeader(current, catEntries.Key);
             foreach (var entry in catEntries.Value)
             {
                 current.AddChild(entry.GetUIEntry());
             }
             body.AddChild(current);
         }
         options = POptions.ReadSettings(path, optionsType);
         if (options == null)
         {
             CreateOptions();
         }
         // Manually build the dialog so the options can be updated after realization
         var obj = pDialog.Build();
         UpdateOptions();
         dialog = obj.GetComponent <KScreen>();
         dialog.Activate();
     }
 }
Пример #3
0
        /// <summary>
        /// Triggered when the Mod Options button is clicked.
        /// </summary>
        public void ShowDialog()
        {
            string title;

            if (string.IsNullOrEmpty(displayInfo.Title))
            {
                title = PLibStrings.BUTTON_OPTIONS;
            }
            else
            {
                title = string.Format(PLibStrings.DIALOG_TITLE, OptionsEntry.LookInStrings(
                                          displayInfo.Title));
            }
            // Close current dialog if open
            CloseDialog();
            // Ensure that it is on top of other screens (which may be +100 modal)
            var pDialog = new PDialog("ModOptions")
            {
                Title              = title, Size = SETTINGS_DIALOG_SIZE, SortKey = 150.0f,
                DialogBackColor    = PUITuning.Colors.OptionsBackground,
                DialogClosed       = OnOptionsSelected, MaxSize = SETTINGS_DIALOG_MAX_SIZE,
                RoundToNearestEven = true
            }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, PLibStrings.TOOLTIP_OK,
                        PUITuning.Colors.ButtonPinkStyle).AddButton(PDialog.DIALOG_KEY_CLOSE,
                                                                    STRINGS.UI.CONFIRMDIALOG.CANCEL, PLibStrings.TOOLTIP_CANCEL,
                                                                    PUITuning.Colors.ButtonBlueStyle);

            options = POptions.ReadSettings(POptions.GetConfigFilePath(optionsType),
                                            optionsType);
            if (options == null)
            {
                options = CreateOptions(optionsType);
            }
            AddModInfoScreen(pDialog);
            FillModOptions(pDialog);
            // Manually build the dialog so the options can be updated after realization
            var obj = pDialog.Build();

            UpdateOptions();
            dialog = obj.GetComponent <KScreen>();
            dialog.Activate();
        }
Пример #4
0
 /// <summary>
 /// Triggered when the Mod Options button is clicked.
 /// </summary>
 public void OnModOptions(GameObject _)
 {
     if (path != null)
     {
         string title = handler.GetTitle(OptionsEntry.LookInStrings(infoAttr?.Title));
         if (string.IsNullOrEmpty(title))
         {
             title = PUIStrings.BUTTON_OPTIONS;
         }
         // Close current dialog if open
         CloseDialog();
         // Ensure that it is on top of other screens (which may be +100 modal)
         var pDialog = new PDialog("ModOptions")
         {
             Title              = title, Size = SETTINGS_DIALOG_SIZE, SortKey = 150.0f,
             DialogBackColor    = PUITuning.Colors.OptionsBackground,
             DialogClosed       = OnOptionsSelected, MaxSize = SETTINGS_DIALOG_MAX_SIZE,
             RoundToNearestEven = true
         }.AddButton("ok", STRINGS.UI.CONFIRMDIALOG.OK, PUIStrings.TOOLTIP_OK,
                     PUITuning.Colors.ButtonPinkStyle).AddButton(PDialog.DIALOG_KEY_CLOSE,
                                                                 STRINGS.UI.CONFIRMDIALOG.CANCEL, PUIStrings.TOOLTIP_CANCEL,
                                                                 PUITuning.Colors.ButtonBlueStyle);
         options = POptions.ReadSettings(path, optionsType);
         if (options == null)
         {
             CreateOptions();
         }
         if (infoAttr != null)
         {
             AddModInfoScreen(pDialog);
         }
         FillModOptions(pDialog);
         // Manually build the dialog so the options can be updated after realization
         var obj = pDialog.Build();
         UpdateOptions();
         dialog = obj.GetComponent <KScreen>();
         dialog.Activate();
     }
 }