Exemplo n.º 1
0
        public static Color GetRarityColor(this ItemRarityType rarity)
        {
            switch (rarity)
            {
            case ItemRarityType.COMMON:
                return(COMMON_COLOR);

            case ItemRarityType.RARE:
                return(RARE_COLOR);

            case ItemRarityType.EPIC:
                return(EPIC_COLOR);

            case ItemRarityType.LEGENDARY:
                return(LEGENDARY_COLOR);
            }
            return(COMMON_COLOR);
        }
Exemplo n.º 2
0
        public static string GetFullItemDescription(GarageItem item, bool withParentItemName, string commonRarity = "", string rareRarity = "", string epicRarity = "", string legendaryRarity = "")
        {
            string         str    = !withParentItemName ? (Instance.GetCategoryName(item.MarketItem) + " " + item.Name) : GetDetailedName(item.MarketItem);
            string         str2   = string.Empty;
            ItemRarityType rarity = item.Rarity;

            switch (item.Rarity)
            {
            case ItemRarityType.COMMON:
                str2 = str2 + commonRarity;
                break;

            case ItemRarityType.RARE:
                str2 = str2 + rareRarity;
                break;

            case ItemRarityType.EPIC:
                str2 = str2 + epicRarity;
                break;

            case ItemRarityType.LEGENDARY:
                str2 = str2 + legendaryRarity;
                break;

            default:
                break;
            }
            if (!string.IsNullOrEmpty(str2))
            {
                string   str3       = str;
                string[] textArray1 = new string[] { str3, "\n<color=#", rarity.GetRarityColor().ToHexString(), ">", str2, "</color>" };
                str = string.Concat(textArray1);
            }
            string description = item.Description;

            if (!string.IsNullOrEmpty(description))
            {
                str = str + "\n" + description;
            }
            return(str);
        }
Exemplo n.º 3
0
        public static string GetFullItemDescription(Entity marketItem, string commonRarity = "", string rareRarity = "", string epicRarity = "", string legendaryRarity = "")
        {
            string         detailedName = GetDetailedName(marketItem);
            string         str2         = string.Empty;
            ItemRarityType rarityType   = marketItem.GetComponent <ItemRarityComponent>().RarityType;

            switch (rarityType)
            {
            case ItemRarityType.COMMON:
                str2 = str2 + commonRarity;
                break;

            case ItemRarityType.RARE:
                str2 = str2 + rareRarity;
                break;

            case ItemRarityType.EPIC:
                str2 = str2 + epicRarity;
                break;

            case ItemRarityType.LEGENDARY:
                str2 = str2 + legendaryRarity;
                break;

            default:
                break;
            }
            if (!string.IsNullOrEmpty(str2))
            {
                string   str3       = detailedName;
                string[] textArray1 = new string[] { str3, "\n<color=#", rarityType.GetRarityColor().ToHexString(), ">", str2, "</color>" };
                detailedName = string.Concat(textArray1);
            }
            string description = marketItem.GetComponent <DescriptionItemComponent>().Description;

            if (!string.IsNullOrEmpty(description))
            {
                detailedName = detailedName + "\n" + description;
            }
            return(detailedName);
        }
Exemplo n.º 4
0
        private void DrawEffect(GraffitiVisualEffect prefab, float length, Transform parent, string spriteUid, ItemRarityType rarity)
        {
            GetInstanceFromPoolEvent eventInstance = new GetInstanceFromPoolEvent {
                Prefab          = prefab.gameObject,
                AutoRecycleTime = length
            };

            base.ScheduleEvent(eventInstance, new EntityStub());
            Transform instance = eventInstance.Instance;

            instance.parent        = parent;
            instance.localPosition = Vector3.zero;
            instance.localRotation = Quaternion.identity;
            GraffitiVisualEffect component = instance.GetComponent <GraffitiVisualEffect>();

            component.Image.SpriteUid = spriteUid;
            component.Rarity          = rarity;
            component.gameObject.SetActive(true);
        }
 private void AddMainItem(string title, long count, string spriteUid, bool needFrame = false, ItemRarityType rarity = 0)
 {
     this.mainPreviewContainer.gameObject.SetActive(true);
     this.AddItem(title, count, this.mainPreviewContainer, spriteUid, needFrame, rarity).transform.SetAsFirstSibling();
 }
        private GameObject AddItem(string title, long count, Transform parent, string spriteUid, bool needFrame = false, ItemRarityType rarity = 0)
        {
            GameObject obj2 = Instantiate <GameObject>(this.elementPrefab.gameObject);

            obj2.transform.SetParent(parent, false);
            StarterPackElementComponent component = obj2.GetComponent <StarterPackElementComponent>();

            component.title.text = title;
            component.previewSkin.gameObject.GetComponent <Image>().preserveAspect = true;
            component.previewSkin.SpriteUid = spriteUid;
            if (count <= 0L)
            {
                component.count.gameObject.SetActive(false);
            }
            else
            {
                component.count.gameObject.SetActive(true);
                component.count.text = "x" + count;
            }
            if (!needFrame)
            {
                component.RarityMask.enabled = false;
                component.RarityFrame.gameObject.SetActive(false);
                component.RarityMask.transform.localScale  = new Vector3(1f, 1f, 1f);
                component.RarityFrame.transform.localScale = new Vector3(1f, 1f, 1f);
            }
            else
            {
                component.RarityMask.enabled = true;
                component.RarityFrame.gameObject.SetActive(true);
                component.RarityFrame.SelectedSpriteIndex  = (int)rarity;
                component.RarityMask.transform.localScale  = new Vector3(0.7f, 0.7f, 0.7f);
                component.RarityFrame.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
            }
            return(obj2);
        }