public void SetCurrentScreen(Screen screen) { if (screen != null) { this.isInstance = false; if (currentControl != null) { currentControl.Destroy(); } this.currentControl = screen; currentControl.SetLock(false); currentControl.SetLocation(0, 0); currentControl.SetClose(false); currentControl.SetOnLoadState(true); if (screen.GetBackground() != null) { currentControl.SetRepaintMode(Screen.SCREEN_BITMAP_REPAINT); } this.isInstance = true; if (screen is EmulatorListener) { SetEmulatorListener((EmulatorListener)screen); } else { SetEmulatorListener(null); } screens.AddLast(screen); } }
public virtual void ReplaceScreen(Screen screen, MoveMethod m) { if (screen != null && screen != this) { screen.SetOnLoadState(false); SetLock(true); screen.SetLock(true); this.replaceMethod = m; this.replaceDstScreen = screen; screen.SetRepaintMode(SCREEN_CANVAS_REPAINT); switch (m) { case MoveMethod.FROM_LEFT: dstPos.SetLocation(-GetWidth(), 0); isScreenFrom = true; break; case MoveMethod.FROM_RIGHT: dstPos.SetLocation(GetWidth(), 0); isScreenFrom = true; break; case MoveMethod.FROM_UP: dstPos.SetLocation(0, -GetHeight()); isScreenFrom = true; break; case MoveMethod.FROM_DOWN: dstPos.SetLocation(0, GetHeight()); isScreenFrom = true; break; case MoveMethod.FROM_UPPER_LEFT: dstPos.SetLocation(-GetWidth(), -GetHeight()); isScreenFrom = true; break; case MoveMethod.FROM_UPPER_RIGHT: dstPos.SetLocation(GetWidth(), -GetHeight()); isScreenFrom = true; break; case MoveMethod.FROM_LOWER_LEFT: dstPos.SetLocation(-GetWidth(), GetHeight()); isScreenFrom = true; break; case MoveMethod.FROM_LOWER_RIGHT: dstPos.SetLocation(GetWidth(), GetHeight()); isScreenFrom = true; break; default: dstPos.SetLocation(0, 0); isScreenFrom = false; break; } Replace_Thread loading = new Replace_Thread(screen); CallEvent(loading); replaceLoading = true; } }
private void SetScreen(Screen screen, bool put) { if (currentControl != null && currentControl.IsOnLoadComplete()) { return; } lock (this) { if (screen == null) { this.isInstance = false; throw new RuntimeException( "Cannot create a [Screen] instance !"); } GLLoader.Destory(); if (!LSystem.isLogo) { if (currentControl != null) { SetTransition(screen.OnTransition()); } else { LTransition transition = screen.OnTransition(); if (transition == null) { switch (MathUtils.Random(0, 3)) { case 0: transition = LTransition.NewFadeIn(); break; case 1: transition = LTransition.NewArc(); break; case 2: transition = LTransition .NewSplitRandom(LColor.black); break; case 3: transition = LTransition .NewCrossRandom(LColor.black); break; } } SetTransition(transition); } } screen.SetOnLoadState(false); if (currentControl == null) { currentControl = screen; } else { lock (currentControl) { currentControl.Destroy(); currentControl = screen; } } this.isInstance = true; if (screen is EmulatorListener) { SetEmulatorListener((EmulatorListener)screen); } else { SetEmulatorListener(null); } screen.OnCreate(LSystem.screenRect.width, LSystem.screenRect.height); LSystem.CallScreenRunnable(new _LoadingScreen(this, screen)); if (put) { screens.AddLast(screen); } loading_Control = null; } }