コード例 #1
0
ファイル: HelpScreen.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            SpriteFont font = content.Load<SpriteFont>("EventFont");
            SpriteFont midFont = content.Load<SpriteFont>("MediumButtonFont");
            SpriteFont calendarFont = content.Load<SpriteFont>("CalendarFont");
            dashboardFont = content.Load<SpriteFont>("gamefont");
            gameFont = content.Load<SpriteFont>("gamefont");
            background = content.Load<Texture2D>("finance");
            dashboardTexture = content.Load<Texture2D>("gradient");
            textBoxTexture = content.Load<Texture2D>("textbox");
            calendarTexture = content.Load<Texture2D>("calendar");
            smallCalendarTexture = content.Load<Texture2D>("vcalendar_new");
            summaryTexture = content.Load<Texture2D>("Money Calculator");
            bookTexture = content.Load<Texture2D>("book_icon");
            testTexture = content.Load<Texture2D>("Exams_icon_100");
            undoTexture = content.Load<Texture2D>("undo-icon-64");
            backTexture = content.Load<Texture2D>("Back_64");
            continueTexture = content.Load<Texture2D>("Continue_64");
            noteTexture = content.Load<Texture2D>("note-small");
            todayTexture = content.Load<Texture2D>("Calendar_large");

            #region Generate Tiles

            Tile today = new Tile()
            {
                Position = new Vector2(margin.X * 2, margin.Y),
                Background = todayTexture,
                Screen = this,
                Size = new Vector2(128, 128),
                TileAlignment = Tile.Alignment.Fill,
            };
            today.Selected += ShowDash;
            tiles.Add(today);

            note1 = new Tile()
            {
                Text = "  Credit Card \n  Payment Due",
                Position = new Vector2(margin.X * 2, margin.Y * 8),
                Background = noteTexture,
                Size = new Vector2(noteTexture.Width, noteTexture.Height),
                Font = font,
                Screen = this,
                TextColor = Color.Red,
            };
            note1.Selected += LoadPaymentScreen;
            tiles.Add(note1);

            note2 = new Tile()
            {
                Text = "Car Repair",
                Position = note1.Position + new Vector2(note1.Size.X + margin.X * 2, 0),
                Background = noteTexture,
                Size = new Vector2(noteTexture.Width, noteTexture.Height),
                Font = font,
                Screen = this,
                TextColor = Color.Red,
            };
            note2.Selected += LoadPaymentScreen;
            tiles.Add(note2);

            note3 = new Tile()
            {
                Text = "Random Expense",
                Position = note2.Position + new Vector2(note2.Size.X + margin.X * 2, 0),
                Background = noteTexture,
                Size = new Vector2(noteTexture.Width, noteTexture.Height),
                Font = font,
                Screen = this,
                TextColor = Color.Red,
            };
            note3.Selected += LoadPaymentScreen;
            tiles.Add(note3);

            bankT = new Tile()
            {
                Size = new Vector2(margin.Y * 2.5f, margin.Y * 2f),
                Position = new Vector2(GlobalVariables.ScreenWidth - margin.Y * 4, margin.Y * 2),
                Screen = this,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                Background = summaryTexture,
                TileAlignment = Tile.Alignment.Center,
            };
            bankT.Selected += LoadBank;
            tiles.Add(bankT);

            calendarT = new Tile()
            {
                Size = new Vector2(margin.Y * 2.5f, margin.Y * 2.5f),
                Position = bankT.Position + new Vector2(0, bankT.Size.Y + margin.Y * 2),
                Background = smallCalendarTexture,
                Screen = this,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                TileAlignment = Tile.Alignment.Center,
            };
            calendarT.Selected += ShowDash;
            tiles.Add(calendarT);

            book = new Tile()
            {
                Size = new Vector2(margin.Y * 2.7f, margin.Y * 2.5f),
                Position = calendarT.Position + new Vector2(0, calendarT.Size.Y + margin.Y * 2),
                Background = bookTexture,
                Screen = this,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                TileAlignment = Tile.Alignment.Fill,
            };
            book.Selected += LoadTransactionScreen;
            tiles.Add(book);

            test = new Tile()
            {
                Size = new Vector2(margin.Y * 2.5f, margin.Y * 2.5f),
                Position = book.Position + new Vector2(0, book.Size.Y + margin.Y * 2),
                Background = testTexture,
                Screen = this,
                TileAlignment = Tile.Alignment.Fill,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
            };
            test.Selected += LoadQuiz;
            tiles.Add(test);

            undoButton = new Tile()
            {
                Size = new Vector2(undoTexture.Width, undoTexture.Height),
                Position = new Vector2(GlobalVariables.ScreenWidth / 2 - undoTexture.Width / 2 - margin.Y * 2, margin.Y * 17),
                Screen = this,
                Font = midFont,
                ButtonColor = buttonColor,
                Background = undoTexture,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                TileAlignment = Tile.Alignment.Fill,

            };
            undoButton.Selected += Undo;
            tiles.Add(undoButton);

            continueButton = new Tile()
            {
                Position = undoButton.Position + new Vector2(undoButton.Size.X + margin.Y * 2, 0),
                Screen = this,
                Background = continueTexture,
                Font = midFont,
                ButtonColor = buttonColor,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                Size = new Vector2(continueTexture.Width, continueTexture.Height),
            };
            continueButton.Selected += NewDay;
            tiles.Add(continueButton);

            backButton = new Tile()
            {
                Size = new Vector2(backTexture.Width, backTexture.Height),
                Position = undoButton.Position - new Vector2(backTexture.Width + margin.Y * 2, 0),
                Screen = this,
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                Background = backTexture,
            };
            backButton.Selected += OnCancel;
            tiles.Add(backButton);

            #endregion

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            //Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
コード例 #2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            background = content.Load<Texture2D>("Transaction_Screen");
            nextArrowTexture = content.Load<Texture2D>("Continue_64");
            font = content.Load<SpriteFont>("DashboardFont");
            backArrowTexture = content.Load<Texture2D>("back_64");

            #region Create Tiles

            backButton = new Tile()
            {
                Position = new Vector2((GlobalVariables.ScreenWidth / 2) - 96, GlobalVariables.ScreenHeight - (margin.Y + 48)),
                Size = new Vector2(backArrowTexture.Width, backArrowTexture.Height),
                Screen = this,
                Background = backArrowTexture,
            };
            backButton.Selected += Back;
            tiles.Add(backButton);

            nextButton = new Tile()
            {
                Position = new Vector2((GlobalVariables.ScreenWidth / 2) + 32, GlobalVariables.ScreenHeight - (margin.Y + 48)),
                Size = new Vector2(nextArrowTexture.Width, nextArrowTexture.Height),
                Screen = this,
                Background = nextArrowTexture,
            };
            nextButton.Selected += Next;
            tiles.Add(nextButton);

            #endregion
        }
