/// <summary>
        /// construct new menu
        /// </summary>
        public GameChooserMenu()
        {
            ActiveInState         = new StateBrowsingMenu();
            panel                 = new GardenGamesPanel(this);
            panel.Motion.Position = new Vector2(0.0f, 0.0f);

            // get the items to display
            gamesList = GardenGame.Instance.GameLib.GetList();

            // background
            Spritelet bg = new Spritelet("parc-by-gadl.png");

            bg.Motion.Position     = new Vector2(0.66667f, 0.22f);
            bg.DrawInfo.LayerDepth = 1f;
            //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f);
            // bg color 169, 157, 241
            bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(v / 70.0f); }, "Rotate"));
            bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(0.45f + 0.75f * (float)Math.Sqrt(v / 430.0)); }, "Scale"));
            bg.Motion.TargetPos      = new Vector2(0.66667f, 0.9f);
            bg.Motion.TargetPosSpeed = 0.004f;
            Add(bg);
            background = bg;

            // logo
            Spritelet logo = new Spritelet("igglogo");

            Add(logo);
            logo.DrawInfo.Alpha  = 0.7f;
            logo.Motion.Scale    = 0.55f;
            logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.04f);
            ColorChangeBehavior fadeIn = new ColorChangeBehavior();

            logo.Add(fadeIn);
            fadeIn.Intensity = 0f;
            fadeIn.FadeToTarget(0.9344f, 6f);
            logo.Motion.Add(new SineModifier("ScaleModifier", 0.03124f, 0.07344f, 1.0f));

            // set my panel and games list
            Add(panel);
            panel.OnUpdateList(gamesList);
        }
