Пример #1
0
        // CopyTo
        protected override void CopyTo(WidgetBase o)
        {
            base.CopyTo(o);

            WidgetMenuNode oo = (WidgetMenuNode)o;

            oo.Value = Value;
        }
Пример #2
0
        // OnUpdate
        protected override void OnUpdate(float frameTime)
        {
            base.OnUpdate(frameTime);

            CalculateTargetOffset();

            if ((Speed != 0.0f) && (CurrentOffset != TargetOffset))
            {
                float amount = Speed * frameTime;

                CurrentOffset.X += (TargetOffset.X - CurrentOffset.X) * amount;
                CurrentOffset.Y += (TargetOffset.Y - CurrentOffset.Y) * amount;
                CurrentOffset.Z += (TargetOffset.Z - CurrentOffset.Z) * amount;

                float diffX = Math.Abs(TargetOffset.X - CurrentOffset.X);
                float diffY = Math.Abs(TargetOffset.Y - CurrentOffset.Y);
                float diffZ = Math.Abs(TargetOffset.Z - CurrentOffset.Z);

                float diffE = 0.001f;

                if (diffX < diffE)
                {
                    CurrentOffset.X = TargetOffset.X;
                }
                if (diffY < diffE)
                {
                    CurrentOffset.Y = TargetOffset.Y;
                }
                if (diffZ < diffE)
                {
                    CurrentOffset.Z = TargetOffset.Z;
                }
            }

            Vector3 offset = new Vector3();

            for (int i = 0; i < Nodes.Count; ++i)
            {
                WidgetMenuNode node = Nodes[i];

                node.Position.X = CurrentOffset.X + offset.X;
                node.Position.Y = CurrentOffset.Y + offset.Y;
                node.Position.Z = CurrentOffset.Z + offset.Z;

                offset.X += (node.Size.X + Padding) * Direction.X;
                offset.Y += (node.Size.Y + Padding) * Direction.Y;
                offset.Z += (node.Size.Z + Padding) * Direction.Z;
            }
        }
Пример #3
0
        // CalculateTargetOffset
        private void CalculateTargetOffset()
        {
            TargetOffset.X = 0.0f;
            TargetOffset.Y = 0.0f;
            TargetOffset.Z = 0.0f;

            for (int i = 0; i < CurrentNode; ++i)
            {
                WidgetMenuNode node = Nodes[i];

                TargetOffset.X -= (node.Size.X + Padding) * Direction.X;
                TargetOffset.Y -= (node.Size.Y + Padding) * Direction.Y;
                TargetOffset.Z -= (node.Size.Z + Padding) * Direction.Z;
            }
        }
