public static TestCustomEvent Parse(string inputString) { string[] stringSeparators = new string[] { separator }; var retv = new TestCustomEvent(); var inputList = inputString.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries); retv.name = inputList[0]; for (var a = 1; a < inputList.Length; a++) { string paramLine = inputList[a]; if (!string.IsNullOrEmpty(paramLine)) { retv.Add(TestEventParam.Parse(paramLine)); } } return(retv); }
public override Dictionary <double, string> Generate() { SetRandomSeed(); List <string> eventNames = new List <string>() { "Heatmap.PlayerPosition", "Heatmap.Crash" }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[a]; var x = new TestEventParam("x", TestEventParam.Str, ""); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Str, ""); customEvent.Add(y); var z = new TestEventParam("z", TestEventParam.Str, ""); customEvent.Add(z); var t = new TestEventParam("t", TestEventParam.Str, ""); customEvent.Add(t); var dx = new TestEventParam("dx", TestEventParam.Str, ""); customEvent.Add(dx); var dy = new TestEventParam("dy", TestEventParam.Str, ""); customEvent.Add(dy); var dz = new TestEventParam("dz", TestEventParam.Str, ""); customEvent.Add(dz); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int eventCount = 300; int deviceCount = 2; int sessionCount = 2; // Custom to this lesson float baseSpeed = 2f; float crashMod = 3.5f; float speed = 0f; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * eventCount * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; Vector3 position = Vector3.zero, destination = Vector3.zero; for (int a = 0; a < deviceCount; a++) { string platform = "ios"; for (int b = 0; b < sessionCount; b++) { float theta = 1f; UpdateOval(ref position, theta); for (int c = 0; c < eventCount; c++) { speed = (Mathf.Abs(m_Radius - position.x) / m_Radius) * baseSpeed + UnityEngine.Random.Range(0.1f, 5f); theta += speed; Vector3 lastPosition = position; UpdateOval(ref position, theta); currentSeconds++; TestCustomEvent customEvent = (speed > baseSpeed * crashMod && UnityEngine.Random.Range(0f, 1f) > .25f) ? events[1] : events[0]; customEvent.SetParam("t", c.ToString()); // destination Vector3 diff = position - lastPosition; destination = Vector3.MoveTowards(position, position + (diff * speed), 10000f); customEvent.SetParam("x", position.x.ToString()); customEvent.SetParam("y", position.y.ToString()); customEvent.SetParam("z", position.z.ToString()); customEvent.SetParam("dx", destination.x.ToString()); customEvent.SetParam("dy", destination.y.ToString()); customEvent.SetParam("dz", destination.z.ToString()); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; } } } retv.Add(firstDate, data); fileCount++; return(retv); }
public override Dictionary <double, string> Generate() { SetRandomSeed(); List <string> eventNames = new List <string>() { "Heatmap.LookAt" }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[a]; var x = new TestEventParam("x", TestEventParam.Str, ""); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Str, ""); customEvent.Add(y); var z = new TestEventParam("z", TestEventParam.Str, ""); customEvent.Add(z); var t = new TestEventParam("t", TestEventParam.Str, ""); customEvent.Add(t); var dx = new TestEventParam("rx", TestEventParam.Str, ""); customEvent.Add(dx); var dy = new TestEventParam("ry", TestEventParam.Str, ""); customEvent.Add(dy); var dz = new TestEventParam("rz", TestEventParam.Str, ""); customEvent.Add(dz); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int waypointsPerPlay = 25; int deviceCount = 5; int sessionCount = 1; string platform = "ios"; // Custom to this lesson int lookThisManyPlaces = 15; int lookThisManyTimesMin = 1; int lookThisManyTimesMax = 5; float radius = 50f; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * waypointsPerPlay * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; int currentPoint = 0; int currentPlace = 0; int totalPoints = 0; float shortestUser = 1.5f; float tallestUser = 2.5f; int totalPlaces = deviceCount * sessionCount * waypointsPerPlay * lookThisManyPlaces; int[] numTimesToLookList = new int[totalPlaces]; for (int d = 0; d < totalPlaces; d++) { numTimesToLookList[d] = UnityEngine.Random.Range(lookThisManyTimesMin, lookThisManyTimesMax); totalPoints += numTimesToLookList[d]; } Vector3 position = Vector3.zero, destination = Vector3.zero; for (int a = 0; a < deviceCount; a++) { for (int b = 0; b < sessionCount; b++) { for (int c = 0; c < waypointsPerPlay; c++) { position = new Vector3(UnityEngine.Random.Range(-radius, radius), UnityEngine.Random.Range(shortestUser, tallestUser), UnityEngine.Random.Range(-radius, radius)); for (int e = 0; e < lookThisManyPlaces; e++) { Vector3 rotation = new Vector3(UnityEngine.Random.Range(0, -180f), UnityEngine.Random.Range(0f, 360f), 0f); while (numTimesToLookList[currentPlace] > 0) { Progress(currentPoint, totalPoints); currentPoint++; numTimesToLookList[currentPlace]--; currentSeconds++; TestCustomEvent customEvent = events[0]; customEvent.SetParam("t", c.ToString()); customEvent.SetParam("x", position.x.ToString()); customEvent.SetParam("y", position.y.ToString()); customEvent.SetParam("z", position.z.ToString()); customEvent.SetParam("rx", rotation.x.ToString()); customEvent.SetParam("ry", rotation.y.ToString()); customEvent.SetParam("rz", rotation.z.ToString()); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; } currentPlace++; } } } } EndProgress(); retv.Add(firstDate, data); fileCount++; return(retv); }
public override Dictionary <double, string> Generate() { SetRandomSeed(); List <string> eventNames = new List <string>() { "Heatmap.CombatKills", "Heatmap.PlayerPosition" }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[a]; var x = new TestEventParam("x", TestEventParam.Str, ""); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Str, ""); customEvent.Add(y); var z = new TestEventParam("z", TestEventParam.Str, ""); customEvent.Add(z); var t = new TestEventParam("t", TestEventParam.Str, ""); customEvent.Add(t); var rx = new TestEventParam("rx", TestEventParam.Str, ""); customEvent.Add(rx); var ry = new TestEventParam("ry", TestEventParam.Str, ""); customEvent.Add(ry); var rz = new TestEventParam("rz", TestEventParam.Str, ""); customEvent.Add(rz); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int eventCount = 500; int deviceCount = 5; int sessionCount = 1; // Custom to this lesson float randomRange = .25f; float radius = 1000f; Vector3 position = Vector3.zero, rotation = Vector3.zero, pointOnCircle = Vector3.zero; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * eventCount * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; int currentPoint = 0; for (int a = 0; a < deviceCount; a++) { string platform = "ios"; for (int b = 0; b < sessionCount; b++) { for (int c = 0; c < eventCount; c++) { Progress(currentPoint, totalSeconds); currentPoint++; currentSeconds++; TestCustomEvent customEvent = (c % 100 == 0) ? events[0] : events[1]; customEvent.SetParam("t", c.ToString()); Vector3 lastPosition = new Vector3(position.x, position.y, position.z); position = UpdatePosition(ref position, ref pointOnCircle, radius, randomRange); Vector3 dir = (lastPosition - position).normalized; rotation = Quaternion.LookRotation(dir).eulerAngles; customEvent.SetParam("x", position.x.ToString()); customEvent.SetParam("y", position.y.ToString()); customEvent.SetParam("z", position.z.ToString()); customEvent.SetParam("rx", rotation.x.ToString()); customEvent.SetParam("ry", rotation.y.ToString()); customEvent.SetParam("rz", rotation.z.ToString()); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; if (a == deviceCount - 1 && b == sessionCount - 1 && c == eventCount - 1) { retv.Add(firstDate, data); fileCount++; } } } } EndProgress(); return(retv); }
override protected Dictionary <double, string> Play() { SetRandomSeed(); List <string> eventNames = new List <string>() { m_EventName }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[a]; var x = new TestEventParam("x", TestEventParam.Str, ""); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Str, ""); customEvent.Add(y); var t = new TestEventParam("t", TestEventParam.Str, ""); customEvent.Add(t); var level = new TestEventParam("level", TestEventParam.Str, ""); customEvent.Add(level); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int eventCount = 100; int deviceCount = 5; int sessionCount = 3; // Custom to this lesson int[] position = new int[2] { m_Width / 2, m_Height / 2 }; int[] lastPosition = new int[2] { m_Width / 2, m_Height / 2 }; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * eventCount * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; int currentPoint = 0; for (int a = 0; a < deviceCount; a++) { string platform = "ios"; for (int b = 0; b < sessionCount; b++) { Prefill(); Carve(m_Width / 2, m_Height / 2, m_Directions["N"], null); int level = UnityEngine.Random.Range(1, m_Levels); for (int c = 0; c < eventCount; c++) { Progress(currentPoint, totalSeconds); currentPoint++; currentSeconds++; TestCustomEvent customEvent = events[0]; customEvent.SetParam("t", c.ToString()); if (c == 0) { position = new int[2] { m_Width / 2, m_Height / 2 }; lastPosition = new int[2] { m_Width / 2, m_Height / 2 }; } int[] previousPosition = position.Clone() as int[]; position = Move(position, lastPosition); m_Route.Add(position); lastPosition = previousPosition; customEvent.SetParam("x", position[0].ToString()); customEvent.SetParam("y", position[1].ToString()); customEvent.SetParam("level", level.ToString()); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; if (a == deviceCount - 1 && b == sessionCount - 1 && c == eventCount - 1) { retv.Add(firstDate, data); fileCount++; } } } } EndProgress(); return(retv); }
public override Dictionary <double, string> Generate() { SetRandomSeed(); List <string> eventNames = new List <string>() { "Heatmap.LookAt" }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[a]; var x = new TestEventParam("x", TestEventParam.Str, ""); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Str, ""); customEvent.Add(y); var z = new TestEventParam("z", TestEventParam.Str, ""); customEvent.Add(z); var t = new TestEventParam("t", TestEventParam.Str, ""); customEvent.Add(t); var dx = new TestEventParam("dx", TestEventParam.Str, ""); customEvent.Add(dx); var dy = new TestEventParam("dy", TestEventParam.Str, ""); customEvent.Add(dy); var dz = new TestEventParam("dz", TestEventParam.Str, ""); customEvent.Add(dz); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int eventCount = 30; int deviceCount = 5; int sessionCount = 1; // Custom to this lesson int lookThisManyPlaces = 3; int lookThisManyTimesMin = 5; int lookThisManyTimesMax = 20; float randomRange = .25f; float radius = 1000f; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * eventCount * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; Vector3 position = Vector3.zero, destination = Vector3.zero, pointOnCircle = Vector3.zero; for (int a = 0; a < deviceCount; a++) { string platform = "ios"; for (int b = 0; b < sessionCount; b++) { for (int c = 0; c < eventCount; c++) { pointOnCircle = new Vector3(UnityEngine.Random.Range(-radius, radius), 0f, UnityEngine.Random.Range(-radius, radius)); position = UpdatePosition(ref position, ref pointOnCircle, radius, randomRange); position.y = 0f; for (int e = 0; e < lookThisManyPlaces; e++) { int numTimesToLook = UnityEngine.Random.Range(lookThisManyTimesMin, lookThisManyTimesMax); float xAddition = UnityEngine.Random.Range(-radius, radius); float yAddition = UnityEngine.Random.Range(0, radius / 2f); float zAddition = UnityEngine.Random.Range(-radius, radius); while (numTimesToLook > 0) { numTimesToLook--; currentSeconds++; TestCustomEvent customEvent = events[0]; customEvent.SetParam("t", c.ToString()); destination = new Vector3(position.x + xAddition, position.y + yAddition, position.z + zAddition); customEvent.SetParam("x", position.x.ToString()); customEvent.SetParam("y", position.y.ToString()); customEvent.SetParam("z", position.z.ToString()); customEvent.SetParam("dx", destination.x.ToString()); customEvent.SetParam("dy", destination.y.ToString()); customEvent.SetParam("dz", destination.z.ToString()); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; } } } } } retv.Add(firstDate, data); fileCount++; return(retv); }
public override Dictionary <double, string> Generate() { SetRandomSeed(); List <string> eventNames = new List <string>() { "Heatmap.ShotWeapon" }; List <TestCustomEvent> events = new List <TestCustomEvent>(); for (int a = 0; a < eventNames.Count; a++) { TestCustomEvent customEvent = new TestCustomEvent(); customEvent.name = eventNames[UnityEngine.Random.Range(0, eventNames.Count)]; var x = new TestEventParam("x", TestEventParam.Num, 0, 0); customEvent.Add(x); var y = new TestEventParam("y", TestEventParam.Num, 0, 0); customEvent.Add(y); var z = new TestEventParam("z", TestEventParam.Num, 0, 0); customEvent.Add(z); events.Add(customEvent); } var retv = new Dictionary <double, string>(); string data = ""; int fileCount = 0; int eventCount = 500; int deviceCount = 5; int sessionCount = 1; // Custom to this lesson float minRadius = 5f; float radius = 10f; DateTime now = DateTime.UtcNow; int totalSeconds = deviceCount * eventCount * sessionCount; double endSeconds = Math.Round((now - UnityAnalytics.DateTimeUtils.s_Epoch).TotalSeconds); double startSeconds = endSeconds - totalSeconds; double currentSeconds = startSeconds; double firstDate = currentSeconds; int currentPoint = 0; for (int a = 0; a < deviceCount; a++) { string platform = "ios"; for (int b = 0; b < sessionCount; b++) { for (int c = 0; c < eventCount; c++) { Progress(currentPoint, totalSeconds); currentPoint++; currentSeconds++; TestCustomEvent customEvent = events[UnityEngine.Random.Range(0, events.Count)]; customEvent.SetParam("t", currentSeconds - startSeconds); float mult = UnityEngine.Random.Range(0f, 1f) > .5f ? -1f : 1f; float distance = UnityEngine.Random.Range(minRadius, radius) * mult; Vector3 rot = new Vector3(UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f), UnityEngine.Random.Range(-1f, 1f)); Vector3 position = rot.normalized * distance; customEvent.SetParam("x", position.x, position.x); customEvent.SetParam("y", position.y, position.y); customEvent.SetParam("z", position.z, position.z); string evt = customEvent.WriteEvent(a, b, currentSeconds, platform); data += evt; if (a == deviceCount - 1 && b == sessionCount - 1 && c == eventCount - 1) { retv.Add(firstDate, data); fileCount++; } } } } EndProgress(); return(retv); }