Exemple #1
0
    // 获取下一个关卡的id
    public int GetNextLevel(int curLevelID, ChapterType chapterType)
    {
        if (curLevelID == 0)
        {
            // 获取第一个关卡
            foreach (var item in MissionConstConfigLoader.Data)
            {
                if (item.Value.MissionDegree == (int)chapterType)
                {
                    return(item.Key);
                }
            }
        }
        else
        {
            bool find = false;
            foreach (var item in MissionConstConfigLoader.Data)
            {
                if (item.Key == curLevelID)
                {
                    find = true;
                    continue;
                }

                if (find && (item.Value.MissionDegree == (int)chapterType))
                {
                    return(item.Key);
                }
            }
        }

        return(0);
    }
Exemple #2
0
    // 当前章节是否通关(当前章节的所有关卡都已通关)
    public bool IsFullPass(int chapterID, ChapterType chapterType)
    {
        bool find = false;

        foreach (var item in MissionConstConfigLoader.Data)
        {
            MissionConstConfig cfg = item.Value;
            if (cfg.Chapter == chapterID && cfg.MissionDegree == (int)chapterType)
            {
                find = true;
                LevelInfo info = GetLevelInfo(cfg.Id);
                if (info == null || info.star <= 0)
                {
                    return(false);
                }
            }
        }

        if (!find)
        {
            return(false);
        }

        return(true);
    }
Exemple #3
0
    // 此章节是否可以选择(存在当前章节的关卡,或者上一个章节已通关)
    public bool IsChapterEnable(int chapterID, ChapterType chapterType)
    {
        // 第一个场景必然是可以打的(TODO 考虑精英副本)
        if (chapterID == 1)
        {
            return(true);
        }

        // 当前章节有已通关的关卡
        List <LevelInfo> list;

        if (LevelInfo.TryGetValue(chapterID, out list))
        {
            foreach (var item in list)
            {
                MissionConstConfig cfg = MissionConstConfigLoader.GetConfig(item.levelID);
                if (cfg.MissionDegree == (int)chapterType)
                {
                    return(true);
                }
            }
        }

        // 上一个关卡已通关,则此关卡是可以打的
        if (IsFullPass(chapterID - 1, chapterType))
        {
            return(true);
        }
        return(false);
    }
Exemple #4
0
    public void OpenChapterView()
    {
        line = ChapterType.Main;
        //字段赋值
        GetUserInfo();
        if (_mainMaxCount >= _curVersionsMaxCount)
        {
            m_chapterList.Init(_curVersionsMaxCount + 1, _passChapterID, _unlockMaxChapterID);
        }
        //红点
        ShowChapterBtnRedDot();
        ShowOADBtnRedDot();
        //进入章节动画
        CutInUIChapter();
        StartCoroutine(CutIn(1));

        //Debug.Log(TimeHelper.loginServerDateTime);//登陆时的服务器时间  用户登陆时的时间
        //Debug.Log(TimeHelper.ServerDateTimeNow);//服务器当前的时间  实时更新

        ////Debug.Log(TimeHelper.ServerTime(TimeHelper.Now()));//服务器当前的时间戳
        //var time = TimeHelper.ServerTime(TimeHelper.LoginServerTime);//登陆时的服务器时间戳

        //Debug.Log($"服务器当前的时间戳{TimeHelper.Now()}");
        //Debug.Log($"登陆时的服务器时间戳{TimeHelper.LoginServerTime}");
        //var time111 = TimeHelper.GetDateTime(0, 6, 0, 0);
        //Debug.Log($"6dian cai neng {time111}");
    }
Exemple #5
0
        public void Save(ChapterType cType, String filename)
        {
            switch (cType)
            {
            case ChapterType.XML:
                SaveXML(filename);
                break;

            case ChapterType.OGM:
                SaveOGM(filename);
                break;
            }
        }
Exemple #6
0
        public void Load(ChapterType cType, String filename)
        {
            switch (cType)
            {
            case ChapterType.XML:
                LoadXML(filename);
                break;

            case ChapterType.OGM:
                LoadOGM(filename);
                break;
            }
        }
Exemple #7
0
    // 获取总星数
    public int GetFullChapterStar(int chapterID, ChapterType chapterType)
    {
        int star = 0;

        foreach (var item in MissionConstConfigLoader.Data)
        {
            if (item.Value.Chapter == chapterID && item.Value.MissionDegree == (int)chapterType)
            {
                star += 3;
            }
        }
        return(star);
    }
