コード例 #1
0
        public static void ColorTo(this HGraphics grap, Color col, float time, float delay = 0, Action <ColorAnimat> over = null, bool cover = true)
        {
            if (grap == null)
            {
                return;
            }
            grap.gameObject.SetActive(true);
            var ani = AnimationManage.Manage.FindAni <ColorAnimat>((o) => { return(o.Target == grap ? true : false); });

            if (ani == null)
            {
                ani = new ColorAnimat(grap);
            }
            else if (!cover)
            {
                return;
            }
            ani.StartColor = grap.MainColor;
            ani.EndColor   = col;
            ani.Time       = time;
            ani.Delay      = delay;
            if (over == null)
            {
                ani.PlayOver = (o) => { o.Dispose(); }
            }
            ;
            else
            {
                ani.PlayOver = over;
            }
            ani.Play();
        }
コード例 #2
0
 public static ColorAnimat FindColorAni(this HGraphics grap)
 {
     if (grap == null)
     {
         return(null);
     }
     grap.gameObject.SetActive(true);
     return(AnimationManage.Manage.FindAni <ColorAnimat>((o) => { return o.Target == grap ? true : false; }));
 }
コード例 #3
0
ファイル: AnimationExtand.cs プロジェクト: huqiang0204/HGUI
 /// <summary>
 /// 查询一个颜色过度动画
 /// </summary>
 /// <param name="grap">实例目标</param>
 /// <returns></returns>
 public static ColorAnimat FindColorAni(this HGraphics grap)
 {
     if (grap == null)
     {
         return(null);
     }
     grap.activeSelf = true;
     return(AnimationManage.Manage.FindAni <ColorAnimat>((o) => { return o.Target == grap ? true : false; }));
 }
コード例 #4
0
ファイル: HGraphicsLoader.cs プロジェクト: huqiang0204/HGUI
        protected unsafe void SaveHGraphics(HGraphics src, FakeStruct fake)
        {
            HGraphicsData *tar    = (HGraphicsData *)fake.ip;
            var            buffer = fake.buffer;
            var            tex    = src.MainTexture;

            if (tex != null)
            {
                var an = ElementAsset.TxtureFormAsset(tex.name);
                if (an != null)
                {
                    tar->asset = buffer.AddData(an);
                }
                tar->MainTexture = buffer.AddData(tex.name);
            }
            tex = src.STexture;
            if (tex != null)
            {
                var an = ElementAsset.TxtureFormAsset(tex.name);
                if (an != null)
                {
                    tar->asset = buffer.AddData(an);
                }
                tar->STexture = buffer.AddData(tex.name);
            }
            tex = src.TTexture;
            if (tex != null)
            {
                var an = ElementAsset.TxtureFormAsset(tex.name);
                if (an != null)
                {
                    tar->asset = buffer.AddData(an);
                }
                tar->TTexture = buffer.AddData(tex.name);
            }
            tex = src.FTexture;
            if (tex != null)
            {
                var an = ElementAsset.TxtureFormAsset(tex.name);
                if (an != null)
                {
                    tar->asset = buffer.AddData(an);
                }
                tar->FTexture = buffer.AddData(tex.name);
            }
            if (src.m_material != null)
            {
                tar->shader = buffer.AddData(src.m_material.shader.name);
            }
            tar->color         = src.m_color;
            tar->uvRect        = src.uvrect;
            tar->Shadow        = src.Shadow;
            tar->shadowOffsset = src.shadowOffsset;
            tar->shadowColor   = src.shadowColor;
        }
コード例 #5
0
ファイル: ColorAnimat.cs プロジェクト: pkwzsqsdly/HGUI
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="img">图形实例对象</param>
 public ColorAnimat(HGraphics img)
 {
     Target = img;
     AnimationManage.Manage.AddAnimat(this);
 }
コード例 #6
0
ファイル: HGraphicsLoader.cs プロジェクト: huqiang0204/HGUI
        protected void LoadHGraphics(HGraphics tar, FakeStruct fake)
        {
            HGraphicsData tmp = new HGraphicsData();

            unsafe
            {
                HGraphicsData *src = &tmp;
                GraphicsHelper.LoadData((byte *)src, fake.ip);
                var buffer = fake.buffer;
                asset       = buffer.GetData(src->asset) as string;
                MainTexture = buffer.GetData(src->MainTexture) as string;
                if (MainTexture != null)
                {
                    tar.MainTexture = ElementAsset.FindTexture(asset, MainTexture);
                }
                else
                {
                    tar.MainTexture = null;
                }
                STexture = buffer.GetData(src->STexture) as string;
                if (STexture != null)
                {
                    tar.STexture = ElementAsset.FindTexture(asset, STexture);
                }
                else
                {
                    tar.STexture = null;
                }
                TTexture = buffer.GetData(src->TTexture) as string;
                if (TTexture != null)
                {
                    tar.TTexture = ElementAsset.FindTexture(asset, TTexture);
                }
                else
                {
                    TTexture = null;
                }
                FTexture = buffer.GetData(src->FTexture) as string;
                if (FTexture != null)
                {
                    tar.FTexture = ElementAsset.FindTexture(asset, FTexture);
                }
                else
                {
                    FTexture = null;
                }
                shader = buffer.GetData(src->shader) as string;
                if (shader != null)
                {
                    tar.Material = new Material(Shader.Find(shader));
                }
                else
                {
                    tar.Material = null;
                }
            }
            tar.m_color       = tmp.color;
            tar.uvrect        = tmp.uvRect;
            tar.Shadow        = tmp.Shadow;
            tar.shadowOffsset = tmp.shadowOffsset;
            tar.shadowColor   = tmp.shadowColor;
            tar.tris          = null;
        }