Beispiel #1
0
        protected override void OnEnable()
        {
            base.OnEnable();

            ToggleButtonComponent = (QToggleButton)target;
            Normal = serializedObject.FindProperty("Normal");
            Choose = serializedObject.FindProperty("Choose");
        }
Beispiel #2
0
 private static void SetDefaultValue(QToggleButton component)
 {
     if (component == null)
     {
         return;
     }
     if (component.targetGraphic != null)
     {
         component.targetGraphic.raycastTarget = true;
     }
     component.SetToggleEditor(false);
 }
Beispiel #3
0
        public static new QToggleButton AddComponent()
        {
            QImageBox image = QImageBoxEditor.AddComponent();

            image.raycastTarget = true;

            QToggleButton component = Utility.GetOrAddCompoment <QToggleButton>(image.CacheGameObject);

            component.name = typeof(QToggleButton).Name.ToString();
            //设置默认值
            SetDefaultValue(component);
            return(component);
        }
        public static QToggleButtonGroup AddComponent()
        {
            QToggleButtonGroup component = UtilityEditor.ExtensionComponentWhenCreate <QToggleButtonGroup>(typeof(QToggleButtonGroup).Name.ToString());

            component.list.Clear();

            for (int i = 0; i < 2; i++)
            {
                Selection.activeObject = component;
                QToggleButton button = QToggleButtonEditor.AddComponent();
                component.list.Add(button);
            }
            Selection.activeObject = component;
            return(component);
        }
Beispiel #5
0
        public void OnGroup(int pre, int cur)
        {
            QLog.LogEditor(StringUtility.Format("点击pre = {0}, cur = {1}.", pre, cur));

            //设置所有组件的显示隐藏
            int length = list.Count;

            for (int i = 0; i < length; i++)
            {
                QToggleButton toggleButton = list[i];
                toggleButton.SetChoose(cur);
            }

            //设置组件的回调函数
            if (OnGroupAction != null)
            {
                OnGroupAction(pre, cur);
            }
        }
Beispiel #6
0
        public void SetData(int index, Action <int, int> OnGroupAction, bool doAction = false)
        {
            this.pre = -1;
            this.cur = -1;

            this.cur           = index;
            this.OnGroupAction = OnGroupAction;

            int length = list.Count;

            for (int i = 0; i < length; i++)
            {
                QToggleButton toggleButton = list[i];
                toggleButton.SetGroupData(i, index, OnGroup);
            }

            if (doAction)
            {
                OnGroup(pre, cur);
            }
        }