public static Texture2D ItemToTexture2D(Item t, out Color c)
    {
        if (t.IsNone)
        {
            c = Color.white;
            return(null);
        }

        Texture2D toAssignImage = ResourceLoader.GetLeafImage();

        System.Drawing.Color itemColor = ItemColor.GetItemColor(t);
        c = new Color(itemColor.R / 255f, itemColor.G / 255f, itemColor.B / 255f, itemColor.A / 255f);

        if (SpritesExist())
        {
            InitParser();
            byte[] bytes = SpriteParser.CurrentInstance.GetPng(t.ItemId, t.Count);
            if (bytes != null)
            {
                toAssignImage = new Texture2D(2, 2);
                toAssignImage.LoadImage(bytes);
                c = Color.white;
            }
        }

        return(toAssignImage);
    }
 public void Assign(Item item)
 {
     //IL_0026: Unknown result type (might be due to invalid IL or missing references)
     //IL_006f: Unknown result type (might be due to invalid IL or missing references)
     ItemAssigned = item;
     if (ItemAssigned.IsNone)
     {
         ImageComponent.texture = null;
         ImageComponent.color   = Color.white;
     }
     else
     {
         ImageComponent.texture = ResourceLoader.GetLeafImage();
         System.Drawing.Color itemColor = ItemColor.GetItemColor(item);
         ImageComponent.color = new Color(itemColor.R / 255f, itemColor.G / 255f, itemColor.B / 255f, itemColor.A / 255f);
     }
     FiveInts[0].text = item.Count.ToString();
     FiveInts[1].text = item.SystemParam.ToString();
     FiveInts[2].text = item.AdditionalParam.ToString();
     FiveInts[3].text = 0.ToString();
     FiveInts[4].text = item.UseCount.ToString();
     Text[] fiveInts = FiveInts;
     foreach (Text val in fiveInts)
     {
         if (val.text == 0.ToString())
         {
             val.text = "";
         }
     }
 }
    public static Texture2D ItemToTexture2D(Item t, out Color c)
    {
        if (t.IsNone)
        {
            c = Color.white;
            return(null);
        }

        Texture2D toAssignImage = ResourceLoader.GetLeafImage();

        Beri.Drawing.Color itemColor = ItemColor.GetItemColor(t);
        c = new Color(itemColor.R / 255f, itemColor.G / 255f, itemColor.B / 255f, itemColor.A / 255f);

        string path = GetImagePathFromItem(t);

        if (path != "")
        {
            if (File.Exists(path))
            {
                byte[] bytes = File.ReadAllBytes(path);
                toAssignImage = new Texture2D(2, 2);
                toAssignImage.LoadImage(bytes);
                c = Color.white;
            }
        }

        return(toAssignImage);
    }
Exemple #4
0
        private void ChangeItem(ushort item, ushort count)
        {
            var pb = PB_Item;

            pb.BackColor       = ItemColor.GetItemColor(item);
            pb.BackgroundImage = ItemSprite.GetItemSprite(item, count);
        }
 public void OnClickItemInfoShow(int itemid, Button button)
 {
     if (InformationPanel != null && EquipmentActionPanel != null)
     {
         if (selectedButton != null)
         {
             selectedButton.interactable = true;
         }
         selectedButton = button;
         selectedButton.interactable = false;
         Item item = ItemSystem.GetUserEquipmentItem(itemid);
         InformationPanel.transform.GetChild(0).GetComponent <Image>().enabled = true;
         InformationPanel.transform.GetChild(0).GetComponent <Image>().sprite  = ItemSystem.GetItemImage(item.id);
         InformationPanel.transform.GetChild(0).GetComponent <Image>().gameObject.SetActive(true);
         InformationPanel.transform.GetComponentInChildren <Text>().enabled = true;
         InformationPanel.transform.GetComponentInChildren <Text>().text    = string.Format("{0}({1})", ItemSystem.GetItemName(item.id), Enum.GetName(typeof(GachaSystem.GachaClass), (GachaSystem.GachaClass)item.itemClass - 1));
         InformationPanel.transform.GetComponentInChildren <Text>().color   = ItemColor.GetItemColor(item.itemClass);
         EquipmentActionPanel.SetActive(true);
         EquipmentActionPanel.transform.GetChild(0).GetComponent <Text>().text = ItemSystem.GetEquipmentItemDescription(item);
         EquipmentActionPanel.GetComponentInChildren <Button>().enabled        = true;
         EquipmentActionPanel.GetComponentInChildren <Button>().GetComponentInChildren <Text>().text = LocalizationManager.GetText("equipmentItemEquipButton");
         EquipmentActionPanel.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
         EquipmentActionPanel.GetComponentInChildren <Button>().onClick.AddListener(delegate
         {
             EquipmentEvent(item.customId);
         });
     }
 }