コード例 #3
0
ファイル: QuizScreen.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            background = content.Load<Texture2D>("Quiz_Screen");
            buttonTexture = content.Load<Texture2D>("button");
            font = content.Load<SpriteFont>("DashboardFont");
            backArrowTexture = content.Load<Texture2D>("back_64");

            GenerateQuestion();
            float buttonTextSize = .18f;

            #region Create Tiles

            Vector2 buttonSize;

            buttonSize = new Vector2(font.MeasureString(answerA).X * buttonTextSize + 16, 40);
            Tile a = new Tile()
            {
                Text = answerA,
                TextColor = Color.Black,
                Size = buttonSize,
                Position = new Vector2(GlobalVariables.ScreenWidth / 2 - buttonSize.X / 2, GlobalVariables.ScreenHeight / 2 - buttonSize.Y / 2),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = font,
                FontScale = buttonTextSize,
                TileAlignment = Tile.Alignment.Fill,
            };
            a.Selected += AnsweredA;
            tiles.Add(a);

            buttonSize= new Vector2(font.MeasureString(answerB).X * buttonTextSize + 16, 40);
            Tile b = new Tile()
            {
                Text = answerB,
                TextColor = Color.Black,
                Size = buttonSize,
                Position = new Vector2(GlobalVariables.ScreenWidth / 2 - buttonSize.X / 2, a.Position.Y + buttonSize.Y +8),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = font,
                FontScale = buttonTextSize,
                TileAlignment = Tile.Alignment.Fill,
            };
            b.Selected += AnsweredB;
            tiles.Add(b);

            buttonSize= new Vector2(font.MeasureString(answerC).X * buttonTextSize + 16, 40);
            Tile c = new Tile()
            {
                Text = answerC,
                TextColor = Color.Black,
                Size = buttonSize,
                Position = new Vector2(GlobalVariables.ScreenWidth / 2 - buttonSize.X / 2, b.Position.Y + buttonSize.Y +8),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = font,
                FontScale = buttonTextSize,
                TileAlignment = Tile.Alignment.Fill,
            };
            c.Selected += AnsweredC;
            tiles.Add(c);

            buttonSize= new Vector2(font.MeasureString(answerD).X * buttonTextSize + 16, 40);
            Tile d = new Tile()
            {
                Text = answerD,
                TextColor = Color.Black,
                Size = buttonSize,
                Position = new Vector2(GlobalVariables.ScreenWidth / 2 - buttonSize.X / 2, c.Position.Y + buttonSize.Y +8),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = font,
                FontScale = buttonTextSize,
                TileAlignment = Tile.Alignment.Fill,
            };
            d.Selected += AnsweredD;
            tiles.Add(d);

            Tile back = new Tile()
            {
                Position = new Vector2(margin.X, margin.Y),
                Size = new Vector2(backArrowTexture.Width, backArrowTexture.Height),
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                Screen = this,
                Background = backArrowTexture,
            };
            back.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                ExitScreen();
            };
            tiles.Add(back);

            #endregion
        }
