Beispiel #1
0
        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());
        }
Beispiel #2
0
        // 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;
        }
Beispiel #3
0
 public SpellsPanel(ResizeCalc rootX, ResizeCalc rootY, ResizeCalc width, ResizeCalc height)
     : base(rootX, rootY, width, height, true, false)
 {
 }
Beispiel #4
0
 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;
 }