Beispiel #1
0
        public override bool RunScriptCommand()
        {
            UnityEngine.Object original   = Resources.Load("UIBackground/Background6");
            GameObject         gameObject = UnityEngine.Object.Instantiate(original) as GameObject;

            if (ClassSingleton <AdventureSceneData> .Instance.commonBackground == null)
            {
                UIRoot     uiroot = UnityEngine.Object.FindObjectOfType <UIRoot>();
                TutorialUI componentInChildren = uiroot.GetComponentInChildren <TutorialUI>();
                componentInChildren.CommonBackground = gameObject;
                gameObject.transform.SetParent(componentInChildren.transform);
                gameObject.transform.localScale = Vector3.one;
            }
            ClassSingleton <AdventureSceneData> .Instance.commonBackground = gameObject;
            gameObject.name = "ShowBackgroundCommandObj";
            UITexture componentInChildren2 = gameObject.GetComponentInChildren <UITexture>();

            componentInChildren2.depth = this.depth;
            Texture2D mainTexture;

            if (this.switchKey == "res")
            {
                mainTexture = (Resources.Load(this.path) as Texture2D);
            }
            else
            {
                mainTexture = (MonsterIconCacheBuffer.Instance().LoadAndCacheObj(this.path, null) as Texture2D);
            }
            componentInChildren2.mainTexture = mainTexture;
            base.ResumeScriptEngine();
            return(true);
        }
Beispiel #2
0
    public static void SetTextureMonsterParts(ref PicturebookItem.TextureData textureData, string resourcePath, string assetBundlePath)
    {
        Texture2D texture2D  = Resources.Load(resourcePath) as Texture2D;
        Texture2D texture2D2 = Resources.Load(resourcePath + "_alpha") as Texture2D;
        string    path       = assetBundlePath + "_alpha";

        if (texture2D == null && texture2D2 == null)
        {
            Texture2D texture2D3          = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(assetBundlePath, null) as Texture2D;
            Texture2D monsterAlphaTexture = MonsterIconCacheBuffer.Instance().LoadAndCacheObj(path, null) as Texture2D;
            if (null != texture2D3)
            {
                textureData._monsterTexture = texture2D3;
                textureData._isMainTexture  = true;
            }
            if (null != texture2D3)
            {
                textureData._monsterAlphaTexture = monsterAlphaTexture;
            }
        }
        else
        {
            textureData._monsterTexture      = texture2D;
            textureData._monsterAlphaTexture = texture2D2;
            textureData._isMainTexture       = false;
        }
    }
Beispiel #3
0
 public static MonsterIconCacheBuffer Instance()
 {
     if (MonsterIconCacheBuffer.instance == null)
     {
         MonsterIconCacheBuffer.instance = new MonsterIconCacheBuffer(80);
     }
     return(MonsterIconCacheBuffer.instance);
 }
Beispiel #4
0
    public static void ReloadMaster()
    {
        DirectoryInfo directoryInfo = new DirectoryInfo(Application.persistentDataPath);

        foreach (FileInfo fileInfo in directoryInfo.GetFiles())
        {
            string name = fileInfo.Name;
            if (name.StartsWith("MA_"))
            {
                File.Delete(Application.persistentDataPath + "/" + name);
            }
        }
        MasterDataMng.Instance().ClearCache();
        MissionBannerCacheBuffer.ClearCacheBuffer();
        MonsterIconCacheBuffer.ClearCacheBuffer();
        PresentBoxItemIconCacheBuffer.ClearCacheBuffer();
        TitleIconCacheBuffer.ClearCacheBuffer();
        StringMaster.Reload();
        AlertMaster.Reload();
    }
Beispiel #5
0
 public static void ClearCacheBuffer()
 {
     MonsterIconCacheBuffer.instance = null;
 }
Beispiel #6
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);
                    }
                }
            }
        }
    }