コード例 #4
0
ファイル: Calendar.cs プロジェクト: Ben-Cortina/My-Life
        void UpdateCalendar()
        {
            days.Clear();
            int week = 1;
            Color color;
            for (DateTime temp = new DateTime(GlobalVariables.Date.Year, GlobalVariables.Date.Month, 1);
                temp.Month == GlobalVariables.Date.Month; temp = temp.AddDays(1))
            {
                if (temp == GlobalVariables.Date)
                    color = Color.DarkGreen;
                else
                {
                    color = normalColor;
                    foreach (CalendarEvent e in events)
                    {
                        if (e.DueDate == temp)
                        {
                            color = highlightColor;
                            break;
                        }
                    }
                }

                Tile tile = new Tile()
                {
                    Text = temp.Day.ToString(),
                    Position = position + new Vector2((int)temp.DayOfWeek * (1 + ratio.X) * tileSize.X,
                        (1 + ratio.Y) * week * tileSize.Y + size.Y * 0.3f),
                    Screen = screen,
                    Font = font,
                    TextColor = color,
                    Size = tileSize,
                };
                tile.Selected += DateSelected;

                days.Add(tile);

                if (temp.DayOfWeek == DayOfWeek.Saturday)
                    week++;
            }
        }
コード例 #5
0
ファイル: Calendar.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public void Initialize()
        {
            // TODO: Add your initialization code here

            tileSize.X = size.X / (7 + 6 * ratio.X);
            tileSize.Y = 0.7f * size.Y / (6 + 5 * ratio.Y);

            for (int i = 0; i < weeks.Length; i++)
            {
                Tile week = new Tile()
                {
                    Text = weeks[i].ToString(),
                    Size = tileSize,
                    Position = position + new Vector2(i * (1 + ratio.X) * tileSize.X,
                        size.Y * 0.3f),
                    TextColor = Color.Black,
                    Screen = screen,
                    Font = font
                };

                weekTiles.Add(week);
                UpdateCalendar();
            }
        }
