Exemple #1
0
            private void UpdateUI()
            {
                if (_isUpdatingUI)
                {
                    return;
                }
                var keyTypeName   = (string)Values[0];
                var valueTypeName = (string)Values[1];
                var keyType       = TypeUtils.GetType(keyTypeName);
                var valueType     = TypeUtils.GetType(valueTypeName);

                if (keyType == ScriptType.Null)
                {
                    Editor.LogError("Missing type " + keyTypeName);
                    keyType = ScriptType.Object;
                }
                if (valueType == ScriptType.Null)
                {
                    Editor.LogError("Missing type " + valueTypeName);
                    valueType = ScriptType.Object;
                }
                var dictionaryType = ScriptType.MakeDictionaryType(keyType, valueType);

                _isUpdatingUI          = true;
                _keyTypePicker.Value   = keyType;
                _valueTypePicker.Value = valueType;
                _output.CurrentType    = dictionaryType;
                _isUpdatingUI          = false;

                if (Surface == null)
                {
                    return;
                }
                var canEdit = Surface.CanEdit;

                _keyTypePicker.Enabled   = canEdit;
                _valueTypePicker.Enabled = canEdit;

                Title = Surface.GetTypeName(dictionaryType);
                _keyTypePicker.Width   = 160.0f;
                _valueTypePicker.Width = 160.0f;
                ResizeAuto();
                _keyTypePicker.Width   = Width - 30;
                _valueTypePicker.Width = Width - 30;
            }