Exemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            StatEffect current = property.GetValue() as StatEffect;

            position = EditorGUI.PrefixLabel(position, label);
            DoSelection(position, property, label, current);
            EditorGUI.EndProperty();
        }
Exemplo n.º 2
0
        public void RemoveEffect(StatEffect effect)
        {
            StatEffect instance = this.m_Effects.Find(x => x.Name == effect.Name);

            this.m_Effects.Remove(instance);
        }
Exemplo n.º 3
0
 public void AddEffect(StatEffect effect)
 {
     effect = Instantiate(effect);
     this.m_Effects.Add(effect);
     effect.Initialize(this);
 }
Exemplo n.º 4
0
        protected virtual void DoSelection(Rect buttonRect, SerializedProperty property, GUIContent label, StatEffect current)
        {
            GUIStyle   buttonStyle   = EditorStyles.objectField;
            GUIContent buttonContent = new GUIContent(current != null ? current.Name : "Null");

            if (GUI.Button(buttonRect, buttonContent, buttonStyle))
            {
                ObjectPickerWindow.ShowWindow(buttonRect, typeof(StatDatabase), BuildSelectableObjects(),
                                              (UnityEngine.Object obj) => {
                    property.serializedObject.Update();
                    property.objectReferenceValue = obj;
                    property.serializedObject.ApplyModifiedProperties();
                },
                                              () => {
                    StatDatabase db = EditorTools.CreateAsset <StatDatabase>(true);
                });
            }
        }