Exemplo n.º 1
0
        public void SetData(DRMonster d)
        {
            this.data = d;
            this.used = true;
            leftTime  = 0;
            monBase.SetActive(true);

            monBase.transform.localEulerAngles = new Vector3(0, 0, -90);
            w        = -0.4f;
            moveFlag = false;
            //Debug.Log("显示");
            go.transform.Find("Text").gameObject.GetComponent <Text>().text = data.BName;
            string imgUrl = AssetUtility.GetUIImageAssets(data.asset);

            GameEntry.Resource.LoadAsset(imgUrl, new LoadAssetCallbacks((assetName, asset, duration, userData) =>
            {
                //Log.Info("Load font '{0}' OK.{1}", imgUrl,asset);
                //Image img = go.GetComponent<Image>();
                //创建Sprite
                Texture2D texture = (Texture2D)asset;
                Sprite sprite     = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                img.sprite        = sprite;
            },

                                                                        (assetName, status, errorMessage, userData) =>
            {
                Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", data.asset, assetName, errorMessage);
            }));
        }
Exemplo n.º 2
0
        public static void LoadAndSetImage(string assetN, Image img)
        {
            string imgUrl = AssetUtility.GetUIImageAssets(assetN);

            GameEntry.Resource.LoadAsset(imgUrl, new LoadAssetCallbacks((assetName, asset, duration, userData) =>
            {
                //Log.Info("Load font '{0}' OK.{1}", imgUrl,asset);
                //创建Sprite
                Texture2D texture = (Texture2D)asset;
                Sprite sprite     = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                img.sprite        = sprite;
            },

                                                                        (assetName, status, errorMessage, userData) =>
            {
                Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", assetN, assetName, errorMessage);
            }));
        }
Exemplo n.º 3
0
        private void showCompose(DRMonster data, DRMonster fir, DRMonster sec)
        {
            string asset = "wrong";
            string BName = "失败";

            if (data != null)
            {
                asset = data.asset;
                BName = data.BName;
            }

            string imgUrl = AssetUtility.GetUIImageAssets(asset);

            GameEntry.Resource.LoadAsset(imgUrl, new LoadAssetCallbacks((assetName, assete, duration, userData) =>
            {
                //Log.Info("Load font '{0}' OK.{1}", imgUrl,asset);
                Image img = finGO.GetComponent <Image>();
                //创建Sprite
                Texture2D texture = (Texture2D)assete;
                Sprite sprite     = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
                img.sprite        = sprite;

                finGO.transform.Find("Text").gameObject.GetComponent <Text>().text = BName;

                finGO.SetActive(true);
                Invoke("hideFinGo", 1.2f);


                clearShow();
            },

                                                                        (assetName, status, errorMessage, userData) =>
            {
                Log.Error("Can not load font '{0}' from '{1}' with error message '{2}'.", asset, assetName, errorMessage);
            }));
        }