示例#1
0
        public static T GetEvent <T>(string eventKey) where T : IInputEventBase, new()
        {
            T tmp = HeapObjectPool <T> .GetObject();

            tmp.EventKey = eventKey;

            return(tmp);
        }
        static T GetUIEvent <T>(string UIName, string ComponentName, string parm) where T : InputUIEventBase, new()
        {
            T msg = HeapObjectPool <T> .GetObject();

            msg.Reset();
            msg.m_name     = UIName;
            msg.m_compName = ComponentName;
            msg.m_pram     = parm;

            return(msg);
        }
        internal static InputEventRegisterInfo <InputUIOnMouseEvent> GetOnMouseListener(string m_UIEventKey, string UIName, string ComponentName, bool isDown, InputEventHandle <InputUIOnMouseEvent> callback)
        {
            InputEventRegisterInfo <InputUIOnMouseEvent> info = HeapObjectPool <InputEventRegisterInfo <InputUIOnMouseEvent> > .GetObject();

            info.eventKey = InputUIOnMouseEvent.GetEventKey(UIName, ComponentName, isDown);
            info.callBack = callback;

            InputMessageManager.AddListener(
                InputUIOnMouseEvent.GetEventKey(UIName, ComponentName, isDown), callback);

            return(info);
        }
        public static InputEventRegisterInfo <InputUIOnScrollEvent> GetOnScrollListener(string UIName, string ComponentName, InputEventHandle <InputUIOnScrollEvent> callback)
        {
            InputEventRegisterInfo <InputUIOnScrollEvent> info = HeapObjectPool <InputEventRegisterInfo <InputUIOnScrollEvent> > .GetObject();

            info.eventKey = InputUIOnScrollEvent.GetEventKey(UIName, ComponentName);
            info.callBack = callback;

            InputMessageManager.AddListener(
                InputUIOnScrollEvent.GetEventKey(UIName, ComponentName), callback);

            return(info);
        }
        public static InputEventRegisterInfo <InputUILongPressEvent> GetLongPressListener(LongPressAcceptor acceptor, string UIName, string ComponentName, string parm, InputEventHandle <InputUILongPressEvent> callback)
        {
            InputlongPressRegisterInfo info = HeapObjectPool <InputlongPressRegisterInfo> .GetObject();

            info.eventKey      = InputUILongPressEvent.GetEventKey(UIName, ComponentName, parm);
            info.callBack      = callback;
            info.m_acceptor    = acceptor;
            info.m_OnLongPress = (type) =>
            {
                DispatchLongPressEvent(UIName, ComponentName, parm, type);
            };

            return(info);
        }
        public static InputEndDragRegisterInfo GetOnEndDragListener(DragAcceptor acceptor, string UIName, string ComponentName, string parm, InputEventHandle <InputUIOnEndDragEvent> callback)
        {
            InputEndDragRegisterInfo info = HeapObjectPool <InputEndDragRegisterInfo> .GetObject();

            info.eventKey    = InputUIOnEndDragEvent.GetEventKey(UIName, ComponentName, parm);
            info.callBack    = callback;
            info.m_acceptor  = acceptor;
            info.m_OnEndDrag = (data) =>
            {
                DispatchEndDragEvent(UIName, ComponentName, parm, data);
            };

            return(info);
        }
        public static InputButtonClickRegisterInfo GetOnClickListener(Button button, string UIName, string ComponentName, string parm, InputEventHandle <InputUIOnClickEvent> callback)
        {
            InputButtonClickRegisterInfo info = HeapObjectPool <InputButtonClickRegisterInfo> .GetObject();

            info.eventKey  = InputUIOnClickEvent.GetEventKey(UIName, ComponentName, parm);
            info.callBack  = callback;
            info.m_button  = button;
            info.m_OnClick = () =>
            {
                DispatchOnClickEvent(UIName, ComponentName, parm);
            };

            return(info);
        }
示例#8
0
 public static void PutSODict(Dictionary <string, object> dict)
 {
     dict.Clear();
     HeapObjectPool <Dictionary <string, object> > .PutObject(dict);
 }
示例#9
0
 public static Dictionary <string, object> GetSODict()
 {
     return(HeapObjectPool <Dictionary <string, object> > .GetObject());
 }