public void UpdateBuildState() { string strPath = GetPrefabName(); if (!this.transform.FindChild(strPath)) { CreateBuild(); } else { if (m_getUI != null) { m_getUI.InitUI(m_buildData, this); } if (buildNum == BaseBuildingData.Q_phD) { VipInfoData vip = Core.Data.vipManager.GetVipInfoData(Core.Data.playerManager.RTData.curVipLevel); if (vip != null) { bool isVisib = vip.iqshow > 0 && Core.Data.playerManager.RTData.curLevel >= m_buildData.config.limitLevel; RED.SetActive(isVisib, this.gameObject); } else { RED.SetActive(false, this.gameObject); } } m_tipUI = transform.GetComponentInChildren <BuildTipUI>(); UpdateRobFire(); if (m_tipUI != null) { m_tipUI.InitName(m_buildData); } if (m_buildData.config.build_kind == BaseBuildingData.BUILD_KIND_BATTLE) { if (m_firePar == null) { m_firePar = transform.FindChild(FIRE_PATH); } if (m_firePar != null) { RED.SetActive(m_buildData.RTData.dur > 0, m_firePar.gameObject); } } CheckLighting(); } }
void CreateBuild() { Clear(); string strPath = GetPrefabName(); UnityEngine.Object obj = PrefabLoader.loadFromPack(BASE_PREFAB_PATH + strPath, false); if (obj == null) { RED.LogWarning(BASE_PREFAB_PATH + strPath + "is not find"); return; } GameObject build = Instantiate(obj) as GameObject; build.name = strPath; RED.AddChild(build, this.gameObject); build.transform.localPosition = Vector3.zero; if (m_buildData != null) { this.name = m_buildData.config.ID + "_" + m_buildData.RTData.id.ToString(); } // if(m_buildData.config.build_kind == BaseBuildingData.BUILD_KIND_PRODUCE) // { // if(m_buildData.RTData.robc > 0) // { // UnityEngine.Object firePrefab = PrefabLoader.loadFromPack(BASE_PREFAB_PATH + FIRE, false); // m_fire = Instantiate(firePrefab) as GameObject; // RED.AddChild(m_fire, this.gameObject, new Vector3(0.4f, 1.6f, 0.1f)); // if (m_meat == null) // { // m_meat = transform.FindChild ("830001_1/Object171"); // } // if (m_meat != null) // { // RED.SetActive (false, m_meat.gameObject); // } // } // } UpdateRobFire(); CheckLighting(); if (m_buildData.config.build_kind != BaseBuildingData.BUILD_KIND_NORMAL) { m_getUI = transform.GetComponentInChildren <BuildGetUI>(); if (m_getUI != null) { m_getUI.InitUI(m_buildData, this); } else { RED.LogWarning("build get ui not find " + m_buildData.config.id); } } m_tipUI = transform.GetComponentInChildren <BuildTipUI>(); if (m_tipUI != null) { m_tipUI.InitName(m_buildData); } }