示例#1
0
    public static UIWindowBase CreateUIWindow(string UIName)
    {
        Debug.Log("CreateUIWindow " + UIName);

        GameObject   UItmp        = GameObjectManager.CreateGameObjectByPool(UIName, UIManagerGo);
        UIWindowBase UIWIndowBase = UItmp.GetComponent <UIWindowBase>();

        UISystemEvent.Dispatch(UIWIndowBase, UIEvent.OnInit);  //派发OnInit事件

        UIWIndowBase.windowStatus = UIWindowBase.WindowStatus.Create;

        try
        {
            UIWIndowBase.InitWindow(GetUIID(UIName));
        }
        catch (Exception e)
        {
            Debug.LogError(UIName + "OnInit Exception: " + e.ToString());
        }

        AddHideUI(UIWIndowBase);

        UILayerManager.SetLayer(UIWIndowBase);      //设置层级

        return(UIWIndowBase);
    }
示例#2
0
    /// <summary>
    /// 打开UI
    /// </summary>
    /// <param name="UIName">UI名</param>
    /// <param name="callback">动画播放完毕回调</param>
    /// <param name="objs">回调传参</param>`
    /// <returns>返回打开的UI</returns>
    public static UIWindowBase OpenUIWindow(string UIName, UICallBack callback = null, params object[] objs)
    {
        UIWindowBase UIbase = GetHideUI(UIName);

        if (UIbase == null)
        {
            UIbase = CreateUIWindow(UIName);
        }

        RemoveHideUI(UIbase);
        AddUI(UIbase);

        UIStackManager.OnUIOpen(UIbase);
        UILayerManager.SetLayer(UIbase);      //设置层级

        UIbase.windowStatus = UIWindowBase.WindowStatus.OpenAnim;

        UISystemEvent.Dispatch(UIbase, UIEvent.OnOpen);  //派发OnOpen事件
        try
        {
            UIbase.OnOpen();
        }
        catch (Exception e)
        {
            Debug.LogError(UIName + " OnOpen Exception: " + e.ToString());
        }

        UISystemEvent.Dispatch(UIbase, UIEvent.OnOpened);     //派发OnOpened事件

        UIAnimManager.StartEnterAnim(UIbase, callback, objs); //播放动画
        return(UIbase);
    }
示例#3
0
    /// <summary>
    /// 打开UI
    /// </summary>
    /// <param name="UIName">UI名</param>
    /// <param name="callback">动画播放完毕回调</param>
    /// <param name="objs">回调传参</param>`
    /// <returns>返回打开的UI</returns>
    public static UIWindowBase OpenUIWindow(string UIName, UICallBack callback = null, params object[] objs)
    {
        //从隐藏UI中取出
        var uiBase = GetHideUI(UIName);

        if (uiBase == null)
        {
            uiBase = CreateUIWindow(UIName);
        }

        //从隐藏UI中删除
        RemoveHideUI(uiBase);

        //加入显示中UI
        AddUI(uiBase);

        //派发OnOpen事件
        UISystemEvent.Dispatch(uiBase, UIEvent.OnOpen);
        try
        {
            uiBase.OnOpen();
        }
        catch (Exception e)
        {
            Debug.LogError(UIName + " OnOpen Exception: " + e.ToString());
        }

        //设置层级
        m_uiLayerManager.SetLayer(uiBase);

        //播放动画
        m_uiAnimManager.StartEnterAnim(uiBase, callback, objs);

        return(uiBase);
    }
示例#4
0
    /// <summary>
    /// 打开UI
    /// </summary>
    /// <param name="UIName">UI名</param>
    /// <param name="callback">动画播放完毕回调</param>
    /// <param name="objs">回调传参</param>
    /// <returns>返回打开的UI</returns>
    public static UIWindowBase OpenUIWindow(string UIName, UICallBack callback = null, params object[] objs)
    {
        UIWindowBase UIbase = GetHideUI(UIName);

        if (UIbase == null)
        {
            UIbase = CreateUIWindow(UIName);
        }
        else
        {
            UIbase.gameObject.SetActive(true);
        }

        RemoveHideUI(UIbase);
        AddUI(UIbase);

        UISystemEvent.Dispatch(UIbase, UIEvent.OnOpen);  //派发OnOpen事件
        try{
            UIbase.OnOpen();
        }
        catch (Exception e)
        {
            Debug.LogError("OnOpen Exception: " + e.ToString());
        }

        s_UILayerManager.SetLayer(UIbase);                      //设置层级
        s_UIAnimManager.StartEnterAnim(UIbase, callback, objs); //播放动画
        return(UIbase);
    }
