public void Construct(DiContainer _container, FIDefaultRequest _server, GDManager _staticData) { container = _container; server = _server; staticData = _staticData; serverData = (container.Resolve <IDataProvider>() as FIFakeServerDataProvider).srcContainer; }
//Testing Purpose! public void LoadServerData() { srcContainer = new FIRData(); if (System.IO.File.Exists(FilePath) == true) { string jsonStr = System.IO.File.ReadAllText(FilePath); var jsonData = JsonConvert.DeserializeObject <JObject>(jsonStr); srcContainer.DeserializeFromJson(dataTypeContainer, jsonData); Debug.Log("[FIFakeServerDataProvider] Loaded"); } }
void Update() { if (loadData == false) { return; } FIRData srvData = (container.Resolve <IDataProvider>() as FIFakeServerDataProvider).srcContainer; GetData(totalServerData, srvData); FIRData cliData = (container.Resolve <IDataProvider>() as FIFakeServerDataProvider).RuntimeData as FIRData; GetData(totalData, cliData); loadData = false; }
public FIClientDataProvider(FIBuildOptions _buildOptions, FIRBaseDataTypeContainer _typeContainer) { buildOption = _buildOptions; dataTypeContainer = _typeContainer; baseData = new FIRData(); if (System.IO.File.Exists(FilePath) == true) { string jsonStr = System.IO.File.ReadAllText(FilePath); var jsonData = JsonConvert.DeserializeObject <JObject>(jsonStr); baseData.DeserializeFromJson(dataTypeContainer, jsonData); Debug.Log("[ClientDataProvider] Loaded"); } else { Debug.Log("[ClientDataProvider] New"); } }
void GetData(List <SingleData> src, FIRData data) { src.Clear(); foreach (var classData in data.objectDic) { foreach (var item in classData.Value) { var singleItem = new SingleData(); singleItem.type = string.Format("{0}:{1}", classData.Key.Name, item.Key); var jObj = JObject.FromObject(item.Value); foreach (var prop in jObj.Properties()) { singleItem.inside.Add(string.Format("{0}:{1}", prop.Name, prop.Value)); } src.Add(singleItem); } } }