Exemple #6
0
        private void cbItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            var selectedItemId = (ushort)(int)cbItem.SelectedValue;
            var itemCount      = (ushort)0;

            pbItem.BackColor = ItemColor.GetItemColor(selectedItemId);
            pbItem.Image     = ItemSprite.GetItemSprite(selectedItemId, itemCount);
            SelectedItemInfo = itemConvertor.FromItemId(selectedItemId);
            OnItemChanged();
        }
Exemple #7
0
        private void SetItemSprite(Item item, PictureBox pb)
        {
            var dw   = Sprites.Width;
            var dh   = Sprites.Height;
            var font = L_ItemName.Font;

            pb.BackColor       = ItemColor.GetItemColor(item);
            pb.BackgroundImage = ItemSprite.GetItemSprite(item);
            var backing = new Bitmap(dw, dh);

            pb.Image = ItemSprite.GetItemMarkup(item, font, dw, dh, backing);
        }
 public void RefreshUI()
 {
     if (ItemSlotPrefab != null && InformationPanel != null && EquipmentActionPanel != null && ItemListContentView != null)
     {
         if (equipmentItemId == 0)
         {
             InformationPanel.transform.GetChild(0).GetComponent <Image>().enabled = false;
             InformationPanel.transform.GetComponentInChildren <Text>().text       = LocalizationManager.GetText("equipmentItemEmpty");
             EquipmentActionPanel.transform.GetChild(0).GetComponent <Text>().text = LocalizationManager.GetText("equipmentItemEmptyInformation");
             EquipmentActionPanel.GetComponentInChildren <Button>().enabled        = false;
             EquipmentActionPanel.GetComponentInChildren <Button>().GetComponentInChildren <Text>().text = "";
         }
         else
         {
             Item equipmentItemInfo = ItemSystem.GetUserEquipmentItem(equipmentItemId);
             InformationPanel.transform.GetChild(0).GetComponent <Image>().enabled = true;
             InformationPanel.transform.GetChild(0).GetComponent <Image>().sprite  = ItemSystem.GetItemImage(equipmentItemId, true);
             InformationPanel.transform.GetComponentInChildren <Text>().enabled    = true;
             InformationPanel.transform.GetComponentInChildren <Text>().text       = string.Format("{0}({1})", ItemSystem.GetItemName(equipmentItemInfo.id), Enum.GetName(typeof(GachaSystem.GachaClass), (GachaSystem.GachaClass)equipmentItemInfo.itemClass - 1));
             InformationPanel.transform.GetComponentInChildren <Text>().color      = ItemColor.GetItemColor(equipmentItemInfo.itemClass);
             EquipmentActionPanel.transform.GetChild(0).GetComponent <Text>().text = ItemSystem.GetEquipmentItemDescription(equipmentItemInfo);
             EquipmentActionPanel.GetComponentInChildren <Button>().enabled        = true;
             EquipmentActionPanel.GetComponentInChildren <Button>().GetComponentInChildren <Text>().text = LocalizationManager.GetText("equipmentItemUnEquipButton");
             EquipmentActionPanel.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
             EquipmentActionPanel.GetComponentInChildren <Button>().onClick.AddListener(delegate
             {
                 DismountEvent(equipmentItemInfo.id);
             });
         }
         foreach (Transform child in ItemListContentView.transform)
         {
             Destroy(child.gameObject);
         }
         userEquipmentItemList = ItemSystem.GetUserUnEquipmentItems(Common.OrderByType.VALUE);
         for (var i = 0; i < userEquipmentItemList.Count; i++)
         {
             GameObject itemSlot = Instantiate(ItemSlotPrefab, ItemListContentView.transform);
             itemSlot.transform.GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(userEquipmentItemList[i].id);
             itemSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(userEquipmentItemList[i].id);
             itemSlot.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(userEquipmentItemList[i].itemClass);
             itemSlot.GetComponentInChildren <Text>().text  = ItemSystem.GetItemName(userEquipmentItemList[i].id);
             itemSlot.transform.GetChild(2).GetComponent <Image>().color = ItemColor.GetItemColor(userEquipmentItemList[i].itemClass);
             int index = i;
             itemSlot.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
             itemSlot.GetComponentInChildren <Button>().onClick.AddListener(delegate
             {
                 OnClickItemInfoShow(userEquipmentItemList[index].customId, itemSlot.GetComponentInChildren <Button>());
             });
         }
     }
 }
