Example #1
0
    //SetHotKey 20190227
    private void DropToHotkeyBar(ItemSlot dropItemSlot)
    {
        RestorableItem dragToHotkeyItem = draggedSlot.Item as RestorableItem;
        RestorableItem dropToHotkeyItem = dropItemSlot.Item as RestorableItem;

        if (dropItemSlot is HotkeySlot)
        {
            if (dragToHotkeyItem != null)
            {
                hotkeyBar.SetHotkeyItem(dropItemSlot);
                //Instantiate(draggedSlot).Item = (RestorableItem)draggedSlot.Item;
                print("test3");
            }
            if (dropToHotkeyItem != null)
            {
                dropItemSlot.Item = (RestorableItem)dropItemSlot.Item;
                print("test4");
            }
        }
        if (draggedSlot is HotkeySlot)
        {
            if (dragToHotkeyItem != null)
            {
                dragToHotkeyItem = (RestorableItem)dropItemSlot.Item;
            }
            if (dropToHotkeyItem != null)
            {
                dropToHotkeyItem = (RestorableItem)dropItemSlot.Item;
            }
        }
    }
Example #2
0
    private void InventoryRightClick(ItemSlot itemSlot)
    {
        if (itemSlot.Item is EquippableItem)
        {
            Equip((EquippableItem)itemSlot.Item);
        }

        if (itemSlot.Item is EquippableItem)
        {
            Equip((EquippableItem)itemSlot.Item);
        }
        else if (itemSlot.Item is RestorableItem)
        {
            RestorableItem restorable = (RestorableItem)itemSlot.Item;
            restorable.Use(this);

            inventory.RemoveItem(restorable);
            restorable.Destroy();

            if (restorable.IsConsumable)
            {
                inventory.RemoveItem(restorable);
                restorable.Destroy();
            }
        }
    }
Example #3
0
    //補助道具顯示 20190221
    public void ShowTooltip(RestorableItem item)
    {
        ItemNameText.text = item.ItemName;
        ItemSlotText.text = item.restoreItemType.ToString();

        sb.Length = 0;
        AddStat(item.add_HP, "玩家體力");
        AddStat(item.add_MP, "玩家魔力");
        AddStat(item.add_Attack, "攻擊力");
        AddStateBool(item.BackToTown, "使用後傳送回村莊");

        ItemStatText.color = Color.white;
        ItemStatText.text  = sb.ToString();

        //調整價錢顯示顏色(玩家金幣不足顯示紅色)
        pb.Length = 0;
        if (item.Price <= player.MONEY)
        {
            AddPrice(item.Price, "價錢");
            ItemPriceText.color = Color.green;
        }
        else if (item.Price > player.MONEY)
        {
            AddPrice(item.Price, "價錢");
            ItemPriceText.color = Color.red;
        }
        ItemPriceText.text = pb.ToString();

        gameObject.SetActive(true);
    }
Example #4
0
    public void UseHotkeyItem(HotkeySlot hotkeySlot)
    {
        if (hotkeySlot.Item is RestorableItem)
        {
            RestorableItem restorable = (RestorableItem)hotkeySlot.Item;
            restorable.Use(this);

            hotkeyBar.RemoveItem(restorable);
            restorable.Destroy();

            if (restorable.IsConsumable)
            {
                hotkeyBar.RemoveItem(restorable);
                restorable.Destroy();
            }
        }

        if (hotkeySlot.Item is MagicalcardItem && isStartTimer != true)
        {
            //使用魔法書
            MagicalcardItem magicalcard = (MagicalcardItem)hotkeySlot.Item;
            magicalcard.Use(this);
            isStartTimer = true;
            isHotkeySlot = hotkeySlot;
            isMagicCard  = magicalcard;
        }
        else if ((hotkeySlot.Item is MagicalcardItem && isStartTimer != false))                    //警告:冷卻時間無法持續使用
        {
            FindObjectOfType <StatePanel>().SetSateText("<color=red>" + "目前無法使用該魔法" + "</color>"); //顯示StatePanel
        }
    }
