public NVASettingsButton(IEventAggregator eventAggregator, INvtSession session, AnalyticsEngine engine, AnalyticsEngineControl control, Account currentAccount, IVideoInfo videoInfo = null) : base(eventAggregator, session, currentAccount, engine, control, videoInfo) { Init(); }
public NVAButtonBase(IEventAggregator eventAggregator, INvtSession session, Account currentAccount, AnalyticsEngine engine, AnalyticsEngineControl control, IVideoInfo videoInfo = null) : base(eventAggregator, session, currentAccount) { this.engine = engine; this.control = control; this.videoInfo = videoInfo; }
public async Task <IActionResult> GetEventsAggregatedAsync(string field, uint controllerId = 0, TimeSpan?step = null, DateTimeOffset?from = null, DateTimeOffset?to = null, double?timezone = null) { if (step.HasValue && step.Value.Ticks < 0) { if (step.Value.TotalDays == -7) { // Weekly } else { switch ((int)step.Value.TotalDays) { case -30: // Monthly case -90: // Quarterly case -180: // Half-yearly break; default: return(BadRequest($"Invalid step: {step}")); } } } Func <EventX, object> selfunc = null; switch (field) { case "IP": selfunc = ev => ev.IP; break; case "JobMode": selfunc = ev => ev.JobMode; break; case "OpMode": selfunc = ev => ev.OpMode; break; case "Connected": selfunc = ev => ev.Connected; break; case "JobCard": selfunc = ev => ev.JobCardId == "" ? null : ev.JobCardId; break; case "Operator": selfunc = ev => ev.OperatorId; break; case "Mold": selfunc = ev => ev.MoldId == Guid.Empty ? null : ev.MoldId; break; default: return(BadRequest($"Invalid aggregate grouping: {field}")); } if (!timezone.HasValue) { if (from.HasValue) { timezone = from.Value.Offset.TotalMinutes; } else if (to.HasValue) { timezone = to.Value.Offset.TotalMinutes; } else { timezone = DateTimeOffset.Now.Offset.TotalMinutes; } } if (!AnalyticsEngine.IsInitialized) { return(NotFound()); } try { (from, to) = Utils.ProcessDateTimeRange(from, to); // Get the data using (var db = new ConfigDB()) { using (var ana = new AnalyticsEngine(db)) { var result = await ana.GetEventsTimeSplit(from.Value, to.Value, selfunc, field, NoValueMarker, true, step ?? default(TimeSpan), TimeSpan.FromMinutes(timezone.Value), HttpContext.GetOrg(), new[] { controllerId }).ConfigureAwait(false); if (result == null) { return(NotFound()); } return(Ok(result)); } } } catch (ArgumentException ex) { return(BadRequest(ex.Message)); } }
public void Update() { playerMovement.bufferIter = bufferIter; if (playerMovement.locked) { return; } char button = GetButtonPress(); meleeCooldownTimer -= Time.deltaTime; if (button == 'D' && meleeCooldownTimer <= 0) { reticle.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(string.Concat("sprites/weapons/", playerStats.character.ToString(), playerStats.number == 0 ? "" : "Alt", "/Melee")); Melee(); } else if (button != '0' && exponentCooldownTimer <= 0 && !melee) { shotCooldownTimer = shotCooldownTime; if (button != 'D') // threw everything in here to get this cooldown not to interfere with sword. works. { if (bufferIter >= mashBufferSize) { Fire(); AnalyticsEngine.Increment(string.Concat(playerStats.character.ToString(), "BulletsFired")); } else { mashBuffer.SetValue(button, bufferIter); if (!mashing) { mashing = true; } ExponentShot(); if (poweredUpBuffer || bufferIter < mashBufferSize) { bufferIter++; } } } } else if (mashing && button == '0' && !melee) { shotCooldownTimer -= Time.deltaTime; if (shotCooldownTimer <= 0.0f) { Fire(); } } if (exponentCooldownTimer > 0) { exponentCooldownTimer -= Time.deltaTime; renderer.color = new Color(0.5f, 0.5f, 0.5f); } else { renderer.color = new Color(1f, 1f, 1f); playerStats.UpdateBufferBar(bufferIter); } }
// Use this for initialization void Start() { GameObject[] HorusWinsIcons; GameObject[] SetWinsIcons; SetWinsIcons = GameObject.FindGameObjectsWithTag("SetWinsIcon"); HorusWinsIcons = GameObject.FindGameObjectsWithTag("HorusWinsIcon"); HorusWinsIconsSR = new SpriteRenderer[HorusWinsIcons.Length]; SetWinsIconsSR = new SpriteRenderer[SetWinsIcons.Length]; p1LifeBar = GameObject.Find("P1LifeBar"); p1BufferBar = GameObject.Find("P1BufferBarSegments"); p2LifeBar = GameObject.Find("P2LifeBar"); p2BufferBar = GameObject.Find("P2BufferBarSegments"); UIElements = GameObject.Find("InGameUIElements"); ToggleUI(false); player1Wins = 0; player2Wins = 0; roundsToWin = 2; int j = 0; for (int i = 1; i >= 0; i--) { HorusWinsIconsSR[j] = HorusWinsIcons[i].GetComponent <SpriteRenderer>(); SetWinsIconsSR[j] = SetWinsIcons[i].GetComponent <SpriteRenderer>(); j++; } timerStarted = false; //bullets = new BulletDepot(); // clearing a warning w/next line - ski bullets = ScriptableObject.CreateInstance <BulletDepot>(); bullets.Load(); playerFactory = GetComponent <PlayerInitializer>(); playerFactory.bullets = bullets; player1Controls = CreateControlScheme(0); player2Controls = CreateControlScheme(1); currentRoundTime = roundTime; titleLogo = GameObject.FindGameObjectWithTag("TitleLogo").GetComponent <SpriteRenderer>(); pressStart = titleLogo.GetComponent <Text>(); infoScreen = GameObject.FindGameObjectWithTag("InfoScreen").GetComponent <SpriteRenderer>(); background = GameObject.FindGameObjectWithTag("Background").GetComponent <SpriteRenderer>(); roundTimer = GameObject.FindGameObjectWithTag("RoundTimer").GetComponent <Text>(); victoryText = GameObject.FindGameObjectWithTag("VictoryText").GetComponent <Text>(); titleLogo.enabled = true; pressStart.enabled = true; currentUpdateFunction = TitleScreen; characterSelectManager = GetComponent <CharacterSelectManager>(); int numCharacters = System.Enum.GetNames(typeof(Character)).Length; string[,] bulletDescriptions = new string[numCharacters, numCharacters]; for (int i = 0; i < numCharacters; i++) { bulletDescriptions[i, 0] = bullets.types[i].projectileTypes[1].bulletDescription; bulletDescriptions[i, 1] = bullets.types[i].projectileTypes[2].bulletDescription; bulletDescriptions[i, 2] = bullets.types[i].projectileTypes[0].bulletDescription; } AnalyticsEngine.Initialize(new string[] { "LoholtBulletsFired", "OrpheusBulletsFired", "HirukoBulletsFired" }); }
public async Task <IActionResult> GetCycleDataVariableAsync(uint controllerId, string variable, DateTimeOffset?from = null, DateTimeOffset?to = null, DataFileFormats format = DataFileFormats.JSON, double timezone = 0.0) { if (string.IsNullOrWhiteSpace(variable)) { return(BadRequest($"Invalid variable name: {variable}")); } IEnumerable <CycleDataX> result; try { (from, to) = Utils.ProcessDateTimeRange(from, to); using (var db = new ConfigDB()) { using (var ana = new AnalyticsEngine(db)) { result = await ana.GetDataAsync <CycleDataX>(Storage.CycleDataTable, from.Value, to.Value, null, Sorting.ByTime, HttpContext.GetOrg(), controllerId, variable); if (result == null) { return(NotFound()); } } } } catch (ArgumentException ex) { return(BadRequest(ex.Message)); } var data = result.AsParallel().Select(x => new TimeValue <double>(x.Time, x.ContainsKey(variable) ? x[variable] : 0.0)).ToList(); // Encode result switch (format) { case DataFileFormats.JSON: return(Json(data)); case DataFileFormats.CSV: return(Content(DataFileGenerator.BuildCSVFile(TimeValue <double> .Headers, data, timezone), "text/csv", Encoding.UTF8)); case DataFileFormats.TSV: return(Content(DataFileGenerator.BuildCSVFile(TimeValue <double> .Headers, data, timezone, "\t", false), "text/csv", Encoding.UTF8)); case DataFileFormats.XLS: case DataFileFormats.XLSX: { IWorkbook xls; string mime; string ext; switch (format) { case DataFileFormats.XLS: xls = new HSSFWorkbook(); ext = ".xls"; mime = "application/vnd.ms-excel"; break; case DataFileFormats.XLSX: xls = new XSSFWorkbook(); ext = ".xlsx"; mime = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; default: throw new ApplicationException(); } using (var stream = new MemoryStream()) { DataFileGenerator.BuildXLSFile(stream, xls, variable, TimeValue <double> .Headers, data, timezone); var filedata = stream.ToArray(); return(File(filedata, mime, variable + ext)); } } default: throw new ApplicationException(); } }