Ejemplo 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();
                });
            }
        }
Ejemplo n.º 2
0
        void render_panel(Panel p, ConfigureSetup setup, int selected_i, int setup_i)
        {
            // generate details, just once
            // note: details were once elegantly serialized among all the other setup data,
            //       see comment inside generate_details() to understand why this was necessary instead
            setup.generate_details(this);

            // render panel title
            // only allow reconfiguration if there are more setups than slots
            if (unlocked.Count <= selected.Count)
            {
                p.section(setup.name);
            }
            else
            {
                string desc = setup.desc.Length > 0 ? Lib.BuildString("<i>", setup.desc, "</i>") : string.Empty;
                p.section(setup.name, desc, () => change_setup(-1, selected_i, ref setup_i), () => change_setup(1, selected_i, ref setup_i));
            }

            // render details
            foreach (var det in setup.details)
            {
                p.content(det.label, det.value);
            }
        }
Ejemplo n.º 3
0
        void Render_panel(Panel p, ConfigureSetup setup, int selected_i, int setup_i)
        {
            // generate details, just once
            // note: details were once elegantly serialized among all the other setup data,
            //       see comment inside generate_details() to understand why this was necessary instead
            setup.Generate_details(this);

            // render panel title
            // only allow reconfiguration if there are more setups than slots
            if (unlocked.Count <= selected.Count)
            {
                p.AddSection(Lib.Ellipsis(setup.name, Styles.ScaleStringLength(70)), setup.desc);
            }
            else
            {
                p.AddSection(Lib.Ellipsis(setup.name, Styles.ScaleStringLength(70)), setup.desc, () => Change_setup(-1, selected_i, ref setup_i), () => Change_setup(1, selected_i, ref setup_i));
            }

            // render details
            foreach (var det in setup.details)
            {
                p.AddContent(det.label, det.value);
            }
        }