public void Init(string panelName, Transform parent, bool isReviseScale, bool UseUICamera = true) { Transform unitTf = transform; unitTf.parent = parent; if (UseUICamera) { unitTf.localEulerAngles = Rotation; } else { unitTf.localEulerAngles = Vector3.zero; } // 테이블에서 스케일과 포지션값을 읽어온다 Partner.PartnerScaleInfo info = _LowDataMgr.instance.GetPartnerScaleInfo(gameObject.name, panelName); if (info == null) { Debug.Log(string.Format("{0} is null", gameObject.name)); unitTf.localScale = Scale; unitTf.localPosition = Vector3.zero; } else { if (info.rotate_y == 0) //0일경우 회전값을 강제로 돌려줘야함 { unitTf.localEulerAngles = Rotation; } else { unitTf.localEulerAngles = new Vector3(info.rotate_x, info.rotate_y, 0); } //unitTf.localEulerAngles = new Vector3(info.rotate_x, info.rotate_y, 0); unitTf.localScale = new Vector3(info.scale, info.scale, info.scale); unitTf.localPosition = new Vector3(info._x, info._y, 0); } NGUITools.SetChildLayer(unitTf, LayerMask.NameToLayer("UI")); }
public void Init(Transform parent, UnitAnimator anim, GameObject[] effect, bool isReviseScale, bool isShadow, string panelName) { UnitAnim = anim; Transform unitTf = transform; unitTf.parent = parent; unitTf.localEulerAngles = Rotation; // 테이블에서 스케일과 포지션값을 읽어온다 Partner.PartnerScaleInfo info = _LowDataMgr.instance.GetPartnerScaleInfo(gameObject.name, panelName); if (info == null) { Debug.Log(string.Format("{0} is null", gameObject.name)); unitTf.localScale = Scale; unitTf.localPosition = Vector3.zero; } else { if (info.rotate_y == 0) //0일경우 회전값을 강제로 돌려줘야함 { unitTf.localEulerAngles = Rotation; } else { unitTf.localEulerAngles = new Vector3(info.rotate_x, info.rotate_y, 0); } if (info.scale == 0) { unitTf.localScale = Scale; } else { unitTf.localScale = new Vector3(info.scale, info.scale, info.scale); } unitTf.localPosition = new Vector3(info._x, info._y, 0); } if (!string.IsNullOrEmpty(panelName) && panelName.Contains("TownPanel")) { if (unitTf.name.Contains("pc_f")) { unitTf.transform.localPosition = new Vector3(0, -12, 0); } else if (unitTf.name.Contains("pc_p")) { unitTf.transform.localPosition = new Vector3(0, -4, 0); } else if (unitTf.name.Contains("pc_d")) { unitTf.transform.localPosition = new Vector3(-1.93f, 6.39f, 0); unitTf.transform.localScale = new Vector3(190, 190, 190); } } if (effect != null) { GameObject readyPop = UIMgr.GetUI("UIPopup/ReadyPopup"); UIPanel panel = null; if (readyPop != null) { panel = readyPop.GetComponent <UIPanel>(); } else { UIBasePanel curUI = UIMgr.instance.GetCurPanel(); if (curUI != null) { panel = curUI.gameObject.GetComponent <UIPanel>(); } } if (panel != null) { RenderQ = panel.startingRenderQueue + 20; } if (RenderQ <= 3020) { RenderQ = 3030; } if (effect[0] != null)//파트너의 경우 없을 수 있다. { CheckRenderQ(RenderQ, effect[0].transform); List <ParticleSystem> list = UIHelper.FindComponents <ParticleSystem>(effect[0].transform); ResettingParticle(parent, list, 0.4f); } if (effect[1] != null)//파트너의 경우 없을 수 있다. { CheckRenderQ(RenderQ, effect[1].transform); List <ParticleSystem> list = UIHelper.FindComponents <ParticleSystem>(effect[1].transform); ResettingParticle(parent, list, 0.4f); } if (effect[0] != null) { effect[0].SetActive(true); } if (effect[1] != null) { effect[1].SetActive(true); } } EffectObj = effect; //if (parent.parent != null && parent.parent.FindChild("Shadow") == null) if (isShadow && parent.parent != null && parent.parent.FindChild("Shadow") == null) { GameObject shadowGO = ResourceMgr.Instantiate <GameObject>("Etc/Shadow"); shadowGO.transform.parent = unitTf; shadowGO.transform.localPosition = Vector3.zero; //new Vector3(0, 0.028f, 0f); shadowGO.transform.localRotation = Quaternion.Euler(new Vector3(-80, 180, -180)); shadowGO.transform.localScale = Vector3.one; //new Vector3(1.5f, 1.5f, 1.5f); shadowGO.name = "Shadow"; NGUITools.SetLayer(shadowGO, parent.gameObject.layer); SetRenderQueue q = shadowGO.AddComponent <SetRenderQueue>(); q.renderQueue = 3001; shadowGO.transform.parent = parent.parent; } NGUITools.SetLayer(unitTf.gameObject, LayerMask.NameToLayer("UI"));//parent.gameObject.layer); NGUITools.SetChildLayer(unitTf, LayerMask.NameToLayer("UI")); }