示例#5
0
    /// <summary>
    /// 打开UI
    /// </summary>
    /// <param name="l_UIname">UI名</param>
    /// <param name="l_callback">动画播放完毕回调</param>
    /// <param name="l_objs">回调传参</param>
    /// <returns>返回打开的UI</returns>
    public static UIWindowBase OpenUIWindow(string l_UIname, UICallBack l_callback = null, params object[] l_objs)
    {
        UIWindowBase l_UIbase = GetHideUI(l_UIname);

        if (l_UIbase == null)
        {
            l_UIbase = CreateUIWindow(l_UIname);
        }

        RemoveHideUI(l_UIbase);
        AddUI(l_UIbase);

        UISystemEvent.Dispatch(l_UIbase, UIEvent.OnOpen);  //派发OnOpen事件
        try{
            l_UIbase.OnOpen();
        }
        catch (Exception e)
        {
            Debug.LogError("OnOpen Exception: " + e.ToString());
        }

        s_UILayerManager.SetLayer(l_UIbase);                          //设置层级
        s_UIAnimManager.StartEnterAnim(l_UIbase, l_callback, l_objs); //播放动画
        return(l_UIbase);
    }
示例#6
0
    static void CloseUIWindowCallBack(UIWindowBase UI, params object[] objs)
    {
        UISystemEvent.Dispatch(UI, UIEvent.OnClose);  //派发OnClose事件
        try
        {
            UI.OnClose();
        }
        catch (Exception e)
        {
            Debug.LogError(UI.UIName + " OnClose Exception: " + e.ToString());
        }

        AddHideUI(UI);
    }
示例#7
0
    public static void CloseUIWindowCallBack(UIWindowBase l_UI, params object[] l_objs)
    {
        UISystemEvent.Dispatch(l_UI, UIEvent.OnDestroy);  //派发OnDestroy事件
        try
        {
            l_UI.OnClose();
        }
        catch (Exception e)
        {
            Debug.LogError("OnClose Exception: " + e.ToString());
        }

        l_UI.RemoveAllEvent();
        AddHideUI(l_UI);
    }
示例#8
0
    public static UIWindowBase ShowUI(UIWindowBase ui)
    {
        UISystemEvent.Dispatch(ui, UIEvent.OnShow);  //派发OnShow事件
        try
        {
            ui.Show();
            ui.OnShow();
        }
        catch (Exception e)
        {
            Debug.LogError(ui.UIName + " OnShow Exception: " + e.ToString());
        }

        return(ui);
    }
示例#9
0
    static void CloseUIWindowCallBack(UIWindowBase l_UI, params object[] l_objs)
    {
        UISystemEvent.Dispatch(l_UI, UIEvent.OnClose);  //派发OnClose事件
        try
        {
            l_UI.OnClose();
        }
        catch (Exception e)
        {
            Debug.LogError("OnClose Exception: " + e.ToString());
        }

        l_UI.gameObject.SetActive(false);
        AddHideUI(l_UI);
    }
