예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EquippedForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler.</param>
        /// <param name="infoRequester">The info requester.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException"><paramref name="infoRequester" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="dragDropHandler" /> is <c>null</c>.</exception>
        public EquippedForm(DragDropHandler dragDropHandler, ItemInfoRequesterBase<EquipmentSlot> infoRequester, Vector2 position,
                            Control parent) : base(parent, position, new Vector2(200, 200))
        {
            if (infoRequester == null)
                throw new ArgumentNullException("infoRequester");
            if (dragDropHandler == null)
                throw new ArgumentNullException("dragDropHandler");

            _dragDropHandler = dragDropHandler;
            _infoRequester = infoRequester;

            CreateItemSlots();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShopForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler callback.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        public ShopForm(DragDropHandler dragDropHandler, Vector2 position, Control parent)
            : base(parent, position, new Vector2(200, 200))
        {
            _dragDropHandler = dragDropHandler;

            IsVisible = false;

            var itemsSize = _columns * _itemSize;
            var paddingSize = (_columns + 1) * _padding;
            Size = itemsSize + paddingSize + Border.Size;

            CreateItemSlots();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShopForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler callback.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        public ShopForm(DragDropHandler dragDropHandler, Vector2 position, Control parent)
            : base(parent, position, new Vector2(200, 200))
        {
            _dragDropHandler = dragDropHandler;

            IsVisible = false;

            var itemsSize   = _columns * _itemSize;
            var paddingSize = (_columns + 1) * _padding;

            Size = itemsSize + paddingSize + Border.Size;

            CreateItemSlots();
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EquippedForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler.</param>
        /// <param name="infoRequester">The info requester.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException"><paramref name="infoRequester" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="dragDropHandler" /> is <c>null</c>.</exception>
        public EquippedForm(DragDropHandler dragDropHandler, ItemInfoRequesterBase <EquipmentSlot> infoRequester, Vector2 position,
                            Control parent) : base(parent, position, new Vector2(200, 200))
        {
            if (infoRequester == null)
            {
                throw new ArgumentNullException("infoRequester");
            }
            if (dragDropHandler == null)
            {
                throw new ArgumentNullException("dragDropHandler");
            }

            _dragDropHandler = dragDropHandler;
            _infoRequester   = infoRequester;

            CreateItemSlots();
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InventoryForm"/> class.
        /// </summary>
        /// <param name="dragDropHandler">The drag-drop handler.</param>
        /// <param name="isUserInv">A func used to determine if an <see cref="Inventory"/> is the
        /// user's inventory.</param>
        /// <param name="infoRequester">The item info tooltip.</param>
        /// <param name="position">The position.</param>
        /// <param name="parent">The parent.</param>
        /// <exception cref="ArgumentNullException"><paramref name="infoRequester"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="isUserInv"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="dragDropHandler"/> is null.</exception>
        public InventoryForm(DragDropHandler dragDropHandler, Func<Inventory, bool> isUserInv,
                             ItemInfoRequesterBase<InventorySlot> infoRequester, Vector2 position, Control parent)
            : base(parent, position, new Vector2(200, 200))
        {
            if (infoRequester == null)
                throw new ArgumentNullException("infoRequester");
            if (isUserInv == null)
                throw new ArgumentNullException("isUserInv");
            if (dragDropHandler == null)
                throw new ArgumentNullException("dragDropHandler");

            _dragDropHandler = dragDropHandler;
            _isUserInv = isUserInv;
            _infoRequester = infoRequester;

            var itemsSize = _columns * _itemSize;
            var paddingSize = (_columns + 1) * _padding;
            Size = itemsSize + paddingSize + Border.Size;

            CreateItemSlots();
        }
예제 #6
0
        /// <summary>
        /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been
        /// completely and successfully added to the ScreenManager. It is highly recommended that you
        /// use this instead of the constructor. This is invoked only once.
        /// </summary>
        public override void Initialize()
        {
            _gameControls    = new GameplayScreenControls(this);
            _dragDropHandler = new DragDropHandler(this);

            _socket = ClientSockets.Instance;

            _world             = new World(this, new Camera2D(GameData.ScreenSize), new UserInfo(Socket));
            _world.MapChanged += World_MapChanged;

            // Create some misc goodies that require a reference to the Socket
            _equipmentInfoRequester = new EquipmentInfoRequester(UserInfo.Equipped, Socket);
            _inventoryInfoRequester = new InventoryInfoRequester(UserInfo.Inventory, Socket);

            // Other inits
            InitializeGUI();
            _characterTargeter = new CharacterTargeter(World);

            // NOTE: Test lighting
            _userLight = new Light {
                Size = new Vector2(512), IsEnabled = false
            };
            DrawingManager.LightManager.Add(_userLight);
        }
예제 #7
0
        /// <summary>
        /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been
        /// completely and successfully added to the ScreenManager. It is highly recommended that you
        /// use this instead of the constructor. This is invoked only once.
        /// </summary>
        public override void Initialize()
        {
            _gameControls = new GameplayScreenControls(this);
            _dragDropHandler = new DragDropHandler(this);

            _socket = ClientSockets.Instance;

            _world = new World(this, new Camera2D(GameData.ScreenSize), new UserInfo(Socket));
            _world.MapChanged += World_MapChanged;

            // Create some misc goodies that require a reference to the Socket
            _equipmentInfoRequester = new EquipmentInfoRequester(UserInfo.Equipped, Socket);
            _inventoryInfoRequester = new InventoryInfoRequester(UserInfo.Inventory, Socket);

            // Other inits
            InitializeGUI();
            _characterTargeter = new CharacterTargeter(World);

            // NOTE: Test lighting
            _userLight = new Light { Size = new Vector2(512), IsEnabled = false };
            DrawingManager.LightManager.Add(_userLight);
        }