コード例 #6
0
ファイル: PaymentScreen.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Load graphics content for the screen.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            buttonTexture = content.Load<Texture2D>("button");
            textBoxTexture = content.Load<Texture2D>("textbox");
            font = content.Load<SpriteFont>("DashboardFont");
            gradientTexture = content.Load<Texture2D>("gradient");
            amount = minimum;
            Vector2 buttonSize = new Vector2(108, 40);
            if (minimum == maximum)
            {
                paymentBox = new Rectangle((int)(GlobalVariables.ScreenWidth * .25f),
                    (int)(GlobalVariables.ScreenHeight * .375f),
                    (int)(GlobalVariables.ScreenWidth * .5f),
                    (int)(GlobalVariables.ScreenHeight * .25f));
                #region Create Tiles
                Tile cashTile = new Tile()
                {
                    Text = "Cash",
                    TextColor = Color.Black,
                    Size = buttonSize,
                    Position = new Vector2(paymentBox.X + 3 * paymentBox.Width / 4 - (buttonSize.X + 2), paymentBox.Y + 104),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    TileAlignment = Tile.Alignment.Fill,
                };
                cashTile.Selected += PayCash;
                tiles.Add(cashTile);

                Tile creditTile = new Tile()
                {
                    Text = "Credit",
                    TextColor = Color.Black,
                    Position = new Vector2(paymentBox.X + 3 * paymentBox.Width / 4 + 2, cashTile.Position.Y),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                creditTile.Selected += PayCredit;
                tiles.Add(creditTile);
            }
            else
            {
                paymentBox = new Rectangle((int)(GlobalVariables.ScreenWidth * .25f),
                    (int)(GlobalVariables.ScreenHeight * .3f),
                    (int)(GlobalVariables.ScreenWidth * .5f),
                    (int)(GlobalVariables.ScreenHeight * .4f));

                Tile one = new Tile()
                {
                    Text = "+ $1",
                    TextColor = Color.Black,
                    Position = new Vector2(paymentBox.X + paymentBox.Width/4 - (buttonSize.X+2), paymentBox.Y+144),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                one.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount < maximum)
                        amount += 1;
                };
                tiles.Add(one);

                Tile ten = new Tile()
                {
                    Text = "+ $10",
                    TextColor = Color.Black,
                    Position = new Vector2(one.Position.X, one.Position.Y + buttonSize.Y + 4),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                ten.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount < maximum-9)
                        amount += 10;
                };
                tiles.Add(ten);

                Tile hundred = new Tile()
                {
                    Text = "+ $100",
                    TextColor = Color.Black,
                    Position = new Vector2(ten.Position.X, ten.Position.Y + buttonSize.Y + 4),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                hundred.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount < maximum-99)
                        amount += 100;
                };
                tiles.Add(hundred);

                Tile oneM = new Tile()
                {
                    Text = "- $1",
                    TextColor = Color.Black,
                    Position = new Vector2(one.Position.X + buttonSize.X +4 , one.Position.Y),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                oneM.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount > minimum)
                        amount -= 1;
                };
                tiles.Add(oneM);

                Tile tenM = new Tile()
                {
                    Text = "- $10",
                    TextColor = Color.Black,
                    Position = new Vector2(oneM.Position.X, oneM.Position.Y + buttonSize.Y + 4),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                tenM.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount > minimum+9)
                        amount -= 10;
                };
                tiles.Add(tenM);

                Tile hundredM = new Tile()
                {
                    Text = "- $100",
                    TextColor = Color.Black,
                    Position = new Vector2(tenM.Position.X, tenM.Position.Y + buttonSize.Y + 4),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .18f,
                    Size = buttonSize,
                    TileAlignment = Tile.Alignment.Fill,
                };
                hundredM.Selected += delegate(object o, PlayerIndexEventArgs arg)
                {
                    if (amount > minimum+99)
                        amount -= 100;
                };
                tiles.Add(hundredM);

                buttonSize = new Vector2(159, 59);
                Tile cashTile = new Tile()
                {
                    Text = "Cash",
                    TextColor = Color.Black,
                    Size = buttonSize,
                    Position = new Vector2(paymentBox.X + 3 * paymentBox.Width / 4 - (buttonSize.X/2), paymentBox.Y + 104),
                    Background = buttonTexture,
                    Image = new Rectangle(0, 0, 159, 59),
                    AltImage = new Rectangle(180, 0, 159, 59),
                    TileIteraction = Tile.Interaction.Image,
                    Screen = this,
                    Font = font,
                    FontScale = .20f,
                    TileAlignment = Tile.Alignment.Fill,
                };
                cashTile.Selected += PayCash;
                tiles.Add(cashTile);

            }
               #endregion

            credBox = new Rectangle((int)(GlobalVariables.ScreenWidth * .10f), paymentBox.Y +paymentBox.Height + 16, 450, 185);
            moneyBox = new Rectangle((int)(GlobalVariables.ScreenWidth * .6f), paymentBox.Y + paymentBox.Height + 16, 450, 150);
        }