示例#10
0
 static int Dispatch(IntPtr L)
 {
     try
     {
         int          count = LuaDLL.lua_gettop(L);
         UIWindowBase arg0  = (UIWindowBase)ToLua.CheckUnityObject(L, 1, typeof(UIWindowBase));
         UIEvent      arg1  = (UIEvent)ToLua.CheckObject(L, 2, typeof(UIEvent));
         object[]     arg2  = ToLua.ToParamsObject(L, 3, count - 2);
         UISystemEvent.Dispatch(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#11
0
    public static UIWindowBase CreateUIWindow(string l_UIname)
    {
        GameObject   l_UItmp  = GameObjectManager.CreatGameObject(l_UIname, s_Instance.gameObject);
        UIWindowBase l_UIbase = l_UItmp.GetComponent <UIWindowBase>();

        UISystemEvent.Dispatch(l_UIbase, UIEvent.OnInit);  //派发OnInit事件
        try{
            l_UIbase.Init();
        }
        catch (Exception e) {
            Debug.LogError("OnInit Exception: " + e.ToString());
        }

        AddHideUI(l_UIbase);

        return(l_UIbase);
    }
示例#12
0
    public static UIWindowBase HideUI(UIWindowBase ui)
    {
        ui.windowStatus = UIWindowBase.WindowStatus.Hide;
        UISystemEvent.Dispatch(ui, UIEvent.OnHide);  //派发OnHide事件

        try
        {
            ui.Hide();
            ui.OnHide();
        }
        catch (Exception e)
        {
            Debug.LogError(ui.UIName + " OnShow Exception: " + e.ToString());
        }

        return(ui);
    }
示例#13
0
    //退出动画播放完毕回调
    public void EndExitAnim(UIWindowBase l_UIbase, UICallBack callBack, params object[] objs)
    {
        UISystemEvent.Dispatch(l_UIbase, UIEvent.OnCompleteExitAnim);
        l_UIbase.OnCompleteExitAnim();

        try
        {
            if (callBack != null)
            {
                callBack(l_UIbase, objs);
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
        }
    }
示例#14
0
    //进入动画播放完毕回调
    public void EndEnterAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
    {
        UISystemEvent.Dispatch(UIbase, UIEvent.OnCompleteEnterAnim);
        UIbase.OnCompleteEnterAnim();
        UIbase.windowStatus = UIWindowBase.WindowStatus.Open;

        try
        {
            if (callBack != null)
            {
                callBack(UIbase, objs);
            }
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
        }
    }
示例#15
0
    static void CloseUIWindowCallBack(UIWindowBase UI, params object[] objs)
    {
        UI.windowStatus = UIWindowBase.WindowStatus.Close;
        UISystemEvent.Dispatch(UI, UIEvent.OnClose);  //派发OnClose事件
        try
        {
            UI.OnClose();
        }
        catch (Exception e)
        {
            Debug.LogError(UI.UIName + " OnClose Exception: " + e.ToString());
        }

        UIStackManager.OnUIClose(UI);
        AddHideUI(UI);

        UISystemEvent.Dispatch(UI, UIEvent.OnClosed);  //派发OnOpened事件
    }
示例#16
0
    public static UIWindowBase CreateUIWindow(string UIName)
    {
        GameObject   UItmp  = GameObjectManager.CreateGameObject(UIName, s_UIManagerGo);
        UIWindowBase UIbase = UItmp.GetComponent <UIWindowBase>();

        UISystemEvent.Dispatch(UIbase, UIEvent.OnInit);  //派发OnInit事件
        try{
            UIbase.Init(GetUIID(UIName));
        }
        catch (Exception e)
        {
            Debug.LogError("OnInit Exception: " + e.ToString());
        }

        AddHideUI(UIbase);

        s_UILayerManager.SetLayer(UIbase);      //设置层级

        return(UIbase);
    }
示例#17
0
    /// <summary>
    /// 删除所有隐藏的UI
    /// </summary>
    public static void DestroyAllHideUI()
    {
        foreach (List <UIWindowBase> uis in s_hideUIs.Values)
        {
            for (int i = 0; i < uis.Count; i++)
            {
                UISystemEvent.Dispatch(uis[i], UIEvent.OnDestroy);  //派发OnDestroy事件
                try
                {
                    uis[i].Dispose();
                }
                catch (Exception e)
                {
                    Debug.LogError("OnDestroy :" + e.ToString());
                }
                Destroy(uis[i].gameObject);
            }
        }

        s_hideUIs.Clear();
    }
示例#18
0
    public static void DestroyUI(UIWindowBase l_UI)
    {
        if (GetIsExitsHide(l_UI))
        {
            RemoveHideUI(l_UI);
        }
        else if (GetIsExits(l_UI))
        {
            RemoveUI(l_UI);
        }

        UISystemEvent.Dispatch(l_UI, UIEvent.OnDestroy);  //派发OnDestroy事件
        try
        {
            l_UI.OnDestroy();
        }
        catch (Exception e)
        {
            Debug.LogError("OnDestroy :" + e.ToString());
        }
        Destroy(l_UI.gameObject);
    }
示例#19
0
    /// <summary>
    /// 创建UI,存放在Hide列表中
    /// </summary>
    /// <param name="UIName"></param>
    /// <returns></returns>
    public static UIWindowBase CreateUIWindow(string UIName)
    {
        var uiTmp  = GameObjectManager.Instance.CreatePoolObject(UIName, m_instance);
        var uiBase = uiTmp.GetComponent <UIWindowBase>();

        //派发OnInit事件
        UISystemEvent.Dispatch(uiBase, UIEvent.OnInit);

        try
        {
            uiBase.Init(GetUIID(UIName));
        }
        catch (Exception e)
        {
            Debug.LogError("OnInit Exception: " + e.ToString());
        }

        AddHideUI(uiBase);

        m_uiLayerManager.SetLayer(uiBase);      //设置层级

        return(uiBase);
    }
示例#20
0
    public static void DestroyUI(UIWindowBase UI)
    {
        Debug.Log("UIManager DestroyUI " + UI.name);

        if (GetIsExitsHide(UI))
        {
            RemoveHideUI(UI);
        }
        else if (GetIsExits(UI))
        {
            RemoveUI(UI);
        }

        UISystemEvent.Dispatch(UI, UIEvent.OnDestroy);  //派发OnDestroy事件
        try
        {
            UI.Dispose();
        }
        catch (Exception e)
        {
            Debug.LogError("OnDestroy :" + e.ToString());
        }
        Destroy(UI.gameObject);
    }
示例#21
0
 //开始调用进入动画
 public void StartEnterAnim(UIWindowBase UIbase, UICallBack callBack, params object[] objs)
 {
     UISystemEvent.Dispatch(UIbase, UIEvent.OnStartEnterAnim);
     StartCoroutine(UIbase.EnterAnim(EndEnterAnim, callBack, objs));
 }
示例#22
0
 //刷新是主动调用
 public void Refresh(params object[] args)
 {
     UISystemEvent.Dispatch(this, UIEvent.OnRefresh);
     OnRefresh();
 }