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


C# Basket.Initialize方法代码示例

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


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

示例1: Initialize

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Sources = new List<Source>();
            //set the display to all orientations, then set the size of the screen, then FORCE potrait mode.
            //this makes it full screen portrait. There is most definitely a better way, but I do not know it.
            graphics.SupportedOrientations = DisplayOrientation.Portrait | DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
            graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            graphics.SupportedOrientations = DisplayOrientation.Portrait;
            StartTime = new TimeSpan(0, 0, 0);//initialize start time to something...it will change for sure

            //Add some ads to the app!
            //CURRENTLY THERE ARE NO ADS

            /*
            AdManager ads = new AdManager(this);
            AdGameComponent.Initialize(this, ads.ApplicationId);
            Components.Add(AdGameComponent.Current);
            ads.CreateAd();
            */

            //get the old highscore
            highScore = loadHiScore();
            //create all the buttons we need. Chances are the Y values of these may end up changing
            //pass in the image representing the text the button should display
            StartButton = new Button(this,"play_game", 300);
            MainMenuButton = new Button(this, "home", 600);
            ResetButton = new Button(this, "Reset", 475);
            InstructionsButton = new Button(this, "Instructions", 400);

            TimeLeft = TimeSpan.FromSeconds(30);//as of now games will start off lasting 30 seconds

            mIsTitleScreenShown = true;//start off with titlescreen shown

            basket = new Basket(this);
            basket.Initialize();

            //setup the fonts
            SmallFont = Content.Load<SpriteFont>("InGameFont");
            LargeFont = Content.Load<SpriteFont>("HiScoreFont");

            graphics.ApplyChanges();
            OldState = Keyboard.GetState();//get initial state of keyboard
            base.Initialize();
        }
开发者ID:ExperienceMicrosoft2012,项目名称:Bubble-Basket,代码行数:52,代码来源:Game1.cs


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