コード例 #7
0
ファイル: MainMenuScreen.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("")
        {
            Title = GlobalVariables.Game.Content.Load<Texture2D>("title");

            buttonSize = (int)(GlobalVariables.ScreenWidth / (NumberOfButtons + (NumberOfButtons + 1) * MarginRatio));
            margin = (int)(buttonSize * MarginRatio);
            int buttonY = GlobalVariables.ScreenHeight - buttonSize - margin;

            TitlePostion = new Vector2(GlobalVariables.ScreenWidth / 2 - Title.Width / 2, 0.1f * GlobalVariables.ScreenHeight);

            SpriteFont font = GlobalVariables.Game.Content.Load<SpriteFont>("BigButtonFont");
            Color buttonColor = new Color(0.55f, 0.34f, 0, 0.2f);

            Tile playTile = new Tile()
            {
                //Text = "Play",
                //TextColor = Color.Red,
                Position = new Vector2(margin, buttonY),
                Size = new Vector2(buttonSize),
                Screen = this,
                Font = font,
                ButtonColor = buttonColor,
                Background = GlobalVariables.Game.Content.Load<Texture2D>("play")
            };
            playTile.Selected += PlayGameMenuEntrySelected;
            Tiles.Add(playTile);

            Tile recordsTile = new Tile()
            {
                //Text = "Records",
                //TextColor = Color.Red,
                Position = playTile.Position + new Vector2(margin + buttonSize, 0),
                Size = new Vector2(buttonSize),
                Screen = this,
                Font = font,
                ButtonColor = buttonColor,
                Background = GlobalVariables.Game.Content.Load<Texture2D>("records")
            };
            Tiles.Add(recordsTile);

            Tile helpTile = new Tile()
            {
                //Text = "Help",
                //TextColor = Color.Red,
                Position = recordsTile.Position + new Vector2(margin + buttonSize, 0),
                Size = new Vector2(buttonSize),
                Screen = this,
                Font = font,
                ButtonColor = buttonColor,
                Background = GlobalVariables.Game.Content.Load<Texture2D>("help")
            };
            helpTile.Selected += OptionsMenuEntrySelected;
            Tiles.Add(helpTile);

            Tile exitTile = new Tile()
            {
                Position = helpTile.Position + new Vector2(margin + buttonSize, 0),
                Size = new Vector2(buttonSize),
                Screen = this,
                Font = font,
                ButtonColor = buttonColor,
                Background = GlobalVariables.Game.Content.Load<Texture2D>("exit")
            };
            exitTile.Selected += OnCancel;
            Tiles.Add(exitTile);
        }
