tomasslavicek

Použití objektu GraphicalLayer/ITouchLayer atd.

Jan 29th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.38 KB | None | 0 0
  1. using System;
  2. using System.Net;
  3. using System.Windows;
  4. //using System.Windows.Input;
  5. using HexaLinesWP7.ScreenManagement;
  6. using Microsoft.Xna.Framework;
  7. using System.Collections.Generic;
  8. using Microsoft.Xna.Framework.Input.Touch;
  9. using Microsoft.Xna.Framework.Graphics;
  10. using Microsoft.Xna.Framework.Content;
  11. using HexaLinesWP7.GameObjects;
  12. using HexaLinesWP7.Drawer3D;
  13.  
  14. namespace HexaLinesWP7.ScreenLayers
  15. {
  16.     /// <summary>
  17.     /// Objekt herního GUI
  18.     /// - pro vykreslení "další buňky", skóre apod. potřebuje také vidět na objekt herního plánu (gameData)
  19.     /// - ten je vytvářen v objektu GamePlan, je si ho nutné odsud vytáhnout pomocí SetGameDataReference()
  20.     /// </summary>
  21.     public class GameOverlay : GraphicalLayer, ITouchLayer, ITiltLayer
  22.     {
  23.         GameOverlayDrawer drawer;
  24.  
  25.         public event ChangeScreenHandler ChangeScreen;
  26.         public ChangeScreenHandler RememberedChScrHandler { get; set; }
  27.  
  28.         public GameOverlay(GraphicsDevice device, ContentManager content)
  29.             : base(device, content)
  30.         {
  31.             drawer = new GameOverlayDrawer(device, content);    
  32.         }
  33.        
  34.         /// <summary>
  35.         /// Metoda je volána až poté, co GamePlan.Initialize = při zobrazování okna a spouštění nové hry...
  36.         /// </summary>
  37.         public override void Initialize()
  38.         {
  39.             drawer.Initialize();
  40.         }
  41.                
  42.         public override void LoadContent()
  43.         {
  44.             drawer.LoadContent();
  45.             // Načte obrázky a data potřebná pro vykreslení herního GUI
  46.         }
  47.  
  48.         public void PrepareForNewGame(GameData gameData, CellDrawer cellDrawer)
  49.         {
  50.             drawer.PrepareForNewGame(gameData, cellDrawer);
  51.         }
  52.  
  53.         public override void Update(float elapsedMs)
  54.         {
  55.         }
  56.  
  57.         public override void Draw(float elapsedMs)
  58.         {
  59.             drawer.Draw(elapsedMs);
  60.         }
  61.  
  62.         public override void ChangeOrientation(DisplayOrientation displayOrientation)
  63.         {
  64.         }
  65.  
  66.         public override void RecalculateScreenResolution()
  67.         {
  68.             drawer.RecalculateScreenResolution();
  69.         }
  70.  
  71.         public void HandleTouch(List<TouchLocation> availableTLs, List<int> usedTouchIDs)
  72.         {
  73.  
  74.         }
  75.  
  76.         public void HandleTilt()
  77.         {
  78.  
  79.         }
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment