private void CreateTicketIcon(GameWebAPI.RespDataMA_DungeonTicketMaster.DungeonTicketM ticketMaster, UITexture ticketTexture) { Texture2D tex = NGUIUtil.LoadTexture(ticketMaster.img); if (null != tex) { NGUIUtil.ChangeUITexture(ticketTexture, tex, false); } GUICollider component = ticketTexture.gameObject.GetComponent <GUICollider>(); if (null != component) { component.onTouchEnded += delegate(Touch touch, Vector2 pos, bool flag) { if (flag) { CMD_ticketPOP cmd_ticketPOP = GUIMain.ShowCommonDialog(delegate(int selectButton) { if (selectButton == 0 && null != PartsMenu.instance) { PartsMenu.instance.OnClickedQuestType(1); } }, "CMD_ticketPOP", null) as CMD_ticketPOP; cmd_ticketPOP.Title = ticketMaster.name; cmd_ticketPOP.Info = ticketMaster.description; cmd_ticketPOP.BtnTextYes = StringMaster.GetString("QuestNormal"); cmd_ticketPOP.BtnTextNo = StringMaster.GetString("SystemButtonClose"); if (null != tex) { NGUIUtil.ChangeUITexture(cmd_ticketPOP.txIcon, tex, false); } } }; } }
public static void ChangeUI2DSpriteFromFile(UI2DSprite uiSpr, string texname) { Texture2D texture2D = NGUIUtil.LoadTexture(texname); Rect rect = new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height); Vector2 pivot = new Vector2(0f, 0f); uiSpr.sprite2D = Sprite.Create(texture2D, rect, pivot, 1f); uiSpr.MakePixelPerfect(); }
public static void ChangeUITextureFromFile(UITexture uiTex, string texname, bool resize = true) { Texture2D mainTexture = NGUIUtil.LoadTexture(texname); uiTex.mainTexture = mainTexture; if (resize) { uiTex.MakePixelPerfect(); } }
private void LoadNaviThumb() { this.thumbnails = new Dictionary <string, Texture2D>(); foreach (CMD_Tips.TipsM.Tips tips in this.displayCommentDataList) { string text = tips.img + tips.icon; if (!this.thumbnails.ContainsKey(text)) { Texture2D value = NGUIUtil.LoadTexture("Navi/" + text); this.thumbnails.Add(text, value); } } }
public override void ShowGUI() { base.ShowGUI(); GameWebAPI.RespDataMA_DungeonTicketMaster.DungeonTicketM dungeonTicketM = MasterDataMng.Instance().RespDataMA_DungeonTicketMaster.dungeonTicketM.FirstOrDefault((GameWebAPI.RespDataMA_DungeonTicketMaster.DungeonTicketM x) => this.data.wdi.dungeons[0].dungeonTicketId == x.dungeonTicketId); if (dungeonTicketM != null) { Texture2D texture2D = NGUIUtil.LoadTexture(dungeonTicketM.img); if (texture2D != null) { NGUIUtil.ChangeUITexture(this.ngTICKET_THUMBNAIL, texture2D, false); } if (!string.IsNullOrEmpty(this.data.wdi.expireTime)) { this.ngTXT_TICKET_EXPIRE_TIME.text = string.Format(StringMaster.GetString("ExchangeTimeLimit"), this.data.wdi.expireTime); this.isLimit = true; } else { this.ngTXT_TICKET_EXPIRE_TIME.text = string.Format(StringMaster.GetString("ExchangeTimeLimit"), StringMaster.GetString("SystemNone")); this.isLimit = false; } this.isFree = (dungeonTicketM.freeFlg == "1"); if (this.ngTXT_TICKET_UPDATE_TIME != null) { string arg = string.Empty; string updateTime = this.data.wdi.updateTime; int num = updateTime.IndexOf(' ', 0); if (num != -1) { arg = updateTime.Substring(0, num); } else { arg = updateTime; } this.ngTXT_TICKET_UPDATE_TIME.text = string.Format(StringMaster.GetString("TicketQuestUpdateTime2"), arg); } this.SetBGColor(false); } if (this.ngTXT_TICKET_NAME != null) { this.ngTXT_TICKET_NAME.text = this.data.worldStageM.name; } if (this.ngTXT_TICKET_NUM != null) { this.ngTXT_TICKET_NUM.text = this.Data.wdi.totalTicketNum.ToString(); } this.SetStageGimmick(); }