Ejemplo n.º 1
0
    public void Retry()
    {
        var callback = new MyUnityEvent();

        callback.AddListener(() => ChangeLevel(CurrentLevel));
        MyAdManager.Instance.ShowStageClearInterstitial(callback);
    }
Ejemplo n.º 2
0
        public static void StartListening(string eventName, UnityAction <object[]> listener)
        {
            MyUnityEvent thisEvent;

            if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.AddListener(listener);
            }
            else
            {
                thisEvent = new MyUnityEvent();
                thisEvent.AddListener(listener);
                Instance._eventDictionary.Add(eventName, thisEvent);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// アクションが呼ばれるまで待機する
        /// </summary>
        public static IEnumerator WaitAction <T1, T2>(MyUnityEvent <T1, T2> action, Action callback = null)
        {
            bool isCalled            = false;
            UnityAction <T1, T2> act = ((arg1, arg2) => isCalled = true);

            action.AddListener(act);

            yield return(new WaitUntil(() => isCalled));

            action.RemoveListener(act);
            if (callback != null)
            {
                callback.Invoke();
            }
        }
Ejemplo n.º 4
0
    public static void startListen(TypeOfEvent theType, UnityAction <EventInfo> listener)
    {
        MyUnityEvent thisevent = null;

        if (eventManager.eventDictionary.TryGetValue(theType, out thisevent))
        {
            thisevent.AddListener(listener);
        }
        else
        {
            thisevent = new MyUnityEvent();
            thisevent.AddListener(listener);
            eventManager.eventDictionary.Add(theType, thisevent);
        }
    }
Ejemplo n.º 5
0
    public void SubscribeEvent <T>(string _eventName, UnityAction <T> _functionCall)
    {
        UnityEventBase eventListener;

        if (m_FunctionWithNoParamDictionary.TryGetValue(_eventName, out eventListener))
        {
            UnityEvent <T> unityEvent = eventListener as UnityEvent <T>;
            unityEvent.AddListener(_functionCall);
        }
        else
        {
            UnityEvent <T> unityEvent = new MyUnityEvent <T>();
            unityEvent.AddListener(_functionCall);
            m_FunctionWithNoParamDictionary.Add(_eventName, unityEvent);
        }
    }
Ejemplo n.º 6
0
    public static void AddEventListener(string eventName, UnityAction <object> callBackFunction)
    {
        MyUnityEvent _unityEvent;

        if (_eventDictionary.TryGetValue(eventName, out _unityEvent))
        {
            _unityEvent.AddListener(callBackFunction);
        }
        else
        {
            _unityEvent = new MyUnityEvent();
            _unityEvent.AddListener(callBackFunction);
            _eventDictionary.Add(eventName, _unityEvent);
        }

        Log.L("[EventManager] Add Listener : event = " + eventName + ", callback = " + callBackFunction.Target.ToString() + '.' + callBackFunction.Method.ToString());
    }
Ejemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     uEvent.AddListener(Test);
 }