Пример #4
0
        public JoinGame(List<NGame> games)
            : base("Join Game")
        {
            this.games = games;

            //black background
            WidgetGraphic black = new WidgetGraphic();
            black.Size = new Vector3(_UI.SX, _UI.SY, 0.0f);
            black.AddTexture("null", 0.0f, 0.0f, 1.0f, 1.0f);
            black.ColorBase = Color.Black;
            Add(black);

            WidgetMenuScroll menu = new WidgetMenuScroll(E_MenuType.Vertical);
            menu.Position = new Vector3(_UI.SXM, _UI.SYM + 25.0f, 0.0f);
            menu.Padding = 75.0f;
            menu.Alpha = 1.0f;
            Add(menu);

            Menu = menu;

            for (int i = 0; i < games.Count; ++i) {
                WidgetMenuNode node = new WidgetMenuNode(i);
                node.Parent(menu);
                Add(node);

                Timeline nodeT = new Timeline("selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start);
                nodeT.AddEffect(new TimelineEffect_ScaleX(0.0f, 0.125f, E_LerpType.SmoothStep));
                nodeT.AddEffect(new TimelineEffect_ScaleY(0.0f, 0.125f, E_LerpType.SmoothStep));

                Timeline nodeT2 = new Timeline("selected", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start);
                nodeT2.AddEffect(new TimelineEffect_Intensity(0.0f, .75f, E_LerpType.SmoothStep));

                node.AddTimeline(nodeT);
                node.AddTimeline(nodeT2);

                WidgetText text = new WidgetText();
                text.Size = new Vector3(0.0f, 50.0f, 0.0f);
                text.Align = E_Align.MiddleCentre;
                text.FontStyleName = "Default";
                text.String = games[i].getName();
                text.Parent(node);
                text.ParentAttach = E_Align.MiddleCentre;
                text.ColorBase = Color.Orange;
                Add(text);

            }
        }
Пример #5
0
        // Screen_Options
        public Screen_Options()
            : base("Options")
        {
            WidgetGraphic logo = new WidgetGraphic();
            logo.Position = new Vector3( _UI.SXM, _UI.SYM - 65.0f, 0.0f );
            logo.Size = new Vector3( _UI.SY / 3.0f, _UI.SY / 3.0f, 0.0f );
            logo.Align = E_Align.BottomCentre;
            logo.ColorBase = new SpriteColors( Color.Orange, Color.Orange, Color.Black, Color.Black );
            logo.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            Add( logo );

            WidgetMenuScroll menu = new WidgetMenuScroll( E_MenuType.Vertical );
            menu.Position = new Vector3( _UI.SXM, _UI.SYM + 25.0f + 37.5f, 0.0f );
            menu.Padding = 75.0f;
            menu.Alpha = 0.0f;

            Timeline menuT = new Timeline( "start", false, 0.25f, 0.25f, E_TimerType.Stop, E_RestType.None );
            menuT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
            menu.AddTimeline( menuT );

            Timeline menuT2 = new Timeline( "end", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.None );
            menuT2.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.SmoothStep ) );
            menu.AddTimeline( menuT2 );

            Add( menu );

            // music volume
            WidgetMenuNode node0 = new WidgetMenuNode( 0 );
            Add( node0 );
            node0.Parent( menu );

            Timeline nodeT = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            nodeT.AddEffect( new TimelineEffect_ScaleX( 0.0f, 0.125f, E_LerpType.SmoothStep ) );
            nodeT.AddEffect( new TimelineEffect_ScaleY( 0.0f, 0.125f, E_LerpType.SmoothStep ) );

            Timeline nodeT2 = new Timeline( "selected", false, 0.0f, 0.5f, E_TimerType.Bounce, E_RestType.Start );
            nodeT2.AddEffect( new TimelineEffect_Intensity( 0.0f, 0.75f, E_LerpType.SmoothStep ) );

            node0.AddTimeline( nodeT );
            node0.AddTimeline( nodeT2 );

            WidgetText text0 = new WidgetText();
            text0.Size = new Vector3( 0.0f, 50.0f, 0.0f );
            text0.Align = E_Align.MiddleCentre;
            text0.FontStyleName = "Default";
            text0.String = "MUSIC VOLUME";
            text0.Align = E_Align.MiddleRight;
            text0.Parent( node0 );
            text0.ParentAttach = E_Align.MiddleCentre;
            text0.ColorBase = Color.Orange;
            Add( text0 );

            WidgetMenuSwitch menuSwitch0 = new WidgetMenuSwitch( E_MenuType.Horizontal );
            menuSwitch0.Position = new Vector3( 80.0f, 0.0f, 0.0f );
            menuSwitch0.Parent( node0 );
            menuSwitch0.ParentAttach = E_Align.MiddleCentre;
            menuSwitch0.DeactivateArrows = false;
            Add( menuSwitch0 );

            Timeline timelineArrow_Selected = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            timelineArrow_Selected.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );

            Timeline timelineArrow_Nudge = new Timeline( "nudge", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.None );
            timelineArrow_Nudge.AddEffect( new TimelineEffect_ScaleX( 0.0f, 0.25f, E_LerpType.BounceOnceSmooth ) );
            timelineArrow_Nudge.AddEffect( new TimelineEffect_ScaleY( 0.0f, 0.25f, E_LerpType.BounceOnceSmooth ) );

            WidgetGraphic arrow = new WidgetGraphic();
            arrow.Size = new Vector3( 15.0f, 30.0f, 0.0f );
            arrow.ColorBase = Color.Orange;
            arrow.Alpha = 0.0f;
            arrow.Align = E_Align.MiddleCentre;
            arrow.RenderState.Effect = (int)E_Effect.IntensityAsAlpha_PMA;
            arrow.FlagClear( E_WidgetFlag.InheritIntensity );
            arrow.AddTimeline( timelineArrow_Selected.Copy() );
            arrow.AddTimeline( timelineArrow_Nudge.Copy() );
            arrow.ParentAttach = E_Align.MiddleCentre;

            WidgetGraphic arrowLeft = (WidgetGraphic)arrow.Copy();
            arrowLeft.Name = "arrow_decrease";
            arrowLeft.Position = new Vector3( -50.0f, 0.0f, 0.0f );
            arrowLeft.Rotation.Z = 180.0f;
            arrowLeft.AddTexture( "null", 0.5f, 0.0f, 0.5f, 1.0f );
            arrowLeft.Parent( menuSwitch0 );
            Add( arrowLeft );

            WidgetGraphic arrowRight = (WidgetGraphic)arrow.Copy();
            arrowRight.Name = "arrow_increase";
            arrowRight.Position = new Vector3( 50.0f, 0.0f, 0.0f );
            arrowRight.AddTexture( "null", 0.5f, 0.0f, 0.5f, 1.0f );
            arrowRight.Parent( menuSwitch0 );
            Add( arrowRight );

            menuSwitch0.ArrowDecrease = arrowLeft;
            menuSwitch0.ArrowIncrease = arrowRight;

            for ( int i = 0; i < 11; ++i )
            {
            WidgetMenuNode node = new WidgetMenuNode( i );
            node.Parent( menuSwitch0 );
            Add( node );

            WidgetText text = new WidgetText();
            text.Size = new Vector3( 0.0f, 50.0f, 0.0f );
            text.String = "" + i;
            text.FontStyleName = "Default";
            text.Align = E_Align.MiddleCentre;
            text.ColorBase = Color.Orange;
            text.Parent( node );
            text.ParentAttach = E_Align.MiddleCentre;
            Add( text );
            }

            // sfx volume
            WidgetMenuNode node1 = (WidgetMenuNode)node0.Copy();
            node1.Value = 1;
            Add( node1 );
            node1.Parent( menu );

            WidgetText text1 = (WidgetText)text0.Copy();
            text1.String = "SFX VOLUME";
            text1.Parent( node1 );
            Add( text1 );

            WidgetMenuSwitch menuSwitch1 = (WidgetMenuSwitch)menuSwitch0.CopyAndAdd( this );
            menuSwitch1.ArrowDecrease = menuSwitch1.FindChild( "arrow_decrease" );
            menuSwitch1.ArrowIncrease = menuSwitch1.FindChild( "arrow_increase" );
            menuSwitch1.Parent( node1 );

            MenuSwitch0 = menuSwitch0;
            MenuSwitch1 = menuSwitch1;
        }
