Last active
August 29, 2015 14:05
-
-
Save sassembla/2227c90b7f1519b67951 to your computer and use it in GitHub Desktop.
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; | |
/** | |
仮。もっと小さくしたい。 | |
ネームスペースごとに、扱える数が異なる。 | |
*/ | |
namespace Serialize2 { | |
/** | |
*/ | |
[System.Serializable] | |
public class TableBase2<T1, T2, Type> where Type : VisibleDataSet<T1, T2>{ | |
[SerializeField] | |
public List<Type> list; | |
public void ResetSourceData (Type source) { | |
list = new List<Type>(); | |
list.Add(source); | |
} | |
public void AppendSourceData (Type append) { | |
list.Add(append); | |
} | |
} | |
/** | |
2つの値を保持するデータセット | |
*/ | |
[System.Serializable] | |
public class VisibleDataSet<T1, T2> { | |
public T1 key; | |
public T2 val; | |
public VisibleDataSet(T1 source1, T2 source2) { | |
key = source1; | |
val = source2; | |
} | |
} | |
} | |
namespace Serialize3 { | |
/** | |
3つのデータを扱うテーブル | |
*/ | |
[System.Serializable] | |
public class TableBase3<T1, T2, T3, Type> where Type : VisibleDataSet3<T1, T2, T3>{ | |
[SerializeField] | |
public List<Type> list; | |
public void ResetSourceData (Type source) { | |
list = new List<Type>(); | |
list.Add(source); | |
} | |
public void AppendSourceData (Type append) { | |
list.Add(append); | |
} | |
} | |
/** | |
3つの値を保持するデータセット | |
*/ | |
[System.Serializable] | |
public class VisibleDataSet3<T1, T2, T3> { | |
public T1 s1; | |
public T2 s2; | |
public T3 s3; | |
public VisibleDataSet3(T1 source1, T2 source2, T3 source3) { | |
s1 = source1; | |
s2 = source2; | |
s3 = source3; | |
} | |
} | |
} | |
namespace Serialize4 { | |
/** | |
4つのデータを扱うテーブル | |
*/ | |
[System.Serializable] | |
public class TableBase4<T1, T2, T3, T4, Type> where Type : VisibleDataSet4<T1, T2, T3, T4>{ | |
[SerializeField] | |
public List<Type> list; | |
public void ResetSourceData (Type source) { | |
list = new List<Type>(); | |
list.Add(source); | |
} | |
public void AppendSourceData (Type append) { | |
list.Add(append); | |
} | |
} | |
/** | |
4つの値を保持するデータセット | |
*/ | |
[System.Serializable] | |
public class VisibleDataSet4<T1, T2, T3, T4> { | |
public T1 s1; | |
public T2 s2; | |
public T3 s3; | |
public T4 s4; | |
public VisibleDataSet4(T1 source1, T2 source2, T3 source3, T4 source4) { | |
s1 = source1; | |
s2 = source2; | |
s3 = source3; | |
s4 = source4; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// 使い方
using UnityEngine;
using System.Collections.Generic;
public class SampleObjectController : MonoBehaviour {
}