Пример #1
0
    void OnPanelChange()
    {
        var panelSelected = PanelDropdownSelector.GetSelectedOption();
        var panel         = panels.Find(p => p.name == panelSelected);

        StartCoroutine("ChangePage", panel);
    }
Пример #2
0
    private void Awake()
    {
        optionsMapping = new Dictionary <string, Type>();

        dropDown.OnSelectedOptionChanged.AddListener(() =>
        {
            chosenType = optionsMapping[dropDown.GetSelectedOption()];
            DescriptionAttribute description = chosenType.GetCustomAttribute <DescriptionAttribute>();
            if (description != null)
            {
                descriptionDisplay.text = description.Description;
            }
        }
                                                     );

        Assembly ass = Assembly.GetAssembly(typeof(BaseValueAndColorGenerator));

        foreach (Type t in ass.GetTypes().Where(t => t.IsSubclassOf(typeof(BaseValueAndColorGenerator))))
        {
            string s = t.ToString();

            s = string.Concat(s.Select(x => char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' ');

            optionsMapping.Add(s, t);

            dropDown.AddOption(s);
        }
    }
    void OnOptionSelected()
    {
        //god is this f*****g ugly
        string s = colorDropDown.GetSelectedOption();

        int value = int.Parse(s);

        if (gen != null)
        {
            moveableTileInspected.ChangeColor(gen.ColorPicker.GetColor(value));
            selectedImage.color = gen.ColorPicker.GetColor(value);
            tilePlacer.UpdateValue(moveableTileInspected.GridPosition.ToVec2IntXY(), value);
        }
    }
Пример #4
0
    void OnOptionSelected()
    {
        string opt = dropDown.GetSelectedOption();

        if (typeMapping.ContainsKey(opt))
        {
            chosenType = typeMapping[opt];
            DescriptionAttribute att = chosenType.GetCustomAttribute <DescriptionAttribute>();
            if (att != null)
            {
                descriptionDisplay.text = att.Description;
            }
            SetupParseableContent();
        }
    }