public virtual void OnPreviewGUI(DicingTextureData data, Rect r) { Texture2D texture = this.GetTexture(data.AtlasName); if (texture == null) { return; } float scale = Mathf.Min(r.width / data.Width, r.height / data.Height); float x0 = r.x + r.width / 2 - scale * data.Width / 2; float y0 = r.y + Mathf.Max(r.height / 2 + scale * data.Height / 2, scale * data.Height); data.ForeachVertexList(new Rect(0, 0, 1, 1), true, this, (r1, uv) => { r1.xMin *= scale; r1.xMax *= scale; r1.x += x0; //RectはGUI系だとYが上下逆なのでその処理を r1.yMin *= -scale; r1.yMax *= -scale; r1.y += y0; float tmp = uv.yMin; uv.yMin = uv.yMax; uv.yMax = tmp; GUI.DrawTextureWithTexCoords(r1, texture, uv); }); }
//インポートデータを作成 internal List <DicingTextureData> MakeImportData() { List <DicingTextureData> list = new List <DicingTextureData>(); foreach (TextureInfo texture in textures) { DicingTextureData data = new DicingTextureData(); data.InitOnImport(texture.Name, this.Name, texture.Width, texture.Height, texture.cellIndexLists, this.cells.FindIndex(x => x.IsAllTransparnet)); list.Add(data); } return(list); }
//今の表示状態と比較して、クロスフェード可能か bool EnableCrossFade(AdvGraphicInfo graphic) { DicingTextures dicingTexture = graphic.File.UnityObject as DicingTextures; string pattern = graphic.SubFileName; DicingTextureData data = Dicing.DicingData.GetTextureData(pattern); if (data == null) { return(false); } return(Dicing.DicingData == dicingTexture && Dicing.rectTransform.pivot == graphic.Pivot && Dicing.PatternData.Width == data.Width && Dicing.PatternData.Height == data.Height); }
//パターンチェンジ(通常で言うテクスチャ差し替え) void OnChangePattern() { if (DicingData == null || string.IsNullOrEmpty(pattern)) { m_Texture = s_WhiteTexture; return; } this.patternData = DicingData.GetTextureData(Pattern); if (patternData == null) { Debug.LogError(Pattern + " is not find in " + DicingData.name); return; } this.m_Texture = DicingData.GetTexture(patternData.AtlasName); }
public override void OnPreviewGUI(Rect r, GUIStyle background) { DicingImage obj = this.target as DicingImage; if (obj == null) { return; } if (obj.DicingData == null) { return; } DicingTextureData patternData = obj.PatternData; if (patternData == null) { return; } OnPreviewGUISub(r, patternData); }
void OnPreviewGUISub(Rect r, DicingTextureData patternData) { DicingImage obj = this.target as DicingImage; obj.DicingData.OnPreviewGUI(patternData, r); }
internal List <DicingTextureData.QuadVerts> GetVerts(DicingTextureData patternData) { return(DicingData.GetVerts(patternData)); }
internal void CrossFade(DicingTextureData fadePatternData, Texture fadeTexture, float time, Action onComplete) { this.fadePatternData = fadePatternData; Target.SetAllDirty(); base.CrossFade(fadeTexture, time, onComplete); }
//頂点 public List <DicingTextureData.QuadVerts> GetVerts(DicingTextureData data) { return(data.GetVerts(this)); }