public ActionUI(Vector2 pos) { _windowRect = new Rect(pos, _windowSize); _listRect = new Rect(0, 0, LEFT_PANEL_WIDTH, _windowSize.y); _mainRect = new Rect(LEFT_PANEL_WIDTH, 0, _windowSize.x - LEFT_PANEL_WIDTH, _windowSize.y); _popupUI = new PopupUI(Utils.ACTION_WINDOW_ID_POP); _partSelector = new PartSelector(this.SelectPart); }
public void DisplayLayout(PopupUI popup = null) { if (_valueDict != null) { if (popup != null) { string[] _entry = _valueDict.Keys.ToArray(); int index = Array.IndexOf(_entry, ValueStr); int newVal = popup.GUILayoutPopup(_name + "popup", _entry, index); if ((newVal >= 0) && (newVal < _entry.Length)) { ValueStr = _entry[newVal]; } } else { ValueStr = GUILayout.TextField(ValueStr, IsValid ? Utils.TF_STYLE_VALID : Utils.TF_STYLE_INVALID); } } else if (_type != null) { if (_type.IsEnum && (popup != null)) { int index = (_value != null) ? (int)_value : -1; int newVal = popup.GUILayoutPopup(_name + "popup", Enum.GetNames(_type), index); ValueStr = newVal.ToString(); } else if (_type == typeof(bool)) { // in case of _value == null bool val = (_value != null) && ((bool)_value); bool newVal = GUILayout.Toggle(val, val ? "True" : "False"); ValueStr = newVal.ToString(); } else { ValueStr = GUILayout.TextField(ValueStr, IsValid ? Utils.TF_STYLE_VALID : Utils.TF_STYLE_INVALID); } } }
public EventUI(Vector2 pos) { _windowRect = new Rect(pos, _windowSize); _popupUI = new PopupUI(Utils.EVENT_WINDOW_ID_POP); _partSelector = new PartSelector(this.SelectPart); }