Exemple #8
0
    public async void SwitchAnima(ChapterType chapterType)
    {
        Mask.gameObject.SetActive(true);

        switch (chapterType)
        {
        case ChapterType.Main:
            //全部移动到左边
            ChapterHelper.SetActive(m_chapterList.gameObject, true);
            m_chapterList.Init(_curVersionsMaxCount + 1, _passChapterID, _unlockMaxChapterID);

            m_OADList.transform.DOLocalMoveX(1242, 0.3f);
            ZjbBtn_canvasGroup.DOFade(0, switchBtnPosDutation);
            (ZjbBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondStartPosY, switchBtnPosDutation);
            diamondBtn_canvasGroup.DOFade(1, switchBtnPosDutation);
            (diamondBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondEndPosY, switchBtnPosDutation);

            m_chapterList.transform.DOLocalMoveX(0, 0.3f).OnComplete(() =>
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
            });

            StartCoroutine(CutIn(2));
            await UniTask.Delay(300);

            break;

        case ChapterType.OAD:

            ChapterHelper.SetActive(m_OADList.gameObject, true);
            m_chapterList.transform.DOLocalMoveX(-1242, 0.3f);
            ZjbBtn_canvasGroup.DOFade(1, switchBtnPosDutation);
            (ZjbBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondEndPosY, switchBtnPosDutation);
            diamondBtn_canvasGroup.DOFade(0, switchBtnPosDutation);
            (diamondBtn_canvasGroup.transform as RectTransform).DOAnchorPosY(diamondStartPosY, switchBtnPosDutation);

            m_OADList.transform.DOLocalMoveX(0, 0.3f).OnComplete(() =>
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
                Mask.gameObject.SetActive(false);
            });
            await UniTask.Delay(300);

            m_chapterList.Clear();
            break;
        }
    }
        public static Chapter CreateChapter(ChapterType type)
        {
            switch (type)
            {
            case ChapterType.ConvexHull:
                return(new ConvexHullChapter());

            case ChapterType.LineIntersection:
                return(new LineSegmentIntersectionChapter());

            case ChapterType.Triangulation:
                return(new TriangulationChapter());
            }
            return(null);
        }
Exemple #10
0
    // 获取最后一个副本的位置
    public int GetLastLevelID(ChapterType chapterType)
    {
        int maxLevelID = 0;

        foreach (var chapter in LevelInfo)
        {
            foreach (var level in chapter.Value)
            {
                MissionConstConfig cfg = MissionConstConfigLoader.GetConfig(level.levelID);
                if (cfg.MissionDegree == (int)chapterType && level.levelID > maxLevelID)
                {
                    maxLevelID = level.levelID;
                }
            }
        }

        return(maxLevelID);
    }
Exemple #11
0
    // 是否已经领取对应章节的星级奖励
    public bool HasChapterAward(int chapterID, ChapterType chapterType, int index)
    {
        List <int> list;

        if (chapterType == ChapterType.NORMAL)
        {
            List <int> fullList = new List <int>();

            foreach (var item in ChapterAwardConfigLoader.Data)
            {
                if (item.Value.ChapterID == chapterID)
                {
                    if (item.Value.Degree == (int)ChapterType.NORMAL)
                    {
                        fullList.Add(item.Key);
                    }
                }
            }

            // 普通章节领取情况
            ChapterAwardList.TryGetValue(chapterID, out list);
            return(list != null && list.Count > index && fullList.Count > index && list.IndexOf(fullList[index]) != -1);
        }
        else
        {
            List <int> fullList = new List <int>();

            foreach (var item in ChapterAwardConfigLoader.Data)
            {
                if (item.Value.ChapterID == chapterID)
                {
                    if (item.Value.Degree == (int)ChapterType.ELITE)
                    {
                        fullList.Add(item.Key);
                    }
                }
            }

            // 精英章节领取情况
            EliteChapterAwardList.TryGetValue(chapterID, out list);
            return(list != null && list.Count > index && fullList.Count > index && list.IndexOf(fullList[index]) != -1);
        }
    }
Exemple #12
0
    private void OnMsgFubenStarAwardInfo(byte[] buffer)
    {
        PFubenStarAwardInfo ret = Net.Deserialize <PFubenStarAwardInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.FUBEN_STAR_AWARD_INFO))
        {
            return;
        }

        foreach (var item in ret.fubenGiftList)
        {
            int chapterID = item.chapterId;

            List <int> awardIdList      = new List <int>();
            List <int> eliteAwardIdList = new List <int>();

            foreach (var retAward in item.starAwards)
            {
                ChapterType chapterType = (ChapterType)retAward.llDegree;
                foreach (var retAwardID in retAward.obtainIds)
                {
                    if (chapterType == (int)ChapterType.NORMAL)
                    {
                        // 普通副本对应奖励已领取
                        awardIdList.Add(retAwardID);
                    }
                    else
                    {
                        // 精英副本对应奖励已领取
                        eliteAwardIdList.Add(retAwardID);
                    }
                }
            }

            ChapterAwardList[chapterID]      = awardIdList;
            EliteChapterAwardList[chapterID] = eliteAwardIdList;
        }

        UIManager.Instance.RefreshWindow <UINewPVEEntranceView>();
    }
