This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Drawing; | |
using MyLibrary; | |
namespace MagnaEngine | |
{ | |
public static class PngConverter | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class Test : MonoBehaviour { | |
[System.Serializable] | |
public class Player{ | |
[SerializeField] | |
public int hp; | |
public float atk; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class GameDataUser : MonoBehaviour { | |
void Start () { | |
Debug.Log ("前回セーブしたPlayerのレベルは" + GameData.Player.Level); | |
GameData.Player.Level = 50; | |
GameData.Save (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class GameData : SingletonMonoBehaviour<GameData>{ | |
//セーブしたいデータを定義するクラス | |
//コンストラクタで値を初期化 | |
class SaveData: SavableSingleton<SaveData>{ | |
public Player Player; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour | |
{ | |
private static T instance; | |
public static T Instance { | |
get { | |
if (instance == null) { | |
instance = (T)FindObjectOfType(typeof(T)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using UnityEngine; | |
using System.IO; | |
using System.Security.Cryptography; | |
abstract public class SavableSingleton<T> where T : SavableSingleton<T>, new() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sing System; | |
using UnityEngine; | |
using System.Collections; | |
public class JsonMapper | |
{ | |
static JsonMapper() | |
{ | |
LitJson.JsonMapper.RegisterExporter<float>((obj, writer) => writer.Write(Convert.ToDouble(obj))); | |
LitJson.JsonMapper.RegisterExporter<decimal>((obj, writer) => writer.Write(Convert.ToString(obj))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Security.Cryptography; | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class Crypt | |
{ | |
private const string AesIV = @"jCddaOybW3zEh0Kl"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.IO; | |
using UnityEngine; | |
/// <summary> | |
/// Json形式でセーブできるクラスを提供します。 | |
/// </summary> |