public MapPanel(ResizeCalc rootX, ResizeCalc rootY, ResizeCalc width, ResizeCalc height) : base(rootX, rootY, width, height, false, true) { Random rng = new Random(); map = new int[Width, Height]; for (int x = 0; x < Width; ++x) { for (int y = 0; y < Height; ++y) { map[x, y] = rng.Next(0, 2); } } OnResize += (object s, EventArgs e) => resizeMap(widthCalc(), heightCalc()); }
// Takes messagerecall panel to indicate dependency on being shown public MainCameraPanel(ResizeCalc rootX, ResizeCalc rootY, ResizeCalc width, ResizeCalc height) : base(rootX, rootY, width, height, ApprenticeGame.ActiveMap) { AcceptsKeyboardInput = true; // Sync player manually the first time since they won't have moved after creation of this panel to trigger below lambda. CameraPosition = ApprenticeGame.Player.Position; // Keep our rendered map in sync with player. ApprenticeGame.Player.RemovedFromMap += (s, e) => MapToRender = null; ApprenticeGame.Player.AddedToMap += (s, e) => MapToRender = e.Map; // Keep rendering position in sync with player when they move. ApprenticeGame.Player.Moved += (s, e) => CameraPosition = e.NewPosition; // Keep up with messages as well splitMessages = new List <string>(); MessageCenter.MessageWritten += onMessageWritten; }
public SpellsPanel(ResizeCalc rootX, ResizeCalc rootY, ResizeCalc width, ResizeCalc height) : base(rootX, rootY, width, height, true, false) { }
public AlertPanel(ResizeCalc centerX, ResizeCalc centerY, string message) : base(() => centerX() - (message.Length / 2), () => centerY() - 2, () => message.Length, Screen.SizeC(5), true, false) { this.message = message; }