got app bulding with new unit types
This commit is contained in:
parent
e6cb367885
commit
6b7595ab77
|
|
@ -63,11 +63,11 @@ namespace Johnmagotchi.GameContent.Objects.UI
|
|||
if (HighlightedUnit == null) { return; }
|
||||
|
||||
Texture2D texture = UnitDisplayTexture;
|
||||
if (HighlightedUnit.stats.status.team == Unit.UnitTeam.ENEMY)
|
||||
if (HighlightedUnit.stats.status.team == Units.BattleObjects.UnitCurrentStatus.UnitTeam.ENEMY)
|
||||
{
|
||||
texture = EnemyDisplayTexture;
|
||||
}
|
||||
if (HighlightedUnit.team == UnitObject.UnitTeam.NPC)
|
||||
if (HighlightedUnit.stats.status.team == Units.BattleObjects.UnitCurrentStatus.UnitTeam.NPC)
|
||||
{
|
||||
texture = NpcDisplayTexture;
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ namespace Johnmagotchi.GameContent.Objects.UI
|
|||
// -----------------DRAW TEXT -----------------------------------------
|
||||
posX += (int)Math.Round(.05 * DISPLAY_WIDTH);
|
||||
posY += (15 * ScreenManager.BASE_ZOOM_LEVEL);
|
||||
DrawText(posX, posY, HighlightedUnit.name);
|
||||
DrawText(posX, posY, HighlightedUnit.stats.Name);
|
||||
posY += (15 * ScreenManager.BASE_ZOOM_LEVEL);
|
||||
DrawText(posX, posY, HighlightedUnit.playerClassEnum.ToString());
|
||||
posX += (int)Math.Round(.05 * DISPLAY_WIDTH);
|
||||
|
|
|
|||
|
|
@ -22,76 +22,76 @@ namespace Johnmagotchi.GameContent.Units
|
|||
|
||||
return listA;
|
||||
}
|
||||
public static List<UnitObject> LoadBaseUnits() {
|
||||
List<UnitObject> unitList = new List<UnitObject>();
|
||||
System.Console.WriteLine("PATH: {0}", Directory.GetCurrentDirectory());
|
||||
var path = "..\\..\\..\\Data\\BattleObjects\\UnitDefinitions.csv";
|
||||
List<string> listA = new List<string>();
|
||||
List<string> listB = new List<string>();
|
||||
System.Console.WriteLine("path: {0} ", path);
|
||||
//public static List<UnitObject> LoadBaseUnits() {
|
||||
// List<UnitObject> unitList = new List<UnitObject>();
|
||||
// System.Console.WriteLine("PATH: {0}", Directory.GetCurrentDirectory());
|
||||
// var path = "..\\..\\..\\Data\\BattleObjects\\UnitDefinitions.csv";
|
||||
// List<string> listA = new List<string>();
|
||||
// List<string> listB = new List<string>();
|
||||
// System.Console.WriteLine("path: {0} ", path);
|
||||
|
||||
// these let us resolve which column is which
|
||||
int IdIndex = -1;
|
||||
int NameIndex = -1;
|
||||
int ClassIndex = -1;
|
||||
int isUniqueIndex = -1;
|
||||
int HealthIndex = -1;
|
||||
int AttackIndex = -1;
|
||||
int DefenseIndex = -1;
|
||||
int SpeedIndex = -1;
|
||||
int MovementIndex = -1;
|
||||
int MovementTypeIndex = -1;
|
||||
// // these let us resolve which column is which
|
||||
// int IdIndex = -1;
|
||||
// int NameIndex = -1;
|
||||
// int ClassIndex = -1;
|
||||
// int isUniqueIndex = -1;
|
||||
// int HealthIndex = -1;
|
||||
// int AttackIndex = -1;
|
||||
// int DefenseIndex = -1;
|
||||
// int SpeedIndex = -1;
|
||||
// int MovementIndex = -1;
|
||||
// int MovementTypeIndex = -1;
|
||||
|
||||
bool AreColumnIndexesSet = false;
|
||||
// bool AreColumnIndexesSet = false;
|
||||
|
||||
using (var reader = new StreamReader(path))
|
||||
{
|
||||
// using (var reader = new StreamReader(path))
|
||||
// {
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
var line = reader.ReadLine();
|
||||
var values = line.Split(',');
|
||||
// while (!reader.EndOfStream)
|
||||
// {
|
||||
// var line = reader.ReadLine();
|
||||
// var values = line.Split(',');
|
||||
|
||||
if (AreColumnIndexesSet == false)
|
||||
{
|
||||
//These strings MUST match /GameContent/Data/UnitDefines.CSV
|
||||
// That file MUST have these in the first row.
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
// if (AreColumnIndexesSet == false)
|
||||
// {
|
||||
// //These strings MUST match /GameContent/Data/UnitDefines.CSV
|
||||
// // That file MUST have these in the first row.
|
||||
// for (int i = 0; i < values.Length; i++) {
|
||||
|
||||
if (values[i].Trim() == "ID") { IdIndex = i; }
|
||||
if (values[i].Trim() == "NAME") { NameIndex = i; }
|
||||
if (values[i].Trim() == "CLASS") { ClassIndex = i; }
|
||||
if (values[i].Trim() == "IS_UNIQUE") { isUniqueIndex = i; }
|
||||
if (values[i].Trim() == "HEALTH") { HealthIndex = i; }
|
||||
if (values[i].Trim() == "ATTACK") { AttackIndex = i; }
|
||||
if (values[i].Trim() == "DEFENSE") { DefenseIndex = i; }
|
||||
if (values[i].Trim() == "SPEED") { SpeedIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT") { MovementIndex = i; }
|
||||
if (values[i].Trim() == "MOVEMENT_TYPE") { MovementTypeIndex = i; }
|
||||
// if (values[i].Trim() == "ID") { IdIndex = i; }
|
||||
// if (values[i].Trim() == "NAME") { NameIndex = i; }
|
||||
// if (values[i].Trim() == "CLASS") { ClassIndex = i; }
|
||||
// if (values[i].Trim() == "IS_UNIQUE") { isUniqueIndex = i; }
|
||||
// if (values[i].Trim() == "HEALTH") { HealthIndex = i; }
|
||||
// if (values[i].Trim() == "ATTACK") { AttackIndex = i; }
|
||||
// if (values[i].Trim() == "DEFENSE") { DefenseIndex = i; }
|
||||
// if (values[i].Trim() == "SPEED") { SpeedIndex = i; }
|
||||
// if (values[i].Trim() == "MOVEMENT") { MovementIndex = i; }
|
||||
// if (values[i].Trim() == "MOVEMENT_TYPE") { MovementTypeIndex = i; }
|
||||
|
||||
|
||||
}
|
||||
AreColumnIndexesSet = true;
|
||||
}
|
||||
else {
|
||||
UnitObject unit = new UnitObject();
|
||||
unit.id = Int32.Parse(values[IdIndex]);
|
||||
unit.name = values[NameIndex];
|
||||
unit.playerClassEnum = PlayerClass.GetClassFromShortHand(values[ClassIndex]);
|
||||
unit.isUnique = (values[isUniqueIndex].ToLower() == "true");
|
||||
unit.stats.MaxHealth = Int32.Parse(values[HealthIndex]);
|
||||
unit.stats.Attack = Int32.Parse(values[AttackIndex]);
|
||||
unit.stats.Defense = Int32.Parse(values[DefenseIndex]);
|
||||
unit.stats.Speed = Int32.Parse(values[SpeedIndex]);
|
||||
unit.stats.Movement = Int32.Parse(values[MovementIndex]);
|
||||
unit.stats.setMovementTypeFromFile(values[MovementTypeIndex]);
|
||||
// }
|
||||
// AreColumnIndexesSet = true;
|
||||
// }
|
||||
// else {
|
||||
// UnitObject unit = new UnitObject();
|
||||
// unit.id = Int32.Parse(values[IdIndex]);
|
||||
// unit.name = unit.stats = values[NameIndex];
|
||||
// unit.playerClassEnum = PlayerClass.GetClassFromShortHand(values[ClassIndex]);
|
||||
// unit.isUnique = (values[isUniqueIndex].ToLower() == "true");
|
||||
// unit.stats.MaxHealth = Int32.Parse(values[HealthIndex]);
|
||||
// unit.stats.Attack = Int32.Parse(values[AttackIndex]);
|
||||
// unit.stats.Defense = Int32.Parse(values[DefenseIndex]);
|
||||
// unit.stats.Speed = Int32.Parse(values[SpeedIndex]);
|
||||
// unit.stats.Movement = Int32.Parse(values[MovementIndex]);
|
||||
// unit.stats.setMovementTypeFromFile(values[MovementTypeIndex]);
|
||||
|
||||
unitList.Add(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return unitList;
|
||||
}
|
||||
// unitList.Add(unit);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return unitList;
|
||||
//}
|
||||
|
||||
public static List <Unit> LoadUnitList ()
|
||||
{
|
||||
|
|
@ -149,10 +149,9 @@ namespace Johnmagotchi.GameContent.Units
|
|||
{
|
||||
Unit unit = new Unit();
|
||||
unit.UnitID = Int32.Parse(values[IdIndex]);
|
||||
unit.stats.Name = values[NameIndex];
|
||||
unit.name = values[NameIndex];
|
||||
unit.stats.classId = PlayerClass.GetClassFromShortHand(values[ClassIndex]);
|
||||
// unit.isUnique = (values[isUniqueIndex].ToLower() == "true");
|
||||
unit.name = unit.stats.Name = values[NameIndex];
|
||||
unit.stats.baseStats.MaxHealth = Int32.Parse(values[HealthIndex]);
|
||||
unit.stats.baseStats.Attack = Int32.Parse(values[AttackIndex]);
|
||||
unit.stats.baseStats.Defense = Int32.Parse(values[DefenseIndex]);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
private int selectedUnitIndex;
|
||||
private EditorToolType CurrentTool;
|
||||
private MapEditorInfoText InfoText;
|
||||
public List<UnitObject> AvailableOldUnits;
|
||||
public List<Unit> AvailableNewUnits;
|
||||
public List<UnitLoadout> AvailableLoadouts;
|
||||
private UnitFactionType UnitFaction;
|
||||
|
|
@ -56,7 +55,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
{
|
||||
InfoText.Init(screenManager);
|
||||
selectedTileType = TileType.GRASS;
|
||||
AvailableOldUnits = UnitLoader.LoadBaseUnits();
|
||||
//AvailableOldUnits = UnitLoader.LoadBaseUnits();
|
||||
AvailableNewUnits = UnitLoader.LoadUnitList();
|
||||
|
||||
|
||||
|
|
@ -64,10 +63,10 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
|
||||
selectedUnitIndex = 0;
|
||||
UnitFaction = UnitFactionType.PLAYER;
|
||||
foreach (UnitObject unit in AvailableOldUnits) {
|
||||
TibzLog.Debug(" Unit id: {0}, name: {1}, health: {2}, atk: {3}, def: {4}, spd {5}, unique: {6}, movementType {7} ",
|
||||
unit.id, unit.name, unit.stats.MaxHealth, unit.stats.Attack, unit.stats.Defense,unit.stats.Speed , unit.isUnique, unit.stats.movementType);
|
||||
}
|
||||
//foreach (UnitObject unit in AvailableOldUnits) {
|
||||
// TibzLog.Debug(" Unit id: {0}, name: {1}, health: {2}, atk: {3}, def: {4}, spd {5}, unique: {6}, movementType {7} ",
|
||||
// unit.id, unit.name, unit.stats.MaxHealth, unit.stats.Attack, unit.stats.Defense,unit.stats.Speed , unit.isUnique, unit.stats.movementType);
|
||||
//}
|
||||
|
||||
if (AUTOLOAD_SLOT_0) {
|
||||
this.LoadMapAtSlot(0);
|
||||
|
|
@ -184,7 +183,7 @@ namespace Johnmagotchi.Screen.BattleMapScreens
|
|||
}
|
||||
if (CurrentTool == EditorToolType.UNIT_ADD)
|
||||
{
|
||||
InfoText.Draw(CursorQuadrant, 15, 30, "Current Unit : " + AvailableOldUnits[selectedUnitIndex].name);
|
||||
InfoText.Draw(CursorQuadrant, 15, 30, "Current Unit : " + AvailableNewUnits[selectedUnitIndex].name);
|
||||
InfoText.Draw(CursorQuadrant, 15, 60, "Current Faction : " + UnitFaction);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user