public bool SvgAssetAdd(TextAsset newSvg, int index) { bool ok; bool alreadyExist = false; index = SVGUtils.Clamp(index, 0, this.m_SvgList.Count); foreach (SVGAssetInput svgAsset in this.m_SvgList) { if (svgAsset.TxtAsset == newSvg) { alreadyExist = true; break; } } ok = this.SvgAssetAdd(newSvg, index, alreadyExist); if (ok) { // start with a basic identity scale offset this.m_SvgList.Insert(index, new SVGAssetInput(newSvg, 1.0f, false)); // recalculate atlas hash this.UpdateAtlasHash(); } return(ok); }
protected bool SvgAssetMove(SVGAssetInput svgAsset, int fromIndex, int toIndex) { if (fromIndex >= 0) { // clamp the destination index toIndex = SVGUtils.Clamp(toIndex, 0, this.m_SvgList.Count); // check if movement has sense if (fromIndex != toIndex) { // perform the real movement this.m_SvgList.Insert(toIndex, this.m_SvgList[fromIndex]); if (toIndex <= fromIndex) { ++fromIndex; } this.m_SvgList.RemoveAt(fromIndex); return(true); } } return(false); }