56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class MyAllPostprocessor : AssetPostprocessor
|
|
{
|
|
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
|
|
{
|
|
foreach (string str in importedAssets)
|
|
{
|
|
if (str.Contains("tkg_game_configs.json"))
|
|
{
|
|
Debug.Log("Reimported Asset: " + str);
|
|
|
|
TKGInnerGameConfig configs = LoadJson.LoadJsonFromFile<TKGInnerGameConfig>(str);
|
|
Debug.Log("configs : " + configs.TKGParams.Count);
|
|
|
|
for(int i = 0; i < configs.TKGParams.Count; i++)
|
|
{
|
|
Debug.Log("param key : " + configs.TKGParams[i].key + " , value : " + configs.TKGParams[i].value);
|
|
}
|
|
|
|
for (int i = 0; i < configs.TKGAdPositionName.TKGIVAdPositionName.Count; i++)
|
|
{
|
|
Debug.Log("iv pos : " + configs.TKGAdPositionName.TKGIVAdPositionName[i]);
|
|
}
|
|
|
|
for (int i = 0; i < configs.TKGAdPositionName.TKGRVPositionName.Count; i++)
|
|
{
|
|
Debug.Log("rv pos : " + configs.TKGAdPositionName.TKGRVPositionName[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class PlayerState : MonoBehaviour
|
|
{
|
|
public string playerName;
|
|
public int lives;
|
|
public float health;
|
|
|
|
public string SaveToString()
|
|
{
|
|
return JsonUtility.ToJson(this);
|
|
}
|
|
|
|
// Given:
|
|
// playerName = "Dr Charles"
|
|
// lives = 3
|
|
// health = 0.8f
|
|
// SaveToString returns:
|
|
// {"playerName":"Dr Charles","lives":3,"health":0.8}
|
|
}
|