Пример #6
0
        // Screen_LevelSelect
        public Screen_LevelSelect()
            : base("LevelSelect")
        {
            WidgetGraphic black = new WidgetGraphic();
            black.Size = new Vector3( _UI.SX, _UI.SY, 0.0f );
            black.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            black.ColorBase = Color.Black;
            Add( black );

            Timeline blackT = new Timeline( "start", true, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            blackT.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.Linear ) );
            black.AddTimeline( blackT );

            Random r = new Random();

            WidgetGraphic background0 = new WidgetGraphic();
            background0.RenderPass = 2;
            background0.Position = new Vector3( _UI.SXM, _UI.SYM, 0.0f );
            background0.Size = new Vector3( _UI.SX, _UI.SY, 0.0f );
            background0.Align = E_Align.MiddleCentre;
            background0.ColorBase = Color.Yellow;
            background0.Intensity = 0.25f;
            background0.Alpha = 0;
            background0.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            background0.RenderState.Effect = (int)E_Effect.GrayScale;
            Add( background0 );

            Timeline back0T = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            back0T.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.Linear ) );
            background0.AddTimeline( back0T );

            WidgetGraphic background1 = (WidgetGraphic)background0.Copy();
            Add( background1 );

            Backgrounds[ 0 ] = background0;
            Backgrounds[ 1 ] = background1;

            Menu = new WidgetMenuScroll( E_MenuType.Horizontal );
            Menu.RenderPass = 1;
            Menu.Speed = 5.0f;
            Menu.Padding = 10.0f;
            Add( Menu );

            for ( int i = 0; i < 4; ++i )
            {
            LevelNodes[ i ] = new List< WidgetBase >();

            WidgetMenuNode node = new WidgetMenuNode( i );
            node.RenderPass = 1;
            node.Size = new Vector3( 40.0f, 40.0f * ( 9.0f / 16.0f ), 0.0f );
            node.Align = E_Align.MiddleCentre;
            node.Alpha = 0.5f;
            node.Parent( Menu );
            Add( node );

            Timeline nodeT = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            nodeT.AddEffect( new TimelineEffect_Alpha( 0.0f, 0.5f, E_LerpType.Linear ) );
            node.AddTimeline( nodeT );

            MenuNodes[ i ] = node;

            WidgetGraphic back = new WidgetGraphic();
            back.RenderPass = 1;
            back.Size = new Vector3( node.Size.X + 1.0f, node.Size.Y + 1.0f, 0.0f );
            back.Align = E_Align.MiddleCentre;
            back.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            back.Parent( node );
            back.ParentAttach = E_Align.MiddleCentre;
            back.ColorBase = Color.Red;
            back.Intensity = 0.5f;
            back.Alpha = 0.0f;
            Add( back );

            Timeline backT = new Timeline( "selected", false, 0.0f, 0.5f, E_TimerType.Bounce, E_RestType.Start );
            backT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
            back.AddTimeline( backT );

            int numRows = 4;
            int numCols = 4;

            for ( int j = 0; j < numRows; ++j )
            {
                for ( int k = 0; k < numCols; ++k )
                {
                    WidgetGraphic graphic = new WidgetGraphic();
                    graphic.RenderPass = 1;
                    graphic.Layer = 2;
                    graphic.Size = new Vector3( node.Size.X / numCols, node.Size.Y / numRows, 0.0f );

                    float x = node.Position.X - node.Size.X / 2.0f + graphic.Size.X / 2.0f;
                    float y = node.Position.Y + node.Size.Y / 2.0f - graphic.Size.Y / 2.0f;

                    graphic.Position = new Vector3( x + ( graphic.Size.X * k ), y - ( graphic.Size.Y * j ), 0.0f );
                    graphic.Align = E_Align.MiddleCentre;
                    graphic.AddTexture( TextureNames[ i ], ( 1.0f / numCols ) * k, ( 1.0f / numRows ) * j, 1.0f / numCols, 1.0f / numRows );
                    graphic.Parent( node );
                    graphic.ParentAttach = E_Align.MiddleCentre;
                    graphic.ColorBase = Color.White;

                    bool complete = ( ( i == 1 ) || ( r.NextDouble() < 0.5f ) );

                    if ( !complete )
                    {
                        graphic.RenderState.Effect = (int)E_Effect.GrayScale;
                        graphic.Intensity = 0.5f;
                    }

                    float gapX = 1.5f;
                    float gapY = 1.5f;

                    Vector3 posTo = new Vector3( x - gapX * ( numCols - 1 ) / 2.0f + ( ( graphic.Size.X + gapX ) * k ) - graphic.Position.X, y + gapY * ( numRows - 1 ) / 2.0f - ( ( graphic.Size.Y + gapY ) * j ) - graphic.Position.Y, 0.0f );

                    float halfX = ( numCols * graphic.Size.X + ( numCols - 1 ) * gapX ) / 2.0f;
                    float rotY = ( posTo.X / halfX ) * -135.0f;

                    posTo.Z = graphic.Size.X * (float)Math.Tan( MathHelper.ToRadians( Math.Abs( rotY ) ) );

                    Timeline graphicT = new Timeline( "select_world", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start );
                    graphicT.AddEffect( new TimelineEffect_PositionX( 0.0f, posTo.X, E_LerpType.SmoothStep ) );
                    graphicT.AddEffect( new TimelineEffect_PositionY( 0.0f, posTo.Y, E_LerpType.SmoothStep ) );
                    graphicT.AddEffect( new TimelineEffect_PositionZ( 0.0f, posTo.Z, E_LerpType.SmoothStep ) );
                    graphicT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.Linear ) );
                    graphicT.AddEffect( new TimelineEffect_RotationY( 0.0f, rotY, E_LerpType.SmoothStep ) );
                    graphic.AddTimeline( graphicT );

                    Timeline graphicT2 = new Timeline( "select_world", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
                    graphicT2.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.Linear ) );
                    graphic.AddTimeline( graphicT2 );

                    WidgetGraphic backLevel = new WidgetGraphic();
                    backLevel.RenderPass = 1;
                    backLevel.Size = new Vector3( graphic.Size.X + 1.0f, graphic.Size.Y + 1.0f, 0.0f );
                    backLevel.Align = E_Align.MiddleCentre;
                    backLevel.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
                    backLevel.Parent( graphic );
                    backLevel.ParentAttach = E_Align.MiddleCentre;
                    backLevel.ColorBase = Color.Red;
                    backLevel.Intensity = 0.5f;
                    backLevel.Alpha = 0.0f;
                    backLevel.FlagClear( E_WidgetFlag.InheritIntensity );
                    Add( backLevel );

                    Timeline backLevelT = new Timeline( "select_level", false, 0.0f, 0.5f, E_TimerType.Bounce, E_RestType.Start );
                    backLevelT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
                    backLevel.AddTimeline( backLevelT );

                    WidgetGraphic backG = (WidgetGraphic)graphic.Copy();
                    backG.Size += new Vector3( 0.25f, 0.25f, 0.0f );
                    backG.ColorBase = Color.Black;
                    backG.Alpha = 0.0f;
                    backG.Layer = 1;
                    backG.Parent( node );
                    Add( backG );

                    Timeline backGT = new Timeline( "select_world", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start );
                    backGT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
                    backG.AddTimeline( backGT );

                    Add( graphic );

                    if ( complete )
                    {
                        WidgetGraphic tick = new WidgetGraphic();
                        tick.RenderPass = 1;
                        tick.Layer = 3;
                        tick.Position = new Vector3( 1.0f, -1.0f, 0.0f );
                        tick.Size = new Vector3( 3.0f, 3.0f, 0.0f );
                        tick.Align = E_Align.BottomRight;
                        tick.Parent( graphic );
                        tick.ParentAttach = E_Align.BottomRight;
                        tick.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
                        tick.Alpha = 0.0f;
                        tick.ColorBase = Color.Green;
                        Add( tick );

                        Timeline tickT = new Timeline( "select_world", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
                        tickT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
                        tick.AddTimeline( tickT );
                    }

                    WidgetText text = new WidgetText();
                    text.RenderPass = 1;
                    text.Layer = 4;
                    text.Size = new Vector3( 0.0f, 3.0f, 0.0f );
                    text.Align = E_Align.MiddleCentre;
                    text.FontStyleName = "Default3dDS";
                    text.String = "" + ( ( j * numCols ) + k + 1 );
                    text.Parent( graphic );
                    text.ParentAttach = E_Align.MiddleCentre;
                    text.ColorBase = Color.Yellow;
                    text.Alpha = 0.0f;
                    Add( text );

                    Timeline textT = new Timeline( "select_world", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start );
                    textT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
                    text.AddTimeline( textT );

                    LevelNodes[ i ].Add( graphic );
                }
            }

            if ( i == 1 )
            {
                WidgetGraphic tickWorld = new WidgetGraphic();
                tickWorld.RenderPass = 1;
                tickWorld.Layer = 3;
                tickWorld.Position = new Vector3( 4.0f, -4.0f, 0.0f );
                tickWorld.Size = new Vector3( 12.0f, 12.0f, 0.0f );
                tickWorld.Align = E_Align.BottomRight;
                tickWorld.Parent( node );
                tickWorld.ParentAttach = E_Align.BottomRight;
                tickWorld.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
                tickWorld.ColorBase = Color.Green;
                Add( tickWorld );

                Timeline tickWorldT = new Timeline( "select_world", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
                tickWorldT.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.SmoothStep ) );
                tickWorld.AddTimeline( tickWorldT );
            }

            // world name
            WidgetText textWorld = new WidgetText();
            textWorld.RenderPass = 1;
            textWorld.Layer = 4;
            textWorld.Position = new Vector3( 0.0f, 1.5f, 0.0f );
            textWorld.Size = new Vector3( 0.0f, 3.5f, 0.0f );
            textWorld.Align = E_Align.BottomCentre;
            textWorld.FontStyleName = "Default3dDS";
            textWorld.String = "WORLD " + ( i + 1 );
            textWorld.Parent( back );
            textWorld.ParentAttach = E_Align.TopCentre;
            textWorld.ColorBase = Color.Orange;
            textWorld.FlagClear( E_WidgetFlag.InheritAlpha );
            textWorld.FlagClear( E_WidgetFlag.InheritIntensity );
            Add( textWorld );

            // num levels complete
            WidgetText textLevelComplete = (WidgetText)textWorld.Copy();
            textLevelComplete.Position.Y *= -1.0f;
            textLevelComplete.Align = E_Align.TopCentre;
            textLevelComplete.Parent( back );
            textLevelComplete.ParentAttach = E_Align.BottomCentre;

            int count = 0;

            for ( int j = 0; j < LevelNodes[ i ].Count; ++j )
                if ( LevelNodes[ i ][ j ].RenderState.Effect == (int)E_Effect.MultiTexture1 )
                    ++count;

            textLevelComplete.String = count + " / " + LevelNodes[ i ].Count;
            Add( textLevelComplete );

            Timeline textWorldT = new Timeline( "select_world", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start );
            textWorldT.AddEffect( new TimelineEffect_PositionY( 0.0f, 2.0f, E_LerpType.SmoothStep ) );
            textWorld.AddTimeline( textWorldT );

            Timeline textLevelCompleteT = new Timeline( "select_world", false, 0.0f, 0.5f, E_TimerType.Stop, E_RestType.Start );
            textLevelCompleteT.AddEffect( new TimelineEffect_PositionY( 0.0f, -2.0f, E_LerpType.SmoothStep ) );
            textLevelComplete.AddTimeline( textLevelCompleteT );
            }

            CurrentSelectionWorld = -1;
            CurrentSelectionLevel = 0;
            CurrentBackground = -1;

            Mode = 0; // world
        }
