Ejemplo n.º 1
0
    /// <summary>
    /// 移动子对象为最后一个
    /// </summary>
    /// <returns></returns>
    public void MoveChild2Last(WndBase Wnd)
    {
        if (Wnd == null || Wnd.tWnd == null)
        {
            return;
        }

        Transform tParent = GetWndParent(Wnd);

        if (tParent == null)
        {
            return;
        }

        bool bChild = false;

        for (int i = 0; i < tParent.childCount; i++)
        {
            if (tParent.GetChild(i) == Wnd.tWnd)
            {
                bChild = true;
            }
        }
        if (bChild == true)
        {
            Wnd.tWnd.SetAsLastSibling();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 设置wnd1 在wnd2前
    /// </summary>
    public static void SetBeforeWnd(WndBase wnd1, WndBase wnd2, int zDepth = 0)
    {
        int index = 0;

        if (wnd2 is WndTopBase)
        {
            index = TopWndDepth;
        }
        else
        {
            index = NormalWndDepth;
        }
        foreach (UIPanel panel in wnd1.BaseHead().m_listUIpanel)
        {
            panel.depth = ++index;
        }
        if (wnd2 is WndTopBase)
        {
            TopWndDepth = index;
        }
        else
        {
            NormalWndDepth = index;
        }

        if (wnd1.transform.localPosition.z > wnd2.transform.localPosition.z)
        {
            wnd1.transform.localPosition = new Vector3(wnd1.transform.localPosition.x, wnd1.transform.localPosition.y, wnd2.transform.localPosition.z);
        }
    }
Ejemplo n.º 3
0
    public bool CheckTopWnd(WndBase Wnd)
    {
        if (Wnd == null)
        {
            return(false);
        }

        WndType wndtype = Wnd.GetWndType();


        if (wndtype == WndType.DialogWnd || wndtype == WndType.MenuWnd)
        {
            return(true);
        }

        if (tParentDialog.childCount > 0)
        {
            return(false);
        }

        if (tParentWnd.childCount == 0)
        {
            return(false);
        }
        else if (tParentWnd.GetChild(tParentWnd.childCount - 1) == Wnd.transform)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 创建子窗口(非WndRoot下{直接挂在窗口里}))
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="strDialogIDD">窗口ID</param>
    /// <param name="parent">父节点</param>
    /// <returns></returns>
    private static T CreateWnd <T>() where T : WndBase
    {
        string strDialogIDD = typeof(T).ToString();

        if (strDialogIDD == WndBase.WndIDD())
        {
            return(default(T));
        }

        GameObject go = NDLoad.LoadWnd(strDialogIDD, g_tWndRoot) as GameObject;

        if (go == null)
        {
            Debug.Log("WndManager CreateWnd " + strDialogIDD + "  not found ! ");
            return(default(T));
        }
        else
        {
            T wndDialog = go.GetComponent <T> ();
            if (wndDialog != null)
            {
                wndDialog.WndStart();
                m_lwnd.Add(wndDialog);
                return(wndDialog);
            }
            else
            {
                Debug.Log(strDialogIDD + "  no add wnd component ! ");
                GameObject.Destroy(go);
            }
            return(default(T));
        }
    }
Ejemplo n.º 5
0
 // <summary>
 // 根据类型获取窗口挂靠节点
 // </summary>
 // <returns></returns>
 public Transform GetWndParent(WndBase wnd)
 {
     if (wnd == null)
     {
         return(null);
     }
     return(GetWndParent(wnd.GetWndType()));
 }
Ejemplo n.º 6
0
 /// 销毁指定窗口
 public static bool DestoryWnd(WndBase wnd)
 {
     if (wnd != null)
     {
         wnd.DestroyWnd(0.0f);
         m_lwnd.Remove(wnd);
     }
     return(true);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 窗口置底
 /// </summary>
 public static void SetWndBottom(WndBase Wnd)
 {
     if (Wnd == null)
     {
         return;
     }
     //设置为最开始一个位置
     m_lwnd.Remove(Wnd);
     g_uiNode.MoveChild2First(Wnd);
 }
Ejemplo n.º 8
0
    /// <summary>
    /// 窗口置顶
    /// </summary>
    public static void SetWndTop(WndBase Wnd)
    {
        if (Wnd == null)
        {
            return;
        }
        //设置为最后一个位置
        m_lwnd.Remove(Wnd);
        m_lwnd.Add(Wnd);

        g_uiNode.MoveChild2Last(Wnd);
    }
Ejemplo n.º 9
0
    private static void AddWnd(WndBase Wnd)
    {
        if (Wnd == null)
        {
            return;
        }


        if (m_lwnd.Contains(Wnd) == false)
        {
            m_lwnd.Add(Wnd);
        }
    }
Ejemplo n.º 10
0
 private void GolfRotate()
 {
     if (m_wndMineBall == null)
     {
         WndManager.CreateWnd <MineBallSpinWnd>(WndType.MenuWnd, false, false, (wnd) =>
         {
             if (wnd != null)
             {
                 m_wndMineBall = wnd;
             }
         });
     }
     else
     {
         m_wndMineBall.gameObject.SetActive(true);
     }
 }
Ejemplo n.º 11
0
    /// <summary>
    /// 创建子窗口(非WndRoot(这下面挂载UI界面)下)
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="strDialogIDD">窗口ID</param>
    /// <param name="parent">父节点</param>
    /// <returns></returns>
    public static T CreateDialog <T>(Transform parent) where T :
    WndBase
    {
        string strDialogIDD = typeof(T).ToString();

        if (strDialogIDD == WndBase.DialogIDD())
        {
            return(default(T));
        }

        GameObject go = NDLoad.LoadWnd(strDialogIDD, parent) as GameObject;

        if (go == null)
        {
            Debug.Log("WndManager CreateDialog " + strDialogIDD + "  not found ! ");
            return(default(T));
        }
        else
        {
            T wndDialog = go.GetComponent <T> ();
            if (wndDialog != null)
            {
                wndDialog.WndStart();
                m_lwnd.Add(wndDialog);
                return(wndDialog);
            }
            else
            {
                wndDialog = go.AddComponent <T> ();
                if (wndDialog != null)
                {
                    wndDialog.WndStart();
                    m_lwnd.Add(wndDialog);
                }

                return(wndDialog);
            }
        }
    }
Ejemplo n.º 12
0
    // <summary>
    // 确认窗口是否在最顶层
    // </summary>
    public static bool CheckTopWnd(WndBase Wnd)
    {
        if (Wnd == null)
        {
            return(false);
        }

        if (Wnd.GetWndType() != WndType.NormalWnd)
        {
            return(true);
        }

        int index = -1;
        int max   = 0;

        for (int i = 0; i < m_lwnd.Count; i++)
        {
            if (m_lwnd[i] != null && m_lwnd[i].GetWndType() == WndType.NormalWnd)
            {
                max = i;
                if (m_lwnd[i] == Wnd)
                {
                    index = i;
                }
            }
        }

        if (index == max)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Ejemplo n.º 13
0
 /// <summary>
 /// 让主菜单置于某窗口前
 /// </summary>
 public static void SetMainMenuTop(WndBase wnd1)
 {
 }
Ejemplo n.º 14
0
    static void Build()
    {
        string outPrefabPath = "Assets/Tencent/OutUI";

        if (Selection.objects == null)
        {
            return;
        }
        List <string> outPaths = new List <string> ();
        Dictionary <string, GameObject> objList = new Dictionary <string, GameObject>();

        string timePath = outPrefabPath + "/" + DateTime.Now.ToString("yyyyMMddHHmmss");

        CreateDirectory(timePath);

        timePath += "/";

        foreach (UnityEngine.Object o in Selection.objects)
        {
            WndBase [] gos = U3DUtil.GetComponentsInChildren <WndBase>((o as GameObject));
            if (gos != null)
            {
                foreach (WndBase obj in gos)
                {
                    string name = obj.GetType().ToString();
                    objList.Add(name, obj.gameObject);
                    GameObject.DestroyImmediate(obj, true);
                }
            }


            WndBase wnd = (o as GameObject).GetComponent <WndBase>();

            if (wnd != null)
            {
                GameObject.DestroyImmediate(wnd, true);
            }

            string inStr = AssetDatabase.GetAssetPath(o);

            string [] paths2 = AssetDatabase.GetDependencies(new string[] { inStr });
            foreach (string pathItem in paths2)
            {
                string del = o.name + ".cs";
                if (o.name.EndsWith("Item") || o.name.EndsWith("item"))
                {
                    outPaths.Add(pathItem);
                }
                else if (pathItem.EndsWith(del) || pathItem.Contains("Assets/NGUI/Scripts"))
                {
                    continue;
                }
                else
                {
                    outPaths.Add(pathItem);
                }
            }
        }
        if (outPaths.Count < 1)
        {
            return;
        }

        string outUnit = timePath + Selection.objects[0].name + ".unitypackage";

//
        AssetDatabase.ExportPackage(outPaths.ToArray(), outUnit, ExportPackageOptions.Default);
        AssetDatabase.Refresh();

//		foreach(UnityEngine.Object o in Selection.objects)
//		{
////			Type type = GetType (o.name);
////			object baseinfo= Activator.CreateInstance (type);
//			Component com = (o as GameObject).GetComponent(o.name);
//			if(com == null)
//			{
//				(o as GameObject).AddComponent(o.name);
//			}
//
//		}
//		foreach(string key in objList.Keys)
//		{
//			GameObject obj;
//			objList.TryGetValue(key,out obj);
//			Component com = obj.GetComponent(key);
//			if(com == null)
//			{
//				obj.AddComponent(key);
//			}
//
//		}
    }