Esempio n. 1
0
    public override void PrepareEndGame(bool win = false)
    {
        base.PrepareEndGame(win);

        //튜토리얼 챕터 클리어 강제로나갈 수도 있으니 저장시켜준다.
        //if (G_GameInfo.GameMode == GAME_MODE.SINGLE && StageId == 101 && UIMgr.instance.CurTutorial == TutorialType.CHAPTER)
        //    PlayerPrefs.SetInt(string.Format("Tutorial{0}", NetData.instance.GetUserInfo()._charUUID), (int)TutorialType.CHAPTER_REWARD);

        if (win && 0 < SingleGameState.StageQuestList.Count)
        {
            //3이 별갯수
            int[] TempStar = new int[] {
                SingleGameState.StageQuestList[0].IsClear ? 1 : 0,
                SingleGameState.StageQuestList[1].IsClear ? 1 : 0,
                SingleGameState.StageQuestList[2].IsClear ? 1 : 0
            };

            int stageNum = (int)(StageId % 100);
            if (10 <= stageNum)//챕터 클리어.
            {
                NetData.ClearSingleStageData clearData = null;
                if (NetData.instance.GetUserInfo().ClearSingleStageDic.TryGetValue(StageId, out clearData))
                {
                    if (clearData.Clear_0 + clearData.Clear_1 + clearData.Clear_2 <= 0)
                    {
                        SingleGameState.IsChapterClear = true;
                    }
                }
                else//없는것이 맞다.
                {
                    SingleGameState.IsChapterClear = true;
                }
            }

            NetworkClient.instance.SendPMsgStageCompleteC((int)StageId, win ? 1 : 0, TempStar);
        }

        Debug.Log("SingleGameState.IsChapterClear = " + SingleGameState.IsChapterClear);
    }
    /// <summary> 테이블 데이터 셋팅 </summary>
    void SetDataTable(List <DataChapter> dataList, uint addStageId)
    {
        Dictionary <uint, NetData.ClearSingleStageData> clearStageDic = NetData.instance.GetUserInfo().ClearSingleStageDic;

        bool curStage = false;

        int chapCount  = addStageId >= 10000 ? 6 : (int)SystemDefine.MaxChapter;
        int stageCount = addStageId >= 10000 ? 3 : (int)SystemDefine.MaxChapter;

        //일반 스테이지
        for (int i = 0; i < /*SystemDefine.MaxChapter*/ chapCount; i++)
        {
            int chapterNumber   = i + 1;
            int totalClearGrade = 0;

            List <DataStage> stageList = new List <DataStage>();

            for (int j = 0; j < /*SystemDefine.MaxStage*/ stageCount; j++)
            {
                DataStage data = new DataStage();

                byte[] clearGrade = new byte[3];
                short  state      = 0;//1;//클리어한 지역.

                uint stageId    = addStageId + (uint)((chapterNumber * 100) + (j + 1));
                int  clearCount = 0;
                NetData.ClearSingleStageData clearStageData = null;
                if (!clearStageDic.TryGetValue(stageId, out clearStageData))
                {
                    //추후에 살려놔야함 지금은 모든걸 오픈
                    if (!curStage)
                    {
                        curStage = true;
                        state    = 0;
                    }
                    else//활성화 되지 않은 지역.
                    {
                        state = -1;
                    }
                }
                else
                {
                    state = 1;

                    clearGrade[0] = clearStageData.Clear_0;
                    clearGrade[1] = clearStageData.Clear_1;
                    clearGrade[2] = clearStageData.Clear_2;

                    totalClearGrade += clearStageData.Clear_0 + clearStageData.Clear_1 + clearStageData.Clear_2;
                    clearCount       = clearStageData.DailyClearCount;
                }

                if (data.InitStageData(stageId, clearGrade, state, clearCount))
                {
                    stageList.Add(data);
                }
                else//어려움일 경우 이럴수 있다 아니라면 문제가있는것.
                {
                    break;
                }
            }

            if (stageList.Count <= 0)
            {
                break;
            }

            NetData.StageStarRewardData rewardData = new NetData.StageStarRewardData();
            DataChapter dataChap = new DataChapter(chapterNumber, stageList[0]._StageLowData.type == 2, rewardData, stageList);//totalClearGrade,
            dataList.Add(dataChap);
        }
    }
    /// <summary> 조건 체크. </summary>
    bool CheckContentsLink(Item.ContentsListInfo info, bool isClick)
    {
        bool isEnter = false;

        switch (info.ContentsType)
        {
        case 1:    //조합

            break;

        case 11:    //차관
            if (_LowDataMgr.instance.GetEtcTableValue <uint>(EtcID.PvpEnterLv) <= NetData.instance.UserLevel)
            {
                isEnter = true;
            }
            break;

        case 12:    //난투장
            List <DungeonTable.FreefightTableInfo> freeList = _LowDataMgr.instance.GetLowDataFreeFightList();
            for (int i = 0; i < freeList.Count; i++)
            {
                if (NetData.instance.UserLevel < freeList[i].MinenterLv || freeList[i].MaxenterLv < NetData.instance.UserLevel)
                {
                    continue;
                }

                isEnter = true;
                break;
            }

            break;

        case 2:    //모험 일반
        case 3:    //모험 어려움
            uint require = 0;
            NetData.ClearSingleStageData stageData = null;
            if (!NetData.instance.GetUserInfo().ClearSingleStageDic.TryGetValue(info.ContentsIdx, out stageData))
            {
                DungeonTable.StageInfo stageInfo = _LowDataMgr.instance.GetStageInfo(info.ContentsIdx);
                if (stageInfo != null && stageInfo.RequireStageId != null && 0 < stageInfo.RequireStageId.list.Count)
                {
                    List <string> conList = stageInfo.RequireStageId.list;
                    for (int i = 0; i < conList.Count; i++)
                    {
                        uint conIdx = uint.Parse(conList[i]);
                        if (NetData.instance.GetUserInfo().ClearSingleStageDic.TryGetValue(conIdx, out stageData))    //이전 스테이지 클리어해야함.
                        {
                            continue;
                        }

                        require = 1;    //진행 불가능
                        break;
                    }
                }
            }

            if (require <= 0)
            {
                isEnter = true;
            }

            break;

        case 5:    //보스레이드
            DungeonTable.SingleBossRaidInfo bossRaid = _LowDataMgr.instance.GetSingleBossRaidLimitLevel(info.ContentsIdx);
            if (bossRaid.levelLimit <= NetData.instance.UserLevel)
            {
                isEnter = true;
            }
            break;

        case 6:    //멀티 보스레이드
            DungeonTable.MultyBossRaidInfo multyBossRaid = _LowDataMgr.instance.GetLowDataMultyBossInfo(info.ContentsIdx);
            if (multyBossRaid.levelLimit <= NetData.instance.UserLevel)
            {
                isEnter = true;
            }
            break;

        case 10:    //길드
            if (0 < NetData.instance.GetUserInfo()._GuildId)
            {
                isEnter = true;
            }
            break;

        case 4:    //마계의탑
        case 7:    //콜로세움
        case 8:    //골드 던전
        case 9:    //경험치 던전
            byte idx = 0;
            if (info.ContentsType == 4)
            {
                idx = (byte)9;
            }
            else if (info.ContentsType == 7)
            {
                idx = (byte)1;
            }
            else if (info.ContentsType == 8)
            {
                idx = (byte)3;
            }
            else if (info.ContentsType == 9)
            {
                idx = (byte)2;
            }

            DungeonTable.ContentsOpenInfo content = _LowDataMgr.instance.GetFirstContentsOpenInfo(idx);
            if (content.ConditionType1 == 2 && content.ConditionValue1 <= NetData.instance.GetUserInfo()._TotalAttack)
            {
                isEnter = true;
            }
            else if (content.ConditionType1 == 1 && content.ConditionValue1 <= NetData.instance.UserLevel)
            {
                isEnter = true;
            }
            break;
        }

        if (!isEnter)
        {
            if (isClick)
            {
                SceneManager.instance.SetNoticePanel(NoticeType.Message, 0, _LowDataMgr.instance.GetStringCommon(712));
            }
            return(false);
        }

        return(true);
    }