Пример #1
0
        private ClientMessage Deserialize(byte[] bytes)
        {
            MemoryStream stream = new MemoryStream(bytes);

            return(serializer.Deserialize(stream, new ClientMessage(), typeof(ClientMessage)) as ClientMessage);
            //return Serializer.Deserialize<ClientMessage> (stream);
        }
Пример #2
0
        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;
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 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;
 }