Ejemplo n.º 1
0
    /// <summary>
    ///  获取贴图(同步)
    /// </summary>
    /// <param name="abPath"></param>
    /// <param name="assetName"></param>
    /// <returns></returns>
    public CMTexture GetTexture(string abPath, string assetName, float timeIdleStateKeep = 120, float timeRelaseStateKeep = 10)
    {
        CMTexture cmtex = null;

        if (!m_texs.TryGetValue(assetName, out cmtex))
        {
            cmtex = new CMTexture(abPath, assetName, timeIdleStateKeep, timeRelaseStateKeep);
            m_texs.Add(assetName, cmtex);
        }
        return(cmtex.GetCMResource());
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 获取贴图(异步)
    /// </summary>
    /// <param name="abPath"></param>
    /// <param name="assetName"></param>
    /// <param name="tex"></param>
    /// <param name="createDlg"></param>
    /// <param name="custParam"></param>
    /// <returns></returns>
    public bool GetTextureAsyn(string abPath, string assetName, ref CMResAsynSeedData <CMTexture> seedData, CMResEvent <CMTexture> createDlg, float timeIdleStateKeep = 120, float timeRelaseStateKeep = 10, object param1 = null, object param2 = null, object param3 = null)
    {
        CMTexture cmtex = null;

        if (!m_texs.TryGetValue(assetName, out cmtex))
        {
            cmtex = new CMTexture(abPath, assetName, timeIdleStateKeep, timeRelaseStateKeep);
            m_texs.Add(assetName, cmtex);
        }
        cmtex.GetCMResourceAsyn(ref seedData, createDlg, param1, param2, param3);
        return(true);
    }
Ejemplo n.º 3
0
    public override void Release(bool depthRelease = true)
    {
        base.Release(depthRelease);
        if (null != m__texture)
        {
            m__texture.mainTexture = null;
        }

        if (tex != null)
        {
            tex.ReleaseReference();
            tex = null;
        }
    }
Ejemplo n.º 4
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        m_sliderPro.value = 0.0f;
        mapSystem         = ClientGlobal.Instance().GetMapSystem();
        if (mapSystem != null)
        {
            Progress = 0f;
            update   = true;
        }

        if (m_lstTips.Count <= 0)
        {
            List <table.LoadingTipsDatabase> lstTips = GameTableManager.Instance.GetTableList <table.LoadingTipsDatabase>();
            for (int i = 0; i < lstTips.Count; i++)
            {
                if (!string.IsNullOrEmpty(lstTips[i].strText))
                {
                    m_lstTips.Add(lstTips[i].strText);
                }
            }

            m_lstTexture.Add((uint)TextureID.Loadingbg);
            m_lstTexture.Add((uint)TextureID.Loadingbg2);
        }

        int tipRandom = UnityEngine.Random.Range(0, m_lstTips.Count);
        int texRandom = UnityEngine.Random.Range(0, m_lstTexture.Count);

        m_tipsLabel.text = m_lstTips[tipRandom];
        if (null != m__texture)
        {
            if (null != tex)
            {
                tex.ReleaseReference();
                tex = null;
            }
            tex = UIManager.GetTexture(m_lstTexture[texRandom]);
            if (tex != null)
            {
                m__texture.mainTexture = tex.GetTexture();
                m__texture.Update();
                m__texture.SetDirty();
                m__texture.MarkAsChanged();
            }
        }
    }