Beispiel #1
0
        protected bool DoGUIStrandard(GUIFunc func)
        {
            var customLabel = GetCustomLabel();

            if (customLabel != null)
            {
                RGUI.BeginCustomLabel(customLabel);
            }
            if (synced)
            {
                RGUI.BeginColor(syncedColor);
            }

            var changed = false;

            using (new GUILayout.HorizontalScope())
            {
                changed  = DoGUICheckChanged(key, func);
                changed |= DoGUIDefaultButton();
            }

            if (synced)
            {
                RGUI.EndColor();
            }
            if (customLabel != null)
            {
                RGUI.EndCustomLabel();
            }

            return(changed);
        }
Beispiel #2
0
        protected bool DoGUICheckChanged(string key, GUIFunc func)
        {
            var changed = false;

            if (!PrefsKVS.HasKey(key))
            {
                Set(defaultValue);
                changed = true;
            }

            var prev = _Get();
            var next = func(prev);

            if (!Compare(prev, next))
            {
                _Set(next);
                changed = true;
            }

            return(changed);
        }