Ejemplo n.º 1
0
        // Screen_Loading
        public Screen_Loading()
            : base("Loading")
        {
            int numIcons = 10;
            float gap = -40.0f;

            for ( int i = 0; i < numIcons; ++i )
            {
            float rot = ( MathHelper.TwoPi / numIcons ) * i;
            Matrix m = Matrix.CreateRotationZ( rot );

            WidgetGraphic icon = new WidgetGraphic();
            icon.Position = new Vector3( 0.0f, gap, 0.0f );
            Vector3.Transform( ref icon.Position, ref m, out icon.Position );
            icon.Position += new Vector3( _UI.SXM, _UI.SYM - 50.0f, 0.0f );
            icon.Size = new Vector3( 12.0f, 12.0f, 0.0f );
            icon.Align = E_Align.MiddleCentre;
            icon.ColorBase = Color.Orange;
            icon.AddTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f );
            icon.Rotation.Z = MathHelper.ToDegrees( rot );
            Add( icon );

            Timeline iconT = new Timeline( "", true, ( 1.0f / numIcons ) * i, 0.5f, E_TimerType.Bounce, E_RestType.None );
            iconT.AddEffect( new TimelineEffect_Alpha( 0.0f, -1.0f, E_LerpType.SmoothStep ) );
            iconT.AddEffect( new TimelineEffect_ScaleX( 0.0f, 0.5f, E_LerpType.SmoothStep ) );
            iconT.AddEffect( new TimelineEffect_ScaleY( 0.0f, 0.5f, E_LerpType.SmoothStep ) );
            icon.AddTimeline( iconT );

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

            WidgetText text = new WidgetText();
            text.Position = new Vector3( _UI.SXM, _UI.SYM + 25.0f, 0.0f );
            text.Size = new Vector3( 0.0f, 60.0f, 0.0f );
            text.Align = E_Align.TopCentre;
            text.FontStyle = _UI.Store_FontStyle.Get( "Default" ).Copy();
            text.FontStyle.TrackingPercentage = 0.1875f;
            text.String = "LOADING";
            text.ColorBase = Color.Orange;
            text.AddFontEffect( new FontEffect_ColorLerp( 0.03125f, 1.5f, 3.0f, Color.White, E_LerpType.BounceOnceSmooth ) );
            text.AddFontEffect( new FontEffect_Scale( 0.03125f, 0.75f, 3.0f, 1.0f, 1.5f, 1.0f, 2.0f, E_LerpType.BounceOnceSmooth ) );
            Add( text );

            Timeline textT2 = new Timeline( "start", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            textT2.AddEffect( new TimelineEffect_Alpha( -1.0f, 0.0f, E_LerpType.SmoothStep ) );
            text.AddTimeline( textT2 );
        }
Ejemplo n.º 2
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);

            }
        }
Ejemplo n.º 3
0
        // Screen_Start
        public Screen_Start()
            : base("Start")
        {
            WidgetGraphic logo = new WidgetGraphic();
            logo.Position = new Vector3(_UI.SXM, _UI.SYM, 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);

            if (!_G.UI.SS_FromMainMenu)
            {
                Timeline logoT = new Timeline("start", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.None);
                logoT.AddEffect(new TimelineEffect_Alpha(-1.0f, 0.0f, E_LerpType.SmoothStep));
                logo.AddTimeline(logoT);
            }

            _G.UI.SS_FromMainMenu = false;

            WidgetText text = new WidgetText();
            text.Position = new Vector3(_UI.SXM, _UI.SYM + 150.0f, 0.0f);
            text.Size = new Vector3(0.0f, 60.0f, 0.0f);
            text.Align = E_Align.MiddleCentre;
            text.FontStyle = _UI.Store_FontStyle.Get("Default").Copy();
            text.FontStyle.TrackingPercentage = 0.1875f;
            text.String = "PRESS START BUTTON";
            text.ColorBase = Color.Orange;
            text.AddFontEffect(new FontEffect_ColorLerp(0.03125f, 1.5f, 3.0f, Color.White, E_LerpType.BounceOnceSmooth));
            text.AddFontEffect(new FontEffect_Scale(0.03125f, 0.75f, 3.0f, 1.0f, 1.5f, 1.0f, 2.0f, E_LerpType.BounceOnceSmooth));
            Add(text);

            Timeline textT = new Timeline("start", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start);
            textT.AddEffect(new TimelineEffect_Alpha(-1.0f, 0.0f, E_LerpType.SmoothStep));
            text.AddTimeline(textT);
        }
