private void OnAddBuidUI(BuidAchorData archorData, GameObject obj, bool isGuid) { foreach (var kv in m_topUI) { for (int i = 0; i < kv.Value.Count; i++) { if (kv.Value[i].isExist(archorData.m_buidID)) { return; } } } BuildTopIconComponent buildIcon = this.m_grid.AddChild <BuildTopIconComponent>(); if (isGuid) { buildIcon.gameObject.name = obj.name; buildIcon.SetData(null, true); } else { buildIcon.SetData(archorData, isGuid); } Transform uiObj = buildIcon.gameObject.transform; Vector3 localPos = EngineCore.Utility.CameraUtility.WorldPointInCanvasRectTransform(obj.transform.position, uiObj.gameObject);//this.m_grid.gameObject.transform.InverseTransformPoint(obj.transform.position); uiObj.transform.position = localPos; Transform tran = obj.transform; if (m_topUI.ContainsKey(tran)) { m_topUI[tran].Add(buildIcon); } else { m_topUI.Add(tran, new List <BuildTopIconComponent>() { buildIcon }); } buildIcon.Visible = true; }
public BigWorldBuild(long buildId, GameObject buildObj, ParticleScale wallEffectMaterial) { this.m_BuildID = buildId; this.m_buildObj = buildObj; this.m_unlockMaterial = BigWorldGameObject.GetBuildCommonMatByName("UnLock.mat"); //this.m_cacheMaterial = cacheMaterial; this.m_confBuild = ConfBuilding.Get(buildId); long[] m_sceneIDs = CommonTools.StringToLongArray(m_confBuild.sceneIds); long[] m_completeTaskIDs = CommonTools.StringToLongArray(m_confBuild.taskIds); m_achorData = new BuidAchorData(buildId, m_sceneIDs, m_completeTaskIDs); this.status = 0; this.m_srcPos = buildObj.transform.position; //this.m_unlockMaterial = unLockMaterial; this.m_unLockEffect = wallEffectMaterial; //this.m_dimianEffectMat = dimainEffectMat; //Transform wallTran = buildObj.transform.Find("wall"); //if (wallTran != null) //{ // this.m_buildWall = wallTran.gameObject; // this.m_buildWall.SetActive(false); //} }
public void SetData(BuidAchorData achordata, bool isGuid) { //this.m_buidID = buildID; this.m_isGuid = isGuid; this.m_achorData = achordata; if (this.m_achorData != null) { this.m_normalIcon.Sprite = "icon_position_type4.png"; this.m_confBuilding = ConfBuilding.Get(this.m_achorData.m_buidID); SetBuildStatus(this.m_achorData.BuildStatus); } else if (isGuid) { this.m_normalIcon.Sprite = "icon_position_type2.png"; this.m_normalIcon.Visible = true; //已解锁 //this.m_lockIcon.Visible = false; //加锁 //this.m_canLockIcon.Visible = false; //可解锁 } List <BuidTopSceneIcon> buildTopIcon = new List <BuidTopSceneIcon>(); if (achordata != null) { for (int i = 0; i < achordata.m_enterData.Count; i++) { this.m_sceneImg[i].SetData(achordata.m_enterData[i], i); buildTopIcon.Add(this.m_sceneImg[i]); //this.m_sceneImg[i].Visible = true; } buildTopIcon.Sort(SortSceneIcon); for (int i = 0; i < buildTopIcon.Count; i++) { buildTopIcon[i].SetIndex(i, Mathf.Lerp(0.2f, 0.05f, i / (float)buildTopIcon.Count)); } } }
private void OnBuildTopUIByObj(BuidAchorData archorData, GameObject obj, bool isGuid) { OnAddBuidUI(archorData, obj, isGuid); }