public void SetType(BattleMonsterButton.Type type)
        {
            this.selectFrame.gameObject.SetActive(type == BattleMonsterButton.Type.Select);
            int num = (type != BattleMonsterButton.Type.Dead) ? 0 : 1;

            this.baseFrame.atlas  = this.uiAtlases[num];
            this.bgFrame.atlas    = this.uiAtlases[num];
            this.flashFrame.atlas = this.uiAtlases[num];
            if (this.charaTexture.material == null)
            {
                this.charaTexture.shader = this.materials[num].shader;
            }
            else if ((type == BattleMonsterButton.Type.Dead && this.iconType != BattleMonsterButton.Type.Dead) || (type != BattleMonsterButton.Type.Dead && this.iconType == BattleMonsterButton.Type.Dead))
            {
                this.iconType = type;
                Texture texture  = this.charaTexture.material.GetTexture("_MaskTex");
                Texture texture2 = this.charaTexture.material.GetTexture("_MainTex");
                if (type == BattleMonsterButton.Type.Dead)
                {
                    Shader iconShaderGray = GUIMonsterIcon.GetIconShaderGray();
                    this.charaTexture.material = new Material(iconShaderGray);
                    this.charaTexture.material.SetTexture("_MaskTex", texture);
                    this.charaTexture.material.SetTexture("_MainTex", texture2);
                }
                else
                {
                    Shader iconShader = GUIMonsterIcon.GetIconShader();
                    this.charaTexture.material = new Material(iconShader);
                    this.charaTexture.material.SetTexture("_MaskTex", texture);
                    this.charaTexture.material.SetTexture("_MainTex", texture2);
                }
            }
        }
Esempio n. 2
0
    public void SetMonsterIcon(PicturebookItem.TextureData textureData, string growStep, bool isUnknown)
    {
        if (null == this.txCHAR.material)
        {
            Shader iconShader = GUIMonsterIcon.GetIconShader();
            this.txCHAR.material = new Material(iconShader);
        }
        if (!textureData._isMainTexture)
        {
            this.txCHAR.material.SetTexture("_MaskTex", textureData._monsterAlphaTexture);
            this.txCHAR.material.SetTexture("_MainTex", textureData._monsterTexture);
        }
        else
        {
            NGUIUtil.ChangeUITexture(this.txCHAR, textureData._monsterTexture, false);
            this.txCHAR.material.SetTexture("_MaskTex", Texture2D.whiteTexture);
        }
        int growStep2 = int.Parse(growStep);

        PicturebookMonsterIcon.SetThumbnailFrame(this.spBASE, this.spFRAME, growStep2);
        this.ngTX_IS_UNKOWN.gameObject.SetActive(isUnknown);
        MonsterIconGrayout.SetGrayout(base.gameObject, (!isUnknown) ? GUIMonsterIcon.DIMM_LEVEL.ACTIVE : GUIMonsterIcon.DIMM_LEVEL.DISABLE);
    }
Esempio n. 3
0
    public static void SetTextureMonsterParts(UITexture iconTexture, string resourcePath, string assetBundlePath, bool isLoadASync)
    {
        bool      flag             = false;
        Texture2D texture2D        = Resources.Load(resourcePath) as Texture2D;
        Texture2D texture2D2       = Resources.Load(resourcePath + "_alpha") as Texture2D;
        string    assetBundlePathA = assetBundlePath + "_alpha";

        if (null != texture2D && null != texture2D2 && !flag)
        {
            if (null == iconTexture.material)
            {
                Shader iconShader = GUIMonsterIcon.GetIconShader();
                iconTexture.material = new Material(iconShader);
            }
            iconTexture.material.SetTexture("_MaskTex", texture2D2);
            iconTexture.material.SetTexture("_MainTex", texture2D);
            iconTexture.mainTexture = null;
        }
        else if (isLoadASync)
        {
            NGUIUtil.ChangeUITexture(iconTexture, null, false);
            MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePath, delegate(UnityEngine.Object obj)
            {
                Texture2D tex = obj as Texture2D;
                if (null == iconTexture.material)
                {
                    Shader iconShader3   = GUIMonsterIcon.GetIconShader();
                    iconTexture.material = new Material(iconShader3);
                }
                NGUIUtil.ChangeUITexture(iconTexture, tex, false);
                if (null != iconTexture.material)
                {
                    Texture2D texture2D5 = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePathA, null) as Texture2D;
                    if (texture2D5 != null)
                    {
                        iconTexture.material.SetTexture("_MaskTex", texture2D5);
                    }
                    else
                    {
                        iconTexture.material.SetTexture("_MaskTex", Texture2D.whiteTexture);
                    }
                }
            });
        }
        else
        {
            Texture2D texture2D3 = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePath, null) as Texture2D;
            if (null != texture2D3)
            {
                NGUIUtil.ChangeUITexture(iconTexture, texture2D3, false);
                if (null == iconTexture.material)
                {
                    Shader iconShader2 = GUIMonsterIcon.GetIconShader();
                    iconTexture.material = new Material(iconShader2);
                }
                if (null != iconTexture.material)
                {
                    Texture2D texture2D4 = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePathA, null) as Texture2D;
                    if (texture2D4 != null)
                    {
                        iconTexture.material.SetTexture("_MaskTex", texture2D4);
                    }
                    else
                    {
                        iconTexture.material.SetTexture("_MaskTex", Texture2D.whiteTexture);
                    }
                }
            }
        }
    }