Skip to content

Commit

Permalink
Added serialization attributes so panic states are properly tracked a…
Browse files Browse the repository at this point in the history
…cross saved games for issue #1
  • Loading branch information
RealityMachina committed May 22, 2018
1 parent 8dc323f commit fee06d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions PunchinOut/BasicPanic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using PunchinOut;
using BattleTech.Serialization;

namespace BasicPanic
{
Expand Down Expand Up @@ -464,8 +465,10 @@ internal class ModSettings
public float WeaponlessModifier = 15;
public float AloneModifier = 20;
}
[SerializableContract("Holder")]
public static class Holder
{
[SerializableMember(SerializationTarget.SaveGame)]
public static List<PanicTracker> TrackedPilots;

public static void Reset()
Expand Down
9 changes: 9 additions & 0 deletions PunchinOut/panicTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@
using System.Linq;
using System.Text;
using BattleTech;
using BattleTech.Serialization;

namespace PunchinOut
{

public enum PanicStatus
{
Normal,
Fatigued,
Stressed,
Panicked
}

[SerializableContract("Holder")]
public class PanicTracker
{
[SerializableMember(SerializationTarget.SaveGame)]
public PanicStatus pilotStatus;

[SerializableMember(SerializationTarget.SaveGame)]
public string trackedMech;

[SerializableMember(SerializationTarget.SaveGame)]
public bool ChangedRecently;

public PanicTracker(Mech mech)
Expand Down

0 comments on commit fee06d3

Please sign in to comment.