C# 클래스 Nez.SceneTransition

SceneTransition is used to transition from one Scene to another or within a scene with an effect. If sceneLoadAction is null Nez will perform an in-Scene transition as opposed to loading a new Scene mid transition. The general gist of a transition is the following: - onBeginTransition will be called allowing you to yield for multipart transitions - for two part transitions with Effects you can yield on a call to tickEffectProgressProperty for part one to obscure the screen - next, yield a call to loadNextScene to load up the new Scene - finally, yield again on tickEffectProgressProperty to un-obscure the screen and show the new Scene
파일 보기 프로젝트 열기: prime31/Nez 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
loadSceneOnBackgroundThread bool
onScreenObscured System.Action
previousSceneRender Microsoft.Xna.Framework.Graphics.RenderTarget2D
wantsPreviousSceneRender bool

보호된 프로퍼티들

프로퍼티 타입 설명
_isNewSceneLoaded bool
sceneLoadAction Func

Private Properties

프로퍼티 타입 설명

공개 메소드들

메소드 설명
onBeginTransition ( ) : IEnumerator

called after the previousSceneRender occurs for the first (and only) time. At this point you can load your new Scene after yielding one frame (so the first render call happens before scene loading).

preRender ( Graphics graphics ) : void

called before the Scene is rendered. This allows a transition to render to a RenderTarget if needed and avoids issues with MonoGame clearing the framebuffer when a RenderTarget is used.

render ( Graphics graphics ) : void

do all of your rendering here

tickEffectProgressProperty ( Effect effect, float duration, EaseType easeType = EaseType.ExpoOut, bool reverseDirection = false ) : IEnumerator

the most common type of transition seems to be one that ticks progress from 0 - 1. This method takes care of that for you if your transition needs to have a _progress property ticked after the scene loads.

보호된 메소드들

메소드 설명
SceneTransition ( Func sceneLoadAction, bool wantsPreviousSceneRender = true ) : System
SceneTransition ( bool wantsPreviousSceneRender = true ) : System
loadNextScene ( ) : IEnumerator
transitionComplete ( ) : void

this should be called when your transition is complete and the new Scene has been set. It will clean up

메소드 상세

SceneTransition() 보호된 메소드

protected SceneTransition ( Func sceneLoadAction, bool wantsPreviousSceneRender = true ) : System
sceneLoadAction Func
wantsPreviousSceneRender bool
리턴 System

SceneTransition() 보호된 메소드

protected SceneTransition ( bool wantsPreviousSceneRender = true ) : System
wantsPreviousSceneRender bool
리턴 System

loadNextScene() 보호된 메소드

protected loadNextScene ( ) : IEnumerator
리턴 IEnumerator

onBeginTransition() 공개 메소드

called after the previousSceneRender occurs for the first (and only) time. At this point you can load your new Scene after yielding one frame (so the first render call happens before scene loading).
public onBeginTransition ( ) : IEnumerator
리턴 IEnumerator

preRender() 공개 메소드

called before the Scene is rendered. This allows a transition to render to a RenderTarget if needed and avoids issues with MonoGame clearing the framebuffer when a RenderTarget is used.
public preRender ( Graphics graphics ) : void
graphics Graphics Graphics.
리턴 void

render() 공개 메소드

do all of your rendering here
public render ( Graphics graphics ) : void
graphics Graphics Graphics.
리턴 void

tickEffectProgressProperty() 공개 메소드

the most common type of transition seems to be one that ticks progress from 0 - 1. This method takes care of that for you if your transition needs to have a _progress property ticked after the scene loads.
public tickEffectProgressProperty ( Effect effect, float duration, EaseType easeType = EaseType.ExpoOut, bool reverseDirection = false ) : IEnumerator
effect Microsoft.Xna.Framework.Graphics.Effect
duration float duration
easeType EaseType
reverseDirection bool if true, _progress will go from 1 to 0. If false, it goes form 0 to 1
리턴 IEnumerator

transitionComplete() 보호된 메소드

this should be called when your transition is complete and the new Scene has been set. It will clean up
protected transitionComplete ( ) : void
리턴 void

프로퍼티 상세

_isNewSceneLoaded 보호되어 있는 프로퍼티

use this for two part transitions. For example, a fade would fade to black first then when _isNewSceneLoaded becomes true it would fade in. For in-Scene transitions _isNewSceneLoaded will be set to true at the midpoint just as if a new Scene was loaded.
protected bool _isNewSceneLoaded
리턴 bool

loadSceneOnBackgroundThread 공개적으로 프로퍼티

if true, the next Scene will be loaded on a background thread. Note that if raw PNG files are used they cannot be loaded on a background thread.
public bool loadSceneOnBackgroundThread
리턴 bool

onScreenObscured 공개적으로 프로퍼티

called when loadNextScene is executing. This is useful when doing inter-Scene transitions so that you know when you can more the Camera or reset any Entities
public Action,System onScreenObscured
리턴 System.Action

previousSceneRender 공개적으로 프로퍼티

contains the last render of the previous Scene. Can be used to obscure the screen while loading a new Scene.
public RenderTarget2D,Microsoft.Xna.Framework.Graphics previousSceneRender
리턴 Microsoft.Xna.Framework.Graphics.RenderTarget2D

sceneLoadAction 보호되어 있는 프로퍼티

function that should return the newly loaded scene
protected Func sceneLoadAction
리턴 Func

wantsPreviousSceneRender 공개적으로 프로퍼티

if true, Nez will render the previous scene into previousSceneRender so that you can use it with your transition
public bool wantsPreviousSceneRender
리턴 bool