Beispiel #1
0
    public override void Hide()
    {
        base.Hide();

        CameraManager.instance.mainCamera.gameObject.SetActive(true);

        //List<NetData._ItemData> itemList = NetData.instance.GetUserInfo().GetTypeItemList(eItemType.USE);
        //for (int i = 0; i < itemList.Count; i++)
        //{
        //    if (!itemList[i].IsNewItem)
        //        continue;

        //    itemList[i].IsNewItem = false;//나갈때 다 꺼져
        //}

        SceneManager.instance.SetAlram(AlramIconType.CATEGORY, false);

        if (ReOpenPanel != null)
        {
            ReOpenPanel.Show(ReOpenPanel.GetParams());
        }
        else
        {
            Debug.LogWarning("ReOpenPanel is Null");
            UIMgr.OpenTown();
        }
    }
Beispiel #2
0
    public void ShowUIPanel(UIPanelID id)
    {
        //1:判断是否是已显示的UI面板
        if (showedUIPanelDict.ContainsKey(id))//当前UI已经在显示列表中了,就直接返回
        {
            return;
        }

        //2:判断此面板是否已创建,没有则加载 预置体,创建面板,显示+管理起来

        //通过ID获取需要显示的UI,从 AllUIdict 容器中获取(打开过的面板,会在 AllUIdict 引用)
        UIBasePanel tmpUIPanel = GetUIPanelFromAllDict(id);

        if (tmpUIPanel == null)                                   //如果在容器中没有此UI,就从资源中读取ui预制体,并创建
        {
            string prefabPath = UIPrefabPath.getUIPrefabPath(id); //通过ID,获取对应的路径

            if (!string.IsNullOrEmpty(prefabPath))
            {
                GameObject prefab = Resources.Load <GameObject>(prefabPath);          //加载资源

                if (prefab != null)                                                   //资源加载成功
                {
                    GameObject goWillShowUIPanelObj = GameObject.Instantiate(prefab); //克隆游戏对象到层次面板上

                    tmpUIPanel = goWillShowUIPanelObj.GetComponent <UIBasePanel>();   //获取此对象上的UI

                    prefab = null;
                }
                else
                {
                    Debug.LogError("资源" + prefabPath + "不存在");
                }
            }
        }

        //3:更新显示其它的UI
        UpdateOtherUIPanelState(tmpUIPanel);

        // 将创建的新的UIPanel添加到字典中(如果有,就等于无此操作)
        allUIPanelDict[id]    = tmpUIPanel;
        showedUIPanelDict[id] = tmpUIPanel;

        //  改变当前的显示层级,放在外面更加灵活,可能会修改面板的显示层级
        if (tmpUIPanel != null)
        {
            Transform root = GetRootNodeOfPanel(tmpUIPanel);//获取UI所对应的根节点

            //放入根节点下面
            UIUtils.addChildToParent(root, tmpUIPanel.transform);//放入根节点下面
        }

        //4:显示当前UI
        tmpUIPanel.Show();

        curDisplayUIPanel = tmpUIPanel;
    }
    public override void OnDestroy()
    {
        base.OnDestroy();

        if (beforePanel != null)
        {
            beforePanel.Show();
        }
    }
    public override void Hide()
    {
        base.Hide();

        if (reOpenPanel != null)
        {
            reOpenPanel.Show(reOpenPanel.GetParams());
        }
        else
        {
            UIMgr.OpenDungeonPanel();
        }
    }
    static public void setHudPanelVisible(bool b)
    {
        UIBasePanel hudPanel = GetHUDBasePanel();

        if (hudPanel != null)
        {
            if (b)
            {
                hudPanel.Show();
            }
            else
            {
                hudPanel.Hide();
            }
        }
    }
    /// <summary>
    /// UIOpen 전용 함수 for UIBasePanel
    /// 해당UI가 없으면 생성하고, 있으면 Show해주도록 한다.
    /// </summary>
    /// <param name="uiPath">생성하려는 UI의 경로 (UI의 고유이름으로 등록됨) ["UI/" + uiPath]</param>
    static public GameObject Open(string uiPath, params object[] args)
    {
        instance.CheckUIRoot();

        UIBasePanel panel = UIMgr.instance.FindInShowing(uiPath);

        if (null != panel)
        {
            // 숨겨져있다면 보여지도록 하고, 보여지는 상태에서 호출되면 재갱신이라고 보면됨.
            panel.Show(args);
        }
        else
        {
            GameObject newPanelGO = ResourceMgr.InstantiateUI(uiPath);
            if (null != newPanelGO)
            {
                panel = newPanelGO.GetComponent <UIBasePanel>();
                if (null == panel)
                {
                    Debug.LogError("UIBasePanel이 존재하지 않는 UI객체입니다.");
                }

                panel.gameObject.SetActive(true);
                panel.name = uiPath;
                panel.SetParams(args);
            }
        }

        if (panel is MissionPanel || panel is ResultRewardStarPanel)
        {
            instance.SetShadowLight(false);
        }

        //if (!uiPath.Contains("SystemPopup")  && 0 == instance.SceneUIMgr.CurPopupId)//현재 팝업이 켜져있는것
        //{
        //    UIBasePanel systemPanel = GetUIBasePanel("UIPopup/SystemPopup");
        //    if (systemPanel != null)
        //        (systemPanel as SystemPopup).OnEnd();
        //    else
        //        instance.SceneUIMgr.CurPopupId = -1;
        //}

        return(panel.gameObject);
    }
