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);
        }
        private void PopulateScores(HighScoreTable scores)
        {
            List<HighScoreEntry> scorelist = scores.GetHighScores();

            PanelControl newList = new PanelControl();

            for(int i = 0; i < scorelist.Count; i++)
            {
                CurrencyStringer stringer = new CurrencyStringer(scorelist[i].score);
                newList.AddChild(CreateLeaderboardEntryControl(scorelist[i].name, stringer.outputstring.ToString(), "Wave " + scorelist[i].wave, i == scores.currentHighScoreIndex));
            }

            newList.LayoutColumn(0, 0, 0);

            if (resultListControl != null)
            {
                RemoveChild(resultListControl);
            }
            resultListControl = newList;
            AddChild(resultListControl);
            LayoutColumn(0, 0, 0);
        }
Beispiel #3
0
        public void ShareWithFriend(UInt64 score)
        {
            ShareLinkTask shareLinkTask = new ShareLinkTask();

            shareLinkTask.Title = "Node.Hack EX for Windows Phone";
            shareLinkTask.LinkUri = new Uri("http://www.nodehackgame.com", UriKind.Absolute);
            if (score == 0)
            {
                shareLinkTask.Message = "I just played Node.Hack EX, a hacking action/strategy game for Windows Phone. Try it out!";
            }
            else
            {
                CurrencyStringer stringer = new CurrencyStringer(score);
                shareLinkTask.Message = "I just got " + stringer.outputstring.ToString() + " in Node.Hack EX, a hacking game for Windows Phone.";
            }

            shareLinkTask.Show();
        }
        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)));
        }
        public override void LoadContent()
        {
            //Special if game is considered "continuing"
            MenuEntry continueGameMenuEntry = new MenuEntry("Continue Wave " + ((Game1)(ScreenManager.Game)).GetCurrentWave());
            continueGameMenuEntry.Selected += ContinueGameMenuEntrySelected;

            if (continuingGame)
            {
                MenuEntries.Add(continueGameMenuEntry);
            }

            // Create our menu entries.
            MenuEntry playGameMenuEntry = new MenuEntry(continuingGame?"Restart Game":"Play Game");

            MenuEntry highScoresMenuEntry = new MenuEntry("High Scores");
            //MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry howToPlayEntry = new MenuEntry("How to Play");
            MenuEntry shareWithFriendMenuEntry = new MenuEntry("Tell a Friend");

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;

            highScoresMenuEntry.Selected += HighScoresMenuEntrySelected;
            //optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            howToPlayEntry.Selected += howToPlayEntrySelected;

            shareWithFriendMenuEntry.Selected += shareWithFriendMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);

            MenuEntries.Add(highScoresMenuEntry);
               // MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(howToPlayEntry);
            MenuEntries.Add(shareWithFriendMenuEntry);

            //check if we are continuing. if so, preconstruct the score and wave strings.
            if (continuingGame)
            {
                Game1 ourGame = (Game1)ScreenManager.Game;
                currentMoneyStringer = new CurrencyStringer(ourGame.GetFinalScore());
                currentWaveString = "Wave: " + ourGame.GetCurrentWave() + "\nScore: " + currentMoneyStringer.outputstring;
            }

            ((Game1)(ScreenManager.Game)).SetBackgroundSubtitle("Sprites\\Titles\\MainMenu", 1.0f);

            base.LoadContent();
        }