示例#1
0
        private bool OnNumAccumForDemo2(IGEvent inEvent)
        {
            bool ret = false;

            LMEvent_NumAccumForDemo2 realEvt = inEvent as LMEvent_NumAccumForDemo2;

            int newVal = realEvt.mNumberToAccum + 1;

            //注意这里异步发给了自己,下一帧就会收到//
            LMEvent_NumAccumForDemo2 anEvtToMyself = FakeObjPoolMgr.FetchAutoRecycleObj <LMEvent_NumAccumForDemo2>();

            anEvtToMyself.mNumberToAccum = newVal;
            SendEventAsync(anEvtToMyself);

            //注意这里给M层也发了一份,那边是 DisplayUIForDemo2 等着收//
            if (X2MBridge.IsValid)
            {
                LMEvent_NumAccumForDemo2 anotherEvtToM = FakeObjPoolMgr.FetchAutoRecycleObj <LMEvent_NumAccumForDemo2>();
                anotherEvtToM.mNumberToAccum = newVal;
                //注意这里发送给了M层//
                X2MBridge.Instance.SendEventAsync(anotherEvtToM);
            }

            return(ret);
        }
示例#2
0
    private bool OnNumAccumForDemo2(IGEvent inEvent)
    {
        bool ret = false;

        if (mDisplayText == null)
        {
            LogUtil.Error("DisplayUIForDemo2.OnNumAccumForDemo2: mDisplayText invalid");
            return(ret);
        }

        LMEvent_NumAccumForDemo2 realEvt = inEvent as LMEvent_NumAccumForDemo2;

        mDisplayText.text = realEvt.mNumberToAccum.ToString();

        return(ret);
    }
        public void Start()
        {
            /*
             * ---------------------------------
             * Demo2逻辑的入口
             * 注意这里起到了启动计数逻辑作用
             * --------------------------------
             */
            LMEvent_ShowDisplayUIForDemo2 showUIEvt = FakeObjPoolMgr.FetchAutoRecycleObj <LMEvent_ShowDisplayUIForDemo2>();

            X2MBridge.Instance.SendEventAsync(showUIEvt);

            //开始计数//
            LMEvent_NumAccumForDemo2 startAccEvt = FakeObjPoolMgr.FetchAutoRecycleObj <LMEvent_NumAccumForDemo2>();

            X2LBridge.Instance.SendEventAsync(startAccEvt);
        }