Ejemplo n.º 4
0
        // Screen_Popup
        public Screen_Popup( E_PopupType type )
            : base("Popup")
        {
            Type = type;

            int layer = _UI.Sprite.TopLayer - 1;

            WidgetGraphic black = new WidgetGraphic();
            black.Layer = layer;
            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;
            black.Alpha = 0.0f;
            Add( black );

            Timeline blackT = new Timeline( "start", false, 0.0f, 0.25f, E_TimerType.Stop, E_RestType.Start );
            blackT.AddEffect( new TimelineEffect_Alpha( 0.0f, 0.85f, E_LerpType.SmoothStep ) );
            black.AddTimeline( blackT );

            WidgetText text = new WidgetText();
            text.Layer = layer;
            text.Size = new Vector3( 600.0f, 40.0f, 0.0f );
            text.Align = E_Align.MiddleCentre;
            text.FontStyle = _UI.Store_FontStyle.Get( "Default" );
            text.String = Messages[ (int)Type ];
            text.ColorBase = Color.Yellow;
            text.FlagClear( E_WidgetFlag.InheritAlpha );
            text.Parent( black );
            text.ParentAttach = E_Align.MiddleCentre;

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

            Vector2 stringSize = _UI.Font.StringSize( text.String, text.FontStyle, text.Size.Y, text.Size.X );
            float border = 80.0f;

            WidgetBox back = new WidgetBox();
            back.Layer = layer;
            back.Size = new Vector3( stringSize.X + border, stringSize.Y + border, 0.0f );
            back.Align = E_Align.MiddleCentre;
            back.AddTexture( "box", 0.0f, 0.0f, 1.0f, 1.0f );
            back.ColorBase = Color.DarkBlue;
            back.Parent( text );
            back.ParentAttach = E_Align.MiddleCentre;
            back.CornerSize = new Vector2( border / 2.0f );
            back.CornerPuv01 = new Vector2( 0.0f );
            back.CornerSuv01 = new Vector2( 0.25f );

            Add( back );
            Add( text );

            WidgetText textButtons = new WidgetText();
            textButtons.Layer = layer;
            textButtons.Position = new Vector3( 0.0f, 20.0f, 0.0f );
            textButtons.Size = new Vector3( 0.0f, 30.0f, 0.0f );
            textButtons.Align = E_Align.MiddleCentre;
            textButtons.FontStyleName = "Default";
            textButtons.String = "[[A]] YES     [[B]] NO";
            textButtons.ColorBase = Color.White;
            textButtons.Parent( back );
            textButtons.ParentAttach = E_Align.BottomCentre;
            Add( textButtons );
        }
Ejemplo n.º 5
0
        // Copy
        public Timeline Copy()
        {
            Timeline o = new Timeline();

            o.Name = Name;
            o.Active = Active;

            o.Time = Time;
            o.StartTime = StartTime;
            o.EffectTime = EffectTime;

            o.TimerType = TimerType;
            o.TimerDirection = TimerDirection;
            o.RestType = RestType;

            o.Effects = new List< TimelineEffect >( Effects.Count );

            for ( int i = 0; i < Effects.Count; ++i )
            o.Effects.Add( Effects[ i ].Copy() );

            return o;
        }
Ejemplo n.º 6
0
 // AddTimeline
 public void AddTimeline( Timeline timeline )
 {
     Timelines.Add( timeline );
 }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
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
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        // 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 );
            }
        }
