Example usage for com.badlogic.gdx.utils Json addClassTag

List of usage examples for com.badlogic.gdx.utils Json addClassTag

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils Json addClassTag.

Prototype

public void addClassTag(String tag, Class type) 

Source Link

Document

Sets a tag to use instead of the fully qualifier class name.

Usage

From source file:com.kotcrab.vis.editor.module.editor.DonateReminderModule.java

License:Apache License

@Override
public void init() {
    FileHandle storage = fileAccess.getMetadataFolder();
    FileHandle storageFile = storage.child("donateReminder.json");

    Json json = new Json();
    json.setIgnoreUnknownFields(true);//  w  w w .j a va 2 s. c  o m
    json.addClassTag("EditorRunCounter", EditorRunCounter.class);

    EditorRunCounter runCounter;
    try {
        if (storageFile.exists()) {
            runCounter = json.fromJson(EditorRunCounter.class, storageFile);
        } else
            runCounter = new EditorRunCounter();
    } catch (SerializationException ignored) {
        runCounter = new EditorRunCounter();
    }

    runCounter.counter++;

    if (runCounter.counter % 50 == 0) {
        VisTable table = new VisTable(true);

        table.add("If you like VisEditor please consider").spaceRight(3);
        table.add(new LinkLabel("donating.", DONATE_URL));
        LinkLabel hide = new LinkLabel("Hide");
        table.add(hide);
        menuBar.setUpdateInfoTableContent(table);

        hide.setListener(labelUrl -> menuBar.setUpdateInfoTableContent(null));
    }

    json.toJson(runCounter, storageFile);
}

From source file:com.kotcrab.vis.editor.module.project.ProjectVersionModule.java

License:Apache License

public static Json getNewJson() {
    Json json = new Json();
    json.addClassTag("ProjectVersionDescriptor", ProjectVersionDescriptor.class);
    return json;/*  w  w w. j  a v a  2 s  . c  o m*/
}

From source file:com.kotcrab.vis.editor.module.project.SpriterDataIOModule.java

License:Apache License

public static Json getNewJson() {
    Json json = new Json();
    json.addClassTag("SpriterAssetData", SpriterAssetData.class);
    return json;/*  w  w w.  ja  va  2  s  .  co  m*/
}