Exemple #9
0
    public void RefreshUI()
    {
        if (ItemSlotPrefab != null && ItemListContentView != null)
        {
            foreach (Transform child in ItemListContentView.transform)
            {
                Destroy(child.gameObject);
            }
            foreach (Transform child in SellListContentView.transform)
            {
                Destroy(child.gameObject);
            }
            userItemList.Sort((i1, i2) => i2.itemClass.CompareTo(i1.itemClass));
            for (var i = 0; i < userItemList.Count; i++)
            {
                GameObject itemSlot = Instantiate(ItemSlotPrefab, ItemListContentView.transform);
                itemSlot.transform.GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(userItemList[i].id);
                itemSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(userItemList[i].id);
                itemSlot.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(userItemList[i].itemClass);
                itemSlot.GetComponentInChildren <Text>().text  = ItemSystem.GetItemName(userItemList[i].id);
                itemSlot.transform.GetChild(2).GetComponent <Image>().color = ItemColor.GetItemColor(userItemList[i].itemClass);
                int index = i;
                itemSlot.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
                itemSlot.GetComponentInChildren <Button>().onClick.AddListener(delegate
                {
                    OnClickItemToSellList(userItemList[index], itemSlot.GetComponentInChildren <Button>());
                });
                itemSlot.gameObject.SetActive(true);
            }

            for (var i = 0; i < sellItemList.Count && i < 15; i++)
            {
                GameObject itemSlot = Instantiate(ItemSlotPrefab, SellListContentView.transform);
                itemSlot.transform.GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(sellItemList[i].id);
                itemSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(sellItemList[i].id);
                itemSlot.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(sellItemList[i].itemClass);
                itemSlot.GetComponentInChildren <Text>().text  = ItemSystem.GetItemName(sellItemList[i].id);
                itemSlot.transform.GetChild(2).GetComponent <Image>().color = ItemColor.GetItemColor(sellItemList[i].itemClass);
                int index = i;
                itemSlot.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
                itemSlot.GetComponentInChildren <Button>().onClick.AddListener(delegate
                {
                    OnClickItemToInventory(sellItemList[index], itemSlot.GetComponentInChildren <Button>());
                });
                itemSlot.gameObject.SetActive(true);
            }
        }
    }
