//------------------------------------------------------------------------------------------------------------------------ // Update() //------------------------------------------------------------------------------------------------------------------------ //this method polls the shop for messages and prints them. Since the shop caches the messages, it prints the same //message each frame. An event system would work better. protected void Update() { string[] messages = shopModel.GetMessages(); if (messages.Length > 0) { string message = messages[messages.Length - 1]; Debug.Log(message); } }
//------------------------------------------------------------------------------------------------------------------------ // DrawMessages() //------------------------------------------------------------------------------------------------------------------------ //Draw messages onto this messagebox private void DrawMessages() { graphics.DrawString("Use ARROWKEYS to navigate. Press SPACE to buy, BKSPACE to sell.", SystemFonts.CaptionFont, Brushes.White, 0, 0); string[] messages = shop.GetMessages(); for (int index = 0; index < messages.Length; index++) { String message = messages[index]; graphics.DrawString(message, SystemFonts.CaptionFont, Brushes.Black, 0, FontHeight + index * FontHeight); } }
//------------------------------------------------------------------------------------------------------------------------ // DrawMessages() //------------------------------------------------------------------------------------------------------------------------ //Draw messages onto this messagebox private void DrawMessages() { graphics.DrawString("Use ARROWKEYS to navigate. Press SPACE to buy, BKSPACE to sell.", SystemFonts.CaptionFont, Brushes.White, 0, 0); string[] messages = shop.GetMessages(); for (int index = 0; index < messages.Length; index++) { String message = messages[index]; graphics.DrawString(message, SystemFonts.CaptionFont, Brushes.White, 0, FontHeight + index * FontHeight); } graphics.DrawString("Money: " + shop.GetPlayerMoneyString(), SystemFonts.CaptionFont, Brushes.White, 100, 500); graphics.DrawString("Press C to change currency", SystemFonts.CaptionFont, Brushes.White, 100, 520); }