private void InitScrollView(LibOptionInfo initLibOptionInfo) { int childCount = ConfigScrollView.content.childCount; for (int i = 0; i < childCount; i++) { Destroy(ConfigScrollView.content.GetChild(i).gameObject); } for (int i = 0; i < initLibOptionInfo.FurniturelTempList.Count; i++) { var configGrid_PreObj = Instantiate(mConfigGrid_Pre); configGrid_PreObj.SetActive(true); configGrid_PreObj.transform.SetParent(ConfigScrollView.content); configGrid_PreObj.transform.localPosition = Vector3.zero; configGrid_PreObj.transform.localScale = Vector3.one; configGrid_PreObj.transform.FindChild("ConfigName").GetComponent <Text>().text = initLibOptionInfo.FurniturelTempList[i].TyepName; for (int j = 0; j < initLibOptionInfo.FurniturelTempList[i].ChildBtnsList.Count; j++) { var ConfigBtn_PreObj = Instantiate(mConfigBtn_Pre); ConfigBtn_PreObj.SetActive(true); ConfigBtn_PreObj.transform.SetParent(configGrid_PreObj.transform); ConfigBtn_PreObj.transform.localPosition = Vector3.zero; ConfigBtn_PreObj.transform.localScale = Vector3.one; ConfigBtn_PreObj.transform.FindChild("BtnName").GetComponent <Text>().text = initLibOptionInfo.FurniturelTempList[i].ChildBtnsList[j].Name; ConfigBtn_PreObj.GetComponent <Button>().onClick.AddListener(() => { //弹出框提示 UIMgr.OpenPanel <UIPopUpBox>(UILevel.Common, new UIPopUpBoxData() { BtnTexts = new string[] { "OK" }, TitleText = "家具展示:" + mDropDownNamesList[mCurrentDropValue], HintText = "暂时还未添加,敬请期待。。。", ShowBg = true }); }); } } ConfigScrollView.gameObject.Show(); }
private void AddFurniturelStyle(string typeName, List <FurniturelTemp> furniturelTemp, Sprite typeBg = null) { LibOptionInfo mLibOptionInfo = new LibOptionInfo(); mLibOptionInfo.TypeNmae = typeName; mLibOptionInfo.BgSprite = typeBg; mLibOptionInfo.FurniturelTempList = furniturelTemp; if (mLibOpDict.ContainsKey(typeName)) { mLibOpDict[typeName] = mLibOptionInfo; } else { mLibOpDict.Add(typeName, mLibOptionInfo); } }