Exemple #1
0
    public LevelExtraPB LevelExtra; //关卡额外要求

    public VisitLevelVo(VisitingLevelRulePB pb, RepeatedField <VisitingLevelPlotRulePB> plotRule, RepeatedField <VisitingLevelInfoRulePB> infoRule)
    {
        LevelId         = pb.LevelId;
        BeforeLevelId   = pb.BeforeLevelId;
        AfterLevelId    = pb.AfterLevelId;
        LevelMark       = pb.LevelMark;
        LevelInfoId     = pb.LevelInfoId;
        NpcId           = (PlayerPB)((LevelId / 1000) % 10);
        LevelType       = pb.Type;
        Abilitys        = pb.Abilities;
        ChapterGroup    = pb.ChapterGroup;
        DepartmentLevel = pb.LevelExtra.DepartmentLevel;
        ItemMax         = pb.ItemMax;
        FansMax         = pb.FansMax;
        PreLevelId      = pb.BeforeLevelId;
        NextLevelId     = pb.AfterLevelId;
        Awards          = pb.Awards;
        LevelExtra      = pb.LevelExtra;
        LevelPlot       = pb.LevelPlot;
        ChapterBackdrop = pb.ChapterBackdrop;
        Sweetness       = pb.Sweetness;
        if (LevelType == LevelTypePB.Story)
        {
            StoryId = LevelMark;
        }
        else if (LevelType == LevelTypePB.Value) //数值关卡
        {
            ItemMax = pb.ItemMax;
            FansMax = pb.FansMax;

            StringBuilder sb = new StringBuilder();
            sb.Append("关键字:");
            List <string> list = new List <string>();
            foreach (var fan in FansMax)
            {
                string name = GlobalData.DepartmentData.GetFans(fan.Key).Name;
                sb.Append(name);
                sb.Append("、");
                list.Add("<color='#DC88A7'>" + name + "</color>");
            }

            FansKeyword = sb.ToString();
            FansKeyword = FansKeyword.Substring(0, FansKeyword.Length - 2);

            foreach (var rulePb in plotRule)
            {
                if (rulePb.LevelPlotType == LevelPlotTypePB.PlotFans && rulePb.PlotId == LevelPlot[0])
                {
                    FansDescription = rulePb.PlotDesc;
                    FansDescription = string.Format(FansDescription, list.ToArray());
                }
                else if (rulePb.LevelPlotType == LevelPlotTypePB.PlotPlayer && rulePb.PlotId == LevelPlot[1])
                {
                    HeroDescription = rulePb.PlotDesc;

                    List <string> temp = new List <string>();
                    for (int i = 0; i < Abilitys.Count; i++)
                    {
                        temp.Add($"<color=#DC88A7>{ViewUtil.AbilityToString(Abilitys[i])}</color>");
                    }
                    HeroDescription = string.Format(HeroDescription, temp.ToArray());
                }
            }

            foreach (var infoRulePb in infoRule)
            {
                if (infoRulePb.InfoId == LevelInfoId && infoRulePb.InfoType == 0)
                {
                    LevelDescription = infoRulePb.LevelDesc;
                    LevelName        = infoRulePb.LevelName;
                    break;
                }
            }
        }



        Hardness = pb.GameType;
        var values = new List <int>();

        values.AddRange(pb.StarSource.Values);
        if (values.Count > 0)
        {
            _maxPower = values[values.Count - 1];
        }
        else
        {
            _maxPower = 100;
        }
    }
Exemple #2
0
    public void SetData(LevelPB pb, RepeatedField <LevelPlotRulePB> plotRule, RepeatedField <LevelInfoRulePB> infoRule,
                        List <List <LevelData> > localDataList)
    {
        _localDataList = localDataList;

        MaxStar       = 3;
        Hardness      = pb.GameType;
        LevelMark     = pb.LevelMark;
        LevelInfoId   = pb.LevelInfoId;
        ChapterGroup  = pb.ChapterGroup;
        LevelPlot     = pb.LevelPlot;
        LevelId       = pb.LevelId;
        BeforeLevelId = pb.BeforeLevelId;
        AfterLevelId  = pb.AfterLevelId;
        LevelType     = pb.Type;
        Abilitys      = pb.Abilities;
        Awards        = pb.Awards;

        DepartmentLevel = pb.LevelExtra.DepartmentLevel;


//        if (pb.LevelCoordinate.Count > 0)
//            Positon = new Vector2(pb.LevelCoordinate[0], -pb.LevelCoordinate[1]);



        if (LevelType == LevelTypePB.Story)
        {
            StoryId = LevelMark;
        }
        else if (LevelType == LevelTypePB.Value) //数值关卡
        {
            ItemMax = pb.ItemMax;
            FansMax = pb.FansMax;

            StringBuilder sb = new StringBuilder();
            sb.Append("关键字:");
            List <string> list = new List <string>();
            foreach (var fan in FansMax)
            {
                string name = GlobalData.DepartmentData.GetFans(fan.Key).Name;
                sb.Append(name);
                sb.Append("、");
                list.Add("<color='#DC88A7'>" + name + "</color>");
            }

            FansKeyword = sb.ToString();
            FansKeyword = FansKeyword.Substring(0, FansKeyword.Length - 2);

            foreach (var rulePb in plotRule)
            {
                if (rulePb.PlotId == LevelPlot[0])
                {
                    if (rulePb.LevelPlotType == LevelPlotTypePB.PlotFans)
                    {
                        FansDescription = rulePb.PlotDesc;

                        FansDescription = string.Format(FansDescription, list.ToArray());
                    }
                    else if (rulePb.LevelPlotType == LevelPlotTypePB.PlotPlayer)
                    {
                        HeroDescription = rulePb.PlotDesc;

                        List <string> temp = new List <string>();
                        for (int i = 0; i < Abilitys.Count; i++)
                        {
                            temp.Add($"<color=#DC88A7>{ViewUtil.AbilityToString(Abilitys[i])}</color>");
                            // temp.Add($"<color='#DC88A7'>" + ViewUtil.AbilityToString(Abilitys[i]) + "</color>");
                        }

                        HeroDescription = string.Format(HeroDescription, temp.ToArray());
                    }
                }
            }

            foreach (var infoRulePb in infoRule)
            {
                if (infoRulePb.InfoId == LevelInfoId && infoRulePb.InfoType == 0)
                {
                    LevelDescription = infoRulePb.LevelDesc;
                    LevelName        = infoRulePb.LevelName;
                }
            }
        }

        MaxChallangeTimes = pb.Max;
        //EventId = pb.EventId;
        var values = new List <int>();

        values.AddRange(pb.StarSource.Values);
        if (values.Count > 0)
        {
            MaxPower = values[values.Count - 1];
        }
        else
        {
            MaxPower = 100;
        }
    }