Databinding system
This commit is contained in:
parent
e25cd95a66
commit
d562db1cc3
2 changed files with 45 additions and 0 deletions
33
Assets/src/Databind.cs
Normal file
33
Assets/src/Databind.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Databind{
|
||||
|
||||
|
||||
interface Slave{
|
||||
void OnMasterUpdated();
|
||||
}
|
||||
|
||||
class Master{
|
||||
void Register(Slave s){
|
||||
m_slaves.Add(s);
|
||||
}
|
||||
void Unregister(Slave s){
|
||||
m_slaves.Remove(s);
|
||||
}
|
||||
void Clear(){
|
||||
m_slaves.Clear();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
foreach(var s in m_slaves){
|
||||
s.OnMasterUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<Slave> m_slaves = new List<Slave>();
|
||||
}
|
||||
|
||||
|
||||
}
|
12
Assets/src/Databind.cs.meta
Normal file
12
Assets/src/Databind.cs.meta
Normal file
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: de0110c8591b4d7479530c6cbb9a8669
|
||||
timeCreated: 1425568296
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Reference in a new issue