【酷熊科技】工作积累 ----------- Unity3D 读取 图片

 

      UISprite2D spMoney;

 

                // 钻石建造卷图标
                string path = ResourcePath.Icon.money + "/" + "";                   // 读取本地路径
                spMoney.sprite2D = NGUITools.LoadAsset<Sprite>(path);        // 将读取的路径转化成sprite格式

 

  

        // 金币建造卷图标
                Texture2D textureGoldBuild = Resources.Load("Icon/money/") as Texture2D;   // 将读取的本地的路径转化成Texture2D类型
                Sprite spriteGoldBuild = Sprite.Create(

                           textureGoldBuild,

                           new Rect(0, 0, textureGoldBuild.width, textureGoldBuild.height),

                           new Vector2(0.5f, 0.5f)

                         );

      spMoney.sprite2D = spriteGoldBuild;

 

 

 

 

case 1: //金币

      ResourcePath.Icon.money = "Icon/money";


                path = ResourcePath.Icon.money + "/" + "gold";
                mustGetRewardIcon.sprite2D = NGUITools.LoadAsset<Sprite>(path);

      

 

posted @ 2016-09-18 18:04  silent-bobo  阅读(216)  评论(0编辑  收藏  举报