public static void SetItemSlots(Character character, ItemSlots slots) { GmSerializer serializer = new GmSerializer(); MemoryStream stream = new MemoryStream(); serializer.Serialize(stream, slots); character.itemSlotData = System.Convert.ToBase64String(stream.ToArray()); }
public static void SetItemSlots(Character character, ItemSlots slots) { GmSerializer serializer = new GmSerializer(); MemoryStream stream = new MemoryStream(); serializer.Serialize(stream, slots); character.itemSlotData = System.Convert.ToBase64String(stream.ToArray()); }
private static void Save(Characters characters) { MemoryStream stream = new MemoryStream(); GmSerializer serializer = new GmSerializer(); serializer.Serialize(stream, characters); PlayerPrefs.SetString("npcs", Convert.ToBase64String(stream.ToArray())); Debug.Log(characters.characters.Count + " npc characters saved"); }
public static ItemSlots GetItemSlots(Character character) { if (character.itemSlotData == null) { Debug.Log("ItemSlotData is null"); return new ItemSlots(); } GmSerializer serializer = new GmSerializer(); MemoryStream stream = new MemoryStream(System.Convert.FromBase64String(character.itemSlotData)); return serializer.Deserialize(stream, new ItemSlots(), typeof(ItemSlots)) as ItemSlots; }
private static Characters Load() { if (!PlayerPrefs.HasKey("npcs")) { return(null); } byte[] bytes = Convert.FromBase64String(PlayerPrefs.GetString("npcs")); MemoryStream stream = new MemoryStream(bytes); GmSerializer serializer = new GmSerializer(); return(serializer.Deserialize(stream, new Characters(), typeof(Characters)) as Characters); }
public static ItemSlots GetItemSlots(Character character) { if (character.itemSlotData == null) { Debug.Log("ItemSlotData is null"); return(new ItemSlots()); } GmSerializer serializer = new GmSerializer(); MemoryStream stream = new MemoryStream(System.Convert.FromBase64String(character.itemSlotData)); return(serializer.Deserialize(stream, new ItemSlots(), typeof(ItemSlots)) as ItemSlots); }
private static Characters Load() { if (!PlayerPrefs.HasKey("npcs")) { return null; } byte[] bytes = Convert.FromBase64String(PlayerPrefs.GetString("npcs")); MemoryStream stream = new MemoryStream(bytes); GmSerializer serializer = new GmSerializer(); return serializer.Deserialize(stream, new Characters(), typeof(Characters)) as Characters; }
private static void Save(Characters characters) { MemoryStream stream = new MemoryStream(); GmSerializer serializer = new GmSerializer(); serializer.Serialize(stream, characters); PlayerPrefs.SetString("npcs", Convert.ToBase64String(stream.ToArray())); Debug.Log(characters.characters.Count + " npc characters saved"); }