Exemple #10
0
    public IEnumerator ShowGetGacha(Item item)
    {
        yield return(new WaitForSeconds(1.0f));

        GameObject slotItem = Instantiate(slotGachaPrefab, ItemView);

        itemContainerImage = slotItem.GetComponent <Image>();
        itemImage          = slotItem.transform.GetChild(0).GetComponent <Image>();
        itemClassText      = slotItem.transform.GetChild(1).GetComponentInChildren <Text>();
        itemNameText       = slotItem.transform.GetChild(2).GetComponent <Text>();
        itemEffect         = slotItem.transform.GetComponentInChildren <ParticleSystem>();

        // 아이템 등급별 색상
        int itemClass = item.itemClass;

        if (itemClass >= 5)
        {
            itemEffect.Play();
        }
        else
        {
            itemEffect.Stop();
        }

        itemClassText.color      = ItemColor.GetItemColor(itemClass);
        itemNameText.color       = ItemColor.GetItemColor(itemClass);
        itemContainerImage.color = ItemColor.GetItemColor(itemClass);
        //

        itemImage.sprite   = ItemSystem.GetItemImage(item.id);
        itemClassText.text = Enum.GetName(typeof(GachaSystem.GachaClass), (GachaSystem.GachaClass)item.itemClass - 1);
        itemNameText.text  = ItemSystem.GetItemName(item.id);
        if (slotItem.GetComponent <AiryUIAnimatedElement>() != null)
        {
            slotItem.GetComponent <AiryUIAnimatedElement>().ShowElement();
        }
        else
        {
            slotItem.gameObject.SetActive(true);
        }
        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop);
        yield return(new WaitForSeconds(0.1f));

        GetComponent <Button>().interactable = true;
        tabText.enabled = true;
        yield return(null);
    }
    public void OnItemSlotClick(int index)
    {
        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
        if (itemSlots[index] != null && PanelItemInfo.activeSelf)
        {
            if (!PanelItemInfo.activeSelf)
            {
                selectedItem = itemSlots[index].Item;
            }
            else
            {
                selectedItem                 = itemSlots[index].Item;
                itemInfoImage.sprite         = ItemSystem.GetItemImage(itemSlots[index].Item.id);
                itemInfoContainerImage.color = ItemColor.GetItemColor(itemSlots[index].Item.itemClass);
                itemInfoCoverImage.sprite    = ItemSystem.GetItemClassImage(itemSlots[index].Item.id);
                itemInfoName.text            = ItemSystem.GetItemName(itemSlots[index].Item.id) + string.Format(" {0}", ItemSystem.GetIemClassName(itemSlots[index].Item.itemClass));
                itemInfoName.color           = ItemColor.GetItemColor(itemSlots[index].Item.itemClass);
                itemInfoDescription.text     = ItemSystem.GetEquipmentItemDescription(itemSlots[index].Item);
                itemInfoParent.gameObject.SetActive(true);
                itemInfoName.enabled        = true;
                itemInfoDescription.enabled = true;
                if (selectedItem.itemClass < 8 && selectedItem.equipCharacterId == 0)
                {
                    itemSellButton.enabled = true;
                    itemSellButton.GetComponent <Image>().enabled          = true;
                    itemSellButton.GetComponentInChildren <Text>().enabled = true;
                }
                else
                {
                    itemSellButton.enabled = false;
                    itemSellButton.GetComponent <Image>().enabled          = false;
                    itemSellButton.GetComponentInChildren <Text>().enabled = false;
                }

                if (itemInfoParent.GetComponent <AiryUIAnimatedElement>() != null)
                {
                    itemInfoParent.GetComponent <AiryUIAnimatedElement>().ShowElement();
                }
                Debugging.Log(index + " 아이템 슬롯버튼 클릭");
            }
        }
    }
 public void SetSelectedItem(Item itemSlot)
 {
     selectedItem                 = itemSlot;
     itemInfoImage.sprite         = ItemSystem.GetItemImage(itemSlot.id);
     itemInfoContainerImage.color = ItemColor.GetItemColor(itemSlot.itemClass);
     itemInfoName.text            = ItemSystem.GetItemName(itemSlot.id) + string.Format(" {0}", ItemSystem.GetIemClassName(itemSlot.itemClass));
     itemInfoName.color           = ItemColor.GetItemColor(itemSlot.itemClass);
     itemInfoDescription.text     = ItemSystem.GetEquipmentItemDescription(itemSlot);
     itemInfoParent.gameObject.SetActive(true);
     itemInfoName.enabled        = true;
     itemInfoDescription.enabled = true;
     itemSellButton.enabled      = true;
     itemSellButton.GetComponent <Image>().enabled          = true;
     itemSellButton.GetComponentInChildren <Text>().enabled = true;
     if (itemInfoParent.GetComponent <AiryUIAnimatedElement>() != null)
     {
         itemInfoParent.GetComponent <AiryUIAnimatedElement>().ShowElement();
     }
     Debugging.Log(itemSlot.customId + " 아이템 슬롯버튼 클릭");
 }
    public void RefreshUI(Common.OrderByType orderByType = Common.OrderByType.VALUE)
    {
        items = ItemSystem.GetUserItems(orderByType);
        inventoryCountText.text = string.Format("{0} / {1}", items.Count, User.inventoryCount);

        if (items != null)
        {
            for (int i = 0; i < itemSlots.Length; i++)
            {
                itemSlots[i].Item = null;
                itemSlots[i].GetComponent <Button>().enabled = false;

                itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Image>().color = ItemColor.C;
                isEquipPanel = itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(2).gameObject;
                isEquipPanel.SetActive(false);
                itemSlots[i].transform.GetChild(3).gameObject.SetActive(false);
                itemSlots[i].transform.GetChild(4).gameObject.SetActive(false);
                if (i < items.Count && i < itemSlots.Length)
                {
                    itemSlots[i].Item = items[i];
                    itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(items[i].itemClass);
                    itemSlots[i].transform.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(items[i].itemClass);
                    itemSlots[i].GetComponent <Button>().enabled = true;
                    if (items[i].equipCharacterId > 0)
                    {
                        isEquipPanel.SetActive(true);
                    }
                    int index = i;
                    if (index < items.Count && index < itemSlots.Length)
                    {
                        itemSlots[i].GetComponent <Button>().onClick.RemoveAllListeners();
                        itemSlots[i].GetComponent <Button>().onClick.AddListener(delegate
                        {
                            OnItemSlotClick(index);
                        });
                    }
                }
            }
        }
        Debugging.Log(items.Count + " 개의 아이템 로드됨");
    }