Beispiel #7
0
    // 쿠폰팝업창
    //void OnClickCoupon()
    //{
    //    CouponPopup.SetActive(true);

    //    UIButton CouponAccept = transform.FindChild("CouponPopup/BtnCouponAccept").GetComponent<UIButton>();
    //    UIButton CouponClose = transform.FindChild("CouponPopup/BtnCouponClose").GetComponent<UIButton>();


    //    EventDelegate.Set(CouponAccept.onClick, OnClickCouponAccept);
    //    EventDelegate.Set(CouponClose.onClick, delegate () { CouponPopup.SetActive(false); });
    //}

    /// <summary> 적 유닛 Hp,이름 표기 유무 </summary>
    //void OnClickShowNpcHead()
    //{
    //    option.ShowNpcHead = BtnShowHead.value;
    //}

    //void OnClickInviteFriend()
    //{
    //    option.BlockFriendInvite = BtnInviteFriend.value;
    //}
    //void OnClickParty()
    //{
    //    option.BlockParty = BtnParty.value;
    //}

    //void OnClickCouponAccept()
    //{
    //    string number = InputCoupon.value;
    //    if (string.IsNullOrEmpty(number))
    //        return;

    //    //   Debug.Log(number);
    //}


    public override void Close()
    {
        base.Close();

        Time.timeScale = 1;

        //저장하고 끄기
        option.SaveOptionData();

        //if (openType==1)
        //{
        //    ChatPopup chat = SceneManager.instance.ChatPopup(false);
        //    chat.Show();
        //    return;
        //}

        if (TownState.TownActive)
        {
            UIBasePanel townPanel = UIMgr.GetTownBasePanel();
            if (townPanel != null)
            {
                townPanel.Show();
            }
        }
        else
        {
            UIBasePanel hudPanel = UIMgr.GetHUDBasePanel();
            if (hudPanel != null)
            {
                (hudPanel as InGameHUDPanel).SetJoyActive(true);
            }

            //ChatPopup chat = SceneManager.instance.ChatPopup(false);
            UIBasePanel chat = UIMgr.GetUIBasePanel("UIPopup/ChatPopup");
            if (chat != null)
            {
                (chat as ChatPopup).OnShow();
            }
        }
    }
    /// <summary>
    /// 뒤로가기 시 발생할 이벤트
    /// </summary>
    //public override void Hide()
    public override void Hide()
    {
        CameraManager.instance.mainCamera.gameObject.SetActive(true);

        byte state = StagePopup.OnClosePopup();

        if (state == 0)//팝업 객체가 꺼져있다면 종료. 아니면 무시 시킨다.
        {
            base.Hide();
            if (reOpenPanel != null)
            {
                reOpenPanel.Show(reOpenPanel.GetParams());
            }
            else
            {
                UIMgr.OpenTown();
            }
        }
        else if (state == 1)
        {
            SetArrow();
        }
    }
    public override void Close()
    {
        CameraManager.instance.mainCamera.gameObject.SetActive(true);
        base.Close();

        //타운패널을 제외하고 호출됬을경우 종료했을때 다시 호출해 줘야함
        if (BasePanel != null)
        {
            //마계의탑은 정보를 받아와야하므로 따로호출해줘야함
            if (BasePanel.ToString().Contains("Tower"))
            {
                UIMgr.OpenTowerPanel();
            }
            else
            {
                BasePanel.Show(BasePanel.GetParams());
            }
        }
        else
        {
            UIMgr.OpenTown();
        }
    }