protected override void RefreshGameObjs() { base.RefreshGameObjs(); SetGameObjCountEquleList(data.wallList.Count, wallLines, prefabs.GetNewInstance_grey); SetGameObjCountEquleList(data.wallList.Count, wallsideLines, prefabs.GetNewInstance_black, 2); SetGameObjCountEquleList(data.wallList.Count, wallEndLines, prefabs.GetNewInstance_black, 2); SetGameObjCountEquleList(data.pointList.Count, wallPoints, prefabs.GetNewInstance_point); SetGameObjCountEquleList(data.wallList.Count, showLenLines, prefabs.GetNewInstance_line, 2); SetGameObjCountEquleList(data.wallList.Count, showLenPoints, prefabs.GetNewInstance_fork, 4); SetGameObjCountEquleList(data.wallList.Count, showWords, prefabs.GetNewInstance_text, 2); SetGameObjCountEquleList(data.roomList.Count, floors, prefabs.GetNewInstance_floor); SetGameObjCountEquleList(data.roomList.Count, areas, prefabs.GetNewInstance_area); SetGameObjCountEquleList(selectPackedProductdatas.Count, selectPackedproducts, prefabs.GetNewInstance_selectGoods); for (int i = 0; i < showLenLines.Count; i++) { showLenLines[i].gameObject.SetActive(false); } for (int i = 0; i < showLenPoints.Count; i++) { showLenPoints[i].gameObject.SetActive(false); } for (int i = 0; i < showWords.Count; i++) { showWords[i].gameObject.SetActive(false); } for (int i = 0; i < data.productDataList.Count; i++) { int id = data.productDataList[i].id; if (products.ContainsKey(id) == false) { products.Add(id, new List <GameObject>()); } } goodsViewList.Clear(); removeListId.Clear(); foreach (int id in products.Keys) { hasIndexList.Clear(); for (int i = 0; i < data.productDataList.Count; i++) { ProductData productData = data.productDataList[i]; if (productData.id == id) { hasIndexList.Add(i); if (products.ContainsKey(id) && products[id].Count >= hasIndexList.Count) { GameObject go = products[id][hasIndexList.Count - 1]; Vector3 size = mainPageData.getProduct(productData.seekId).size; GoodsVO vo = mainPageData.getGoods(productData.seekId); ResourcesPool.DisposTexture(go); SetTextureTool.SetTexture(go, vo.uri2D, vo.seekId); Product product = mainPageData.getProduct(vo.seekId); float y = productData.height; switch (productData.type) { case 2: //门窗 { //if (product.entityType == "window") //{ // y = 1; //} } break; case 3: //吊顶 { if (product == null) { break; } y = defaultSetting.DefaultHeight + productData.height - product.size.y; } break; case 4: //地毯 { y = productData.height + -0.001f; } break; case 5: //天花板 { y = defaultSetting.DefaultHeight + productData.height - 0.001f; } break; case 6: //吸附各个平面 暂时不做 { //world3d.y = defaultSetting.DefaultHeight - 0.01f; } break; default: //不吸附 break; } productData.setData(go, size, y, true); GoodsView goodsView = go.GetComponent <GoodsView>(); goodsView.SetData(productData); if (selectObjData == productData) { if (selectGoods == null) { selectGoods = prefabs.GetNewInstance_selectGoods().gameObject; } selectGoods.transform.localRotation = go.transform.localRotation; selectGoods.transform.localScale = go.transform.localScale; selectGoods.transform.localPosition = go.transform.localPosition - Vector3.forward; selectGoods.SetActive(true); if (productData.hide == true) { selectGoods.SetActive(false); } } for (int k = 0; k < selectPackedProductdatas.Count; k++) { if (selectPackedProductdatas[k] == productData) { GameObject obj = selectPackedproducts[k]; //if (obj == null) obj = prefabs.GetNewInstance_selectGoods().gameObject; obj.transform.localRotation = go.transform.localRotation; obj.transform.localScale = go.transform.localScale; obj.transform.localPosition = go.transform.localPosition - Vector3.forward; obj.SetActive(true); if (productData.hide == true) { obj.SetActive(false); } break; } } if (productData.hide == true) { go.SetActive(false); } else { go.SetActive(true); } goodsViewList.Add(goodsView); } } } int minCount = hasIndexList.Count < products[id].Count ? hasIndexList.Count : products[id].Count; for (int i = minCount; i < products[id].Count; i++) { GameObject.DestroyImmediate(products[id][i], true); products[id].RemoveAt(i); i--; } for (int i = minCount; i < hasIndexList.Count; i++) { int index = hasIndexList[i]; ProductData product = data.productDataList[index]; LoadMode(product); } if (products[id].Count == 0) { removeListId.Add(id); } } if ((selectObjData == null || selectObjData is ProductData == false) && selectGoods != null) { selectGoods.SetActive(false); } for (int i = 0; i < removeListId.Count; i++) { products.Remove(removeListId[i]); } if (inputWallLengths.Count == 0) { for (int i = 0; i < 5; i++) { GameObject go = prefabs.GetNewInstance_inputWallLength().gameObject; go.AddComponent <SetLengthHandleView>(); go.SetActive(false); inputWallLengths.Add(go); } } }