示例#1
0
 private static void CallUpdateable(TArray <Updateable> list)
 {
     lock (typeof(LProcess))
     {
         TArray <Updateable> loadCache;
         lock (list)
         {
             loadCache = new TArray <Updateable>(list);
             list.Clear();
         }
         for (int i = 0, size = loadCache.size; i < size; i++)
         {
             Updateable r = loadCache.Get(i);
             if (r == null)
             {
                 continue;
             }
             lock (r)
             {
                 try
                 {
                     r.Action(null);
                 }
                 catch (System.Exception cause)
                 {
                     LSystem.Error("Updateable dispatch failure", cause);
                 }
             }
         }
         loadCache = null;
     }
 }
示例#2
0
 public override void Run(LTimerContext time)
 {
     if (outerInstance._game != null)
     {
         try
         {
             //outerInstance.StartTransition();
             //screen.SetClose(false);
             //screen.ResetOrder();
             //screen.ResetSize();
             //screen.OnLoad();
             //screen.OnLoaded();
             //screen.SetOnLoadState(true);
             screen.Resume();
             //outerInstance.endTransition();
         }
         catch (System.Exception cause)
         {
             LSystem.Error("Screen onLoad dispatch failed: " + screen, cause);
         }
         finally
         {
             Kill();
         }
     }
 }
示例#3
0
        private void SetScreen(Screen screen, bool put)
        {
            if (_loadingScreen != null && _loadingScreen.IsOnLoadComplete())
            {
                return;
            }
            try
            {
                lock (this)
                {
                    if (screen == null)
                    {
                        this.isInstance = false;
                        throw new LSysException("Cannot create a [Screen] instance !");
                    }

                    //screen.SetOnLoadState(false);
                    if (_currentScreen == null)
                    {
                        _currentScreen = screen;
                    }
                    else
                    {
                        KillScreen(screen);
                    }
                    this.isInstance = true;

                    screen.OnCreate(LSystem.viewSize.GetWidth(), LSystem.viewSize.GetHeight());

                    RealtimeProcess process = new RealtimeProcessImpl(this, screen);
                    process.SetProcessType(GameProcessType.Initialize);
                    process.SetDelay(0);

                    RealtimeProcessManager.Get().AddProcess(process);

                    if (put)
                    {
                        _screens.Add(screen);
                    }
                    _loadingScreen = null;
                }
            }
            catch (System.Exception cause)
            {
                LSystem.Error("Update Screen failed: " + screen, cause);
            }
        }
示例#4
0
            internal void Update(LTimerContext c)
            {
                try
                {
                    switch (type)
                    {
                    case DRAW_USER:
                        /*DrawListener<Screen> drawing = screen._drawListener;
                         * if (drawing != null)
                         * {
                         *      drawing.update(c.timeSinceLastUpdate);
                         * }*/
                        screen.Alter(c);
                        break;

                    case DRAW_SPRITE:
                        /*screen.spriteRun = (screen.sprites != null && screen.sprites.size() > 0);
                         * if (screen.spriteRun)
                         * {
                         *      screen.sprites.update(c.timeSinceLastUpdate);
                         * }*/
                        break;

                    case DRAW_DESKTOP:
                        /*	screen.desktopRun = (screen.desktop != null && screen.desktop.size() > 0);
                         *      if (screen.desktopRun)
                         *      {
                         *              screen.desktop.update(c.timeSinceLastUpdate);
                         *      }*/
                        break;

                    case DRAW_EMPTY:
                    default:
                        break;
                    }
                }
                catch (System.Exception cause)
                {
                    LSystem.Error("Screen update() dispatch failure", cause);
                }
            }
示例#5
0
 private void KillScreen(Screen screen)
 {
     try
     {
         lock (_currentScreen)
         {
             if (_currentScreen != null)
             {
                 _currentScreen.Destroy();
             }
             if (screen == _currentScreen)
             {
                 screen.Pause();
             }
             screen.Destroy();
             _currentScreen = screen;
         }
     }
     catch (System.Exception cause)
     {
         LSystem.Error("Destroy screen failure", cause);
     }
 }