Exemple #13
0
    // 获取当前章节的星数
    public int GetChapterStar(int chapterID, ChapterType chapterType)
    {
        int star = 0;
        List <LevelInfo> list;

        LevelInfo.TryGetValue(chapterID, out list);
        if (list == null)
        {
            return(0);
        }

        foreach (var item in list)
        {
            MissionConstConfig cfg = MissionConstConfigLoader.GetConfig(item.levelID);
            if (cfg.MissionDegree == (int)chapterType)
            {
                // 只有精英和boss关卡统计星级
                star += item.star;
            }
        }

        return(star);
    }
Exemple #14
0
    // 请求领取关卡星级奖励
    public void RequestGetChapterAward(int awardID, int chapterID, ChapterType chapterType)
    {
        PCMInt data = new PCMInt();

        data.arg = awardID;

        NetworkManager.Instance.Send(eCommand.OBTAIN_FUBEN_STAR_AWARD, data, (buffer) => {
            PAwardPointList ret = Net.Deserialize <PAwardPointList>(buffer);
            if (!Net.CheckErrorCode(ret.errorCode, eCommand.OBTAIN_FUBEN_STAR_AWARD))
            {
                return;
            }

            // 领取奖励成功

            List <ItemInfo> itemList = new List <ItemInfo>();
            foreach (var item in ret.awardPoits)
            {
                UserManager.Instance.OnAddUserExp(item.awExp);

                foreach (var itemData in item.awardItems)
                {
                    ItemInfo itemInfo = new ItemInfo();
                    itemInfo.Deserialize(itemData);
                    itemList.Add(itemInfo);
                }
            }

            // 实际添加物品
            UserManager.Instance.AddItem(itemList, true);

            // 显示获得新物品
            if (itemList.Count > 0)
            {
                UIManager.Instance.OpenWindow <UIGetItemView>(itemList);
            }

            // 更新现存数据
            List <int> list;
            if (chapterType == ChapterType.NORMAL)
            {
                ChapterAwardList.TryGetValue(chapterID, out list);
                if (list == null)
                {
                    list = new List <int>();
                    ChapterAwardList[chapterID] = list;
                }
            }
            else
            {
                EliteChapterAwardList.TryGetValue(chapterID, out list);
                if (list == null)
                {
                    list = new List <int>();
                    EliteChapterAwardList[chapterID] = list;
                }
            }

            list.Add(awardID);
            UIManager.Instance.RefreshWindow <UINewPVEEntranceView>();
            UIManager.Instance.RefreshWindow <UIPVEStarAwardView>();
            EventDispatcher.TriggerEvent(EventID.EVENT_UI_MAIN_REFRESH_VALUE);
        });
    }
