Beispiel #1
0
        public int AddTimerTask(uint delay, uint frameCount, Action callback, bool loop = false)
        {
            var t = ClassPoolModule <TimerData> .Alloc();

            t = this.InitTimer(t, delay, frameCount, loop) as TimerData;
            t.SetCallback(callback);
            return(t.TimerId);
        }
Beispiel #2
0
        /// <summary>
        /// 关闭事件压入队列
        /// </summary>
        /// <param name="nErrCode">关闭错误码</param>
        public void PushClosedEvent(NetErrCode nErrCode)
        {
            NetEvent evt = ClassPoolModule <NetEvent> .Alloc();

            evt.m_nEvtType = NetEvtType.Event_Closed;
            evt.m_nErrCode = nErrCode;
            m_queueEvent.Enqueue(evt);
        }
Beispiel #3
0
        public void PushReceiveEvent(int dataLen)
        {
            NetEvent evt = ClassPoolModule <NetEvent> .Alloc();

            evt.m_nEvtType = NetEvtType.Event_Receive;
            evt.m_dataLen  = dataLen;
            m_queueEvent.Enqueue(evt);
        }
Beispiel #4
0
        public int AddTimerTask <T>(uint delay, uint frameCount, Action <T> callback, T arg, bool loop = false)
        {
            var t = ClassPoolModule <TimerData <T> > .Alloc();

            t = this.InitTimer(t, delay, frameCount, loop) as TimerData <T>;
            t.SetCallback(callback);
            t.Arg = arg;
            return(t.TimerId);
        }
Beispiel #5
0
        public void AddScrollBroadcast(string info, int loop = 1)
        {
            var data = ClassPoolModule <ScrollData> .Alloc();

            data.Info = info;
            data.Loop = loop;
            this.AddScrollBroadcast(data);
            this.StartRoll();
        }
Beispiel #6
0
        public void PushConnectEvent(bool bSuccess)
        {
            var evt = ClassPoolModule <NetEvent> .Alloc();

            evt.m_nEvtType = NetEvtType.Event_Connect;
            evt.m_nErrCode = bSuccess ? NetErrCode.Net_NoError : NetErrCode.Net_SysError;
            m_queueEvent.Enqueue(evt);
            this.CanUpdate = bSuccess;
        }
Beispiel #7
0
        private NewbieHelpStep CreateNewbieHelpStep(NewbieHelpData data, int mainId)
        {
            NewbieHelpStep result = null;

            switch (data.NewbieType)
            {
            case ENewbieHelpType.ButtonClickWithContent:
                ClassPoolModule <NewbieButtonWithContentStep> .Init();

                result = ClassPoolModule <NewbieButtonWithContentStep> .Alloc();

                break;

            case ENewbieHelpType.ButtonClickNoContent:
                ClassPoolModule <NewbieButtonNoContentStep> .Init();

                result = ClassPoolModule <NewbieButtonNoContentStep> .Alloc();

                break;

            case ENewbieHelpType.CharacterTip:
                NewbieHelpTipStep.Init();
                ClassPoolModule <NewbieHelpTipStep> .Init();

                result = ClassPoolModule <NewbieHelpTipStep> .Alloc();

                break;
            }
            if (result != null)
            {
                result.MainID           = mainId;
                result.ID               = data.Id;
                result.ActionOnFinished = this.NextNewbieStep;
            }
            return(result);
        }