Exemple #14
0
    public void EnableUI()
    {
        totalValue = 0;
        totalCount = 0;
        if (ItemSlotPrefab != null && ItemListContentView != null)
        {
            userItemList.Clear();
            sellItemList.Clear();
            foreach (Transform child in ItemListContentView.transform)
            {
                Destroy(child.gameObject);
            }
            foreach (Transform child in SellListContentView.transform)
            {
                Destroy(child.gameObject);
            }
            userItemList = ItemSystem.GetUserUnEquipmentItems(Common.OrderByType.VALUE);

            for (var i = 0; i < userItemList.Count; i++)
            {
                GameObject itemSlot = Instantiate(ItemSlotPrefab, ItemListContentView.transform);
                itemSlot.transform.GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(userItemList[i].id);
                itemSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(userItemList[i].id);
                itemSlot.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(userItemList[i].itemClass);
                itemSlot.GetComponentInChildren <Text>().text  = ItemSystem.GetItemName(userItemList[i].id);
                itemSlot.transform.GetChild(2).GetComponent <Image>().color = ItemColor.GetItemColor(userItemList[i].itemClass);
                int index = i;
                itemSlot.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
                itemSlot.GetComponentInChildren <Button>().onClick.AddListener(delegate
                {
                    OnClickItemToSellList(userItemList[index], itemSlot.GetComponentInChildren <Button>());
                });
                itemSlot.gameObject.SetActive(true);
            }
            SetActionInfo(0, 0, false);
        }
    }
