void ReleaseTexture() { if (m_texture != null) { m_texture.Release(); m_texture = null; } }
private void InitMiniMap() { // quadTrans = m_widget_Root.transform.Find( "Quad" ); quadTrans = m_trans_minimapObj; if (quadTrans != null) { //Collider col = quadTrans.GetComponent<MeshCollider>(); //if ( col != null ) col.enabled = false; //quadTrans.gameObject.AddComponent<QuadMesh>(); } m_QuadMesh = quadTrans.GetComponent <QuadMesh>(); if (m_QuadMesh == null) { m_QuadMesh = quadTrans.gameObject.AddComponent <QuadMesh>(); } playerIcon = m_widget_Root.transform.Find("IconContainer/playericon"); MeshRenderer mr = quadTrans.GetComponent <MeshRenderer>(); mapMat = mr.material; mapMat.shader = Resources.Load("Shaders/Custom/Mask") as Shader; // UIParticleWidget pw = quadTrans.GetComponent<UIParticleWidget>(); // if(pw != null) // { // pw.SetParticleDirty(); // } //mainPlayer = ClientGlobal.Instance().MainPlayer; entityTable.Add(GetStrByIconType(IconType.playericon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.npcicon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.mastericon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.otherplayericon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.duiyouicon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.peticon), new List <long>()); entityTable.Add(GetStrByIconType(IconType.robot), new List <long>()); //if (m_slider_Zoomslider != null) //{ // //UISlider[] sliders = obj.GetComponentsInChildren<UISlider>(); // //m_slider_Zoomslider.onChange.Add(OnClick_Zoomslider); // EventDelegate.Add(m_slider_Zoomslider.onChange, OnClick_Zoomslider); //} m_pointParentTrans = m_trans_minimapObj; string maskPath = BigMapPanel.MINIMAP_TEXTURE_PATH + "minimapmask.unity3d"; if (m_maskTextrue != null) { m_maskTextrue.Release(); m_maskTextrue = null; } Engine.RareEngine.Instance().GetRenderSystem().CreateTexture(ref maskPath, ref m_maskTextrue, CreateTextureEvent, null, Engine.TaskPriority.TaskPriority_Immediate); RegisterMiniMapEvents(true); }
protected override void OnDisable() { base.OnDisable(); if (m_texture != null) { m_texture.Release(); m_texture = null; } }
void InitCard() { if (m_db != null) { if (m_texture != null) { m_texture.Release(); m_texture = null; } string bgPath = "ui/texture/pack/fuben/" + m_db.strIcon + ".unity3d"; bool success = Engine.RareEngine.Instance().GetRenderSystem().CreateTexture(ref bgPath, ref m_texture, CreateTextureEvent, null, Engine.TaskPriority.TaskPriority_Immediate); if (success) { m__bgtexture.mainTexture = m_texture.GetTexture(); } m_trans_WardItem.gameObject.SetActive(false); m_trans_lingpai.gameObject.SetActive(true); m_label_FB_name.text = m_db.copyName; string str = m_db.openLv + CommonData.GetLocalString("级解锁"); m_label_lock_level.text = StringUtil.GetColorString((int)m_db.openLv, MainPlayerHelper.GetPlayerLevel(), ColorType.Red, ColorType.Green, str); if (m_db.copyType == (uint)CopyTypeTable.Camp)//阵营战 { m_btn_btn_Two.gameObject.SetActive(true); m_btn_btn_Two.GetComponentInChildren <UILabel>().text = CommonData.GetLocalString("兑换"); m_btn_btn_enter.GetComponentInChildren <UILabel>().text = CommonData.GetLocalString("报名"); } else if (m_db.copyFlag == (uint)CopyFlag.DaTi) { m_btn_btn_Two.gameObject.SetActive(false); m_btn_btn_enter.GetComponentInChildren <UILabel>().text = CommonData.GetLocalString("进入"); } else if (m_db.copyFlag != (uint)CopyFlag.Huodong && m_db.membType != 0) { m_btn_btn_Two.gameObject.SetActive(true); m_btn_btn_Two.GetComponentInChildren <UILabel>().text = CommonData.GetLocalString("前往组队"); } else { m_btn_btn_Two.gameObject.SetActive(false); m_btn_btn_enter.GetComponentInChildren <UILabel>().text = CommonData.GetLocalString("进入"); } string useStr = GetEnterItem(); bool enterCostVisble = false; if (string.IsNullOrEmpty(useStr)) { m_label_enteritemname.text = ""; m_label_enterneedcount.text = ""; m_sprite_itembg.transform.DestroyChildren(); } else { List <uint> idlist = StringUtil.GetSplitStringList <uint>(useStr, '_'); if (idlist.Count == 2) { ItemDataBase db = GameTableManager.Instance.GetTableItem <ItemDataBase>(idlist[0]); if (db != null) { m_label_enteritemname.text = db.itemName; int count = DataManager.Manager <ItemManager>().GetItemNumByBaseId(idlist[0]); m_label_enterneedcount.text = StringUtil.GetNumNeedString(count, idlist[1]); m_needItmeID = idlist[0]; UIItem.AttachParent(m_sprite_itembg.transform, m_needItmeID, (uint)count, ShowGetWayCallBack, true, (uint)idlist[1]); // DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_itembg, db.quality, false); UIManager.GetQualityAtlasAsyn(db.quality, ref m_curQualityAsynSeed, () => { if (null != m_sprite_itembg) { m_sprite_itembg.atlas = null; } }, m_sprite_itembg); enterCostVisble = true; } } else { m_sprite_itembg.spriteName = ""; } } if (null != m_trans_enterinfo && m_trans_enterinfo.gameObject.activeSelf != enterCostVisble) { m_trans_enterinfo.gameObject.SetActive(enterCostVisble); } } }