Example #5
0
    public override bool CanReceiveItem(Item item)
    {
        if (item == null)
        {
            return(true);
        }

        RestorableItem  restorableItem = item as RestorableItem;
        MagicalcardItem magicalcard    = item as MagicalcardItem;

        return(restorableItem || magicalcard != null);
    }
Example #6
0
    //補助道具顯示 20190221
    public void ShowTooltip(RestorableItem item)
    {
        ItemNameText.text = item.ItemName;
        ItemSlotText.text = item.restoreItemType.ToString();

        sb.Length = 0;
        AddStat(item.add_HP, "玩家體力");
        AddStat(item.add_MP, "玩家魔力");
        AddStat(item.add_Speed, "攻擊速度");

        //調整補助道具顯示顏色(紅色) 20190221
        ItemStatText.color = Color.red;
        ItemStatText.text  = sb.ToString();

        gameObject.SetActive(true);
    }
Example #7
0
    public void UseHotkeyItem(HotkeySlot hotkeySlot)
    {
        if (hotkeySlot.Item is RestorableItem)
        {
            RestorableItem restorable = (RestorableItem)hotkeySlot.Item;
            restorable.Use(this);

            hotkeyBar.RemoveItem(restorable);
            restorable.Destroy();

            if (restorable.IsConsumable)
            {
                hotkeyBar.RemoveItem(restorable);
                restorable.Destroy();
            }
        }
    }
Example #8
0
    //補助道具顯示 20190221
    public void ShowTooltip(RestorableItem item)
    {
        ItemNameText.text = item.ItemName;
        ItemSlotText.text = item.restoreItemType.ToString();

        sb.Length = 0;
        AddStat(item.add_HP, "玩家體力");
        AddStat(item.add_MP, "玩家魔力");
        AddStat(item.add_Attack, "攻擊力");
        AddStateBool(item.BackToTown, "<color=white>" + "使用後傳送回村莊" + "</color>");
        AddStateBool(item.UseByRightClick, "<color=grey>" + "點擊右鍵即可使用" + "</color>");

        //調整補助道具顯示顏色
        ItemStatText.color = Color.green;
        ItemStatText.text  = sb.ToString();

        gameObject.SetActive(true);
    }
Example #9
0
    private void ShowTooltip(ItemSlot itemSlot)
    {
        EquippableItem equippableItem = itemSlot.Item as EquippableItem;

        if (equippableItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(equippableItem);
        }

        //新增補助道具顯示功能 20190222
        RestorableItem restorableItem = itemSlot.Item as RestorableItem;

        if (restorableItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(restorableItem);
        }
    }
Example #10
0
    //商品顯示價錢Tooltip 20190417
    private void ShowMoneyTooltip(ShopSlot shopSlot)
    {
        //裝備顯示
        EquippableItem equippableItem = shopSlot.item as EquippableItem;

        if (equippableItem != null)
        {
            moneyTooltip.transform.position = Input.mousePosition;
            moneyTooltip.ShowTooltip(equippableItem);
        }

        //補助道具顯示
        RestorableItem restorableItem = shopSlot.item as RestorableItem;

        if (restorableItem != null)
        {
            moneyTooltip.transform.position = Input.mousePosition;
            moneyTooltip.ShowTooltip(restorableItem);
        }
    }
Example #11
0
    private void ShowTooltip(ItemSlot itemSlot)
    {
        EquippableItem equippableItem = itemSlot.Item as EquippableItem;

        if (equippableItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(equippableItem);
        }

        //新增補助道具顯示功能 20190222
        RestorableItem restorableItem = itemSlot.Item as RestorableItem;

        if (restorableItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(restorableItem);
        }

        MagicalcardItem magicalcardItem = itemSlot.Item as MagicalcardItem;

        if (magicalcardItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(magicalcardItem);
        }

        //新增任務道具顯示功能 20190407
        MissionItem missionItem = itemSlot.Item as MissionItem;

        if (missionItem != null)
        {
            itemTooltip.transform.position = Input.mousePosition;
            itemTooltip.ShowTooltip(missionItem);
        }
    }