コード例 #1
0
ファイル: SceneContainer.cs プロジェクト: Daramkun/Misty
        public override void Draw( GameTime gameTime )
        {
            if ( currentNode != null )
                currentNode.Draw ( gameTime );

            if ( TransitionState != TransitionState.None )
            {
                TransitionState = SceneTransitor.Transitioning ( TransitionState, sceneList.Peek (), gameTime );
                if ( TransitionState == Scenes.TransitionState.PretransitionEnd )
                {
                    switch ( ContainMethod )
                    {
                        case SceneContainMethod.Flat:
                            spinlock.Enter ();
                            sceneList.Pop ().Outro ();
                            nextNode.Intro ( nextNodeArgs );
                            nextNode.Parent = this;
                            sceneList.Push ( currentNode = nextNode );
                            nextNode = null;
                            nextNodeArgs = null;
                            spinlock.Exit ();
                            break;
                        case SceneContainMethod.Stack:
                            if ( nextNode == null )
                            {
                                spinlock.Enter ();
                                Node nn = sceneList.Pop ();
                                nn.Parent = null;
                                nn.Outro ();
                                currentNode = null;
                                nextNode = null;
                                nextNodeArgs = null;
                                spinlock.Exit ();
                            }
                            else
                            {
                                spinlock.Enter ();
                                nextNode.Intro ( nextNodeArgs );
                                sceneList.Push ( currentNode = nextNode );
                                nextNode = null;
                                nextNodeArgs = null;
                                spinlock.Exit ();
                            }
                            break;
                    }
                    gameTime.Reset ();
                }
                else if ( TransitionState == Scenes.TransitionState.End )
                {
                    TransitionState = TransitionState.None;
                    nextNode = null;
                }
            }
            base.Draw ( gameTime );
        }