yyl
3 天以前 6faba902086330e9c2c49948b10e5aeecb893bcd
Main/System/Battle/BattleManager.cs
@@ -126,6 +126,30 @@
        List<GameNetPackBasic> packQueueSnapshot = new List<GameNetPackBasic>(packQueue);
        List<GameNetPackBasic> newPackList = ParseBattlePackList(string.Empty, packQueueSnapshot);
        Action printNewPack = () =>
        {
            string temp = "After AnalysisPackQueueAndDistribute newPackList count: " + newPackList.Count + "\n";
            foreach (var pack in newPackList)
            {
                if (pack is CustomHB426CombinePack b426Pack)
                {
                    temp += "  pack type is " + pack.GetType().Name + " tag is " + (b426Pack.startTag != null ? b426Pack.startTag.Tag : "null") + "\n";
                }
                else if (pack is CustomB421ActionPack b421Pack)
                {
                    temp += "  pack type is " + pack.GetType().Name + " guid is " + b421Pack.guid + "\n";
                }
                else
                {
                    temp += "  pack type is " + pack.GetType().Name + "\n";
                }
            }
            Debug.LogWarning(temp);
        };
        printNewPack();
        // HashSet<int> skipIndexes = new HashSet<int>();
        // // 这里已经是按照Dequeue的顺序了
@@ -210,127 +234,15 @@
    public static List<GameNetPackBasic> ParseBattlePackList(string guid, List<GameNetPackBasic> packQueueSnapshot)
    {
        bool wrong = false;
        var list = CustomHB426CombinePack.CombineToSkillPackFromList(guid, packQueueSnapshot);
        string str = "ParseBattlePackList \n";
        for (int i = 0; i < list.Count; i++)
        {
            str += "  " + list[i].GetType().Name + "\n";
        }
        BattleDebug.LogError(str);
        return list;
        List<GameNetPackBasic> newPackList = new List<GameNetPackBasic>();
        HB421_tagMCTurnFightObjAction b421Pack = null;
        for (int i = 0; i < packQueueSnapshot.Count; i++)
        {
           GameNetPackBasic pack = packQueueSnapshot[i];
            if (null == b421Pack)
            {
                if (pack is HB421_tagMCTurnFightObjAction _b421)
                {
                    b421Pack = _b421;
                }
                else
                {
                    newPackList.Add(pack);
                }
                continue;
            }
            else
            {
                List<GameNetPackBasic> b421List = new List<GameNetPackBasic>();
                bool find = false;
                for (int k = i; k < packQueueSnapshot.Count; k++/*, Debug.LogError(k + " : is plusing")*/)
                {
                    GameNetPackBasic maybeB426Pack = packQueueSnapshot[k];
                    if (maybeB426Pack is HB426_tagSCTurnFightTag b426Pack)
                    {
                        // Debug.LogError(k + " : find b426 " + maybeB426Pack.packUID + " sign " + b426Pack.Sign + " tag " + b426Pack.Tag);
                        if (b426Pack.Sign == 0)
                        {
                            find = true;
                            List<GameNetPackBasic> b426List = new List<GameNetPackBasic>();
                            b426List.Add(b426Pack);
                            for (int j = k + 1; j < packQueueSnapshot.Count; j++)
                            {
                                GameNetPackBasic maybeB426EndPack = packQueueSnapshot[j];
                                if (maybeB426EndPack is HB426_tagSCTurnFightTag b426EndPack)
                                {
                                    // Debug.LogError(j + " : find b426 end pack : " + b426EndPack.packUID + " sign " + b426EndPack.Sign + " tag " + b426EndPack.Tag);
                                    if (b426EndPack.Tag == b426Pack.Tag)
                                    {
                                        if (b426EndPack.Sign == 1)
                                        {
                                            b426List.Add(maybeB426EndPack);
                                            k = j;
                                            i = k;
                                            break;
                                        }
                                        else
                                        {
                                            Debug.LogError("错误的Sign == 1");
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        //  新的一对
                                    }
                                }
                                else
                                {
                                    b426List.Add(maybeB426EndPack);
                                    k = j;
                                    i = k;
                                }
                            }
                            //   这里面的b421还没处理
                            List<GameNetPackBasic> combinedList = CustomHB426CombinePack.CombineToSkillPackFromList(guid, b426List);
                            b421List.AddRange(combinedList);
                        }
                        else
                        {
                            wrong = true;
                            Debug.LogError("错误的b426 分析有问题 " + b426Pack.packUID);
                        }
                    }
                    else
                    {
                        if (!find)
                        {
                            newPackList.Add(maybeB426Pack);
                            i = k;
                        }
                        else
                        {
                            if (maybeB426Pack is HB421_tagMCTurnFightObjAction _b421)
                            {
                                i = k - 1;
                                break;
                            }
                            b421List.Add(maybeB426Pack);
                            i = k;
                        }
                    }
                }
                CustomB421ActionPack actionPack = CustomB421ActionPack.CreateB421ActionPack(guid, b421List);
                newPackList.Add(actionPack);
                b421Pack = null;
           }
        }
        if (wrong)
        {
            string output = string.Empty;
            for (int f = 0; f < packQueueSnapshot.Count; f++)
            {
                output += (packQueueSnapshot[f].packUID  + "&" + packQueueSnapshot[f].GetType().ToString() + "|");
            }
            Debug.LogError(output);
        }
        return newPackList;
    }
    //  专属于主线战斗的派发
@@ -596,6 +508,7 @@
    // 4-继续战斗          -   玩家主线战斗中(包含主线小怪、主线boss),前端表现完后端同步的战斗片段后,可再回复该值,后端会根据战斗逻辑及流程自动回复下一段的战斗片段封包,一直循环
    public void MainFightRequest(byte reqType, uint reqValue = 0)
    {
        // Debug.LogError("MainFightRequest reqType " + reqType + " reqValue " + reqValue);
        CB413_tagCSMainFightReq req = new CB413_tagCSMainFightReq();
        req.ReqType = reqType;
        req.ReqValue = reqValue;