private void onObjectAdded(RectTransform item, int index) { CustomizationButton component = item.GetComponent <CustomizationButton>(); DecalDefinition decalDefinition = displayedDecals[index]; component.gameObject.name = decalDefinition.AssetName + "_button"; RectTransform rectTransform = component.transform as RectTransform; rectTransform.anchoredPosition = Vector2.zero; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.sizeDelta = Vector2.zero; rectTransform.localScale = Vector3.one; bool canDrag = isLocalPlayerMember; if (!isLocalPlayerMember) { canDrag = !decalDefinition.IsMemberOnly; } if (Service.Get <CatalogServiceProxy>().IsCatalogThemeActive()) { canDrag = true; } Texture2DContentKey decalPath = EquipmentPathUtil.GetDecalPath(decalDefinition.AssetName); component.Init(decalPath, BreadcrumbType, decalDefinition.Id, canDrag); AccessibilitySettings component2 = component.GetComponent <AccessibilitySettings>(); if (component2 != null) { component2.CustomToken = decalDefinition.AssetName; } }
private IEnumerator renderDecal(int decalID) { Dictionary <int, DecalDefinition> decals = Service.Get <GameData>().Get <Dictionary <int, DecalDefinition> >(); Texture2DContentKey iconContentKey = RewardPopupConstants.DefaultIconContentKey; if (decals.TryGetValue(decalID, out var decalDefinition)) { iconContentKey = EquipmentPathUtil.GetDecalPath(decalDefinition.AssetName); } AssetRequest <Texture2D> assetRequest = Content.LoadAsync(iconContentKey); yield return(assetRequest); callback(Sprite.Create(assetRequest.Asset, new Rect(0f, 0f, assetRequest.Asset.width, assetRequest.Asset.height), Vector2.zero), null); }