void CreateLockFB(int type) { //to add... Object prefab = PrefabLoader.loadFromPack("ZQ/LockFB"); if (prefab != null) { GameObject obj = Instantiate(prefab) as GameObject; RED.AddChild(obj, this.gameObject); lockFb = obj.GetComponent <LockFB>(); if (lockFb != null) { lockFb.SetFBType(type); } } }
public void SetData(NewFloor flrData) { if (flrData == null) { gameObject.SetActive(false); return; } if (!gameObject.activeSelf) { gameObject.SetActive(true); } Guang.gameObject.SetActive(false); floorData = flrData; Spr_Buliding.autoResizeBoxCollider = true; Spr_Buliding.pivot = UIWidget.Pivot.Bottom; transform.localPosition = floorData.localPosition; Spr_Buliding.spriteName = floorData.config.TextrueID[0]; Spr_Buliding.MakePixelPerfect(); UIButtonMessage message = gameObject.AddComponent <UIButtonMessage>(); if (message != null) { message.target = JCPVEPlotController.Instance.gameObject; message.functionName = "OnBuildingClick"; } stars.SetStar(floorData.star); SetBuildingState(floorData); int i = 1; bool needCreate = false; for (; i <= 5; i++) { ExploreConfigData explore = Core.Data.newDungeonsManager.GetExploreData(i); if (explore != null) { if (explore.openfloor == floorData.config.ID && Core.Data.newDungeonsManager.lastFloorId < explore.openfloor) { needCreate = true; break; } } } if (needCreate) { if (lockFb == null) { CreateLockFB(i); } else { lockFb.SetFBType(i); } } else if (lockFb != null) { Destroy(lockFb.gameObject); lockFb = null; } }