Exemple #15
0
    // 一场战斗胜利,更新level中的星级数据,并且更新最新关卡
    public void OnBattleResult(PBattleReport data)
    {
        if (data.pos == null)
        {
            Log.Error("OnBattleResult error, PBattleReport 没有设置 data.pos");
            return;
        }

        int levelID            = data.pos.x;
        MissionConstConfig cfg = MissionConstConfigLoader.GetConfig(levelID);

        if (cfg == null)
        {
            return;
        }

        UserManager.Instance.SP = Mathf.Max(0, UserManager.Instance.SP - cfg.StaminaCost);

        bool isAttacker = UserManager.Instance.EntityID == data.attackerId;

        if (isAttacker)
        {
            if (data.winner == eBattleSide.SIDE_DEFENSER)
            {
                // 输了
                UIManager.Instance.OpenWindow <UIPVEBattleResultFailView>();
                return;
            }
        }
        else
        {
            if (data.winner == eBattleSide.SIDE_ATTACKER)
            {
                // 输了
                UIManager.Instance.OpenWindow <UIPVEBattleResultFailView>();
                return;
            }
        }

        // 赢了
        LevelInfo info = GetLevelInfo(levelID);

        if (info != null)
        {
            info.star = data.star;
            ++info.fightCount;
        }
        else
        {
            AddLevelInfo(levelID, cfg.TimesLimit > 0 ? cfg.TimesLimit - 1 : 0, data.star);
        }

        ChapterType chapterType = (ChapterType)cfg.MissionDegree;

        if (chapterType == ChapterType.NORMAL)
        {
            LastLevelID = Mathf.Max(LastLevelID, levelID);
            int normalLastLevelID = GetLastLevelID(ChapterType.NORMAL);

            // 最后一个关卡打完后,自动跳到下一个
            if (levelID == normalLastLevelID)
            {
                CurrentSelectLevelID = GetNextLevel(levelID, chapterType);
            }
        }
        else if (chapterType == ChapterType.ELITE)
        {
            LastEliteLevelID = Mathf.Max(LastEliteLevelID, levelID);
            int eliteLastLevelID = GetLastLevelID(ChapterType.ELITE);

            // 最后一个关卡打完后,自动跳到下一个
            if (levelID == eliteLastLevelID)
            {
                CurrentSelectLevelID = GetNextLevel(levelID, chapterType);
            }
        }

        // 刷新副本界面
        UIManager.Instance.RefreshWindow <UINewPVEEntranceView>();

        // 战斗结果
        BattleResult = new BattleResultInfo();
        BattleResult.addPlayerExp = data.awdExp;
        BattleResult.star         = data.star;

        foreach (var item in data.awardPoits)
        {
            if (item.roleType == eRoleType.ROLE_LORD)
            {
            }
            else if (item.roleType == eRoleType.ROLE_HERO)
            {
                BattleResultHeroInfo heroInfo = new BattleResultHeroInfo();
                heroInfo.heroID = item.geter;
                heroInfo.addExp = item.awExp;
                BattleResult.heroInfo.Add(heroInfo);
            }

            foreach (var item2 in item.awardItems)
            {
                if (item2.type == eItem.CURRENCY)
                {
                    // 金钱
                    BattleResult.addMoney = item2.num;
                }
                else
                {
                    ItemInfo itemInfo = new ItemInfo();
                    itemInfo.Deserialize(item2);
                    BattleResult.itemInfo.Add(itemInfo);
                }
            }
        }

        UIManager.Instance.OpenWindow <UIPVEBattleResultView>();
    }
Exemple #16
0
    //章节番外切换按钮
    void OnClickOADBtn(ChapterType chapterType)
    {
        btn_chapter.enabled = false;
        btn_OAD.enabled     = false;
        GetUserInfo();//刷新数据
        if (chapterType == ChapterType.Main)
        {
            if (line == ChapterType.Main)
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
                return;
            }
            line = ChapterType.Main;

            btn_chapter.image.sprite     = selectBtn_sprite;
            btn_OAD.image.sprite         = noSelectBtn_sprite;
            chapterText.color            = selectText_Color;
            OADText.color                = noselectText_Color;
            chapterShadow.effectColor    = new Color(1f, 1f, 1f);
            chapterShadow.effectDistance = new Vector2(1, -2);
            OADShadow.effectColor        = new Color(63f / 255f, 119f / 255f, 188f / 255f);
            OADShadow.effectDistance     = new Vector2(2, 1);
            chapterShadow.enabled        = true;
            chapterOutLine.enabled       = false;
            OADShadow.enabled            = false;
            OADOutLine.enabled           = true;

            SwitchAnima(line);
            //动画后再清除
            //m_chapterList.Clear();
            //m_chapterList.Init(_mainMaxCount, _passChapterID, _unlockMaxChapterID);
        }
        else
        {//番外开启
            if (!StaticData.IsOpenFunction(10021))
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
                return;
            }
            if (line == ChapterType.OAD)
            {
                btn_chapter.enabled = true;
                btn_OAD.enabled     = true;
                return;
            }
            line = ChapterType.OAD;

            btn_chapter.image.sprite     = noSelectBtn_sprite;
            btn_OAD.image.sprite         = selectBtn_sprite;
            chapterText.color            = noselectText_Color;
            OADText.color                = selectText_Color;
            OADShadow.effectColor        = new Color(1f, 1f, 1f);
            OADShadow.effectDistance     = new Vector2(1, -2);
            chapterShadow.effectColor    = new Color(63f / 255f, 119f / 255f, 188f / 255f);
            chapterShadow.effectDistance = new Vector2(2, 1);
            chapterShadow.enabled        = false;
            chapterOutLine.enabled       = true;
            OADShadow.enabled            = true;
            OADOutLine.enabled           = false;

            SwitchAnima(line);
            ChapterHelper.SetActive(m_OADList.gameObject, true);
            //m_OADList.Clear();
            //m_OADList.Init(_OADMaxCount, OADid);
        }

        //用户信息
        //StaticData.playerInfoData.userInfo
        //Debug.Log("点击了切换章节按钮");
        ////通关请求
        //CSClearance cSClearance = new CSClearance() { SectionId = 1001 };
        //ProtocalManager.Instance().SendCSClearance(cSClearance, (SCEmptyClearance cs) => {}, (ErrorInfo e) => { Debug.Log("章节请求失败"); });
    }