当前位置: 首页>>代码示例>>C#>>正文


C# Sample.Play方法代码示例

本文整理汇总了C#中Sample.Play方法的典型用法代码示例。如果您正苦于以下问题:C# Sample.Play方法的具体用法?C# Sample.Play怎么用?C# Sample.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sample的用法示例。


在下文中一共展示了Sample.Play方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        protected override void Initialize()
        {
            Background = new Sprite(new Vector2(0, 0));
            Background.Texture = Cache.Picture("bgtitle");

            Title = new Sprite(new Vector2(-900, 50));
            Title.Texture = Cache.Picture("title");

            Car = new Sprite(new Vector2(-300, 100));
            Car.Texture = Cache.Texture("carBlue");

            Music = new Music("mainmenu");
            Music.Play(true);
            Music.Volume = 0.0f;

            Speedway = new Sample("speedway");
            Speedway.Pitch = 0.2f;

            Help = new HelpText(new Vector2(400, 550));
            Help.Alignment = TextAlignment.Center;
            Help.Color = Color.Red;
            Help.Outline = 1;
            Help.AddText("Start driving ASAP");
            Help.AddText("Be the number one!");
            Help.AddText("Change the game options");
            Help.AddText("Exit the game");
            Help.AddText("Sets the music volume level");
            Help.AddText("Sets the sounds volume level");
            Help.AddText("Switch between fullscreen and windowed");
            Help.AddText("Return to the main menu");
            Help.Index = 0;
            Help.Visible = false;

            MainMenu = new CoRe.GUI.WindowCommand.TextOnly(new Vector2(270, 350));
            MainMenu.AddCommand("Quick Race", ClickQuickRace);
            MainMenu.AddCommand("Championship", ClickChampionship);
            MainMenu.AddCommand("Options", ClickOptions);
            MainMenu.AddCommand("Exit", (Command c) => { XNAGame.I.Finish(); });
            MainMenu.Font = "Ethnocentric";
            MainMenu.Spacing = 40;
            MainMenu.Outline = 2;
            MainMenu.MoveSound = "broumbroum__sf3-sfx-menu-select";
            MainMenu.SelectSound = "runnerpack__menusel";

            OptionMenu = new CoRe.GUI.WindowCommand.TextOnly(new Vector2(270, 350));
            OptionMenu.AddCommand("Music Volume: "+((int)Music.DefaultVolume*100).ToString()+"%", ClickMusicVolume);
            OptionMenu.AddCommand("Sounds Volume: "+((int)Sample.DefaultVolume * 100).ToString() + "%", ClickSoundVolume);
            if (XNAGame.Instance.Graphics.IsFullScreen) { OptionMenu.AddCommand("Fullscreen: ON", ClickFullscreen); }
            else { OptionMenu.AddCommand("Fullscreen: OFF", ClickFullscreen); }
            OptionMenu.AddCommand("Back", ClickBack);
            OptionMenu.Font = "Ethnocentric";
            OptionMenu.Spacing = 40;
            OptionMenu.Outline = 2;
            OptionMenu.MoveSound = "broumbroum__sf3-sfx-menu-select";
            OptionMenu.SelectSound = "runnerpack__menusel";

            MainMenu.Off();
            OptionMenu.Off();

            MainMenu.Position = new Vector2((XNAGame.I.Width - MainMenu.Width) / 2, 350);
            OptionMenu.Position = new Vector2((XNAGame.I.Width - OptionMenu.Width) / 2, 350);
            Speedway.Play();
        }
开发者ID:Dahrkael,项目名称:TopDown-Racer,代码行数:63,代码来源:SceneMenu.cs


注:本文中的Sample.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。