212 lines
8.2 KiB
C#
212 lines
8.2 KiB
C#
using GeometryTD.Definition;
|
|
|
|
namespace GeometryTD.UI
|
|
{
|
|
public class RepoFormUseCase : IUIUseCase
|
|
{
|
|
public RepoFormRawData CreateInitialModel()
|
|
{
|
|
BackpackInventoryData sample = GameEntry.PlayerInventory != null
|
|
? GameEntry.PlayerInventory.GetInventorySnapshot()
|
|
: SampleInventory();
|
|
return new RepoFormRawData
|
|
{
|
|
Inventory = sample
|
|
};
|
|
}
|
|
|
|
public bool TryAssembleTower(long muzzleItemId, long bearingItemId, long baseItemId)
|
|
{
|
|
if (GameEntry.PlayerInventory == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return GameEntry.PlayerInventory.TryAssembleTower(
|
|
muzzleItemId,
|
|
bearingItemId,
|
|
baseItemId,
|
|
out _);
|
|
}
|
|
|
|
public static BackpackInventoryData SampleInventory()
|
|
{
|
|
BackpackInventoryData inventory = new BackpackInventoryData
|
|
{
|
|
Gold = 500
|
|
};
|
|
|
|
MuzzleCompItemData muzzle = new MuzzleCompItemData
|
|
{
|
|
InstanceId = 10001,
|
|
ConfigId = 1,
|
|
Name = "元素枪口",
|
|
Rarity = RarityType.Green,
|
|
Endurance = 90f,
|
|
IsAssembledIntoTower = true,
|
|
AttackDamage = new[] { 20, 30, 40, 50, 80 },
|
|
DamageRandomRate = 0.05f,
|
|
AttackMethodType = AttackMethodType.NormalBullet,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Fire }
|
|
};
|
|
inventory.MuzzleComponents.Add(muzzle);
|
|
inventory.MuzzleComponents.Add(new MuzzleCompItemData
|
|
{
|
|
InstanceId = 10002,
|
|
ConfigId = 2,
|
|
Name = "控制枪口",
|
|
Rarity = RarityType.Blue,
|
|
Endurance = 100f,
|
|
IsAssembledIntoTower = false,
|
|
AttackDamage = new[] { 30, 50, 70, 90, 100 },
|
|
DamageRandomRate = 0.01f,
|
|
AttackMethodType = AttackMethodType.NormalBullet,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Ice, TagType.FreezeMask }
|
|
});
|
|
inventory.MuzzleComponents.Add(new MuzzleCompItemData
|
|
{
|
|
InstanceId = 10003,
|
|
ConfigId = 3,
|
|
Name = "穿透枪口",
|
|
Rarity = RarityType.Purple,
|
|
Endurance = 97f,
|
|
IsAssembledIntoTower = false,
|
|
AttackDamage = new[] { 50, 55, 60, 80, 90 },
|
|
DamageRandomRate = 0.02f,
|
|
AttackMethodType = AttackMethodType.NormalBullet,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Pierce, TagType.Crit }
|
|
});
|
|
|
|
BearingCompItemData bearing = new BearingCompItemData
|
|
{
|
|
InstanceId = 20001,
|
|
ConfigId = 1,
|
|
Name = "元素轴承",
|
|
Rarity = RarityType.Green,
|
|
Endurance = 95f,
|
|
IsAssembledIntoTower = true,
|
|
RotateSpeed = new[] { 10f, 12f, 13f, 14f, 15f },
|
|
AttackRange = new[] { 2f, 2f, 2f, 2f, 2f },
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Fire }
|
|
};
|
|
inventory.BearingComponents.Add(bearing);
|
|
inventory.BearingComponents.Add(new BearingCompItemData
|
|
{
|
|
InstanceId = 20002,
|
|
ConfigId = 2,
|
|
Name = "控制轴承",
|
|
Rarity = RarityType.Blue,
|
|
Endurance = 100f,
|
|
IsAssembledIntoTower = false,
|
|
RotateSpeed = new[] { 20f, 25f, 30f, 32f, 35f },
|
|
AttackRange = new[] { 6f, 6.5f, 7f, 8f, 8f },
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Ice, TagType.Shatter }
|
|
});
|
|
inventory.BearingComponents.Add(new BearingCompItemData
|
|
{
|
|
InstanceId = 20003,
|
|
ConfigId = 3,
|
|
Name = "穿透轴承",
|
|
Rarity = RarityType.Purple,
|
|
Endurance = 96f,
|
|
IsAssembledIntoTower = false,
|
|
RotateSpeed = new[] { 60f, 70f, 80f, 90f, 100f },
|
|
AttackRange = new[] { 4f, 4.5f, 5f, 5.5f, 6f },
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Pierce, TagType.Overpenetrate }
|
|
});
|
|
|
|
BaseCompItemData baseComp = new BaseCompItemData
|
|
{
|
|
InstanceId = 30001,
|
|
ConfigId = 1,
|
|
Name = "元素底座",
|
|
Rarity = RarityType.Green,
|
|
Endurance = 88f,
|
|
IsAssembledIntoTower = true,
|
|
AttackSpeed = new[] { 2f, 1.5f, 1f, 0.8f, 0.7f },
|
|
AttackPropertyType = AttackPropertyType.Fire,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Fire }
|
|
};
|
|
inventory.BaseComponents.Add(baseComp);
|
|
inventory.BaseComponents.Add(new BaseCompItemData
|
|
{
|
|
InstanceId = 30002,
|
|
ConfigId = 2,
|
|
Name = "控制底座",
|
|
Rarity = RarityType.Blue,
|
|
Endurance = 100f,
|
|
IsAssembledIntoTower = false,
|
|
AttackSpeed = new[] { 4f, 4.2f, 4.4f, 4.6f, 4.8f },
|
|
AttackPropertyType = AttackPropertyType.Ice,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Ice, TagType.AbsoluteZero }
|
|
});
|
|
inventory.BaseComponents.Add(new BaseCompItemData
|
|
{
|
|
InstanceId = 30003,
|
|
ConfigId = 3,
|
|
Name = "穿透底座",
|
|
Rarity = RarityType.Purple,
|
|
Endurance = 95f,
|
|
IsAssembledIntoTower = false,
|
|
AttackSpeed = new[] { 1f, 1f, 1f, 1f, 1f },
|
|
AttackPropertyType = AttackPropertyType.Physics,
|
|
Constraint = string.Empty,
|
|
Tags = new[] { TagType.Pierce, TagType.Execution }
|
|
});
|
|
|
|
TowerItemData tower = new TowerItemData
|
|
{
|
|
InstanceId = 90001,
|
|
Name = "测试防御塔-A",
|
|
Rarity = RarityType.Green,
|
|
MuzzleComponentInstanceId = muzzle.InstanceId,
|
|
BearingComponentInstanceId = bearing.InstanceId,
|
|
BaseComponentInstanceId = baseComp.InstanceId,
|
|
Stats = new TowerStatsData
|
|
{
|
|
AttackDamage = new[] { 200, 220, 240, 260, 300 },
|
|
DamageRandomRate = 0f,
|
|
RotateSpeed = new[] { 200f, 210f, 220f, 230f, 240f },
|
|
AttackRange = new[] { 4.5f, 4.7f, 4.9f, 5.1f, 5.3f },
|
|
AttackSpeed = new[] { 1.5f, 1.2f, 1.1f, 1.0f, 0.8f },
|
|
AttackMethodType = AttackMethodType.NormalBullet,
|
|
AttackPropertyType = AttackPropertyType.Fire,
|
|
Tags = new[] { TagType.Fire, TagType.BurnSpread }
|
|
}
|
|
};
|
|
inventory.Towers.Add(tower);
|
|
|
|
inventory.Towers.Add(new TowerItemData
|
|
{
|
|
InstanceId = 90002,
|
|
Name = "测试防御塔-B",
|
|
Rarity = RarityType.Blue,
|
|
MuzzleComponentInstanceId = 0,
|
|
BearingComponentInstanceId = 0,
|
|
BaseComponentInstanceId = 0,
|
|
Stats = new TowerStatsData
|
|
{
|
|
AttackDamage = new[] { 200, 220, 240, 260, 300 },
|
|
DamageRandomRate = 0.1f,
|
|
RotateSpeed = new[] { 200f, 210f, 220f, 230f, 240f },
|
|
AttackRange = new[] { 4.5f, 4.7f, 4.9f, 5.1f, 5.3f },
|
|
AttackSpeed = new[] { 1.5f, 1.2f, 1.1f, 1.0f, 0.8f },
|
|
AttackMethodType = AttackMethodType.NormalBullet,
|
|
AttackPropertyType = AttackPropertyType.Physics,
|
|
Tags = new[] { TagType.Pierce }
|
|
}
|
|
});
|
|
|
|
return inventory;
|
|
}
|
|
}
|
|
}
|