示例#2
0
        /// <summary>
        /// construct new menu
        /// </summary>
        public GameChooserMenu()
        {
            ActiveInState         = new StateBrowsingMenu();
            panel                 = new GardenGamesPanel(this);
            panel.Motion.Position = new Vector2(0.0f, 0.0f);

            // get the items to display
            gamesList = GardenGame.Instance.GameLib.GetList();

            // background
            Spritelet bg = new Spritelet("wee2");

            bg.Motion.Position     = new Vector2(0.68f, 0.425f);
            bg.DrawInfo.LayerDepth = 1f;
            //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f);
            // bg color 169, 157, 241
            bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(v / 44.7f); }, "Rotate"));
            bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(10.5f + 0.95f * (float)Math.Sqrt(v / 430.0)); }, "Scale"));
            bg.Motion.TargetPos      = new Vector2(Screen.Width / 2.0f + 0.1f, 0.75f);
            bg.Motion.TargetPosSpeed = 0.004f;
            Add(bg);
            background = bg;

            // logo that floats in top right
            Spritelet logo = new Spritelet("gtlogo");

            Add(logo);
            logo.DrawInfo.Alpha  = 0.0f;
            logo.Motion.Scale    = 0.7f;
            logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.06f);
            //ColorChangeBehavior fadeIn = new ColorChangeBehavior();
            //logo.Add(fadeIn);
            //fadeIn.Alpha = 0f;
            //fadeIn.AlphaTarget = 0f;
            //fadeIn.FadeAlphaToTarget(0.9344f, 6f);
            logo.Motion.Add(new SineModifier("ScaleModifier", 0.06124f, 0.07144f, 1.0f));

            // set my panel and games list
            Add(panel);
            panel.OnUpdateList(gamesList);
        }
        /// <summary>
        /// construct new menu
        /// </summary>
        public GameChooserMenu()
        {
            ActiveInState = new StateBrowsingMenu();
            panel = new GardenGamesPanel(this);
            panel.Motion.Position = new Vector2(0.0f, 0.0f);

            // get the items to display
            gamesList = GardenGame.Instance.GameLib.GetList();

            // background
            Spritelet bg = new Spritelet("parc-by-gadl.png");
            bg.Motion.Position = new Vector2(0.66667f, 0.22f);
            bg.DrawInfo.LayerDepth = 1f;
            //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f);
            // bg color 169, 157, 241
            bg.Motion.Add(new MyFuncyModifier( delegate(float v) { return v/70.0f; }, "Rotate"));
            bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return (0.45f + 0.75f * (float) Math.Sqrt(v/430.0)); }, "Scale"));
            bg.Motion.TargetPos = new Vector2(0.66667f, 0.9f);
            bg.Motion.TargetPosSpeed = 0.004f;
            Add(bg);
            background = bg;

            // logo
            Spritelet logo = new Spritelet("igglogo");
            Add(logo);
            logo.DrawInfo.Alpha = 0.7f;
            logo.Motion.Scale = 0.55f;
            logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.04f);
            ColorChangeBehavior fadeIn = new ColorChangeBehavior();
            logo.Add(fadeIn);
            fadeIn.Intensity = 0f;
            fadeIn.FadeToTarget(0.9344f, 6f);
            logo.Motion.Add(new SineModifier("ScaleModifier", 0.03124f, 0.07344f, 1.0f));

            // set my panel and games list
            Add(panel);
            panel.OnUpdateList(gamesList);
        }
        public override void OnUserInput(GamesPanel.UserInput inp)
        {
            // HACK: for web games launch, make sure that music is turned back on upon next user input after play
            if (!isGameLaunchOngoing &&
                !GardenGame.Instance.music.IsFadedIn &&
                GardenGame.Instance.music.UserWantsMusic)
            {
                GardenGame.Instance.music.FadeIn();
            }

            switch (inp)
            {
                case UserInput.DOWN:
                    if (cursor.GridPosition.Y < GridMaxY -1 )
                    {
                        cursor.GridPosition.Y += 1f;
                        SelectGameBelowCursor();
                    }
                    break;

                case UserInput.UP:
                    if (cursor.GridPosition.Y > 0)
                    {
                        cursor.GridPosition.Y -= 1f;
                        SelectGameBelowCursor();
                    }
                    break;

                case UserInput.LEFT:
                    if (cursor.GridPosition.X > 0)
                    {
                        cursor.GridPosition.X -= 1f;
                        SelectGameBelowCursor();
                    }
                    break;

                case UserInput.RIGHT:
                    if (cursor.GridPosition.X < GridMaxX - 1)
                    {
                        cursor.GridPosition.X += 1f;
                        SelectGameBelowCursor();
                    }
                    break;

                case UserInput.START_EXIT:
                    isExiting = true;
                    //selectionLevel = 0;
                    Motion.ZoomTarget = PANEL_ZOOM_TARGET_QUITTING ;
                    Motion.ZoomSpeed = PANEL_ZOOM_SPEED_REGULAR ;
                    infoBox.Motion.TargetPos = INFOBOX_ALL_HIDDEN_POSITION;
                    creditsBitmap.Motion.TargetPos = CREDITS_HIDDEN_POSITION;
                    helpTextBitmap.Motion.TargetPos = HELPTEXT_HIDDEN_POSITION;
                    //Motion.ZoomCenter = cursor.Motion.PositionAbs;
                    //Motion.ZoomCenterTarget = cursor.Motion;
                    break;

                case UserInput.STOP_EXIT:
                    if (timeExiting < TIME_BEFORE_EXIT_CONTINUES)
                    {
                        isExiting = false;
                        selectionLevel = 0;
                        Motion.ZoomTarget = PANEL_ZOOM_REGULAR;
                        Motion.ZoomSpeed = PANEL_ZOOM_SPEED_ABORTQUITTING;
                        //Motion.ZoomCenter = cursor.Motion.PositionAbs;
                        //Motion.ZoomCenterTarget = cursor.Motion;
                    }
                    break;

                case UserInput.START_SELECT:
                    if (SelectedGame != null)
                    {
                        GameThumbnail th = null;
                        try
                        {
                            th = thumbnailsCache[SelectedGame.GameID];
                        }
                        catch (Exception) { ; }
                        if (th != null)
                        {
                            switch (selectionLevel)
                            {
                                case 0:
                                    // select once - zoom in on selected game
                                    Motion.ZoomTarget = PANEL_ZOOM_DETAILED_VIEW;
                                    Motion.ZoomSpeed = PANEL_ZOOM_SPEED_REGULAR; // 0.01f;
                                    Motion.ZoomCenterTarget = cursor.Motion;
                                    SelectedGame.Refresh();
                                    selectionLevel++;
                                    break;
                                case 1:
                                    // select again - install or launch game if selection key pressed long enough.
                                    isGameLaunchOngoing = true;
                                    break;
                            }
                        }
                    }
                    break;

                case UserInput.STOP_SELECT:
                    // if not launched long enough, reset - no action
                    if (timeLaunching < TIME_BEFORE_GAME_LAUNCH)
                    {
                        isGameLaunchConfirmed = false;
                    }
                    else
                        isGameLaunchConfirmed = true;
                    isGameLaunchOngoing = false;
                    timeLaunching = 0f;
                    break;

                case UserInput.LAUNCH_WEBSITE:
                    isLaunchWebsite = true;
                    break;

                case UserInput.TOGGLE_MUSIC:
                    GardenGame.Instance.music.ToggleMusic();
                    break;

            } // switch(inp)

            if (!isExiting)
            {
                if (selectionLevel == 0)
                {
                    infoBox.Motion.TargetPos = INFOBOX_DESCRIPTION_HIDDEN_POSITION;
                }

                if (selectionLevel == 1 && SelectedGame != null)
                {
                    int lnCount = SelectedGame.DescriptionLineCount;
                    infoBox.Motion.TargetPos = INFOBOX_SHOWN_POSITION - new Vector2(0f, 0.015f + 0.029f * (lnCount - 1));
                }

                if (SelectedGame == null || SelectedGame.Name.Length == 0)
                {
                    infoBox.Motion.TargetPos = INFOBOX_ALL_HIDDEN_POSITION;
                }
            }
        }