Exemplo n.º 1
0
        public void AddOption(PanelBuilder panel)
        {
            if (type == "bool")
            {
                panel.AddCheckbox(Bool(), Name(), s => { SetValue(Convert.ToString(s)); });
                return;
            }

            if (type.StartsWith("scale"))
            {
                panel.AddHeaderLabel(Name());
                var t = SplitHelper.SeparatorInt(SplitHelper.Delimiter(type).value);
                panel.AddSlider(t[0], t[1], PlayerPrefs.GetInt(id, Int32.Parse(Value())), s =>
                {
                    SetValue(s.ToString());
                });
                return;
            }

            if (type == "text")
            {
                panel.AddInput(Name(), Value(), SetValue);
            }

            if (type.StartsWith("dropdown"))
            {
                var           values = SplitHelper.Separator(SplitHelper.Delimiter(type).value);
                List <string> titles = new List <string>();
                foreach (var value in values)
                {
                    titles.Add(S.T(value));
                }
                panel.AddHeaderLabel(Name());
                panel.AddDropdown(values, Value(), titles.ToArray(), SetValue);
            }
        }