Beispiel #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();
        }
Beispiel #2
0
        public void RemoveEffect(StatEffect effect)
        {
            StatEffect instance = this.m_Effects.Find(x => x.Name == effect.Name);

            this.m_Effects.Remove(instance);
        }
Beispiel #3
0
 public void AddEffect(StatEffect effect)
 {
     effect = Instantiate(effect);
     this.m_Effects.Add(effect);
     effect.Initialize(this);
 }
Beispiel #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);
                });
            }
        }