public void Show(string str) { print("Game info show...\n"); gameObject.SetActive(true); int gameId; if (int.TryParse(str, out gameId)) { cfgGameList = CfgCenter.Inst.m_cfgGameListMgr.FindById(gameId); m_title.text = cfgGameList._name; m_desc.text = cfgGameList._desc; string iconPath = GameConst.UI_Icon_Path + cfgGameList._icon + ".png"; m_icon.sprite = Assist.LoadSprite(iconPath, (int)m_icon.sprite.rect.width, (int)m_icon.sprite.rect.height).toSprite(); string screenShotPath = GameConst.UI_ScreenShot_Path + cfgGameList._screenShot + ".png"; m_screenShot.sprite = Assist.LoadSprite(screenShotPath, (int)m_screenShot.sprite.rect.width, (int)m_screenShot.sprite.rect.height).toSprite(); m_type.text = cfgGameList._type; m_type.text = m_type.text.Replace("\\n", "\n"); for (int i = 0; i < m_typeWordEffectScript.Count; i++) { m_typeWordEffectScript[i].PlayTypeWordEffect(); } } }
public void SetData( ) { id = 1; name.text = "大雄宝殿"; string iconPath = GameConst.UI_Icon_Path + "Icon_DaXiongBaoDian.png"; icon.sprite = Assist.LoadSprite(iconPath, (int)icon.sprite.rect.width, (int)icon.sprite.rect.height).toSprite(); Self.SetActive(false); }
public void SetData(CfgGameList cfgGameList) { id = cfgGameList._id; name.text = cfgGameList._name; //Self.name =cfgGameList._id.ToString(); string iconPath = GameConst.UI_Icon_Path + cfgGameList._icon + ".png"; icon.sprite = Assist.LoadSprite(iconPath, (int)icon.sprite.rect.width, (int)icon.sprite.rect.height).toSprite(); Self.SetActive(false); }
void Start() { string path = Application.persistentDataPath + "/Example.jpg"; transform.GetComponent <UnityEngine.UI.Image>().sprite = Assist.LoadSprite(path, 128, 128).toSprite(); }