コード例 #1
0
ファイル: CutsceneState.cs プロジェクト: xiuzhifu/Redirection
        public CutsceneState(Game game, Mod mod, string path, CutsceneContext context, Playthrough playthrough = null) : base(game, path, LevelOptions.Cutscene)
        {
            m_mod             = mod;
            m_context         = context;
            m_playthrough     = playthrough;
            m_initialShotPath = path;

            m_border         = new CutsceneBorder(true);
            m_animatedCamera = new AnimatedCameraController(Level.TimeMachine);

            m_skipPrompt                       = new InputPrompt(UIFonts.Smaller, game.Language.Translate("menus.skip"), TextAlignment.Right);
            m_skipPrompt.Anchor                = Anchor.BottomRight;
            m_skipPrompt.LocalPosition         = new Vector2(-16.0f, -16.0f - m_skipPrompt.Font.Height);
            m_skipPrompt.GamepadButton         = GamepadButton.A;
            m_skipPrompt.SteamControllerButton = SteamControllerButton.MenuSelect;
            m_skipPrompt.MouseButton           = MouseButton.Left;
            m_skipPrompt.Key                   = Key.Return;
            m_skipPrompt.OnClick              += delegate(object sender, EventArgs e)
            {
                Continue();
            };

            m_loopingSounds = new Dictionary <string, IStoppable>();

            var termFont     = UIFonts.Smaller;
            var screenHeight = game.Screen.Height - 2.0f * m_border.BarHeight;
            var numLines     = (int)(screenHeight / termFont.Height);
            var screenWidth  = game.Screen.Width - (game.Screen.Height - numLines * termFont.Height);

            m_terminal               = new Terminal(termFont, UIColours.White, screenWidth, numLines);
            m_terminal.Anchor        = Anchor.CentreMiddle;
            m_terminal.LocalPosition = new Vector2(-0.5f * m_terminal.Width, -0.5f * m_terminal.Height);
        }
コード例 #2
0
ファイル: MainMenuState.cs プロジェクト: xiuzhifu/Redirection
        private void ContinueGame()
        {
            // Animate the robot
            m_robot.StartAnimation(LuaAnimation.Get("animation/menus/startscreen/robot_move.anim.lua"), false);
            m_robot.PlaySoundAfterDelay("sound/new_robot/idle_loop.wav", true, 0.3f);

            var delay = 1.25f;

            if (App.Demo)
            {
                // Start the main campaign
                var campaign       = Campaign.Get("campaigns/demo.campaign");
                var playthrough    = new Playthrough(Campaign.Get("campaigns/demo.campaign"), 0);
                var firstLevel     = campaign.Levels[0];
                var firstLevelData = LevelData.Get(firstLevel);
                if (firstLevelData.Intro != null)
                {
                    WipeToState(new CutsceneState(Game, null, firstLevelData.Intro, CutsceneContext.LevelIntro, playthrough), delay);
                }
                else
                {
                    WipeToState(new CampaignState(Game, null, playthrough));
                }
            }
            else
            {
                // Open the campaign select
                WipeToState(new CampaignSelectState(Game), delay);
            }
        }
コード例 #3
0
        private void PlayLevel(int level)
        {
            var playthrough = new Playthrough(m_campaign, level);
            var introPath   = LevelData.Get(m_campaign.Levels[level]).Intro;

            if (introPath != null)
            {
                // Go to the cutscene
                WipeToState(new CutsceneState(Game, m_mod, introPath, CutsceneContext.LevelIntro, playthrough));
            }
            else
            {
                // Go to the level
                WipeToState(new CampaignState(Game, m_mod, playthrough));
            }
        }
コード例 #4
0
ファイル: GameOverState.cs プロジェクト: xiuzhifu/Redirection
        public GameOverState(Game game, Mod mod, Playthrough playthrough) : base(game, "menus.game_over.title", "levels/empty.level", MenuArrangement.FullScreen)
        {
            BackPrompt = "menus.continue";

            m_mod         = mod;
            m_playthrough = playthrough;

            var textItems = new List <string>();

            textItems.Add(Game.Language.Translate("menus.game_over.info", playthrough.Campaign.Title));
            if (App.Demo)
            {
                textItems.Add(Game.Language.Translate("credits.thankyou"));
            }

            var menuItems   = new List <string>();
            var menuActions = new List <Action>();

            if (!App.Demo)
            {
                if (m_mod != null && Game.Network.SupportsWorkshop && m_mod.SteamWorkshopID.HasValue)
                {
                    menuItems.Add(Game.Language.Translate("menus.game_over.rate_mod", m_mod.Title));
                    menuActions.Add(RateMod);
                }
                menuItems.Add(Game.Language.Translate("menus.game_over.tweet"));
                menuActions.Add(Tweet);
                if (Game.Network.SupportsWorkshop)
                {
                    if (App.Steam)
                    {
                        menuItems.Add(Game.Language.Translate("menus.campaign_select.open_steam_workshop"));
                    }
                    else
                    {
                        menuItems.Add(Game.Language.Translate("menus.campaign_select.open_workshop"));
                    }
                    menuActions.Add(BrowseWorkshop);
                }
            }

            float yPos = -0.5f * (float)(textItems.Count + menuItems.Count) * UIFonts.Default.Height;

            m_text = new Text[textItems.Count];
            for (int i = 0; i < m_text.Length; ++i)
            {
                var text = new Text(
                    UIFonts.Default,
                    textItems[i],
                    UIColours.Text,
                    TextAlignment.Center
                    );
                text.Anchor        = Anchor.CentreMiddle;
                text.LocalPosition = new Vector2(0.0f, yPos);
                m_text[i]          = text;
                yPos += text.Font.Height;
            }

            m_menu               = new TextMenu(UIFonts.Default, menuItems.ToArray(), TextAlignment.Center, MenuDirection.Vertical);
            m_menu.Anchor        = Anchor.CentreMiddle;
            m_menu.LocalPosition = new Vector2(0.0f, yPos);
            m_menu.TextColour    = UIColours.Link;
            m_menu.OnClicked    += delegate(object sender, TextMenuClickedEventArgs e)
            {
                if (e.Index >= 0 && e.Index < menuActions.Count)
                {
                    menuActions[e.Index].Invoke();
                }
            };
        }
コード例 #5
0
ファイル: CampaignState.cs プロジェクト: xiuzhifu/Redirection
 public CampaignState(Game game, Mod mod, Playthrough playthrough) : base(game, playthrough.Campaign.Levels[playthrough.Level])
 {
     m_mod         = mod;
     m_playthrough = playthrough;
     m_newLevel    = !game.User.Progress.IsLevelCompleted(Level.Info.ID);
 }