Ejemplo n.º 1
0
    /// <summary>
    /// 打开指定弹框
    /// </summary>
    /// <param name="sceneType"></param>
    /// <param name="sceneArgs">场景参数</param>
    public void ShowPanel(PanelName panelName, params object[] sceneArgs)
    {
        if (panels.ContainsKey(panelName))
        {
            //Debug.LogError("该面板已打开!");
            current = panels[panelName];
            current.gameObject.SetActive(false);
            current.OnInit(sceneArgs);
            current.OnShowing();
            ViewMgr.Instance.SetLayer(current.gameObject, LayerType.Panel);
        }
        else
        {
            GameObject go    = new GameObject(panelName.ToString());
            Type       mType = Type.GetType(panelName.ToString());
            PanelBase  pb    = go.AddComponent(mType) as PanelBase; //sceneType.tostring等于该场景的classname
            //pb.gameObject.SetActive(false);

            pb.OnInit(sceneArgs);
            panels.Add(pb.type, pb);
            MaskStyle(pb);
            panelsDethList.Add(pb);
            ChangePanelDeth(pb);
            current = pb;
            pb.OnShowing();
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = Vector3.one;
            go.transform.localRotation = Quaternion.identity;
        }
        StartShowPanel(current, current.PanelShowStyle, true);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 打开指定弹框
 /// </summary>
 /// <param name="sceneType"></param>
 /// <param name="panelArgs">场景参数</param>
 public void ShowPanel(PanelName panelName, params object[] panelArgs)
 {
     MainPanel.isXIALUO = false;
     if (panels.ContainsKey(panelName))
     {
         LogUtils.Log(LogUtils.LogColor.Red, panelName, " 该面板已打开!");
         current = panels[panelName];
     }
     else
     {
         GameObject go    = new GameObject(panelName.ToString());
         Type       mType = Type.GetType(panelName.ToString());
         PanelBase  pb    = go.AddComponent(mType) as PanelBase; //sceneType.tostring等于该场景的classname
         pb.OnInit(panelArgs);
         pb.isShow = true;
         panels.Add(pb.type, pb);
         MaskStyle(pb);
         panelsDethList.Add(pb);
         ChangePanelDeth(pb);
         current = pb;
         pb.OnShowing();
         go.transform.localPosition = Vector3.zero;
         go.transform.localScale    = Vector3.one;
         go.transform.localRotation = Quaternion.identity;
         StartShowPanel(current, current.PanelShowStyle, true);
     }
 }
Ejemplo n.º 3
0
        protected override void OnShown()
        {
            base.OnShown();

            isShow = true;
            MakeFullScreen();
            contentPane = UIPackage.CreateObject(mainPackage, pcname).asCom;
            contentPane.SetSize(GRoot.inst.width, GRoot.inst.height);
            gameObjectName = pname.ToString();
            sortingOrder   = panelMgr.GetTopSortingOrder(layer);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 用于打开已经打开过的页面隐藏显示或者靠后页面置顶
    /// </summary>
    /// <param name="panelName"></param>
    /// <param name="_args"></param>
    public void OpenHidePanel(PanelName panelName, params object[] _args)
    {
        string name = panelName.ToString();

        if (Paneldict.ContainsKey(name))
        {
            GetPanel(name).curView.transform.SetAsLastSibling();
            if (GetPanel(name).curView.gameObject.activeInHierarchy)
            {
                return;
            }
            GetPanel(name).args = _args;
            GetPanel(name).OnShow();
            return;
        }
        else
        {
            Debug.LogError(panelName.ToString() + ":页面打开失败,页面不存在。尝试使用OpenPanel<T>打开页面");
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 隐藏页面
    /// </summary>
    /// <param name="panelName"></param>
    public void HidePanel(PanelName panelName)
    {
        PanelBase panel = GetPanel(panelName);

        if (panel != null)
        {
            if (!panel.curView.activeInHierarchy)
            {
                return;
            }
            RomoveToList(panelName.ToString());
            panel.OnHide();
        }
    }
Ejemplo n.º 6
0
    public void OpenPanel(PanelName panelNmae, params object[] _args)
    {
        string name = panelNmae.ToString();

        if (dict.ContainsKey(name))
        {
            GetPanel(name).skin.transform.SetAsLastSibling();
            if (GetPanel(name).skin.gameObject.activeInHierarchy)
            {
                return;
            }
            GetPanel(name).skin.SetActive(true);
            GetPanel(name).args = _args;
            GetPanel(name).OnOpen();
            return;
        }
    }
Ejemplo n.º 7
0
 public void ClosePanel(PanelName _name)
 {
     ClosePanel(_name.ToString());
 }
Ejemplo n.º 8
0
 public PanelBase GetPanel(PanelName _name)
 {
     return(GetPanel(_name.ToString()));
 }
Ejemplo n.º 9
0
 public Panel GetPanel(PanelName name)
 {
     return(this.GetPanel(name.ToString()));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 通过枚举获得panel
 /// </summary>
 /// <param name="_name"></param>
 /// <returns></returns>
 private PanelBase GetPanel(PanelName _name)
 {
     return(GetPanel(_name.ToString()));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Show Panel
 /// </summary>
 /// <param name="sceneType"></param>
 /// <param name="sceneArgs"></param>
 public void ShowPanel(PanelName panelName, params object[] sceneArgs)
 {
     if (panels.ContainsKey(panelName)){
         Debug.LogError("Panel has been shown");
         current = panels[panelName];
         current.gameObject.SetActive(false);
         current.OnInit(sceneArgs);
         current.OnShowing();
         LayerMgr.GetInstance().SetLayer(current.gameObject, LayerType.Panel);
     }
     else{
         GameObject go = new GameObject(panelName.ToString());
         //sceneType.tostring = classname in the current scene
         current = UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(go, "Assets/Script/Core/View/PanelMgr.cs (94,14)", panelName.ToString()) as PanelBase;
         current.gameObject.SetActive(false);
         current.OnInit(sceneArgs);
         panels.Add(current.type, current);
         current.OnShowing();
         LayerMgr.GetInstance().SetLayer(current.gameObject, LayerType.Panel);
         go.transform.localPosition = Vector3.zero;
         go.transform.localScale = Vector3.one;
         go.transform.localRotation = Quaternion.identity;
         MaskStyle(current);
     }
     StartShowPanel(current, current.PanelShowStyle,true);
 }