98 lines
2.8 KiB
C#
98 lines
2.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Framework.Wrapper;
|
|
using Gameplay.Level;
|
|
using UnityEngine;
|
|
using CharacterInfo = Gameplay.Net.CharacterInfo;
|
|
|
|
/// <summary>
|
|
/// pvp防守方上阵数据
|
|
/// </summary>
|
|
public class PVPDefenderData
|
|
{
|
|
public List<PVPUnitRuntimeInfo> pvpRuntimeUnitInfos = new();
|
|
|
|
public void Init(List<PVPUnitInfo> unitInfos, List<CharacterInfo> characterInfos,
|
|
List<Gameplay.Net.VehicleInfo> vehicleInfos)
|
|
{
|
|
pvpRuntimeUnitInfos.Clear();
|
|
int characterIndex = 0;
|
|
int vehicleIndex = 0;
|
|
for (int i = 0; i < unitInfos.Count; i++)
|
|
{
|
|
var unitInfo = unitInfos[i];
|
|
CharacterInfo characterInfo = null;
|
|
Gameplay.Net.VehicleInfo vehicleInfo = null;
|
|
switch (unitInfo.type)
|
|
{
|
|
case Unit.UnitType.Charactor:
|
|
characterInfo = characterInfos[characterIndex];
|
|
characterIndex++;
|
|
break;
|
|
case Unit.UnitType.Vehicle:
|
|
vehicleInfo = vehicleInfos[vehicleIndex];
|
|
vehicleIndex++;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
PVPUnitRuntimeInfo runtimeInfo = new(unitInfo, characterInfo, vehicleInfo);
|
|
pvpRuntimeUnitInfos.Add(runtimeInfo);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单个战斗单元上阵数据,该数据会序列化后发送给服务器
|
|
/// </summary>
|
|
public class PVPUnitInfo
|
|
{
|
|
public int unitID;
|
|
|
|
public Unit.UnitType type = Unit.UnitType.Charactor;
|
|
|
|
public int cellIndex;
|
|
|
|
public LevelData.AIType aiType = LevelData.AIType.BasicAI;
|
|
|
|
public LevelData.AttachAIType attachAIType = LevelData.AttachAIType.ChainAI;
|
|
|
|
// public byte[] Serialize()
|
|
// {
|
|
//
|
|
// }
|
|
//
|
|
// public void DeSerialize()
|
|
// {
|
|
//
|
|
// }
|
|
}
|
|
|
|
public class PVPUnitRuntimeInfo
|
|
{
|
|
public int unitID { get; private set; }
|
|
|
|
public Unit.UnitType type { get; private set; }
|
|
|
|
public int cellIndex { get; private set; }
|
|
|
|
public LevelData.AIType aiType { get; private set; }
|
|
|
|
public LevelData.AttachAIType attachAIType { get; private set; }
|
|
|
|
public Gameplay.Net.CharacterInfo characterInfo { get; private set; }
|
|
public Gameplay.Net.VehicleInfo vehicleInfo { get; private set; }
|
|
|
|
public PVPUnitRuntimeInfo(PVPUnitInfo pvpUnitInfo, Gameplay.Net.CharacterInfo characterInfo,
|
|
Gameplay.Net.VehicleInfo vehicleInfo)
|
|
{
|
|
unitID = pvpUnitInfo.unitID;
|
|
type = pvpUnitInfo.type;
|
|
cellIndex = pvpUnitInfo.cellIndex;
|
|
aiType = pvpUnitInfo.aiType;
|
|
attachAIType = pvpUnitInfo.attachAIType;
|
|
this.characterInfo = characterInfo;
|
|
this.vehicleInfo = vehicleInfo;
|
|
}
|
|
} |