public static void ReceiveEvent(STKEvent e) { if (savedEvents.ContainsKey(e.eventName)) { List <STKEvent> eventsList = (List <STKEvent>)savedEvents[e.eventName]; eventsList.Add(e); savedEvents[e.eventName] = eventsList; if (settings.useSlidingWindow && eventsList.Count > settings.EventMaximum) //Reduces Data volume when too many Events were received { eventsList.RemoveAt(0); //Removes first Element (Sliding window) } else if (settings.useDataReduction && eventsList.Count > settings.EventMaximum) { eventsList = ReduceListData(eventsList); } else if (settings.createFileWhenFull && eventsList.Count > settings.EventMaximum) { STKJsonParser.SaveRunning(); //Saves all current Events and starts again with 0 Events } } else { savedEvents[e.eventName] = new List <STKEvent>(); List <STKEvent> eventsList = (List <STKEvent>)savedEvents[e.eventName]; eventsList.Add(e); savedEvents[e.eventName] = eventsList; } }
public void ForceStopTest() { STKEventReceiver.SendEvents(); STKEventReceiver.ClearEvents(); STKJsonParser.TestEnd(); STKJsonParser.CreateFile(); SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
public void Onclick() { STKJsonParser.SaveRunning(); }
///<summary>Sends all events to the JSON parser.</summary> public static void SendEvents() { STKJsonParser.ReceiveEvents(savedEvents); }
public void ToggleTest(GameObject button) { if (!started) { STKEventReceiver.ClearEvents(); values = new Hashtable(); foreach (STKTestControllerProperty p in startProperties) { values.Add(p.text.text, p.GetValue()); p.gameObject.SetActive(false); } foreach (STKTestControllerProperty p in runningProperties) { p.gameObject.SetActive(true); } if (hasTimeLimit) { timeText.transform.parent.gameObject.SetActive(true); } button.GetComponent <Button>().GetComponentInChildren <Text>().text = "Stop Stage"; foreach (GameObject g in GameobjectsToActivate) { g.SetActive(true); } for (int i = 0; i < GameobjectsToSendMessageTo.Count; i++) { GameobjectsToSendMessageTo[i].SendMessage(messagesToSend[i]); } foreach (GameObject g in GameobjectsToDeActivate) { g.SetActive(false); } STKJsonParser.TestStart(values); started = true; } else { foreach (STKTestControllerProperty p in startProperties) { p.gameObject.SetActive(true); p.Clear(); } foreach (STKTestControllerProperty p in runningProperties) { values.Add(p.text.text, p.GetValue()); p.gameObject.SetActive(false); } foreach (GameObject g in GameobjectsToActivate) { g.SetActive(false); } time = 0; timeText.transform.parent.gameObject.SetActive(false); STKEventReceiver.SendEvents(); STKEventReceiver.ClearEvents(); STKJsonParser.TestEnd(); started = false; myController.StageEnded(); } }