public GoalWeightStatisticsHomepageController(ServerIP IPConfig, JsonStructure jsonStructureConfig, ChartHomepageInfo homepageChartInfo) : base(IPConfig, jsonStructureConfig, homepageChartInfo, new GoalWeightController(IPConfig, jsonStructureConfig), new WeightController(IPConfig, jsonStructureConfig)) { }
public GoalStepsDailyStatisticsHomepageController(ServerIP IPConfig, JsonStructure jsonStructureConfig, ChartHomepageInfo homepageChartInfo) : base(IPConfig, jsonStructureConfig, homepageChartInfo, new GoalStepsDailyController(IPConfig, jsonStructureConfig), new ActivitySummaryStepsController(IPConfig, jsonStructureConfig)) { }
public GoalCaloriesStatisticsHomepageController(ServerIP IPConfig, JsonStructure jsonStructureConfig, ChartHomepageInfo homepageChartInfo) : base(IPConfig, jsonStructureConfig, homepageChartInfo, new GoalCaloriesOutController(IPConfig, jsonStructureConfig), new ActivitySummaryCaloriesController(IPConfig, jsonStructureConfig)) { }
public void PostData() { // post data without callback Garter.I.PostData <string>("my-key", "Hello World"); // post data with callback Garter.I.PostData <int>("my-num", 6, (error, response) => { if (!string.IsNullOrEmpty(error)) { Debug.LogWarning(error); } else { Debug.Log(response); } }); // Own data type (defined by Class) JsonStructure complexData = new JsonStructure(someStringData, someIntegerData, someFloatData, new JsonStructure.MyTypeData(someListType, someArrayType, someJaggedArrayType)); // WARNING - NEED TO CONVERT TO STRING // REASON: THIS WOULD THROW ERROR FOR USERS PLAYING AS GUESTS. THE FORMAT IS BROKEN ONCE IS SAVED IN PLAYEPREFS. THEREFORE WE RECOMMEND TO USE CONVERSION TO STRING FOR ALL. string complexDataString = Garter.I.ToJson(complexData); // own data types are not allowed for guests. Need to convert the data to string format Garter.I.PostData <string>("complexData", complexDataString, (error, response) => { if (!string.IsNullOrEmpty(error)) { Debug.LogWarning(error); } else { Debug.Log(response); } }); }
public GoalStatisticsController(ServerIP IPConfig, JsonStructure jsonStructureConfig, BaseJsonReadController <TModelGoal> goalController, BaseJsonReadController <TModelRealData> realDataController) : base(IPConfig, jsonStructureConfig) { GoalController = goalController; RealDataController = realDataController; }
public BaseJsonController(ServerIP IPConfig, JsonStructure jsonStructureConfig, JsonData jsonDataConfig) : base(IPConfig) { JsonStructureConfig = jsonStructureConfig; QueryParamsConfig = jsonStructureConfig.QueryParams; AdditionalPathConfig = jsonStructureConfig.AdditionalPath; JsonDataConfig = jsonDataConfig; }
public MQTTController(ServerIP IPConfig, JsonStructure jsonStructureConfig, IHubContext <MqttHub> hubContext) : base(IPConfig) { JsonStructureConfig = jsonStructureConfig; WeightConfig = jsonStructureConfig.Weight; ActivitySummaryConfig = jsonStructureConfig.ActivitySummary; HubContext = hubContext; }
public GoalStatisticsHomepageAbstractController(ServerIP IPConfig, JsonStructure jsonStructureConfig, ChartHomepageInfo homepageChartInfo, BaseJsonReadController <TModelGoal> goalController, BaseJsonReadController <TModelRealData> realDataController) : base(IPConfig, jsonStructureConfig) { GoalController = goalController; RealDataController = realDataController; HomepageChartInfo = homepageChartInfo.GeneralChartInfo; }
public MQTTClient(MQTTInfo MQTTConfig, JsonStructure jsonStructureConfig) { client = new MqttClient(MQTTConfig.BrokerHostName, MQTTConfig.BrokerPort, false, null, null, 0, null, null); client.Connect(Guid.NewGuid().ToString(), MQTTConfig.Username, MQTTConfig.Password); client.MqttMsgPublishReceived += MqttMsgPublishReceived; this.MQTTConfig = MQTTConfig; QueryParamsConfig = jsonStructureConfig.QueryParams; WeightConfig = jsonStructureConfig.Weight; ActivitySummaryConfig = jsonStructureConfig.ActivitySummary; }
// overwrite default values by received values private void SaveToVariables(string json) { //Debug.Log ("Save user data from server to variables" + json); // parse json data JsonStructure dataClass = Garter.I.FromJson <JsonStructure>(json); // overwrite default data by parsed data someStringData = dataClass.someStringData; someIntegerData = dataClass.someIntegerData; someFloatData = dataClass.someFloatData; // myTypeData someListType = dataClass.someOwnTypeData.someListType; someArrayType = dataClass.someOwnTypeData.someArrayType; someJaggedArrayType = dataClass.someOwnTypeData.someJaggedArrayType; }
private JsonStructure CurrentStructure() { JsonStructure jsonStructure; if (!File.Exists(_file)) { jsonStructure = new JsonStructure() { FilteredStates = new string[0], ResetStates = new string[0] }; } else { jsonStructure = JsonConvert.DeserializeObject <JsonStructure>(File.ReadAllText(_file)); } return(jsonStructure); }
public void GetData() { string myKeyData = Garter.I.GetData <string>("my-key"); Debug.Log("my-key: " + myKeyData); int myNumData = Garter.I.GetData <int>("my-num"); Debug.Log("my-num: " + myNumData); string sdkv1data = Garter.I.GetData <string>("default"); Debug.Log("sdkv1data: " + sdkv1data); /*string myComplexData = Garter.I.GetData<string>("complexData",(error,value) => { * if(!string.IsNullOrEmpty(error)){ * Debug.Log ("myComplexData callback - error: " + error); * } else { * Debug.Log ("myComplexData callback - data: " + Garter.I.FromJson<JsonStructure>(value)); * } * }); * Debug.Log ("myComplexData: "+Garter.I.FromJson<JsonStructure>(myComplexData));*/ // INSTEAD OF THIS, USE THE WAY DESCRIBED ABOVE JsonStructure myComplexData = Garter.I.GetData <JsonStructure>("complexData", (error, value) => { if (!string.IsNullOrEmpty(error)) { Debug.Log("myComplexData callback - error: " + error); } else { Debug.Log("myComplexData callback - data: " + value); } }); Debug.Log("myComplexData: " + myComplexData); }
public GoalWeightController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.GoalsWeight) { }
public PatientPersonalDataViewComponent(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig) { //ActivitySummaryController = new ActivitySummaryController(IPConfig, jsonStructureConfig); WeightController = new WeightController(IPConfig, jsonStructureConfig); }
public BaseJsonReadController(ServerIP IPConfig, JsonStructure jsonStructureConfig, JsonData jsonDataConfig) : base(IPConfig, jsonStructureConfig, jsonDataConfig) { }
public DietController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.Diet) { }
public PatientActivitiesViewComponent(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig) { ActivityController = new ActivityController(IPConfig, jsonStructureConfig); }
public string[] GetResetStates() { JsonStructure jsonStructure = CurrentStructure(); return(jsonStructure.ResetStates); }
public string[] GetFilteredStates() { JsonStructure jsonStructure = CurrentStructure(); return(jsonStructure.FilteredStates); }
public HomePageController(ServerIP IPConfig, JsonStructure jsonStructureConfig, DoctorAccount doctorAccountConfig) : base(IPConfig) { DoctorAccountConfig = doctorAccountConfig; JsonStructureConfig = jsonStructureConfig; }
public BaseViewComponent(ServerIP IPConfig, JsonStructure jsonStructureConfig) { this.IPConfig = IPConfig; JsonStructureConfig = jsonStructureConfig; }
public DoctorController(ServerIP IPConfig, JsonStructure jsonStructure) : base(IPConfig, jsonStructure, jsonStructure.Doctor) { }
private void SaveNewStructure(JsonStructure structure) { File.WriteAllText(_file, JsonConvert.SerializeObject(structure)); }
void Export() { string path = EditorUtility.SaveFilePanelInProject("Export structure...", "struct_file", "json", "Export..."); if (path.Length == 0) { return; } JsonStructure toExport = new JsonStructure(); if (structure.structureUID == string.Empty) { Debug.LogError("Missing Structure ID! Check Structure Details category."); return; } toExport.uniqueName = structure.structureUID; toExport.width = (int)size.x; toExport.height = (int)size.y; toExport.length = (int)size.z; toExport.palette = new List <JsonPaletteEntry>(); foreach (PaletteEntry entry in structure.palette) { if (!entry.isValid) { Debug.LogError("Invalid palette entry! Check Palette category."); return; } toExport.palette.Add(new JsonPaletteEntry(entry.isOreDict? "ore" : entry.mod, entry.name, entry.identifier, entry.meta)); } Block master = structure.validFullBlocks.FirstOrDefault(x => x.pos == structure.masterPos); if (master == null) { Debug.LogError("Master block not set or missing palette value! Check Composition category."); return; } PaletteEntry masterPaletteEntry = structure.palette.FirstOrDefault(x => x.identifier == master.paletteValue); if (masterPaletteEntry == null) { Debug.LogError("Master block is missing valid palette value! Check Composition and Palette categories."); return; } toExport.master = new JsonMaster( calculator.BlockPosToLocalX(master.pos), calculator.BlockPosToLocalY(master.pos), calculator.BlockPosToLocalZ(master.pos), masterPaletteEntry.isOreDict ? "ore" : masterPaletteEntry.mod, masterPaletteEntry.name, masterPaletteEntry.meta); toExport.pointsOfInterest = new List <JsonPoI>(); foreach (PoI poi in structure.pointsOfInterest) { if (structure.ignoredPositions2.Contains(poi.pos) || !structure.validFullBlocks.Any(x => x.pos == poi.pos)) { continue; } toExport.pointsOfInterest.Add(new JsonPoI() { position = poi.pos, name = poi.id, facing = poi.facing }); } int firstDimension = AABBGenerator.FirstDimension((int)size.x, (int)size.y, (int)size.z, editorSettings.axisOrder); int secondDimension = AABBGenerator.SecondDimension((int)size.x, (int)size.y, (int)size.z, editorSettings.axisOrder); int thirdDimension = AABBGenerator.ThirdDimension((int)size.x, (int)size.y, (int)size.z, editorSettings.axisOrder); toExport.structure = new List <string>(); string emptyLine = new string(' ', firstDimension); for (int line = 0; line < secondDimension * thirdDimension; line++) { toExport.structure.Add(emptyLine); } foreach (Block block in structure.validFullBlocks) { if (structure.ignoredPositions2.Contains(block.pos)) { continue; } if (block.IsInvalid()) { Debug.LogError(string.Format("Block {0} is missing valid palette value! Check Composition and Palette categories.", block.pos)); return; } int firstPos = AABBGenerator.RelativeX(block.pos, editorSettings.axisOrder, size); int secondPos = AABBGenerator.RelativeZ(block.pos, editorSettings.axisOrder, size); int thirdPos = AABBGenerator.RelativeY(block.pos, editorSettings.axisOrder, size); //Debug.Log(string.Format("{0}, {1}, {2}, {3}, {4}", firstPos, secondPos, thirdPos, toExport.structure[thirdPos * secondDimension + secondPos].Length, block.paletteValue)); toExport.structure[thirdPos * secondDimension + secondPos] = ReplaceAt(toExport.structure[thirdPos * secondDimension + secondPos], firstPos, block.paletteValue); } toExport.AABB = new List <byte>(); List <Box>[] orderedList = new List <Box> [(int)(size.x * size.y * size.z)]; foreach (BlockPosition aabb in structure.allSubAABBs) { if (orderedList[aabb.pos] == null) { orderedList[aabb.pos] = new List <Box>(); } orderedList[aabb.pos].Add(aabb.normalizedBox); } Box fullBox = new Box(0, 0, 0, 16, 16, 16); StringBuilder builder = new StringBuilder(); for (int index = 0; index < orderedList.Length; index++) { if (structure.ignoredPositions2.Contains(index) || orderedList[index] == null) //no collision boxes { builder.Append("null"); } else if (orderedList[index].Count == 1 && orderedList[index][0] == fullBox) //full collision box { builder.Append("[]"); } else //partial collision boxes { List <string> floats = new List <string>(); foreach (Box box in orderedList[index]) { floats.Add(box.ToString(editorSettings.outputFormat)); } builder.Append("[" + string.Join(",", floats) + "]"); } builder.Append(","); } builder.Length -= 1; string json = JsonUtility.ToJson(toExport, false); json = json.Insert(json.LastIndexOf('[') + 1, builder.ToString()); using (StreamWriter writer = new StreamWriter(path)) { writer.Write(json); writer.Flush(); writer.Close(); } }
public BaseJsonController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : this(IPConfig, jsonStructureConfig, null) { }
public TrainingController(ServerIP IPConfig, JsonStructure jsonStructure) : base(IPConfig, jsonStructure, jsonStructure.Training) { }
public PatientController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.Patient) { }
public GoalStepsDailyController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.GoalsStepsDaily) { }
public ActivitySummaryController(ServerIP IPConfig, JsonStructure jsonStructureConfig) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.ActivitySummary) { }
public AdminAuthenticationController(string connectionString, ServerIP IPConfig, JsonStructure jsonStructureConfig, MailData mailData) : base(IPConfig, jsonStructureConfig, jsonStructureConfig.Patient) { DoctorController = new DoctorController(IPConfig, jsonStructureConfig); PatientCollectionController = new PatientController(IPConfig, jsonStructureConfig); ConnectionString = connectionString; MailData = mailData; }