/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Initialize the context UIContext.Initialize(Window, Graphics, Content); UIContext.Load(); // Create the game frame Desktop = new GameDesktop(); Desktop.Load(); Desktop.CreatePanels(); // Initial layout of all views Desktop.LayoutSubviews(); Desktop.NeedsLayout = true; /////////////////////////////////////////////////////////////////// // For debugging read a TMV file as input FileInfo file = new FileInfo("./Test.tmv"); Stream virtualStream = null; FileStream fileStream = file.OpenRead(); if (file.Extension == ".tmv") { virtualStream = new System.IO.Compression.GZipStream(fileStream, System.IO.Compression.CompressionMode.Decompress); } else { virtualStream = fileStream; } // Add the initial state TibiaMovieStream MovieStream = new TibiaMovieStream(virtualStream, file.Name); ClientState State = new ClientState(MovieStream); MovieStream.PlaybackSpeed = 50; State.ForwardTo(new TimeSpan(0, 30, 0)); // If fast-forwarded, client tab immediately, // otherwise delay until we receive the login packet. if (State.Viewport.Player == null) { State.Viewport.Login += delegate(ClientViewport Viewport) { Desktop.AddClient(State); }; } else { Desktop.AddClient(State); } State.Update(new GameTime()); /* * while (MS.Elapsed.TotalMinutes < 0 || MS.Elapsed.Seconds < 0) * Protocol.parsePacket(InStream.Read()); */ }
public SkillPanel(GameDesktop Desktop) { Name = "Skills"; ((UIStackView)ContentView).StretchOtherDirection = true; this.Desktop = Desktop; Desktop.ActiveViewportChanged += ViewportChanged; ViewportChanged(Desktop.ActiveViewport); }
public VIPPanel(GameDesktop Desktop) { Name = "VIP List"; Bounds.Width = 176; Bounds.Height = 200; this.Desktop = Desktop; Desktop.ActiveViewportChanged += ViewportChanged; ViewportChanged(Desktop.ActiveViewport); }
public GameSidebar(GameDesktop Desktop) : base(null, UIElementType.Window) { this.Desktop = Desktop; this.Viewport = Desktop.ActiveViewport; Desktop.ActiveViewportChanged += ViewportChanged; ContentView = new UIStackView(UIStackDirection.Vertical); ContentView.ZOrder = -1; CreateMenu(); AddSubview(ContentView); }
public InventoryPanel(GameDesktop Desktop) { Name = "Inventory"; Bounds = new Rectangle(0, 0, 176, 200); for (InventorySlot slot = InventorySlot.First; slot <= InventorySlot.Last; slot++) { InventoryItemButton InventoryItem = new InventoryItemButton(Viewport, slot) { Bounds = GetSlotPosition(slot) }; InventoryItem.Autoresizable = false; ContentView.AddSubview(InventoryItem); } this.Desktop = Desktop; Desktop.ActiveViewportChanged += ViewportChanged; ViewportChanged(Desktop.ActiveViewport); }