public void OnGUI_DrawNGuiEventImplementation(PlayMakerFSM fsm) { NGuiEventsToPlaymakerFsmEvents _target = (NGuiEventsToPlaymakerFsmEvents)this.target; bool _noImplementation = true; foreach (NGuiPlayMakerDelegates _value in Enum.GetValues(typeof(NGuiPlayMakerDelegates))) { string _fsmEvent = NGuiPlayMakerProxy.GetFsmEventEnumValue(_value); int _counter = _target.getUsage(_value); // if (Application.isPlaying) // { //_fsmEvent += " "+_target.getUsage(_value); // } string _feedback = "Not implemented"; Color _color = Color.white; if (_target.DoesTargetImplementsEvent(fsm, _fsmEvent)) { _noImplementation = false; _feedback = ""; _color = Color.green; } else { if (_target.DoesTargetMissEventImplementation(fsm, _fsmEvent)) { _color = LightOrange; _feedback = "Not used"; } } if (_counter > 0) { _feedback += " " + _counter.ToString(); } GUI.color = _color; GUILayout.BeginHorizontal("", "box", GUILayout.ExpandWidth(true)); GUI.color = Color.white; EditorGUILayout.LabelField(_fsmEvent, _feedback); GUILayout.EndHorizontal(); } if (_noImplementation) { EditorGUI.indentLevel = -2; EditorGUILayout.HelpBox("The Fsm Target does not implement any NGUI Events. Edit your Fsm to add Global Transitions or State Transitions from 'Custom Events/NGUI'", MessageType.Error); } }
public void OnGUI_DrawNGuiEventImplementation(PlayMakerFSM fsm) { NGuiEventsToPlaymakerFsmEvents _target = (NGuiEventsToPlaymakerFsmEvents)this.target; bool _noImplementation = true; foreach (NGuiPlayMakerDelegates _value in Enum.GetValues(typeof(NGuiPlayMakerDelegates))) { string _fsmEvent = NGuiPlayMakerProxy.GetFsmEventEnumValue(_value); bool _customEvent = false; int _customEventIndex = 0; // check if we use default event or custom event if (_target.customEventsKeys != null && _target.customEventsKeys.Contains(_value)) { _customEventIndex = _target.customEventsKeys.IndexOf(_value); _customEvent = true; _fsmEvent = _target.customEventsValues[_customEventIndex]; } bool _isImplemented = _target.DoesTargetImplementsEvent(fsm, _fsmEvent); int _counter = _target.getUsage(_value); // if (Application.isPlaying) // { //_fsmEvent += " "+_target.getUsage(_value); // } string _feedback = "Not implemented"; Color _color = Color.white; if (_isImplemented) { _noImplementation = false; _feedback = "Used"; _color = Color.green; } else { if (_target.DoesTargetMissEventImplementation(fsm, _fsmEvent)) { _color = new Color(255, 178, 102); // PlayMakerPhotonEditorUtility.lightOrange; _feedback = "Not used"; } } if (_counter > 0) { _feedback += " " + _counter.ToString(); } if (!_target.OnlyShowImplemented || (_target.OnlyShowImplemented && _isImplemented)) { GUI.color = _color; GUILayout.BeginVertical("", "box", GUILayout.ExpandWidth(true)); GUI.color = Color.white; if (_customEvent) { GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); if (GUILayout.Button("reset", GUILayout.Width(40))) { if (_target.customEventsKeys != null) { _customEventIndex = _target.customEventsKeys.IndexOf(_value); _target.customEventsKeys.RemoveAt(_customEventIndex); _target.customEventsValues.RemoveAt(_customEventIndex); } return; } GUILayout.Label(_value.ToString()); } else { GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); if (GUILayout.Button("edit", GUILayout.Width(40))) { if (_target.customEventsKeys == null) { _target.customEventsKeys = new List <NGuiPlayMakerDelegates>(); _target.customEventsValues = new List <string>(); } _target.customEventsKeys.Add(_value); _customEventIndex = _target.customEventsKeys.IndexOf(_value); _target.customEventsValues.Add(("MY " + _value + " EVENT").ToUpper()); return; } GUILayout.Label(_fsmEvent); //EditorGUILayout.LabelField(_fsmEvent,_feedback); } GUILayout.Label(_feedback, GUILayout.Width(100)); GUILayout.EndHorizontal(); if (_customEvent) { _target.customEventsValues[_customEventIndex] = GUILayout.TextField(_fsmEvent, GUILayout.MinHeight(18), GUILayout.ExpandWidth(true)); // EditorGUILayout.TextField(_fsmEvent,GUILayout.MaxWidth(200)); } GUILayout.EndVertical(); } } if (_noImplementation) { EditorGUI.indentLevel = -2; EditorGUILayout.HelpBox("The Fsm Target does not implement any NGUI Events. Edit your Fsm to add Global Transitions or State Transitions from 'Custom Events/NGUI'", MessageType.Error); } }