public AccountingPanel(ContentManager content, WaveAccountingTable table, int currentWave, UInt64 totalscore)
        {
            titleFont = content.Load<SpriteFont>("Fonts\\MenuTitle");
            headerFont = content.Load<SpriteFont>("Fonts\\MenuHeader");
            detailFont = content.Load<SpriteFont>("Fonts\\MenuDetail");

            separator = content.Load<Texture2D>("Sprites\\Titles\\Separator");

            totalStringer = new CurrencyStringer(totalscore);

            AddChild(new TextControl(" ", titleFont));
            AddChild(CreateHeaderControl());
            PopulateTable(table, currentWave, totalscore);
        }
示例#2
0
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public Game1()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            graphics.IsFullScreen = true;
              graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);

              // Frame rate is 60 fps
              IsFixedTimeStep = false;
              //TargetElapsedTime = TimeSpan.FromTicks(166667);

            #if WINDOWS
            graphics.IsFullScreen = false;
            #endif

            // you can choose whether you want a landscape or portait
            // game by using one of the two helper functions.
            InitializePortraitGraphics();
            //InitializeLandscapeGraphics();

            //Get CI
            ci = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            ci.NumberFormat.NumberDecimalSeparator = ".";
            ci.NumberFormat.NumberGroupSeparator = ",";

            //Load the waves
            wavedefines = Content.Load<BoardWaveDefines>("Maps\\Waves");
            maxwave = wavedefines.GetMaxWave();

            // Create the accounting table
            currentGameAccounting = new WaveAccountingTable(maxwave);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            //attempt to deserialize overall gameplay state.
            bool loaded;
            loaded = DeserializeState();

            if (loaded == true)
            {
                boardSeed = state.boardSeed;
                currentwave = state.currentWave;
                finalscore = state.currentTotalScore;
                currentGameAccounting.Load(state.accountingentries);
            }

            // attempt to deserialize the screen manager from disk. if that
            // fails, we add our default screens.
            //if (!screenManager.DeserializeState())
            //{
                // Activate the first screens.

            background = new BackgroundScreen("sprites\\Titles\\MainMenu");
            background.StartCursor(2.0f);

            screenManager.AddScreen(background, null);
            screenManager.AddScreen(new SplashScreen(), null);
            //screenManager.AddScreen(new GameOverScreen(), PlayerIndex.One);
            //screenManager.AddScreen(new GameplayScreen(), null);
            //}

               //music
               backgroundMusicManager = new BackgroundMusicManager(this);
               MainMenuSong = Content.Load<Song>("Sounds\\Music\\jm_menu_loop");
               GameSong = Content.Load<Song>("Sounds\\Music\\jm_main_loop");
        }
        private void PopulateTable(WaveAccountingTable table, int currentWave, UInt64 totalscore)
        {
            List<WaveAccountingEntry> entries = table.GetEntries();

            PanelControl newList = new PanelControl();

            for (int i = 0; i < entries.Count; i++)
            {
                CurrencyStringer stringer = new CurrencyStringer(entries[i].c_score);
                newList.AddChild(CreateAccountingEntryControl(entries[i].c_wave.ToString(), stringer.outputstring.ToString(), entries[i].c_wave == currentWave));
            }

            newList.LayoutColumn(0, 0, 0);

            if (resultListControl != null)
            {
                RemoveChild(resultListControl);
            }
            resultListControl = newList;
            AddChild(resultListControl);
            LayoutColumn(0, 0, 0);

            AddChild(new ImageControl(separator, new Vector2(0, 610)));
            AddChild(new TextControl("Total: " + totalStringer.outputstring.ToString(), headerFont, Color.Green, new Vector2(50, 630)));
        }