Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions C7/Animations/AnimationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public static string BaseAnimationKey(string unitName, MapUnit.AnimatedAction ac
return String.Format("{0}_{1}", unitName, action.ToString());
}

public static string BaseAnimationKey(UnitPrototype unit, MapUnit.AnimatedAction action) {
return BaseAnimationKey(unit.artName, action);
public static string BaseAnimationKey(MapUnit unit, MapUnit.AnimatedAction action) {
return BaseAnimationKey(unit.GetArtName(), action);
}

public static string AnimationKey(string baseKey, TileDirection direction) {
return String.Format("{0}_{1}", baseKey, direction.ToString());
}

public static string AnimationKey(UnitPrototype unit, MapUnit.AnimatedAction action, TileDirection direction) {
public static string AnimationKey(MapUnit unit, MapUnit.AnimatedAction action, TileDirection direction) {
return AnimationKey(BaseAnimationKey(unit, action), direction);
}

Expand Down Expand Up @@ -69,11 +69,11 @@ public IniData getINIData(string pathKey) {
return tr;
}

public static string GetUnitDefaultThumbnailKey(UnitPrototype unit) {
return $"{unit.artName}_{thumbnailDirection}_{thumbnailAction}_{thumbnailFrame}";
public static string GetUnitDefaultThumbnailKey(MapUnit unit) {
return $"{unit.GetArtName()}_{thumbnailDirection}_{thumbnailAction}_{thumbnailFrame}";
}

public (ImageTexture baseFrame, ImageTexture tintFrame) GetAnimationFrameAndTintTextures(UnitPrototype unit) {
public (ImageTexture baseFrame, ImageTexture tintFrame) GetAnimationFrameAndTintTextures(MapUnit unit) {

string key = GetUnitDefaultThumbnailKey(unit);

Expand Down Expand Up @@ -112,9 +112,9 @@ public IniData getUnitINIData(string unitTypeName) {
return getINIData(string.Format("Art/Units/{0}/{0}.INI", unitTypeName));
}

public string getUnitFlicFilepath(UnitPrototype unit, MapUnit.AnimatedAction action) {
string directory = string.Format("Art/Units/{0}", unit.artName);
IniData ini = getUnitINIData(unit.artName);
public string getUnitFlicFilepath(MapUnit unit, MapUnit.AnimatedAction action) {
string directory = string.Format("Art/Units/{0}", unit.GetArtName());
IniData ini = getUnitINIData(unit.GetArtName());
string filename = getFlicFileName(ini, action);
return directory.PathJoin(filename);
}
Expand Down Expand Up @@ -169,8 +169,8 @@ public static void loadFlicAnimation(string path, string name, ref SpriteFrames
}
}

public bool LoadAnimation(UnitPrototype unit, MapUnit.AnimatedAction action) {
string name = BaseAnimationKey(unit.artName, action);
public bool LoadAnimation(MapUnit unit, MapUnit.AnimatedAction action) {
string name = BaseAnimationKey(unit.GetArtName(), action);
string testName = AnimationKey(name, TileDirection.NORTH);
if (spriteFrames.HasAnimation(testName) && tintFrames.HasAnimation(testName)) {
return false;
Expand Down Expand Up @@ -210,7 +210,7 @@ public void playSound(string rootPath, IniData iniData, MapUnit.AnimatedAction a
}
}

public C7Animation forUnit(UnitPrototype unit, MapUnit.AnimatedAction action) {
public C7Animation forUnit(MapUnit unit, MapUnit.AnimatedAction action) {
return new C7Animation(this, unit, action);
}

Expand All @@ -228,13 +228,13 @@ public partial class C7Animation {
public AnimationManager animationManager { get; private set; }
public string folderPath { get; private set; } // For example "Art/Units/Warrior" or "Art/Animations/Trajectory"
public string iniFileName { get; private set; }
private UnitPrototype unit;
private MapUnit unit;
public MapUnit.AnimatedAction action { get; private set; }

public C7Animation(AnimationManager civ3AnimData, UnitPrototype unit, MapUnit.AnimatedAction action) {
public C7Animation(AnimationManager civ3AnimData, MapUnit unit, MapUnit.AnimatedAction action) {
this.animationManager = civ3AnimData;
this.folderPath = "Art/Units/" + unit.artName;
this.iniFileName = unit.artName + ".ini";
this.folderPath = "Art/Units/" + unit.GetArtName();
this.iniFileName = unit.GetArtName() + ".ini";
this.action = action;
this.unit = unit;
}
Expand Down
2 changes: 1 addition & 1 deletion C7/Animations/AnimationTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void startAnimation(ID id, C7Animation anim, Action completionEvent, Ani
}

public void startAnimation(MapUnit unit, MapUnit.AnimatedAction action, Action completionEvent, AnimationEnding ending) {
startAnimation(unit.id, civ3AnimData.forUnit(unit.unitType, action), completionEvent, ending);
startAnimation(unit.id, civ3AnimData.forUnit(unit, action), completionEvent, ending);
}

public void startAnimation(Tile tile, AnimatedEffect effect, Action completionEvent, AnimationEnding ending) {
Expand Down
Loading
Loading