Exemple #15
0
    IEnumerator ShowGetItem()
    {
        yield return(new WaitForSeconds(1f));

        List <Item> getItemsIdList = StageManagement.instance.GetStageItems();

        if (getItemsIdList != null && getItemsIdList.Count > 0)
        {
            foreach (var item in getItemsIdList)
            {
                SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop);
                GameObject itemPrefab = Instantiate(GetItemSlotPrefab, GetItemInfoPanel.transform);

                itemPrefab.transform.GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(item.id);
                itemPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(item.id);
                itemPrefab.transform.GetChild(0).GetChild(1).GetComponent <Image>().color  = ItemColor.GetItemColor(item.itemClass);

                itemPrefab.transform.GetComponentInChildren <Text>().text = ItemSystem.GetItemName(item.id);
                if (itemPrefab.GetComponent <AiryUIAnimatedElement>() != null)
                {
                    itemPrefab.GetComponent <AiryUIAnimatedElement>().ShowElement();
                }
                yield return(new WaitForSeconds(0.2f));
            }
        }
        else
        {
            yield return(null);
        }
    }
    public void RefreshEvolutionUI()
    {
        items = ItemSystem.GetUserItems(Common.OrderByType.VALUE);
        if (items != null)
        {
            for (int i = 0; i < itemSlots.Length; i++)
            {
                itemSlots[i].Item = null;
                itemSlots[i].GetComponent <Button>().enabled = false;
                itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Image>().color = ItemColor.C;
                isEquipPanel = itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(2).gameObject;
                isEquipPanel.SetActive(false);
                itemSlots[i].transform.GetChild(3).gameObject.SetActive(false);
                itemSlots[i].transform.GetChild(4).gameObject.SetActive(false);
                if (i < items.Count && i < itemSlots.Length)
                {
                    itemSlots[i].Item = items[i];
                    itemSlots[i].transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(items[i].itemClass);
                    itemSlots[i].transform.GetComponentInChildren <Text>().color = ItemColor.GetItemColor(items[i].itemClass);
                    itemSlots[i].GetComponent <Button>().enabled = true;
                    if (items[i].equipCharacterId > 0)
                    {
                        isEquipPanel.SetActive(true);
                    }
                    int index = i;
                    if (index < items.Count && index < itemSlots.Length)
                    {
                        itemSlots[i].GetComponent <Button>().onClick.RemoveAllListeners();
                    }
                    // Lock

                    if (PanelEvolutionPanel.GetComponent <UI_EvolutionItem>().isEndEvolution)
                    {
                        if (itemSlots[i].Item.equipCharacterId != 0)
                        {
                            itemSlots[i].transform.GetChild(3).gameObject.SetActive(true);
                            itemSlots[i].GetComponent <Button>().enabled = false;
                        }
                        else
                        {
                            itemSlots[i].transform.GetChild(3).gameObject.SetActive(false);
                            itemSlots[i].GetComponent <Button>().enabled = true;
                            itemSlots[i].GetComponent <Button>().onClick.RemoveAllListeners();
                            itemSlots[i].GetComponent <Button>().onClick.AddListener(delegate
                            {
                                OnItemSlotToEvolutionButton(itemSlots[index].Item);
                            });
                        }
                    }
                    else
                    {
                        if (itemSlots[i].Item.itemClass != selectedItem.itemClass || itemSlots[i].Item.equipCharacterId != 0)
                        {
                            itemSlots[i].transform.GetChild(3).gameObject.SetActive(true);
                            itemSlots[i].GetComponent <Button>().enabled = false;
                        }
                        else
                        {
                            itemSlots[i].transform.GetChild(3).gameObject.SetActive(false);
                            itemSlots[i].GetComponent <Button>().enabled = true;
                            itemSlots[i].GetComponent <Button>().onClick.RemoveAllListeners();
                            itemSlots[i].GetComponent <Button>().onClick.AddListener(delegate
                            {
                                OnItemSlotToEvolutionButton(itemSlots[index].Item);
                            });

                            // Select
                            if (PanelEvolutionPanel.GetComponent <UI_EvolutionItem>().IsSelectedItem(itemSlots[index].Item))
                            {
                                itemSlots[i].transform.GetChild(4).gameObject.SetActive(true);
                                itemSlots[i].GetComponent <Button>().enabled = false;
                            }
                            else
                            {
                                itemSlots[i].transform.GetChild(4).gameObject.SetActive(false);
                                itemSlots[i].GetComponent <Button>().enabled = true;
                                itemSlots[i].GetComponent <Button>().onClick.RemoveAllListeners();
                                itemSlots[i].GetComponent <Button>().onClick.AddListener(delegate
                                {
                                    OnItemSlotToEvolutionButton(itemSlots[index].Item);
                                });
                            }
                        }
                    }
                }
            }
        }
    }
 public Color GetItemColor(Item item)
 => ItemColor.GetItemColor(item);
    void RefreshUI()
    {
        if (targetItem == null)
        {
            targetItemSlotImage.sprite = ItemSystem.GetItemNoneImage();
            evolutionButton.gameObject.SetActive(false);
            evolutionInformationText.gameObject.SetActive(true);
            targetItemSlot.GetComponent <Image>().color = Color.white;
        }
        else
        {
            targetItemSlot.GetComponent <Image>().color = ItemColor.GetItemColor(targetItem.itemClass);
            targetItemSlotImage.sprite = ItemSystem.GetItemImage(targetItem.id);
            int itemClass = targetItem.itemClass;
            if (matItems.Count == 2 && itemClass < 8)
            {
                evolutionButton.interactable = true;
                evolutionButton.gameObject.SetActive(true);
                if (paymentType == 0)
                {
                    paymentAmount = itemClass * itemClass * (300 + (itemClass * itemClass * 100));
                }
                else if (paymentType == 1)
                {
                    paymentAmount = itemClass * itemClass * 2;
                }

                evolutionButton.GetComponentInChildren <Text>().text = Common.GetThousandCommaText(paymentAmount);
                evolutionButton.transform.GetChild(1).GetComponent <Image>().sprite = Resources.Load <Sprite>(Common.GetCoinCrystalEnergyImagePath(paymentType));

                evolutionInformationText.gameObject.SetActive(false);
            }
            else
            {
                evolutionButton.gameObject.SetActive(false);
                evolutionInformationText.gameObject.SetActive(true);
            }
        }

        if (resultItem == null)
        {
            resultItemSlotImage.sprite = ItemSystem.GetItemNoneImage();
            resultItemSlot.GetComponent <Image>().sprite = ItemSystem.GetItemClassImage(-1);
            resultItemSlot.transform.GetChild(1).GetComponent <Image>().color = Color.white;
        }
        else
        {
            resultItemSlotImage.sprite = ItemSystem.GetItemImage(resultItem.id);
            resultItemSlot.GetComponent <Image>().sprite = ItemSystem.GetItemClassImage(resultItem.id);
            resultItemSlot.transform.GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(resultItem.itemClass);
        }

        matItemSlotButton1.onClick.RemoveAllListeners();
        matItemSlotButton2.onClick.RemoveAllListeners();
        matItemSlot1.GetComponent <Image>().color = Color.white;
        matItemSlot2.GetComponent <Image>().color = Color.white;
        matItemSlotImage1.sprite = ItemSystem.GetItemNoneImage();
        matItemSlotImage2.sprite = ItemSystem.GetItemNoneImage();
        foreach (var i in matItems.Values)
        {
            if (matItemSlotImage1.sprite.name == ItemSystem.GetItemNoneImage().name)
            {
                matItemSlot1.GetComponent <Image>().color = ItemColor.GetItemColor(i.itemClass);
                matItemSlotImage1.sprite = ItemSystem.GetItemImage(i.id);
                matItemSlotButton1.onClick.AddListener(delegate
                {
                    RemoveMatItem(i);
                });
            }
            else if (matItemSlotImage2.sprite.name == ItemSystem.GetItemNoneImage().name)
            {
                matItemSlot2.GetComponent <Image>().color = ItemColor.GetItemColor(i.itemClass);
                matItemSlotImage2.sprite = ItemSystem.GetItemImage(i.id);
                matItemSlotButton2.onClick.AddListener(delegate
                {
                    RemoveMatItem(i);
                });
            }
        }
        if (parentPanel.GetComponent <UI_Manager_InventoryTab>() != null)
        {
            parentPanel.GetComponent <UI_Manager_InventoryTab>().RefreshEvolutionUI();
        }
    }
