コード例 #1
0
ファイル: EventManager.cs プロジェクト: clairemation/Reunion
    public static void TriggerEvent(string eventName, Player param)
    {
        UnityEventPlayer thisEvent = null;

        if (Instance != null && Instance.eventDictionaryPlayer.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(param);
        }
    }
コード例 #2
0
ファイル: EventManager.cs プロジェクト: clairemation/Reunion
    public static void StopListeningClass(string eventName, UnityAction <Player> listener)
    {
        if (Instance == null)
        {
            return;
        }
        UnityEventPlayer thisEvent = null;

        if (Instance.eventDictionaryPlayer.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
コード例 #3
0
ファイル: EventManager.cs プロジェクト: clairemation/Reunion
    public static void StartListeningClass(string eventName, UnityAction <Player> listener)
    {
        UnityEventPlayer thisEvent = null;

        if (Instance.eventDictionaryPlayer.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new UnityEventPlayer();
            thisEvent.AddListener(listener);
            Instance.eventDictionaryPlayer.Add(eventName, thisEvent);
        }
    }