void OnPress(bool pressed) { if (!enabled || targetFSM == null) { return; } _usage[(int)NGuiPlayMakerDelegates.OnPressEvent]++; if (debug) { Debug.Log("NGuiEventsToPlaymakerFsmEvents OnPress(" + pressed + ") " + _usage[(int)NGuiPlayMakerDelegates.OnPressEvent] + " to " + targetFSM.gameObject.name + "/" + targetFSM.FsmName); } Fsm.EventData.BoolData = pressed; currentTouch = UICamera.currentTouch; FireNGUIPlayMakerEvent(NGuiPlayMakerDelegates.OnPressEvent); if (pressed) { targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(NGuiPlayMakerDelegates.OnPressEventDown)); _usage[(int)NGuiPlayMakerDelegates.OnPressEventDown]++; } else { targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(NGuiPlayMakerDelegates.OnPressEventUp)); _usage[(int)NGuiPlayMakerDelegates.OnPressEventUp]++; } }
void OnHover(bool isOver) { if (!enabled || targetFSM == null) { return; } _usage[(int)NGuiPlayMakerDelegates.OnHoverEvent]++; if (debug) { Debug.Log("NGuiEventsToPlaymakerFsmEvents OnHover(" + isOver + ") " + _usage[(int)NGuiPlayMakerDelegates.OnClickEvent] + " to " + targetFSM.gameObject.name + "/" + targetFSM.FsmName, this); } Fsm.EventData.BoolData = isOver; currentTouch = UICamera.currentTouch; FireNGUIPlayMakerEvent(NGuiPlayMakerDelegates.OnHoverEvent); if (isOver) { targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(NGuiPlayMakerDelegates.OnHoverEventEnter)); _usage[(int)NGuiPlayMakerDelegates.OnHoverEventEnter]++; } else { targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(NGuiPlayMakerDelegates.OnHoverEventExit)); _usage[(int)NGuiPlayMakerDelegates.OnHoverEventExit]++; } }
public void onSnsLoginResult(string result) { Debug.Log("################# onSnsLoginResult=" + result); if (QihooSnsModel.Instance.Using360Login) { QihooSnsModel.Instance.onLoginFinished(result); UserSNSManager.Instance.GetAppFriends(QihooSnsModel.Instance.UserID); } else { QihooSnsModel.Instance.onLoginFinished(result); //UserSNSManager.Instance.getContactContent(); UserSNSManager.Instance.GetAppFriends(QihooSnsModel.Instance.UserID); // there is a "login" button in map scene. In this case, don't load level if (Application.loadedLevelName == "Home") { PlayMakerFSM playFsm = GameObject.Find("Flow Control/Play Button").GetComponent <PlayMakerFSM>(); playFsm.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(NGuiPlayMakerDelegates.OnClickEvent)); //Application.LoadLevel("Map"); } else { // In map level, update score table GameObject scorePanel = GameObject.Find("ScoreRankPanel"); if (scorePanel != null) { ScoreRankPanel scoreCom = scorePanel.GetComponent <ScoreRankPanel>(); scoreCom.UpdateContentForCurrentLevel(); } } } }
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); } }
void FireNGUIPlayMakerEvent(NGuiPlayMakerDelegates _event) { if (customEventsKeys.Contains(_event)) { targetFSM.SendEvent(customEventsValues[customEventsKeys.IndexOf(_event)]); } else { if (debug) { Debug.Log("Sending event" + NGuiPlayMakerProxy.GetFsmEventEnumValue(_event)); } targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(_event)); } }
public bool DoesTargetImplementsEvent(PlayMakerFSM fsm, NGuiPlayMakerDelegates fsmEventDelegate) { return(DoesTargetImplementsEvent(fsm, NGuiPlayMakerProxy.GetFsmEventEnumValue(fsmEventDelegate))); }
void FireNGUIPlayMakerEvent(NGuiPlayMakerDelegates _event) { targetFSM.SendEvent(NGuiPlayMakerProxy.GetFsmEventEnumValue(_event)); }
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); } }