Ejemplo n.º 1
0
    public static void TriggerEvent(ParameterizedGameEvent eventName, object objParameter)
    {
        ObjEvent thisEvent = null;

        if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(objParameter);
        }
    }
Ejemplo n.º 2
0
    public static void TriggerEvent(string eventName, GameObject g)
    {
        ObjEvent thisEvent = null;

        if (instance.ObjEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(g);
        }
    }
Ejemplo n.º 3
0
    public static void StopListeningObj(string eventName, UnityAction <GameObject> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        ObjEvent thisEvent = null;

        if (instance.ObjEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Ejemplo n.º 4
0
    public static void StopListening(ParameterizedGameEvent eventName, UnityAction <object> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        ObjEvent thisEvent = null;

        if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Ejemplo n.º 5
0
    public static void StartListeningObj(string eventName, UnityAction <GameObject> listener)
    {
        ObjEvent thisObjEvent = null;

        if (instance.ObjEventDictionary.TryGetValue(eventName, out thisObjEvent))
        {
            thisObjEvent.AddListener(listener);
        }
        else
        {
            thisObjEvent = new ObjEvent();
            thisObjEvent.AddListener(listener);
            instance.ObjEventDictionary.Add(eventName, thisObjEvent);
        }
    }
Ejemplo n.º 6
0
    public static void StartListening(ParameterizedGameEvent eventName, UnityAction <object> listener)
    {
        ObjEvent thisEvent = null;

        if (instance.objEventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new ObjEvent();
            thisEvent.AddListener(listener);
            instance.objEventDictionary.Add(eventName, thisEvent);
        }
    }
Ejemplo n.º 7
0
            public Events(EndianBinaryReader r)
            {
                ushort count = r.ReadUInt16();

                Warps = new WarpEvent[count];
                for (int i = 0; i < count; i++)
                {
                    Warps[i] = new WarpEvent(r);
                }
                count = r.ReadUInt16();
                Objs  = new ObjEvent[count];
                for (int i = 0; i < count; i++)
                {
                    Objs[i] = new ObjEvent(r);
                }
            }
Ejemplo n.º 8
0
        public Events(JToken j)
        {
            var arr   = (JArray)j[nameof(Warps)];
            int count = arr.Count;

            Warps = new WarpEvent[count];
            for (int i = 0; i < count; i++)
            {
                Warps[i] = new WarpEvent(arr[i]);
            }
            arr   = (JArray)j[nameof(Objs)];
            count = arr.Count;
            Objs  = new ObjEvent[count];
            for (int i = 0; i < count; i++)
            {
                Objs[i] = new ObjEvent(arr[i]);
            }
        }
Ejemplo n.º 9
0
 // 登記事件,提醒 MapManager 對他的綁定物件進行動作.
 public void RegisterEvent(ObjEvent eventName)
 {
     this.objEvents.Add(eventName);
 }