示例#1
0
 public void EndSync()
 {
     MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.Update, _RenderFrameUpdate);
     MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.FixedUpdate, _LogicFrameUpdate);
     MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.LateUpdate, _FrameUpdateEnd);
     MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.OnApplicationPause, _GamePaused);
 }
示例#2
0
 public override void Cancel()
 {
     MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this);
     this.Callback           = null;
     this.CallBackWithParams = null;
     base.Cancel();
 }
示例#3
0
        public void UpdateObstacle()
        {
            if (MainLoop.getInstance() == null)
            {
                LogMgr.LogError("please create kframework first");
                return;
            }

            if (mesh != null)
            {
                MeshMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, 1));
                try {
                    Mesh2Obstacle();
                    Add2Rvo();

                    if (AutoRelease)
                    {
                        this.mesh = null;
                    }
                    this.Inited = true;
                } catch (System.Exception ex) {
                    LogMgr.LogError(ex);
                    this.Inited = true;
                    ClearProgressBar();
                }
            }
        }
示例#4
0
 public Schedule()
 {
     if (MainLoop.getInstance() != null)
     {
         MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.BeforeUpdate, UpdateSchedule);
     }
 }
示例#5
0
 internal void StartUpdate()
 {
     if (mIns.EnableSelfUpdate)
     {
         MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.Update, UpdateEvent);
     }
 }
示例#6
0
        public override void Excute()
        {
            try
            {
                if (!this.isRunning)
                {
                    base.Excute();

                    this.m_startFrame = GameSyncCtr.mIns.RenderFrameCount;

                    ///因为update中还有处理处理逻辑,当帧事件穿插在逻辑之间的时候,可能导致某些依赖此对象的帧逻辑判断错误,目前先放在late中
                    MainLoop.getInstance().RegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this);
                }
            }
            catch (FrameWorkException ex)
            {
                LogMgr.LogException(ex);

                ex.RaiseExcption();
            }
            catch (Exception ex)
            {
                LogMgr.LogException(ex);
            }
        }
示例#7
0
 public void Destroy()
 {
     if (MainLoop.getInstance() != null)
     {
         MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.BeforeUpdate, UpdateSchedule);
     }
     scheduleList.Clear();
 }
示例#8
0
        protected override void CreatedConnection(NetConnection connection)
        {
            if (FrameWorkConfig.Open_DEBUG)
            {
                LogMgr.LogFormat("Http Connected :{0}", connection);
            }

            MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.LateUpdate, this.UpdateQueue);
        }
示例#9
0
 protected void TryBatch()
 {
     if (this.Next != null && !this.m_isBatching)
     {
         this.m_isBatching = true;
         this.Next.Excute();
         MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.LateUpdate, this._SequenceCall);
     }
 }
示例#10
0
        public override void release()
        {
            Close();

            this.selfport = 0;
            this.selfip   = null;

            MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.LateUpdate, UpdateAsync2Sync);
        }
示例#11
0
        protected override void CreatedConnection(NetConnection connection)
        {
            if (FrameWorkConfig.Open_DEBUG)
            {
                LogMgr.LogFormat("TCP :{0} Connection Created", connection);
            }

            MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.LateUpdate, UpdateAsync2Sync);
        }
示例#12
0
        public void StartSync()
        {
            this.FrameRate = Application.targetFrameRate;
            this.Scale     = Time.timeScale;

            MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.FixedUpdate, _LogicFrameUpdate);
            MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.LateUpdate, _FrameUpdateEnd);
            MainLoop.getInstance().RegisterLoopEvent(MainLoopEvent.OnApplicationPause, _GamePaused);
        }
示例#13
0
        public override void Cancel()
        {
            base.Cancel();

            if (!MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this))
            {
                LogMgr.LogError("删除失败");
            }
        }
示例#14
0
 protected AssetBundleCreateRequest LoadFullAssetToMemAsync(BundlePkgInfo pkginfo)
 {
     if (Application.isPlaying && MainLoop.getInstance())
     {
         return(KAssetBundle.LoadFromFileAsync(BundlePathConvert.GetRunningPath(pkginfo.AbFileName)));;
     }
     else
     {
         return(null);
     }
 }
示例#15
0
        protected override void SetFinished()
        {
            MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this);

            if (this.CallBack != null)
            {
                this.CallBack(this);
            }

            base.SetFinished();
        }
