Esempio n. 1
0
        void commit_panel(ConfigureSetup setup, int selected_i, int setup_i)
        {
            // create panel section
            PanelSection ps = new PanelSection(setup.name);

            ps.add(Lib.BuildString("<i>", setup.desc.Length > 0 ? setup.desc : "no description available", "</i>"));
            foreach (var det in setup.details)
            {
                ps.add(det.label, det.value);
            }

            // commit it
            if (Lib.SceneIsGame() || unlocked.Count <= selected.Count)
            {
                window.add(ps);
            }
            else
            {
                window.add(ps, (int i) =>
                {
                    do
                    {
                        setup_i = (setup_i + unlocked.Count + i) % unlocked.Count;
                    }while(selected.Contains(unlocked[setup_i].name));

                    // update selected
                    selected[selected_i] = unlocked[setup_i].name;

                    // reconfigure
                    configure();
                });
            }
        }
Esempio n. 2
0
        void render_section(int i)
        {
            PanelSection section = sections[i];
            Action <int> click   = clicks[i];

            GUILayout.BeginHorizontal(title_container_style);
            if (click == null)
            {
                GUILayout.Label(section.title, title_label_style);
            }
            else
            {
                GUILayout.Label(arrow_left, title_icon_left_style);
                if (Lib.IsClicked())
                {
                    click(-1);
                }
                GUILayout.Label(section.title, title_label_style);
                GUILayout.Label(arrow_right, title_icon_right_style);
                if (Lib.IsClicked())
                {
                    click(1);
                }
            }
            GUILayout.EndHorizontal();

            foreach (PanelEntry entry in section.entries)
            {
                GUILayout.BeginHorizontal(row_style);
                GUILayout.Label(entry.label, label_style);
                GUILayout.Label(entry.value, value_style);
                if (entry.func != null && Lib.IsClicked())
                {
                    entry.func();
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.Space(10.0f);
        }
Esempio n. 3
0
 public void add(PanelSection section, Action <int> click = null)
 {
     sections.Add(section);
     clicks.Add(click);
 }