private void CreateTextureEvent(ITexture obj, object param = null) { if (m_texture != null && m_maskTextrue != null && null != mapMat && null != quadTrans) { mapMat.mainTexture = m_texture.GetTexture(); mapTex = mapMat.mainTexture; if (mapTex == null) { return; } MapData.MapTexture = mapTex; table.MapDataBase mdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_mapid); if (mdb != null) { int texWidth = (int)mdb.textureWidth; mapMat.SetTexture("_Mask", m_maskTextrue.GetTexture()); MapData.MapTextureSize = new Vector2(texWidth, texWidth);//new Vector2( MapData.MapTextureSize.x , (float) MapData.MapTextureSize.y ); Vector3 scale = new Vector3(texWidth, texWidth, 1); if (bTopView) { scale = new Vector3(1, 1, 1); } quadTrans.localScale = scale; } mapSize = Client.ClientGlobal.Instance().GetMapSystem().GetMapSize(); MapData.MapSize = mapSize; } }
private void CreateTextureEvent(ITexture obj, object param = null) { IMapSystem mapsys = Client.ClientGlobal.Instance().GetMapSystem(); if (mapsys == null) { Engine.Utility.Log.Error("Mapsystem is null"); return; } if (m_texture != null) { mapTex.mainTexture = m_texture.GetTexture(); mapTex.MakePixelPerfect(); } else { string texpath = (string)param; Log.Error("texture is null texpath is " + texpath); } m_mapid = mapsys.GetMapID(); table.MapDataBase mdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_mapid); if (mdb != null) { string pos = mdb.uioffset; string[] xy = pos.Split('_'); float x = 0, y = 0; if (xy.Length == 2) { if (float.TryParse(xy[0], out x)) { if (float.TryParse(xy[1], out y)) { originPos = new Vector3(x, y, 0); } } } } m_mapTextureWidth = mdb.textureWidth; m_mapTextureHeight = mdb.textureWidth; mapTex.width = (int)m_mapTextureWidth; mapTex.height = (int)m_mapTextureHeight; mapTex.transform.localPosition = originPos; }
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); } } }