Exemplo n.º 1
0
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     this.m_Prop = property;
     this.m_Text = label.text;
     UnityEventDrawer.State state = this.RestoreState(property);
     this.OnGUI(position);
     state.lastSelectedIndex = this.m_LastSelectedIndex;
 }
Exemplo n.º 2
0
 private UnityEventDrawer.State RestoreState(SerializedProperty property)
 {
     UnityEventDrawer.State state = this.GetState(property);
     this.m_ListenersArray    = state.m_ReorderableList.serializedProperty;
     this.m_ReorderableList   = state.m_ReorderableList;
     this.m_LastSelectedIndex = state.lastSelectedIndex;
     return(state);
 }
 private UnityEventDrawer.State GetState(SerializedProperty prop)
 {
   string propertyPath = prop.propertyPath;
   UnityEventDrawer.State state;
   this.m_States.TryGetValue(propertyPath, out state);
   if (state == null)
   {
     state = new UnityEventDrawer.State();
     SerializedProperty propertyRelative = prop.FindPropertyRelative("m_PersistentCalls.m_Calls");
     state.m_ReorderableList = new ReorderableList(prop.serializedObject, propertyRelative, false, true, true, true);
     state.m_ReorderableList.drawHeaderCallback = new ReorderableList.HeaderCallbackDelegate(this.DrawEventHeader);
     state.m_ReorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawEventListener);
     state.m_ReorderableList.onSelectCallback = new ReorderableList.SelectCallbackDelegate(this.SelectEventListener);
     state.m_ReorderableList.onReorderCallback = new ReorderableList.ReorderCallbackDelegate(this.EndDragChild);
     state.m_ReorderableList.onAddCallback = new ReorderableList.AddCallbackDelegate(this.AddEventListener);
     state.m_ReorderableList.onRemoveCallback = new ReorderableList.RemoveCallbackDelegate(this.RemoveButton);
     state.m_ReorderableList.elementHeight = 43f;
     this.m_States[propertyPath] = state;
   }
   return state;
 }
Exemplo n.º 4
0
        private UnityEventDrawer.State GetState(SerializedProperty prop)
        {
            string propertyPath = prop.propertyPath;

            UnityEventDrawer.State state;
            this.m_States.TryGetValue(propertyPath, out state);
            if (state == null)
            {
                state = new UnityEventDrawer.State();
                SerializedProperty elements = prop.FindPropertyRelative("m_PersistentCalls.m_Calls");
                state.m_ReorderableList = new ReorderableList(prop.serializedObject, elements, false, true, true, true);
                state.m_ReorderableList.drawHeaderCallback  = new ReorderableList.HeaderCallbackDelegate(this.DrawEventHeader);
                state.m_ReorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(this.DrawEventListener);
                state.m_ReorderableList.onSelectCallback    = new ReorderableList.SelectCallbackDelegate(this.SelectEventListener);
                state.m_ReorderableList.onReorderCallback   = new ReorderableList.ReorderCallbackDelegate(this.EndDragChild);
                state.m_ReorderableList.onAddCallback       = new ReorderableList.AddCallbackDelegate(this.AddEventListener);
                state.m_ReorderableList.onRemoveCallback    = new ReorderableList.RemoveCallbackDelegate(this.RemoveButton);
                state.m_ReorderableList.elementHeight       = 43f;
                this.m_States[propertyPath] = state;
            }
            return(state);
        }