private void LoadHeadIconList() { List <int> iconIndexList = new List <int>(); foreach (TextureTableSetting texSetting in TextureTableSettings.GetAll()) { if (texSetting.Id >= 10000 && texSetting.Id < 20000) { iconIndexList.Add(texSetting.Id); } } for (int i = 0; i < iconIndexList.Count; i++) { int iconIndex = iconIndexList[i]; GameObject item = Instantiate(IconInstence); item.SetActive(true); item.name = iconIndex.ToString(); item.transform.Find("Texture").GetComponent <UITexture>().Load(iconIndex); if (iconIndex == myIconIndex) { item.GetComponent <UIToggle>().value = true; } item.transform.SetParent(IconGrid.transform, false); item.transform.localScale = new Vector3(1, 1, 1); item.transform.localPosition = Vector3.zero; } IconGrid.repositionNow = true; }
public void Load(int textureId) { if (textureId == 0) { mainTexture = null; TextureId = 0; return; } if (mainTexture != null && TextureId == textureId) { return; } TextureTableSetting setting = TextureTableSettings.Get(textureId); if (setting != null) { TextureId = textureId; string path = string.Format("UITexture/{0}{1}", setting.Path, (ResourceManager.EditorMode ? "." + setting.Extension : ResourceManager.BUNDLE_SUFFIX)); ResourceManager.LoadTexture(path, LoadCallback, LoadFailed); } }