68 lines
1.6 KiB
C#
68 lines
1.6 KiB
C#
|
using Cal.DataTable;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
public struct MonsterKillInfo:IDisposable
|
|||
|
{
|
|||
|
public int totalAmount;
|
|||
|
public int currAmount;
|
|||
|
|
|||
|
private Action<BattleBase,Team> action;
|
|||
|
private BattleBase parent;
|
|||
|
private Team team;
|
|||
|
private bool isExecuting;
|
|||
|
|
|||
|
public MonsterKillInfo(BattleBase parent,Team team) : this()
|
|||
|
{
|
|||
|
this.parent = parent;
|
|||
|
this.team = team;
|
|||
|
}
|
|||
|
|
|||
|
public void Init(int count, Action<BattleBase,Team> action)
|
|||
|
{
|
|||
|
currAmount = 0;
|
|||
|
totalAmount = count;
|
|||
|
this.action = action;
|
|||
|
}
|
|||
|
public void UpdateAmount(int count)
|
|||
|
{
|
|||
|
if (isExecuting)
|
|||
|
{
|
|||
|
Log.Error($"重复:{this}");
|
|||
|
}
|
|||
|
currAmount += count;
|
|||
|
if (currAmount >= totalAmount)
|
|||
|
{
|
|||
|
isExecuting = true;
|
|||
|
action?.Invoke(parent,team);
|
|||
|
}
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return $"currAmount:{currAmount} totalAmount:{totalAmount} parent:{parent.battleType} action:{action}";
|
|||
|
}
|
|||
|
|
|||
|
public void Dispose()
|
|||
|
{
|
|||
|
totalAmount = 0;
|
|||
|
currAmount = 0;
|
|||
|
action = null;
|
|||
|
parent = null;
|
|||
|
team = null;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class MainStoryBattle : BattleBase
|
|||
|
{
|
|||
|
public override BattleType battleType => BattleType.MainStory;
|
|||
|
|
|||
|
public long startTime;
|
|||
|
|
|||
|
|
|||
|
public MainStory mainStory;
|
|||
|
|
|||
|
}
|
|||
|
}
|