コード例 #8
0
ファイル: BankScreen.cs プロジェクト: Ben-Cortina/My-Life
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            background = content.Load<Texture2D>("Bank_back");
            textBoxTexture = content.Load<Texture2D>("textbox");
            buttonTexture = content.Load<Texture2D>("button");
            numberFont = content.Load<SpriteFont>("DashboardFont");
            backArrowTexture = content.Load<Texture2D>("back_64");

            #region Create Tiles

            Tile one = new Tile()
            {
                Text = "+ $1",
                TextColor = Color.Black,
                Position = new Vector2(GlobalVariables.ScreenWidth * .08f, GlobalVariables.ScreenHeight * .75f),
                Background = buttonTexture,
                Image = new Rectangle(0,0,159,59),
                AltImage = new Rectangle(180,0,159,59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            one.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer < 1000000)
                    transfer += 1;
            };
            tiles.Add(one);

            Tile ten = new Tile()
            {
                Text = "+ $10",
                TextColor = Color.Black,
                Position = new Vector2(one.Position.X + one.Size.X + 5, one.Position.Y),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            ten.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer < 999991)
                transfer += 10;
            };
            tiles.Add(ten);

            Tile hundred = new Tile()
            {
                Text = "+ $100",
                TextColor = Color.Black,
                Position = new Vector2(ten.Position.X + ten.Size.X + 5, ten.Position.Y),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            hundred.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer < 999901)
                    transfer += 100;
            };
            tiles.Add(hundred);

            Tile oneM = new Tile()
            {
                Text = "- $1",
                TextColor = Color.Black,
                Position = new Vector2(one.Position.X,one.Position.Y + one.Size.Y + 5),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            oneM.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer > 0)
                    transfer -= 1;
            };
            tiles.Add(oneM);

            Tile tenM = new Tile()
            {
                Text = "- $10",
                TextColor = Color.Black,
                Position = new Vector2(oneM.Position.X + oneM.Size.X + 5, oneM.Position.Y),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            tenM.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer > 9)
                    transfer -= 10;
            };
            tiles.Add(tenM);

            Tile hundredM = new Tile()
            {
                Text = "- $100",
                TextColor = Color.Black,
                Position = new Vector2(tenM.Position.X + tenM.Size.X + 5, tenM.Position.Y),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .18f,
                Size = new Vector2(159, 59),
                TileAlignment = Tile.Alignment.Fill,
            };
            hundredM.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                if (transfer > 99)
                    transfer -= 100;
            };
            tiles.Add(hundredM);

            Tile depositTile = new Tile()
            {
                Text = "Deposit",
                TextColor = Color.Black,
                Position = new Vector2(GlobalVariables.ScreenWidth*.625f, GlobalVariables.ScreenHeight * .68f),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .20f,
                Size = new Vector2(216, 80),
                TileAlignment = Tile.Alignment.Fill,
            };
            depositTile.Selected += Deposit;
            tiles.Add(depositTile);

            Tile withdrawTile = new Tile()
            {
                Text = "Withdrawal",
                TextColor = Color.Black,
                Position = new Vector2(depositTile.Position.X, depositTile.Position.Y + depositTile.Size.Y +5),
                Background = buttonTexture,
                Image = new Rectangle(0, 0, 159, 59),
                AltImage = new Rectangle(180, 0, 159, 59),
                TileIteraction = Tile.Interaction.Image,
                Screen = this,
                Font = numberFont,
                FontScale = .20f,
                Size = new Vector2(216, 80),
                TileAlignment = Tile.Alignment.Fill,
            };
            withdrawTile.Selected += Withdraw;
            tiles.Add(withdrawTile);

            Tile back = new Tile()
            {
                Position = new Vector2(margin.X, margin.Y),
                Size = new Vector2(backArrowTexture.Width, backArrowTexture.Height),
                TileIteraction = Tile.Interaction.Image,
                Scale = .8f,
                Screen = this,
                Background = backArrowTexture,
            };
            back.Selected += delegate(object o, PlayerIndexEventArgs arg)
            {
                ExitScreen();
            };
            tiles.Add(back);

            #endregion
        }