Пример #7
0
        private void FillSideBar(WidgetMenuScroll sideBar, string[] texNameArray, Vector3 size)
        {
            for (int i = 0; i < texNameArray.Length; ++i)
            {
                WidgetMenuNode node = new WidgetMenuNode(i);
                node.RenderPass = 1;
                node.Size = size;
                node.Align = E_Align.MiddleCentre;
                node.Alpha = 0.5f;
                node.Parent(sideBar);
                Add(node);
                Timeline nodeT = new Timeline("selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start);
                nodeT.AddEffect(new TimelineEffect_Alpha(0.0f, 0.5f, E_LerpType.Linear));
                node.AddTimeline(nodeT);

                WidgetGraphic back = new WidgetGraphic();
                back.RenderPass = 1;
                back.Size = new Vector3(node.Size.X, node.Size.Y, 0.0f);
                back.Align = E_Align.MiddleCentre;
                back.AddTexture("null", 0.0f, 0.0f, 1.0f, 1.0f);
                back.Parent(node);
                back.ParentAttach = E_Align.MiddleRight;
                back.ColorBase = Color.Yellow;
                back.Intensity = 0.5f;
                back.Alpha = 0.0f;
                Add(back);
                Timeline backT = new Timeline("selected", false, 0.0f, 0.5f, E_TimerType.Bounce, E_RestType.Start);
                backT.AddEffect(new TimelineEffect_Alpha(0.2f, 0.9f, E_LerpType.SmoothStep));
                back.AddTimeline(backT);

                WidgetGraphic graphic = new WidgetGraphic();
                graphic.RenderPass = 1;
                graphic.Layer = 2;
                graphic.Size = new Vector3(node.Size.X - 1.0f, node.Size.Y - 1.0f, 0.0f);
                graphic.Align = E_Align.MiddleCentre;
                graphic.AddTexture(texNameArray[i], 0.0f, 0.0f, 1.0f, 1.0f);
                graphic.Name = texNameArray[i];
                graphic.Parent(node);
                graphic.ParentAttach = E_Align.MiddleRight;
                graphic.ColorBase = Color.White;

                Add(graphic);
            }
        }
        // Screen_MainMenu
        public Screen_MainMenu()
            : base("MainMenu")
        {
            WidgetGraphic logo = new WidgetGraphic();
            logo.Position = new Vector3( _UI.SXM, _UI.SYM - 65.0f, 0.0f );
            logo.Size = new Vector3( _UI.SY / 3.0f, _UI.SY / 3.0f, 0.0f );
            logo.Align = E_Align.BottomCentre;
            logo.ColorBase = new SpriteColors( Color.Orange, Color.Orange, Color.Black, Color.Black );
            logo.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            Add( logo );

            Timeline logoT = new Timeline( "end_fade", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            logoT.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.SmoothStep ) );
            logo.AddTimeline( logoT );

            Timeline logoT2 = new Timeline( "end_move", false, 0.25f, 0.25f, E_TimerType.Stop, E_RestType.None );
            logoT2.AddEffect( new TimelineEffect_PositionY( 0.0f, 65.0f, E_LerpType.SmoothStep ) );
            logo.AddTimeline( logoT2 );

            if ( _G.UI.MM_FromStartScreen )
            {
            logo.Position = new Vector3( _UI.SXM, _UI.SYM, 0.0f );

            Timeline logoT3 = new Timeline( "start", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.None );
            logoT3.AddEffect( new TimelineEffect_PositionY( 0.0f, -65.0f, E_LerpType.SmoothStep ) );
            logo.AddTimeline( logoT3 );
            }
            else
            if ( _G.UI.MM_FromLevelSelect )
            {
            Timeline logoT4 = new Timeline( "start", false, 0.25f, 0.25f, E_TimerType.Stop, E_RestType.None );
            logoT4.AddEffect( new TimelineEffect_Alpha( -1.0f, 0.0f, E_LerpType.SmoothStep ) );
            logo.AddTimeline( logoT4 );
            }

            _G.UI.MM_FromStartScreen = false;
            _G.UI.MM_FromLevelSelect = false;

            Logo = logo;

            WidgetMenuScroll menu = new WidgetMenuScroll( E_MenuType.Vertical );
            menu.Position = new Vector3( _UI.SXM, _UI.SYM + 25.0f, 0.0f );
            menu.Padding = 75.0f;
            menu.Alpha = 0.0f;
            Add( menu );

            Timeline menuT = new Timeline( "start", false, 0.25f, 0.25f, E_TimerType.Stop, E_RestType.None );
            menuT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
            menu.AddTimeline( menuT );

            Timeline menuT2 = new Timeline( "end", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.None );
            menuT2.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.SmoothStep ) );
            menu.AddTimeline( menuT2 );

            Menu = menu;

            for ( int i = 0; i < Options.Length; ++i )
            {
            WidgetMenuNode node = new WidgetMenuNode( i );
            node.Parent( Menu );
            Add( node );

            Timeline nodeT = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            nodeT.AddEffect( new TimelineEffect_ScaleX( 0.0f, 0.125f, E_LerpType.SmoothStep ) );
            nodeT.AddEffect( new TimelineEffect_ScaleY( 0.0f, 0.125f, E_LerpType.SmoothStep ) );

            Timeline nodeT2 = new Timeline( "selected", false, 0.0f, 0.5f, E_TimerType.Bounce, E_RestType.Start );
            nodeT2.AddEffect( new TimelineEffect_Intensity( 0.0f, 0.75f, E_LerpType.SmoothStep ) );

            node.AddTimeline( nodeT );
            node.AddTimeline( nodeT2 );

            WidgetText text = new WidgetText();
            text.Size = new Vector3( 0.0f, 50.0f, 0.0f );
            text.Align = E_Align.MiddleCentre;
            text.FontStyleName = "Default";
            text.String = Options[ i ];
            text.Parent( node );
            text.ParentAttach = E_Align.MiddleCentre;
            text.ColorBase = Color.Orange;
            Add( text );

            WidgetGraphic icon = new WidgetGraphic();
            icon.Layer = 1;
            icon.Position = new Vector3( -10.0f, 0.0f, 0.0f );
            icon.Size = new Vector3( 60.0f, 60.0f, 0.0f );
            icon.AddTexture( TextureNames[ i ], 0.0f, 0.0f, 1.0f, 1.0f );
            icon.Alpha = 0;
            icon.Parent( text );
            icon.ColorBase = Color.White;

            if ( ( i & 1 ) == 0 )
            {
                icon.Align = E_Align.MiddleRight;
                icon.ParentAttach = E_Align.MiddleLeft;
            }
            else
            {
                icon.Align = E_Align.MiddleLeft;
                icon.ParentAttach = E_Align.MiddleRight;
                icon.Position *= -1.0f;
            }

            Add( icon );

            Timeline iconT = new Timeline( "selected", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            iconT.AddEffect( new TimelineEffect_Alpha( 0.0f, 1.0f, E_LerpType.SmoothStep ) );
            icon.AddTimeline( iconT );
            }
        }