public void Initialize(Transform saveParent)
    {
        OpenEvent = gameObject.AddComponent <UiOpenEvent>();

        SaveParent              = saveParent;
        transform.parent        = saveParent;
        transform.localPosition = StartPos;
        transform.localScale    = Vector3.one;


        for (int i = 0; i < DownValues.Length; i++)
        {
            UpValues[i].gameObject.GetComponent <TweenAlpha>().delay   = AcDelay + AcDuration;
            DownValues[i].gameObject.GetComponent <TweenAlpha>().delay = AcDelay + AcDuration;

            UpValues[i].gameObject.SetActive(false);
            DownValues[i].gameObject.SetActive(false);
        }

        for (int i = 0; i < MenuType.Length; i++)
        {
            MenuType[i].text = "0";
        }

        SetPowerTime(SceneManager.instance.RegenPowerTime);

        ///뒤로가기 버튼 눌렀을때 현재 페널에 알려준다.
        EventDelegate.Set(BackButton.onClick, delegate() {
            UIMgr.instance.Prev();
        });

        EventDelegate.Set(CategoryGo.GetComponent <UIEventTrigger>().onClick, () => {
            UIBasePanel cago = UIMgr.GetUIBasePanel("UIPanel/CategoryPanel");
            if (cago != null && cago.gameObject.activeSelf)
            {
                return;
            }

            if (CurPanel != null)
            {
                CurPanel.ObjectHide();
            }
            UIMgr.OpenCategoryPanel(CurPanel);
        });

        gameObject.SetActive(false);
    }
Esempio n. 2
0
    public override void Init()
    {
        base.Init();

        for (int i = 0; i < NoticeGo.Length; i++)
        {
            NoticeGo[i].SetActive(false);
        }

        NoticeDelay = new float[NoticeLbl.Length];
        for (int i = 0; i < NoticeLbl.Length; i++)
        {
            NoticeDelay[i]     = 1;
            NoticeLbl[i].color = new Color32(255, 255, 255, 0);
            NoticeLbl[i].text  = "";
        }

        UIHelper.CreateEffectInGame(NoticeGo[(int)NoticeType.Contents].transform.FindChild("Effect"), "Fx_UI_new_contents_01");
        EventDelegate.Set(NoticeGo[(int)NoticeType.Achiev].GetComponent <UIEventTrigger>().onClick,//업적페널 오픈.
                          delegate() {
            if (AchieveType <= 0 || !TownState.TownActive)
            {
                AchieveType    = 0;
                AchieveSubType = 0;
                AchieveLv      = 0;
                NoticeGo[(int)NoticeType.Achiev].SetActive(false);
                return;
            }

            NoticeGo[(int)NoticeType.Achiev].SetActive(false);
            //AchieveType = 0;
            AchieveSubType = 0;
            AchieveLv      = 0;
            if (uiMgr.IsActiveTutorial)    //튜토리얼중 무시한다.
            {
                return;
            }

            UIBasePanel check = uiMgr.GetCurPanel();
            if (check == null)
            {
                check = UIMgr.instance.GetSecondUI();
            }

            if (check == null)
            {
                return;
            }

            if (check.name.Contains("AchievePanel"))    //업적 페널에 있는데 업적이 갱신되서 클릭함 무시한다.
            {
                return;
            }

            if (check.name.Contains("TownPanel"))
            {
                check.Hide();
            }
            else
            {
                check.ObjectHide();
            }

            if (AchieveTabType == 0)
            {
                UIMgr.OpenAchievePanel(check, 0);
            }
            else
            {
                UIMgr.OpenAchievePanel(check, 1, (int)AchieveType);
            }

            if (_TownState != null && _TownState.MyHero != null)
            {
                _TownState.MyHero.ResetMoveTarget();
            }
        });

        for (int i = 0; i < GetMailSlotTf.Length; i++)
        {
            UIHelper.CreateInvenSlot(GetMailSlotTf[i].FindChild("root"));
        }

        EventDelegate.Set(NoticeGo[(int)NoticeType.Contents].transform.FindChild("Icon").GetComponent <UIEventTrigger>().onClick,
                          () => {
            NoticeGo[(int)NoticeType.Contents].SetActive(false);

            if (TownState.TownActive)
            {
                UIBasePanel basePanel = uiMgr.GetCurPanel();    //UIMgr.UIType.Default
                if (basePanel == null)
                {
                    basePanel = uiMgr.GetFirstUI();
                    if (basePanel == null)
                    {
                        basePanel = UIMgr.GetTownBasePanel();
                    }
                }

                if (basePanel != null)
                {
                    if (!basePanel.name.Contains("TownPanel"))
                    {
                        if (basePanel.ReturnType == PrevReturnType.Close)
                        {
                            basePanel.Close();
                        }
                        else
                        {
                            basePanel.Hide();
                        }
                    }
                    else if (!basePanel.IsHidePanel)
                    {
                        basePanel.OnSubTutorial();
                    }
                }
            }
            else
            {
                UIBasePanel resultPanel = UIMgr.GetUIBasePanel("UIPanel/ResultRewardStarPanel");
                if (resultPanel != null)
                {
                    (resultPanel as ResultRewardStarPanel).GotoTown();
                }
            }
        });
    }
    void OnClickContentsLink(Item.ContentsListInfo info)
    {
        if (info.ContentsLinkType == 1)//재료조합
        {
        }
        else if (info.ContentsLinkType == 2)//바로가기(던전)
        {
            if (!CheckContentsLink(info, true))
            {
                return;
            }

            bool isBasePanelHide = true;
            switch (info.ContentsType)
            {
            case 1:    //조합

                break;

            case 11:    //차관
                UIMgr.OpenArenaPanel();
                break;

            case 12:    //난투장
                UIMgr.OpenDogFight();
                break;

            case 2:    //모험 일반
            case 3:    //모험 어려움
                if (BasePanel != null && BasePanel is ChapterPanel)
                {
                    isBasePanelHide = false;
                    (BasePanel as ChapterPanel).SetStageInfoPopup(info.ContentsIdx);
                }

                if (isBasePanelHide)
                {
                    UIMgr.OpenChapter(null, info.ContentsIdx);
                }
                break;

            case 4:    //마계의탑
                UIMgr.OpenTowerPanel(info.ContentsIdx);
                break;

            case 5:    //보스레이드
                DungeonTable.SingleBossRaidInfo bossRaid = _LowDataMgr.instance.GetSingleBossRaidLimitLevel(info.ContentsIdx);
                UIMgr.OpenDungeonPanel(false, 0, GAME_MODE.RAID, bossRaid.Type);
                break;

            case 6:    //멀티 보스레이드
                DungeonTable.MultyBossRaidInfo multyBossRaid = _LowDataMgr.instance.GetLowDataMultyBossInfo(info.ContentsIdx);
                UIMgr.OpenDungeonPanel(false, 0, GAME_MODE.MULTI_RAID, multyBossRaid.Type);
                break;

            case 7:    //콜로세움
                UIMgr.OpenColosseumPanel(0);
                break;

            case 8:    //골드 던전
                UIMgr.OpenDungeonPanel(false, 0, GAME_MODE.SPECIAL_GOLD, 0);
                break;

            case 9:    //경험치 던전
                UIMgr.OpenDungeonPanel(false, 0, GAME_MODE.SPECIAL_EXP, 0);
                break;

            case 10:    //길드
                UIMgr.OpenGuildPanel();
                break;
            }

            if (isBasePanelHide && BasePanel != null)
            {
                BasePanel.ObjectHide();
            }

            Hide();
        }
    }