public FunctionBlockDistrictInfo InitInfo(int blockID) { FunctionBlockDistrictInfo info = new FunctionBlockDistrictInfo(); var config = FunctionBlockModule.GetBlockDistrictConfig(blockID); if (config != null) { info.BlockID = blockID; info.size = new Vector2(config.areaX, config.areaY); info.realityRatio = (float)config.realityRatio; info.currentDistrictDataDic = FunctionBlockModule.GetBlockDistictInfo(config); } return(info); }
public void InitSlot(FunctionBlockDistrictInfo info) { infoData = info; var count = info.size.x * info.size.y; foreach (KeyValuePair <Vector2, DistrictAreaInfo> kvp in info.currentDistrictDataDic) { var element = ObjectManager.Instance.InstantiateObject(UIPath.PrefabPath.DISTRICT_PREFAB_PATH); var districtSlot = UIUtility.SafeGetComponent <DistrictSlot>(element.transform); if (districtSlot != null) { _districtSlotList.Add(districtSlot); districtSlot.InitBaseInfo(kvp.Value); element.transform.SetParent(transform, false); element.name = kvp.Key.ToString(); } else { break; } } }