示例#16
0
        protected IBundleRef LoadFullAssetToMem(BundlePkgInfo pkginfo)
        {
            IBundleRef bundle = null;

            if (ResBundleMgr.mIns.Cache.Contains(pkginfo))
            {
                bundle = ResBundleMgr.mIns.Cache.TryGetValue(pkginfo);
                return(bundle);
            }

#if UNITY_IOS || UNITY_IPHONE || UNITY_ANDROID
            if (GameApplication.isPlaying && MainLoop.getInstance().OpenABMode)
            {
                AssetBundle ab = null;
                using (gstring.Block())
                {
                    ab = this.LoadAssetBundle(BundlePathConvert.GetRunningPath(pkginfo.AbFileName));
                }

                if (ab == null)
                {
                    this.ThrowAssetMissing(this.LoadResPath);
                }

                bundle = ResBundleMgr.mIns.Cache.PushAsset(pkginfo, ab);
                return(bundle);
            }
            else
#endif
            {
                UnityEngine.Object target = AssetDatabaseLoad(pkginfo.EditorPath);
                if (target == null)
                {
                    if (BundleConfig.SAFE_MODE)
                    {
                        this.ThrowAssetMissing(pkginfo.BundleName);
                    }
                    else
                    {
                        this.LoadState = BundleLoadState.Error;
                        LogMgr.LogErrorFormat("Asset {0} Missing", pkginfo.BundleName);
                    }
                }
                else
                {
#if UNITY_EDITOR
                    bundle = ResBundleMgr.mIns.Cache.PushEditorAsset(pkginfo, target);
#endif
                }
                return(bundle);
            }
        }
示例#17
0
        protected override void SetFinished()
        {
            if (!MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this))
            {
                LogMgr.LogError("删除失败");
            }
            if (this.Callback != null)
            {
                this.Callback(this);
            }

            base.SetFinished();
        }
示例#18
0
        public static void DestroyAttEvent(MainLoopEvent loopevent, Type tp, string methodname)
        {
            MethodInfo method = tp.GetMethod(methodname, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);

            if (method != null)
            {
                MainLoop.getInstance().UnRegisterLoopEvent(loopevent, method);
            }
            else
            {
                LogMgr.LogErrorFormat("cant found {0} in type :{1}", methodname, tp);
            }
        }
示例#19
0
 private GameSceneCtr()
 {
     if (MainLoop.getInstance() != null)
     {
         if (MainLoop.getInstance().HasInit)
         {
             this.Init();
         }
         else
         {
             MainLoop.getInstance().FrameWorkDoneEvent += Init;
         }
     }
 }
示例#20
0
        protected override void LoadLuaFiles()
        {
            if (ResBundleMgr.mIns != null && ResBundleMgr.mIns.isDone)
            {
                base.LoadLuaFiles();
#if UNITY_EDITOR
                if (GameConfig.Open_DEBUG || MainLoop.getInstance().OpenLuaLOG)
                {
                    this.luaState.LogGC = true;
                }
#endif

                isDone = true;
            }
        }
示例#21
0
        protected AssetBundle LoadAssetBundle(string path)
        {
            if (MainLoop.getInstance().OpenABMode)
            {
#if UNITY_IOS || UNITY_IPHONE || UNITY_ANDROID
                AssetBundle ab = KAssetBundle.LoadFromFile(path);
                return(ab);
#else
                return(null);
#endif
            }
            else
            {
                return(null);
            }
        }
示例#22
0
        protected void _BatchCall()
        {
            if (this.RunningState == CommandState.Paused)
            {
                return;
            }

            if (this.Next != null)
            {
                if (this.Next.isDone)
                {
                    if (this.Next.Next != null)
                    {
                        this.Next = this.Next.Next;
                    }
                    else
                    {
                        this.m_isBatching = false;
                        this.Next         = null;
                        MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.LateUpdate, this._SequenceCall);

                        if (this.isRunning)
                        {
                            this.SetFinished();
                        }
                    }
                }
            }
            else
            {
                this.m_isBatching = false;
                MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.LateUpdate, this._SequenceCall);

                if (this.isRunning)
                {
                    this.SetFinished();
                }
            }
        }
示例#23
0
        public override void Excute()
        {
            try
            {
                if (!this.isRunning)
                {
                    base.Excute();
                    //if(FrameWorkConfig.Open_DEBUG)
                    //    LogMgr.LogFormat("{0} ID:{1} start . ::::Task :{2}",this,this.UID,this.m_task);
                    ///因为update中还有处理处理逻辑,当帧事件穿插在逻辑之间的时候,可能导致某些依赖此对象的帧逻辑判断错误,目前先放在late中
                    MainLoop.getInstance().RegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this);
                }
            }
            catch (FrameWorkException ex)
            {
                LogMgr.LogException(ex);

                ex.RaiseExcption();
            }
            catch (Exception ex)
            {
                LogMgr.LogException(ex);
            }
        }
示例#24
0
 public static void Destroy()
 {
     MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID);
 }
示例#25
0
 public override void Cancel()
 {
     base.Cancel();
     MainLoop.getInstance().UnRegisterCachedAction(MainLoopEvent.BeforeUpdate, methodID, this);
 }
示例#26
0
 internal void EndUpdate()
 {
     MainLoop.getInstance().UnRegisterLoopEvent(MainLoopEvent.Update, UpdateEvent);
 }