CollectionItemData AddCollectionItem(string id, string type, string name, string pattern, int formality, int sportyness, double anchorX, double anchorY) { CollectionItemData collectionItemData = new CollectionItemData(); collectionItemData.Id = id; collectionItemData.Type = type; collectionItemData.Name = name; collectionItemData.Pattern = pattern; collectionItemData.Formality = formality; collectionItemData.Sportyness = sportyness; CollectionItemAnchorData anchor = new CollectionItemAnchorData(); anchor.X = anchorX; anchor.Y = anchorY; collectionItemData.Anchor = anchor; return(collectionItemData); }
public IEnumerator LoadClothSprite(CollectionItemData cloth, CarouselItemBlock block) { string filePath = Application.streamingAssetsPath + currentCollection.Path + cloth.Id + ".png"; // Load a PNG or JPG image from disk to a Texture2D, assign this texture to a new sprite and return its reference Sprite newSprite = new Sprite(); float PixelsPerUnit = 100.0f; Texture2D spriteTexture = new Texture2D(2, 2); byte[] fileData = null; Debug.Log("UNITY: (Start LoadClothSprite) "); yield return(StartCoroutine(LoadTexture(filePath, result => spriteTexture = result))); newSprite = Sprite.Create(spriteTexture, new Rect(0, 0, spriteTexture.width, spriteTexture.height), new Vector2(0, 0), PixelsPerUnit); newSprite.name = "Loaded sprite"; block.SetSprite(newSprite); Debug.Log("UNITY: (End LoadClothSprite) "); }
internal IFacadeUpdateResult <CollectionData> SaveCollectionItem(object parentId, CollectionItemData childDto) { ArgumentValidator.IsNotNull("parentId", parentId); ArgumentValidator.IsNotNull("childDto", childDto); FacadeUpdateResult <CollectionData> result = new FacadeUpdateResult <CollectionData>(); ICollectionService service = UnitOfWork.GetService <ICollectionService>(); Collection instance = RetrieveOrNew <CollectionData, Collection, ICollectionService>(result.ValidationResult, childDto.Id); if (result.IsSuccessful) { CollectionItem collectionItem = RetrieveOrNewCollectionItem(instance, childDto.Id); if (collectionItem != null) { collectionItem.ReferenceId = childDto.ReferenceId; collectionItem.Sort = childDto.Sort; var saveQuery = service.Save(instance); result.AttachResult(instance.RetrieveData <CollectionData>()); result.Merge(saveQuery); } else { AddError(result.ValidationResult, "CollectionItemCannotBeFound"); } } return(result); }