Example #1
0
        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);
            });
        }
Example #2
0
            //インポートデータを作成
            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);
            }
Example #3
0
        //今の表示状態と比較して、クロスフェード可能か
        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);
        }
Example #4
0
        //パターンチェンジ(通常で言うテクスチャ差し替え)
        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);
        }
Example #5
0
            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);
            }
Example #6
0
            void OnPreviewGUISub(Rect r, DicingTextureData patternData)
            {
                DicingImage obj = this.target as DicingImage;

                obj.DicingData.OnPreviewGUI(patternData, r);
            }
Example #7
0
 internal List <DicingTextureData.QuadVerts> GetVerts(DicingTextureData patternData)
 {
     return(DicingData.GetVerts(patternData));
 }
Example #8
0
 internal void CrossFade(DicingTextureData fadePatternData, Texture fadeTexture, float time, Action onComplete)
 {
     this.fadePatternData = fadePatternData;
     Target.SetAllDirty();
     base.CrossFade(fadeTexture, time, onComplete);
 }
Example #9
0
 //頂点
 public List <DicingTextureData.QuadVerts> GetVerts(DicingTextureData data)
 {
     return(data.GetVerts(this));
 }