public void CloseAllPanel()
        {
            for (int i = 0; i < 3; i++)
            {
                _pictureObj.transform.GetChild(i).gameObject.SetActive(false);
            }

            CloseDescribePanel();
            OnPanelClosed?.Invoke();
        }
        public void CloseDescribePanel()
        {
            // 把描述介面全關閉 需要再另開起
            foreach (Transform t in _describeObj.transform)
            {
                t.gameObject.SetActive(false);
            }

            OnPanelClosed?.Invoke();
        }
Пример #3
0
        /// <summary>
        /// Close the panel
        /// </summary>
        public void Close()
        {
            gameObject.SetActive(false);

            OnPanelClosed?.Invoke();

            if (Inventory != null)
            {
                //Do inventory closed event
                Inventory.HandleInventoryClosed();
            }
        }
Пример #4
0
        public CharacterPanel(
            IRenderWindow renderWindow,
            Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Act1, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(128, 388);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);
        }
Пример #5
0
        public InventoryPanel(IRenderWindow renderWindow,
                              IItemManager itemManager,
                              Func <eItemContainerType, IItemContainer> createItemContainer,
                              Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(18, 384);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);

            secondaryLeftButton                  = createButton(eButtonType.SecondaryInvHand);
            secondaryLeftButton.Location         = panelSprite.Location + new Size(15, 22);
            secondaryLeftButton.OnActivate       = ToggleWeaponsSlot;
            secondaryLeftButton.ClickableRect    = new Size(0, 20);
            secondaryLeftButton.AllowFrameChange = false;

            secondaryRightButton                  = createButton(eButtonType.SecondaryInvHand);
            secondaryRightButton.Location         = panelSprite.Location + new Size(246, 22);
            secondaryRightButton.OnActivate       = ToggleWeaponsSlot;
            secondaryRightButton.ClickableRect    = new Size(0, 20);
            secondaryRightButton.AllowFrameChange = false;

            goldButton            = createButton(eButtonType.GoldCoin);
            goldButton.Location   = panelSprite.Location + new Size(84, 391);
            goldButton.OnActivate = OpenGoldDrop;

            helmContainer          = createItemContainer(eItemContainerType.Helm);
            helmContainer.Location = panelSprite.Location + new Size(135, 5);

            amuletContainer          = createItemContainer(eItemContainerType.Amulet);
            amuletContainer.Location = panelSprite.Location + new Size(209, 34);

            armorContainer          = createItemContainer(eItemContainerType.Armor);
            armorContainer.Location = panelSprite.Location + new Size(135, 75);

            leftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            leftHandContainer.Location = panelSprite.Location + new Size(20, 47);

            rightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            rightHandContainer.Location = panelSprite.Location + new Size(253, 47);

            secondaryLeftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryLeftHandContainer.Location = panelSprite.Location + new Size(24, 45);

            secondaryRightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryRightHandContainer.Location = panelSprite.Location + new Size(257, 45);

            beltContainer          = createItemContainer(eItemContainerType.Belt);
            beltContainer.Location = panelSprite.Location + new Size(136, 178);

            ringtLeftContainer          = createItemContainer(eItemContainerType.Ring);
            ringtLeftContainer.Location = panelSprite.Location + new Size(95, 179);

            ringtRightContainer          = createItemContainer(eItemContainerType.Ring);
            ringtRightContainer.Location = panelSprite.Location + new Size(209, 179);

            gloveContainer          = createItemContainer(eItemContainerType.Glove);
            gloveContainer.Location = panelSprite.Location + new Size(20, 179);

            bootsContainer          = createItemContainer(eItemContainerType.Boots);
            bootsContainer.Location = panelSprite.Location + new Size(251, 178);
        }
 public void Hide()
 {
     this.gameObject.SetActive(false);
     OnPanelClosed?.Invoke();
 }
Пример #7
0
        public InventoryPanel(IRenderWindow renderWindow,
                              IItemManager itemManager,
                              IMapRenderer mapRenderer,
                              ISessionManager sessionManager,
                              Func <eItemContainerType, IItemContainer> createItemContainer,
                              IGameState gameState,
                              Func <eButtonType, IButton> createButton)
        {
            this.renderWindow = renderWindow;
            this.mapRenderer  = mapRenderer;
            this.gameState    = gameState;

            sessionManager.OnFocusOnPlayer   += OnFocusOnPlayer;
            sessionManager.OnPlayerInfo      += OnPlayerInfo;
            sessionManager.OnChangeEquipment += OnChangeEquipment;

            panelSprite = renderWindow.LoadSprite(ResourcePaths.InventoryCharacterPanel, Palettes.Units, FrameType.GetOffset(), true);

            closeButton            = createButton(eButtonType.Close);
            closeButton.Location   = panelSprite.Location + new Size(18, 384);
            closeButton.OnActivate = () => OnPanelClosed?.Invoke(this);

            secondaryLeftButton            = createButton(eButtonType.SecondaryInvHand);
            secondaryLeftButton.Location   = panelSprite.Location + new Size(15, 22);
            secondaryLeftButton.OnActivate = ToggleWeaponsSlot;

            secondaryRightButton            = createButton(eButtonType.SecondaryInvHand);
            secondaryRightButton.Location   = panelSprite.Location + new Size(246, 22);
            secondaryRightButton.OnActivate = ToggleWeaponsSlot;

            goldButton            = createButton(eButtonType.GoldCoin);
            goldButton.Location   = panelSprite.Location + new Size(84, 391);
            goldButton.OnActivate = OpenGoldDrop;

            headContainer          = createItemContainer(eItemContainerType.Helm);
            headContainer.Location = panelSprite.Location + new Size(135, 5);
            headContainer.Slot     = "head";

            neckContainer          = createItemContainer(eItemContainerType.Amulet);
            neckContainer.Location = panelSprite.Location + new Size(209, 34);
            neckContainer.Slot     = "neck";

            torsoContainer          = createItemContainer(eItemContainerType.Armor);
            torsoContainer.Location = panelSprite.Location + new Size(135, 75);
            torsoContainer.Slot     = "tors";

            rightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            rightHandContainer.Location = panelSprite.Location + new Size(20, 47);
            rightHandContainer.Slot     = "rarm";

            leftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            leftHandContainer.Location = panelSprite.Location + new Size(253, 47);
            leftHandContainer.Slot     = "larm";

            secondaryLeftHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryLeftHandContainer.Location = panelSprite.Location + new Size(24, 45);

            secondaryRightHandContainer          = createItemContainer(eItemContainerType.Weapon);
            secondaryRightHandContainer.Location = panelSprite.Location + new Size(257, 45);

            beltContainer          = createItemContainer(eItemContainerType.Belt);
            beltContainer.Location = panelSprite.Location + new Size(136, 178);
            beltContainer.Slot     = "belt";

            ringLeftContainer          = createItemContainer(eItemContainerType.Ring);
            ringLeftContainer.Location = panelSprite.Location + new Size(95, 179);
            ringLeftContainer.Slot     = "rrin";

            ringRightContainer          = createItemContainer(eItemContainerType.Ring);
            ringRightContainer.Location = panelSprite.Location + new Size(209, 179);
            ringRightContainer.Slot     = "lrin";

            gloveContainer          = createItemContainer(eItemContainerType.Glove);
            gloveContainer.Location = panelSprite.Location + new Size(20, 179);
            gloveContainer.Slot     = "glov";

            bootsContainer          = createItemContainer(eItemContainerType.Boots);
            bootsContainer.Location = panelSprite.Location + new Size(251, 178);
            bootsContainer.Slot     = "feet";
        }