yyl
2025-08-08 3bc28c54e82721b7858eaa3507f0f65a4041736d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using UnityEngine;
 
//    只有主线战斗用到 所以这里可能会放一些主线的特殊处理 
 
public class HandModeOperationAgent : IOperationAgent
{
    protected StoryBattleField storyBattleField;
 
    public HandModeOperationAgent(BattleField battleField) : base(battleField)
    {
        storyBattleField = battleField as StoryBattleField;
    }
 
    public override void Run()
    {
        base.Run();
    }
 
    //    通过主界面的按钮推动(调用)DoNext
    public override void DoNext()
    {
        Debug.LogError("HandModeOperationAgent DoNext");
 
        base.DoNext();
 
        //    当前没有在播放战斗录像
        if (!battleField.recordPlayer.IsPlaying())
        {
            Debug.LogError("HandModeOperationAgent DoNext  1");
            // 没有下一个包可以发了
            if (!BattleManager.Instance.DistributeNextPackage())
            {
                //    请求下一个战斗包 或者检查战斗是否结束
                // ReqType; // 0-停止战斗回城;1-设置消耗倍值;2-挑战关卡小怪;3-挑战关卡boss;4-继续战斗;
 
                //    如果在休息 点一下之后应该是挑战小怪或者挑战关卡
                //  如果在战斗 战斗是否结束/战斗持续中 结束应该是挑战下一关 持续应该是继续战斗
 
 
                //    检查一下锤子的消耗
                //FightPoint             用于记录消耗战锤倍数,小于等于1时默认1倍,大于1时为对应消耗倍值,0418刷新类型22
                Debug.LogError("HandModeOperationAgent DoNext  2");
                ulong costRate = PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.FightPoint);
 
                ulong cost = (costRate > 1 ? costRate : 1) * 1; // 1是默认消耗
 
 
 
                Debug.LogError("HandModeOperationAgent DoNext  3");
                byte reqType;
 
                if (storyBattleField.battleState == StoryBattleState.Break)
                {
                    reqType = 2;
                }
                else if (storyBattleField.battleState == StoryBattleState.Battle)
                {
                    if (battleField.IsBattleEnd())
                    {
                        reqType = 2; // 继续挑战小怪
                    }
                    else
                    {
                        reqType = 4; // 继续战斗
                    }
                }
                else
                {
                    Debug.LogError("unknown battle state");
                    return;
                }
 
                Debug.LogError("HandModeOperationAgent DoNext  4   reqType is " + reqType);
 
                //    检查一下锤子的消耗
                if (!ItemLogicUtility.CheckCurrencyCount(41, cost, true))
                {
                    return;
                }
 
                //    如果请求的是2 说明要初始化一下战场
                BattleManager.Instance.MainFightRequest(reqType);
 
                //  初始化战场后本来不会自动打 那么就需要再请求一次4继续战斗 来开始战斗
                if (reqType == 2)
                {
                    BattleManager.Instance.MainFightRequest(4);
                }
            }
        }
        else
        {
            Debug.LogError("action doesnt finish, wait a moment please");
        }
    }
 
 
}