void AddImage() { if(CTS_Data == null) return; CTS_Image newImage = new CTS_Image(); newImage.styleName = "Image Style " + Random.Range(0,1000).ToString(); imageList.Add(newImage); }
public void UpdateImageFormat() { // thisImageStyle = null; for(int i = 0; i < useThisImageList.Count; i++) { if(useThisImageList[i] && imageList.Count >= i + 1) { thisImageStyle = imageList[i]; useImageIndex = i; } } if(thisImageStyle == null) return; image.color = thisImageStyle.color; image.material = thisImageStyle.material; image.sprite = thisImageStyle.sprite; image.raycastTarget = thisImageStyle.raycastTarget; image.type = thisImageStyle.imageType; if(thisImageStyle.imageType == UnityEngine.UI.Image.Type.Filled) { image.fillMethod = thisImageStyle.fillMethod; switch(thisImageStyle.fillMethod) { case UnityEngine.UI.Image.FillMethod.Horizontal: image.fillOrigin = (int) thisImageStyle.originHorz; break; case UnityEngine.UI.Image.FillMethod.Vertical: image.fillOrigin = (int) thisImageStyle.originVert; break; case UnityEngine.UI.Image.FillMethod.Radial90: image.fillOrigin = (int) thisImageStyle.origin90; break; case UnityEngine.UI.Image.FillMethod.Radial180: image.fillOrigin = (int) thisImageStyle.origin180; break; case UnityEngine.UI.Image.FillMethod.Radial360: image.fillOrigin = (int) thisImageStyle.origin360; break; } image.fillClockwise = thisImageStyle.clockwise; image.fillAmount = thisImageStyle.fillAmount; } else image.fillCenter = thisImageStyle.fillCenter; image.preserveAspect = thisImageStyle.preserveAspect; }