Exemple #19
0
    public void RefreshHeroStatusEquipmentPanel()
    {
        //Status 정보
        if (heroStatusInfoPanel != null)
        {
            heroStatusInfoPanel.transform.GetChild(0).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttack(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(0) + ItemSystem.GetHeroEquipmentItemAttack(ref targetHeroData) + LabSystem.GetAddAttack(User.addAttackLevel));
            heroStatusInfoPanel.transform.GetChild(1).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusDefence(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(1) + ItemSystem.GetHeroEquipmentItemDefence(ref targetHeroData) + LabSystem.GetAddDefence(User.addDefenceLevel));
            heroStatusInfoPanel.transform.GetChild(2).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMaxHp(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(2) + ItemSystem.GetHeroEquipmentItemHp(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(3).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusCriticalPercent(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>%", AbilitySystem.GetAbilityStats(3) + ItemSystem.GetHeroEquipmentItemCritical(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(4).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttackSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(4) + ItemSystem.GetHeroEquipmentItemAttackSpeed(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(5).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMoveSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(5) + ItemSystem.GetHeroEquipmentItemMoveSpeed(ref targetHeroData));
            heroStatusInfoPanel.transform.GetChild(6).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusKnockbackResist(ref targetHeroData).ToString("N1");
            heroStatusInfoPanel.transform.GetChild(7).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusSkillEnergy(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(6) + ItemSystem.GetHeroEquipmentItemSkillEnergy(ref targetHeroData));
        }

        if (heroStatPanel != null)
        {
            for (int i = 0; i < heroStatPanel.transform.childCount; i++)
            {
                if (heroStatPanel.transform.GetComponentInChildren <Button>() != null)
                {
                    heroStatPanel.transform.GetComponentInChildren <Button>().gameObject.SetActive(false);
                }
            }
            heroStatPanel.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = targetHeroData.strength.ToString();
            heroStatPanel.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = targetHeroData.intelligent.ToString();
            heroStatPanel.transform.GetChild(2).GetChild(0).GetComponent <Text>().text = targetHeroData.physical.ToString();
            heroStatPanel.transform.GetChild(3).GetChild(0).GetComponent <Text>().text = targetHeroData.agility.ToString();
        }

        // Equipment 장비 정보
        if (heroEquimentItemSlots != null && heroEquimentItemSlots.transform.childCount > 0)
        {
            int[] equipmentItemsId = HeroSystem.GetHeroEquipmentItems(targetHeroData.id);
            for (int i = 0; i < equipmentItemsId.Length; i++)
            {
                if (equipmentItemsId[i] != 0)
                {
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemClassImage(equipmentItemsId[i], true);
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(equipmentItemsId[i], true);
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(ItemSystem.GetUserEquipmentItem(equipmentItemsId[i]).itemClass);
                }
                else
                {
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite             = ItemSystem.GetItemNoneImage();
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemNoneImage();
                    heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.D;
                }
                int buttonIndex = i;
                heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.RemoveAllListeners();
                heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.AddListener(delegate
                {
                    OnEquipmentItemClick(buttonIndex, equipmentItemsId[buttonIndex]);
                });
            }
        }

        // 스킬정보
        Skill heroSkill = SkillSystem.GetSkill(targetHeroData.skill);

        if (heroSkillSlot != null && heroSkill != null)
        {
            skillImage        = heroSkillSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>();
            skillImage.sprite = SkillSystem.GetSkillImage(heroSkill.id);
            heroSkillSlot.transform.GetComponentInChildren <Text>().text = string.Format("<size='27'>{0} : {1}</size>\r\n<color='grey'>{2}</color>", LocalizationManager.GetText("SkillLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id), SkillSystem.GetUserSkillDescription(heroSkill, targetHeroData));
            // 스킬강화버튼
            skillLevelUpButton = heroSkillSlot.GetComponentInChildren <Button>();
            int needMoney = SkillSystem.GetUserSkillLevelUpNeedCoin(heroSkill.id);
            skillLevelUpButton.transform.GetChild(0).GetComponentInChildren <Text>().text = Common.GetThousandCommaText(needMoney);

            if (Common.PaymentAbleCheck(ref User.coin, needMoney))
            {
                skillLevelUpButton.interactable = true;
            }
            else
            {
                skillLevelUpButton.interactable = false;
            }
            skillLevelUpButton.onClick.RemoveAllListeners();
            skillLevelUpButton.onClick.AddListener(delegate
            {
                OnSkillLevelUpClick(heroSkill.id, needMoney);
            });

            if (SkillSystem.isHeroSkillUpgradeAble(heroSkill.id, targetHeroData))
            {
                skillLevelUpButton.interactable = true;
                skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(false);
            }
            else
            {
                skillLevelUpButton.interactable = false;
                skillLevelUpButton.transform.GetChild(2).GetComponentInChildren <Text>().text = string.Format("! {0} : {1}", LocalizationManager.GetText("HeroLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id) + 1);
                skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(true);
            }
        }
    }
        public override void Paint(Graphics gfx, MapRenderContext context)
        {
            var layer = map.CurrentLayer;

            bool[,] drawn = new bool[context.TileRange.Width, context.TileRange.Height];

            for (int x = context.TileRange.Left; x < context.TileRange.Right; x++)
            {
                for (int y = context.TileRange.Top; y < context.TileRange.Bottom; y++)
                {
                    if (drawn[x - context.TileRange.Left, y - context.TileRange.Top])
                    {
                        continue;
                    }

                    var tile = layer.GetTile(x, y);
                    if (tile.IsNone)
                    {
                        continue;
                    }

                    /*if (tile.IsBuried)
                     * {
                     *  // DrawX(data, (x - x0) * scale, (y - y0) * scale, scale, w);
                     * }
                     * else if (tile.IsDropped)
                     * {
                     *  //Rectangle itemRect = context.GetTileRectangle(x, y, 1, 1).Shrink(2, 2, 1, 1);
                     *  //gfx.FillRectangle(Brushes.DeepPink, itemRect);
                     *  //  DrawPlus(data, (x - x0) * scale, (y - y0) * scale, scale, w);
                     * }*/

                    Item? root         = null;
                    Point rootLocation = Point.Empty;

                    if (tile.IsRoot)
                    {
                        root         = tile;
                        rootLocation = new Point(x, y);
                    }
                    else if (tile.IsExtension)
                    {
                        rootLocation = new Point(x - tile.ExtensionX, y - tile.ExtensionY);
                        root         = layer.GetTile(rootLocation.X, rootLocation.Y);

                        //Debug.Assert(root.IsRoot);
                        //Rectangle itemRect = context.GetTileRectangle(x, y, 1, 1).Shrink(2, 2, 1, 1);
                        //gfx.FillRectangle(Brushes.BlueViolet, itemRect);
                    }


                    if (root != null)
                    {
                        var       type     = ItemInfo.GetItemSize(root);
                        var       w        = type.GetWidth();
                        var       h        = type.GetHeight();
                        Rectangle itemRect = context.ToViewport(rootLocation.X, rootLocation.Y, w, h).Shrink(2, 2, 1, 1);
                        gfx.FillRectangle(context.ResourceCache.GetSolidBrush(ItemColor.GetItemColor(root)), itemRect);

                        for (int ix = 0; ix < w; ix++)
                        {
                            int drawnX = rootLocation.X + ix - context.TileRange.Left;
                            if (drawnX < 0)
                            {
                                continue;
                            }
                            if (drawnX >= context.TileRange.Width)
                            {
                                break;
                            }

                            for (int iy = 0; iy < h; iy++)
                            {
                                int drawnY = rootLocation.Y + iy - context.TileRange.Top;

                                if (drawnY < 0)
                                {
                                    continue;
                                }
                                if (drawnY >= context.TileRange.Height)
                                {
                                    break;
                                }

                                drawn[drawnX, drawnY] = true;
                            }
                        }
                    }
                }
            }
        }