mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-16 08:25:20 +01:00
59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using FullInspector;
|
|
using MoleMole.Config;
|
|
|
|
namespace MoleMole
|
|
{
|
|
public class MaxAvatarClassInTeamChallenge : BaseLevelChallenge
|
|
{
|
|
public readonly int targetNum;
|
|
|
|
public readonly EntityClass targetClass;
|
|
|
|
[ShowInInspector]
|
|
protected bool _finished;
|
|
|
|
public MaxAvatarClassInTeamChallenge(LevelChallengeHelperPlugin helper, LevelChallengeMetaData metaData)
|
|
: base(helper, metaData)
|
|
{
|
|
_finished = false;
|
|
targetNum = _metaData.paramList[0];
|
|
targetClass = (EntityClass)_metaData.paramList[1];
|
|
}
|
|
|
|
public override void OnAdded()
|
|
{
|
|
_finished = IsFinished();
|
|
}
|
|
|
|
public override bool IsFinished()
|
|
{
|
|
int amountOfSameEntityClassAvatarInTeam = GetAmountOfSameEntityClassAvatarInTeam(targetClass);
|
|
return amountOfSameEntityClassAvatarInTeam >= targetNum;
|
|
}
|
|
|
|
public override string GetProcessMsg()
|
|
{
|
|
if (IsFinished())
|
|
{
|
|
return "Succ";
|
|
}
|
|
return "Fail";
|
|
}
|
|
|
|
private int GetAmountOfSameEntityClassAvatarInTeam(EntityClass entityClass)
|
|
{
|
|
List<AvatarDataItem> memberList = Singleton<LevelScoreManager>.Instance.memberList;
|
|
int num = 0;
|
|
foreach (AvatarDataItem item in memberList)
|
|
{
|
|
if (item.ClassId == (int)entityClass)
|
|
{
|
|
num++;
|
|
}
|
|
}
|
|
return num;
|
|
}
|
|
}
|
|
}
|