Class AnimationJson

java.lang.Object
dev.kosmx.playerAnim.core.data.gson.AnimationJson
All Implemented Interfaces:
com.google.gson.JsonDeserializer<List<KeyframeAnimation>>, com.google.gson.JsonSerializer<KeyframeAnimation>

public class AnimationJson extends Object implements com.google.gson.JsonDeserializer<List<KeyframeAnimation>>, com.google.gson.JsonSerializer<KeyframeAnimation>
  • Field Details

    • GSON

      @Internal public static final com.google.gson.Gson GSON
  • Constructor Details

    • AnimationJson

      public AnimationJson()
  • Method Details

    • getListedTypeToken

      @Deprecated @Internal public static Type getListedTypeToken()
      Deprecated.
      TypeToken helper for serializing
      Returns:
      TypeToken for animation deserialization
    • deserialize

      public List<KeyframeAnimation> deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      I think, we can stick with this legacy name: emote
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<List<KeyframeAnimation>>
      Throws:
      com.google.gson.JsonParseException
    • serialize

      public com.google.gson.JsonElement serialize(KeyframeAnimation emote, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Animation to emotecraft format JSON tries to serialize extraData as long as it is string/number/bool/json. *
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<KeyframeAnimation>
      Parameters:
      emote - source KeyframeAnimation
      typeOfSrc - idk
      context - :)
      Returns:
      :D Sorry for these really... useful comments
    • asJson

      public static com.google.gson.JsonElement asJson(String str)
    • emoteSerializer

      public static com.google.gson.JsonObject emoteSerializer(KeyframeAnimation emote)
      serialize an emote to json It won't be the same json file (not impossible) but multiple jsons can mean the same emote...

      Oh, and it's public and static, so you can call it from anywhere.

      Parameters:
      emote - Emote to serialize
      Returns:
      return Json object
    • moveSerializer

      public static com.google.gson.JsonArray moveSerializer(KeyframeAnimation emote)