コード例 #1
0
    public static void InpuptField(this CommandContainer _container, Ref <string> _refText1, Ref <string> _refText2, Action <string, string> OnValueClick)
    {
        CommandItem_InputField input1 = _container.Insert <CommandItem_InputField>();
        CommandItem_InputField input2 = _container.Insert <CommandItem_InputField>();

        input1.SetDataUpdate(() => input1.m_InputField.text = _refText1.m_RefValue);
        input2.SetDataUpdate(() => input2.m_InputField.text = _refText2.m_RefValue);
        input1.m_InputField.onValueChanged.AddListener(_refText1.SetValue);
        input2.m_InputField.onValueChanged.AddListener(_refText2.SetValue);
        _container.Button(() => OnValueClick(input1.m_InputField.text, input2.m_InputField.text));
    }
コード例 #2
0
    static T ButtonFoldOutItem <T>(this CommandContainer _container, bool foldOut, out CommandItem_Button _button) where T : CommandItemBase
    {
        _button = null;
        if (!foldOut)
        {
            return(_container.Insert <T>());
        }
        _button = _container.Insert <CommandItem_Button>();
        T item = _container.Insert <T>();

        _button.m_Button.onClick.AddListener(() => item.transform.SetActive(!item.transform.gameObject.activeSelf));
        item.transform.SetActive(false);
        return(item);
    }
コード例 #3
0
    public static CommandContainer Command(string _title, KeyCode _keyCode = KeyCode.None)
    {
        CommandContainer container = Instance.AddCommandLine(_keyCode);

        container.Insert <CommandItem_CommandTitle>().m_CommandTitle.text = _title;
        return(container);
    }
コード例 #4
0
    public static void Button(this CommandContainer _container, Action OnClick)
    {
        CommandItem_Button button = _container.Insert <CommandItem_Button>();

        button.m_Button.onClick.AddListener(() => OnClick());
        button.m_ButtonTitle.text = _container.m_KeyCode.GetKeyCodeString();
    }
コード例 #5
0
    public static void Toggle(this CommandContainer _container, Ref <bool> _refValue, Action <bool> OnToggleChange)
    {
        CommandItem_Toggle toggle = _container.Insert <CommandItem_Toggle>();

        toggle.SetDataUpdate(() => toggle.m_Toggle.isOn = _refValue.m_RefValue);
        toggle.m_Toggle.onValueChanged.AddListener(value => {
            _refValue.SetValue(value);
            OnToggleChange(value);
        });
        toggle.m_ToggleTitle.text = _container.m_KeyCode.GetKeyCodeString();
    }
コード例 #6
0
    public static void Slider(this CommandContainer _container, float _minValue, float _maxValue, Ref <float> _refValue, Action <float> _SetValue, string _format = "{0:0.0}", bool _wholeNumbers = false)
    {
        CommandItem_Slider slider = _container.Insert <CommandItem_Slider>();

        slider.m_Slider.wholeNumbers = _wholeNumbers;
        slider.m_Slider.minValue     = _minValue;
        slider.m_Slider.maxValue     = _maxValue;
        slider.SetDataUpdate(() => {
            float finalValue      = _refValue.m_RefValue;
            slider.m_Slider.value = finalValue;
            slider.m_Value.text   = string.Format(_format, finalValue);
        });
        slider.m_Slider.onValueChanged.AddListener(value => {
            slider.m_Value.text = string.Format(_format, value);
            _refValue.SetValue(value);
            _SetValue(value);
        });
    }