Ejemplo n.º 11
0
    // Startup
    public override void Startup( ContentManager content )
    {
        _UI.Startup( _G.Game, _G.GameInput );

        // load textures
        int bundleIndex = _UI.Texture.CreateBundle();

        _UI.Texture.Add( bundleIndex, "Textures\\UI_Box", "box" );
        _UI.Texture.Add( bundleIndex, "Textures\\UI_Shine", "shine" );
        _UI.Texture.Add( bundleIndex, "Textures\\UI_Buttons", "buttons" );
        _UI.Texture.Add( bundleIndex, "Textures\\UI_FontMult", "font_mult" );
        _UI.Texture.Add( bundleIndex, "Textures\\UI_DebugMenu", "debug_menu" );
        _UI.Texture.Add( bundleIndex, "Textures\\tick", "tick" );

        _UI.Texture.Add( bundleIndex, "Textures\\World_1", "world_1" );
        _UI.Texture.Add( bundleIndex, "Textures\\World_2", "world_2" );
        _UI.Texture.Add( bundleIndex, "Textures\\World_3", "world_3" );
        _UI.Texture.Add( bundleIndex, "Textures\\World_4", "world_4" );

        _UI.Texture.Add( bundleIndex, "Textures\\MM_NewGame", "mm_newgame" );
        _UI.Texture.Add( bundleIndex, "Textures\\MM_LevelSelect", "mm_levelselect" );
        _UI.Texture.Add( bundleIndex, "Textures\\MM_Options", "mm_options" );
        _UI.Texture.Add( bundleIndex, "Textures\\MM_Quit", "mm_quit" );

        _UI.Texture.Add( bundleIndex, "Textures\\CompanyLogo", "company_logo" );
        _UI.Texture.Add( bundleIndex, "Textures\\GameLogo", "game_logo" );

        // load fonts
        _UI.Font.Add( "Fonts\\", "Verdana" );
        _UI.Font.Add( "Fonts\\", "Impact" );

        // everyone has initial control
        _UI.PrimaryPad = -1;

        // setup colors
        _UI.Store_Color.Add( "Blue", 0xff0000ff );
        _UI.Store_Color.Add( "Red", 0xffff0000 );

        // setup timelines
        UI.Timeline timelineText = new UI.Timeline( "selected", false, 0.0f, 0.25f, UI.E_TimerType.Stop, UI.E_RestType.Start );
        timelineText.AddEffect( new UI.TimelineEffect_ColorLerp( Color.Orange, UI.E_LerpType.SmoothStep ) );
        _UI.Store_Timeline.Add( "text_selected_color", timelineText );

        UI.Timeline timeline_StartAlpha = new UI.Timeline( "start", false, 0.0f, 0.25f, UI.E_TimerType.Stop, UI.E_RestType.Start );
        timeline_StartAlpha.AddEffect( new UI.TimelineEffect_Alpha( -1.0f, 0.0f, UI.E_LerpType.SmoothStep ) );
        _UI.Store_Timeline.Add( "text_start_alpha", timeline_StartAlpha );

        // setup textures
        UI.SpriteTexture texture = new UI.SpriteTexture( "buttons", 0.0f, 0.0f, 0.5f, 1.0f );
        _UI.Store_Texture.Add( "buttons_half", texture );

        // setup font styles
        UI.FontStyle fontStyle = new UI.FontStyle( "Impact" );
        fontStyle.AddRenderPass( new UI.FontStyleRenderPass() );
        _UI.Store_FontStyle.Add( "Default", fontStyle );

        UI.FontStyle fontStyleDS = new UI.FontStyle( "Impact" );
        UI.FontStyleRenderPass renderPassDS = new UI.FontStyleRenderPass();
        renderPassDS.ColorOverride = Color.Black;
        renderPassDS.AlphaMult = 0.5f;
        renderPassDS.Offset = new Vector3( 0.05f, -0.05f, 0.0f );
        renderPassDS.OffsetProportional = true;
        fontStyleDS.AddRenderPass( renderPassDS );
        fontStyleDS.AddRenderPass( new UI.FontStyleRenderPass() );
        _UI.Store_FontStyle.Add( "DefaultDS", fontStyleDS );

        // setup font effects
        UI.FontEffect fontEffect = new UI.FontEffect_Scale( 0.0625f, 0.25f, 2.0f, 1.0f, 2.0f, 1.0f, 2.0f, UI.E_LerpType.Sin );
        _UI.Store_FontEffect.Add( "menu_item_scale", fontEffect );

        // setup font icons
        _UI.Store_FontIcon.Add( "A", new UI.FontIcon( _UI.Texture.Get( "buttons" ), 0.0f, 0.0f, ( 64.0f / 820.0f ), 1.0f ) );
        _UI.Store_FontIcon.Add( "B", new UI.FontIcon( _UI.Texture.Get( "buttons" ), ( 63.0f / 820.0f ), 0.0f, ( 64.0f / 820.0f ), 1.0f ) );
        _UI.Store_FontIcon.Add( "X", new UI.FontIcon( _UI.Texture.Get( "buttons" ), ( 126.0f / 820.0f ), 0.0f, ( 64.0f / 820.0f ), 1.0f ) );
        _UI.Store_FontIcon.Add( "Y", new UI.FontIcon( _UI.Texture.Get( "buttons" ), ( 189.0f / 820.0f ), 0.0f, ( 64.0f / 820.0f ), 1.0f ) );

        // setup widgets
        UI.WidgetText text = new UI.WidgetText();
        text.ColorBase = Color.White;
        text.Align = UI.E_Align.TopCentre;
        text.Position = new Vector3( 0.0f, 18.0f, 0.0f );
        text.Size = new Vector3( 0.0f, 3.0f, 0.0f );
        text.Alpha = 0.5f;
        text.FontStyleName = "Default";
        text.AddTimeline( "text_start_alpha" );
        text.RenderPass = 1;
        _UI.Store_Widget.Add( "font_effect_text", text );

        // set initial screen
        PlayState = E_PlayState.TestUI;

        if ( PlayState == E_PlayState.GameWorld )
        {
            _G.Game.DoLayerUpdate( E_Layer.LevelEditor, false );
            _G.Game.DoLayerRender( E_Layer.LevelEditor, false );
            _UI.Screen.AddScreen( new UI.HUD() );
        }
        else
        if ( PlayState == E_PlayState.LevelEditor )
        {
            _G.Game.DoLayerUpdate( E_Layer.GameWorld, false );
            _G.Game.DoLayerRender( E_Layer.GameWorld, false );
            _UI.Screen.AddScreen( new UI.LevelEditorHUD() );
        }
        else
        if ( PlayState == E_PlayState.TestUI )
        {
            _G.Game.DoLayerUpdate( E_Layer.GameWorld, false );
            _G.Game.DoLayerRender( E_Layer.GameWorld, false );
            _G.Game.DoLayerUpdate( E_Layer.LevelEditor, false );
            _G.Game.DoLayerRender( E_Layer.LevelEditor, false );
            _UI.Screen.AddScreen( new UI.Test() );
        }
    }