private void InitTrapRoomUI() { GoClickBuildBtns = NDLoad.LoadWndItem("ClickBuildBtns", WndManager.GetWndRoot().transform); if (GoClickBuildBtns) { m_v3GoClickBuildBtns = GoClickBuildBtns.transform.position; ClickBuildBtns btns = GoClickBuildBtns.GetComponent <ClickBuildBtns>(); if (btns) { //btns.BtnInfo.OnClickEventHandler += BtnInfo_OnClickEventHandler; btns.BtnReturnBag.OnClickEventHandler += BtnReutrnBag_OnClickEventHandler; //btns.BtnUpgrade.OnClickEventHandler += BtnUpgrade_OnClickEventHandler; //btns.BtnDeleteSoldier.OnClickEventHandler += BtnDeleteSoldier_OnClickEventHandler; btns.BtnSetTransGate.OnClickEventHandler += BtnSetTransGate_OnClickEventHandler; } GoClickBuildBtns.SetActive(false); } SetClickBuildBtns(false, false); if (m_Core.m_type == ShipBuildType.BuildRoom) { BuildProperty lifeobj = GetComponent <BuildProperty>(); if (lifeobj != null && lifeobj.GetModeType() == 1605) { SetClickBuildBtns(false, true); } } }
/// <summary> /// 解决该弹窗和炮弹兵重叠 /// </summary> private void FixDepth(GameObject go) { //int pdbycWndDepth = WndManager.GetDialogDepth<PdbycWnd>(); ////NGUIUtil.DebugLog("pdbyc depth =" + pdbycWndDepth); //UIPanel panel = GetComponent<UIPanel>(); //if (panel.depth <= pdbycWndDepth) //{ // panel.depth = pdbycWndDepth + 1; //} Vector3 pos = WndManager.GetWndRoot().transform.InverseTransformPoint(go.transform.position); transform.localPosition = new Vector3(-400f, pos.y + 80f, -1000f); }
/// <summary> /// 获取窗口,从窗口根节点下一层获取,获取失败则创建窗口 /// </summary> /// <typeparam name="T">窗口实现类</typeparam> /// <param name="strDialogIDD">strDialogIDD 窗口ID</param> /// <param name="parent">parent 父节点</param> /// <returns></returns> public static T GetDialog <T>() where T : WndBase { T Wnd = FindDialog <T>(); if (Wnd != null) { return(Wnd); } else { Wnd = WndManager.CreateDialog <T>(WndManager.GetWndRoot().transform); return(Wnd); } }
private void InitHudText() { GoHudText = NDLoad.LoadWndItem("AddExpHUDText", MyHead.Target.transform); GoHudText.gameObject.name = "GetWood"; GameObject child = NGUITools.AddChild(WndManager.GetWndRoot(), GoHudText); if (GoHudText != null) { m_hudText = child.GetComponentInChildren <HUDText>(); m_hudText.bFollowTarget = true; child.AddComponent <UIFollowTarget>().target = MyHead.Target.transform; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; m_hudText.fontSize = 30; } }
// Use this for initialization public virtual void Start() { //m_nHp = m_nFullHp = 100; //preValue = value = 1; GameObject child = NGUITools.AddChild(WndManager.GetWndRoot(), prefab); mText = child.GetComponentInChildren <HUDText>(); if (null == forceTex) { forceTex = hp4; } //forceGrond.GetComponent<SpriteRenderer>().sprite.border // Make the UI follow the target child.AddComponent <UIFollowTarget>().target = target; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; if (mBaojiText != null) { child = NGUITools.AddChild(WndManager.GetWndRoot(), mBaojiText.gameObject); mBaojiText = child.GetComponentInChildren <HUDText>(); child.AddComponent <UIFollowTarget>().target = target; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; } if (mAngerText != null) { child = NGUITools.AddChild(WndManager.GetWndRoot(), mAngerText.gameObject); mAngerText = child.GetComponentInChildren <HUDText>(); child.AddComponent <UIFollowTarget>().target = target; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; } if (BuffText != null) { child = NGUITools.AddChild(WndManager.GetWndRoot(), BuffText.gameObject); BuffText = child.GetComponentInChildren <HUDText>(); child.AddComponent <UIFollowTarget>().target = target; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; } mColorBuff = NGUIText.ParseColor("d3fe78", 0); mColorDebuff = NGUIText.ParseColor("ff5163", 0); }
// Use this for initialization. void Start() { MyHead = GetComponent <AddExpItem_h>(); // MyHead.HudText.bTopRank = false; MyHead.LblNumUsed.gameObject.SetActive(false); if (MyHead.BtnSelect) { MyHead.BtnSelect.OnPressDownEventHandler += BtnSelect_OnPressDownEventHandler; MyHead.BtnSelect.OnPressUpEventHandler += BtnSelect_OnPressUpEventHandler; MyHead.BtnSelect.OnDragEventHandler += BtnSelect_OnDragEventHandler; } SetUI(); m_AddHudText = NDLoad.LoadWndItem("AddExpHUDText", MyHead.Target.transform); GameObject child = NGUITools.AddChild(WndManager.GetWndRoot(), m_AddHudText); m_HudText = child.GetComponentInChildren <HUDText>(); child.AddComponent <UIFollowTarget>().target = MyHead.Target.transform; child.GetComponent <UIFollowTarget>().disableIfInvisible = false; }
/// <summary> /// 加载UI项(按钮等,非窗口类) /// <para>UI项路径 UI/Items/</para> /// </summary> public static GameObject LoadUIBtn(string name, bool isAB = false) { GameObject Prefab = null; if (isAB == false) { Prefab = LoadPrefabInRes(ResoucesPathConfig.Res_WndItemPath + name); } else { return(null); } if (Prefab == null) { return(null); } GameObject go = Instantiate(Prefab, WndManager.GetWndRoot()); return(go); }
public void LoadCanvasBox() { CanvasUnitBG unitBg = TouchMoveManager.GetCanvasUnitBG(Int2.zero); if (unitBg) { m_GoCanvasBox = GameObjectLoader.LoadPath("Prefabs/Others/", "CanvasBox", WndManager.GetWndRoot().transform); Vector3 worldPos = unitBg.transform.position; NGUIUtil.Set3DUIPos(m_GoCanvasBox, worldPos); } }