public void TestStandardDeviation() { StatisticManager statisticManager = new StatisticManager(_artist); double stdDev = statisticManager.CalculateStandardDeviation(); Assert.AreEqual(Math.Round(stdDev, 1), 2.1); }
private void BuildLatestResultTable() { var listOfPages = StatisticManager.GetUserLatestAnswers(_userId); int countOfShowedPages = Math.Min(CountHowManyPagesToShow, listOfPages.Count); LastPagesResultTable.Visible = (countOfShowedPages != 0); for (int i = 0; i < countOfShowedPages; i++) { var pageNameCell = new TableCell { Text = listOfPages[i].PageName }; var themeNameCell = new TableCell { Text = listOfPages[i].ThemeName }; var pageStatusPageCell = new TableCell { Text = listOfPages[i].GetStatus().ToString() }; var dateCell = new TableCell { Text = listOfPages[i].Date.ToString() }; var row = new TableRow(); row.Cells.AddRange(new[] { pageNameCell, themeNameCell, pageStatusPageCell, dateCell }); LastPagesResultTable.Rows.Add(row); } }
public void TestAverage() { StatisticManager statisticManager = new StatisticManager(_artist); double average = statisticManager.CalculateAverageNumberOfWordsInSong(); Assert.AreEqual(average, 4); }
//Wird beim Start ausgeführt private void Start() { statisticManager = GetComponent <StatisticManager>(); //Hole jede KI ais = AI.GetAll(); List <Dropdown.OptionData> aiOptions = new List <Dropdown.OptionData>(); foreach (AI ai in ais) { //Generiere eine Dropdown Option für jede KI aiOptions.Add(new Dropdown.OptionData(ai.name)); } //Generiere eine Dropdown Option für die Modi "One AI" und "All AI" modeSelection.GetComponent <Dropdown>().AddOptions(new List <Dropdown.OptionData>() { new Dropdown.OptionData("One AI"), new Dropdown.OptionData("All AIs") }); aiSelection.GetComponent <Dropdown>().AddOptions(aiOptions); //Generiere für jeden Statistik Modi eine Dropdown Option criteriaSelection.GetComponent <Dropdown>().AddOptions(new List <Dropdown.OptionData>() { new Dropdown.OptionData("Average Fitness"), new Dropdown.OptionData("Best Fitness"), new Dropdown.OptionData("Successrate") }); //Aktualsiere die Session Dropdown Optionen RefreshSessionOption(0); }
private static string FindAnswer(int userId, TblQuestions question) { var answersForQuestion = ServerModel.DB.Load <TblUserAnswers>(ServerModel.DB.LookupIds <TblUserAnswers>(question, null)); var answers = new List <TblUserAnswers>(); foreach (var ans in answersForQuestion) { if (ans.UserRef == userId) { answers.Add(ans); } } if (answers.Count > 0) { var lstUserAnswer = StatisticManager.FindLatestUserAnswer(answers); if (lstUserAnswer != null) { return(lstUserAnswer.UserAnswer); } } return(string.Empty); }
void Awake() { // Singleton GameManager pattern. if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); // Set data manager references. ConnectionManager = this.gameObject.GetComponent <ConnectionManager> (); WorldSettings = this.gameObject.GetComponent <WorldSettings> (); KeyManager = this.gameObject.GetComponent <KeyManager> (); PlayerManager = this.gameObject.GetComponent <PlayerManager> (); StatisticManager = this.gameObject.GetComponent <StatisticManager> (); // Set program control manager references. GameController = GameObject.Find("GameController").GetComponent <GameController> (); MsgBroadcastController = GameObject.Find("MsgBroadcastController").gameObject.GetComponent <MsgBroadcastController> (); WorldManager = GameObject.Find("World").gameObject.GetComponent <WorldManager> (); MainMenuController = GameObject.Find("UI").transform.Find("MainMenuCanvas").GetComponent <MainMenuController> (); }
public void TestDatabase() { var Data = new Data(); var results = DataSources.DataConnections.DriverResultsTableUpdater.GetResultsFromDatabase(Session.Race, Data.NumberOfDrivers, Data.NumberOfTracks, StratSim.Properties.Settings.Default.CurrentYear, Driver.GetDriverIndexDictionary()); var championship = StatisticManager.GetChampionships(results, PointScoringSystem.Post2009, true); Assert.AreEqual(384, ((ChampionshipDataElement)championship.DriverStats[0]).Points); }
private static TblUserAnswers GetLastUserAnswerForCompiledQuestion(TblQuestions q, TblUsers u) { var userAnswers = StudentRecordFinder.GetUserAnswersForQuestion(q, u.ID); var compiledAnswers = StudentRecordFinder.ExtractCompiledAnswers(userAnswers); return(StatisticManager.FindLatestUserAnswer(compiledAnswers)); }
private void GetResultsFromData(Session session) { results = StatisticManager.GetResultsFromDatabase(session); if (ResultsModified != null) { ResultsModified(this, new EventArgs()); } }
public void activate(GameObject player) { var pl = player.GetComponent <Player>(); float divider = pl == null ? 1 : pl.weaponSpeedMultiplier; if (Time.time - this.previousActivation > this.firedelay / divider) { //Allow fire for (int i = 0; i < bulletAmount; i++) { //Spawn a bullet var go = player.tag == "Enemy"? bulletPoolEnemy[this.bulletEnemyPrefab.name][(bulletIndicesEnemy[bulletEnemyPrefab.name]++) % bulletPoolSize] : bulletPool[this.bulletPrefab.name][(bulletIndices[bulletPrefab.name]++) % bulletPoolSize]; go.transform.parent = bulletContainer.transform; go.transform.rotation = player.transform.rotation; go.transform.position = player.transform.Find("shootPoint").position; /*GameObject.Instantiate(bulletPrefab, player.transform.Find("shootPoint").position, * player.transform.rotation * , this.bulletContainer.transform);*/ go.SetActive(true); float angle = this.transform.rotation.eulerAngles.y + (UnityEngine.Random.value - 0.5f) * (spread); Vector3 add = new Vector3( Mathf.Sin(angle * Mathf.PI / 180f), Mathf.Sin(heightAngle * 180f / Mathf.PI), Mathf.Cos(angle * Mathf.PI / 180f) ); add.Normalize(); float addSpeed = 1f; float addDamage = 1f; //TODO - this might be moved to interface at some point, but for now. Lets keep it at player. if (pl != null) { // addSpeed = pl.weaponSpeedMultiplier; addDamage = pl.weaponDamageMultiplier; } else { //Enemies shoot halved speed.s addSpeed = 0.1f * GameConfig.difficulty + 0.7f; addDamage *= GameConfig.difficulty; } // Debug.Log("Shoot angle: " + add); go.GetComponent <IAmmunition>().shooter = player; go.GetComponent <IAmmunition>().direction = add * (bulletspeed * addSpeed + UnityEngine.Random.value * bulletSpeedRandomFactor * addSpeed) + 0f * player.GetComponent <ITarget>().m_Move; // Debug.Log("final shoot: " + go.GetComponent<IAmmunition>().direction); go.GetComponent <IAmmunition>().damage = this.bulletDamage * addDamage; go.GetComponent <IAmmunition>().effectRadius = this.effectRadius; go.GetComponent <IAmmunition>().bulletToShotRatio = 1f / (float)this.bulletAmount; } StatisticManager.calculateShotStatistics(pl, bulletAmount); this.previousActivation = Time.time; } }
private void GetResultsFromData(Session session) { results = StatisticManager.GetResultsFromDatabase(session); Statistic = StatisticManager.GetChampionships(results, PointSystem, DoublePoints); if (DataLoadedFromDatabase != null) { DataLoadedFromDatabase(this, new EventArgs()); } }
void ChampionshipData_PointSystemChanged(object sender, EventArgs e) { ChampionshipStatistic newStatistic = StatisticManager.GetChampionships(results, PointSystem, DoublePoints); RunResultsComparison(results, session, Statistic, newStatistic); if (ChampionshipsModified != null) { ChampionshipsModified(this, newStatistic); } }
// Use this for initialization void Awake () { statistics = new Dictionary<PlayerID, Statistic>(); if(instance != null && instance != this) Destroy(this.gameObject); else instance = this; DontDestroyOnLoad(this.gameObject); }
public AssetFetcher(OMV.GridClient grid) { m_client = grid; // m_client.Assets.OnAssetReceived += new OMV.AssetManager.AssetReceivedCallback(Assets_OnAssetReceived); m_requests = new Dictionary <string, TRequest>(); m_outstandingRequests = new List <TRequest>(); m_stats = new StatisticManager("AssetFetcher"); m_totalRequests = m_stats.GetCounter("TotalRequests"); m_duplicateRequests = m_stats.GetCounter("DuplicateRequests"); m_requestsForExisting = m_stats.GetCounter("RequestsForExistingAsset"); }
private void RaisePositionChanged() { this.AddInfoLog(LocalizedStrings.Str1399Params, _positions.CachedPairs.Select(pos => pos.Key + "=" + pos.Value).JoinCommaSpace()); this.Notify(nameof(Position)); PositionChanged?.Invoke(); StatisticManager.AddPosition(CurrentTime, Position); StatisticManager.AddPnL(CurrentTime, PnL); RaiseNewStateMessage(nameof(Position), Position); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { DestroyImmediate(gameObject); } }
public List <ChartPointWrapper> GetVisitStatistics(ApiDateTime fromDate, ApiDateTime toDate) { SecurityContext.DemandPermissions(Tenant, SecutiryConstants.EditPortalSettings); var from = TenantUtil.DateTimeFromUtc(fromDate); var to = TenantUtil.DateTimeFromUtc(toDate); var points = new List <ChartPointWrapper>(); if (from.CompareTo(to) >= 0) { return(points); } for (var d = new DateTime(from.Ticks); d.Date.CompareTo(to.Date) <= 0; d = d.AddDays(1)) { points.Add(new ChartPointWrapper { DisplayDate = d.Date.ToShortDateString(), Date = d.Date, Hosts = 0, Hits = 0 }); } var hits = StatisticManager.GetHitsByPeriod(Tenant.TenantId, from, to); var hosts = StatisticManager.GetHostsByPeriod(Tenant.TenantId, from, to); if (hits.Count == 0 || hosts.Count == 0) { return(points); } hits.Sort((x, y) => x.VisitDate.CompareTo(y.VisitDate)); hosts.Sort((x, y) => x.VisitDate.CompareTo(y.VisitDate)); for (int i = 0, n = points.Count, hitsNum = 0, hostsNum = 0; i < n; i++) { while (hitsNum < hits.Count && points[i].Date.CompareTo(hits[hitsNum].VisitDate.Date) == 0) { points[i].Hits += hits[hitsNum].VisitCount; hitsNum++; } while (hostsNum < hosts.Count && points[i].Date.CompareTo(hosts[hostsNum].VisitDate.Date) == 0) { points[i].Hosts++; hostsNum++; } } return(points); }
internal int[] GetTeamData() { int[] teamChampionship = new int[Data.NumberOfDrivers / 2]; ChampionshipStatistic statistic = StatisticManager.GetChampionships(results, pointSystem, doublePoints); for (int teamIndex = 0; teamIndex < Data.NumberOfDrivers / 2; teamIndex++) { teamChampionship[teamIndex] = ((ChampionshipDataElement)statistic.TeamStats[teamIndex]).Points; } return(teamChampionship); }
internal int[] GetDriverData() { int[] driverChampionship = new int[Data.NumberOfDrivers]; ChampionshipStatistic statistic = StatisticManager.GetChampionships(results, pointSystem, doublePoints); for (int driverIndex = 0; driverIndex < Data.NumberOfDrivers; driverIndex++) { driverChampionship[driverIndex] = ((ChampionshipDataElement)statistic.DriverStats[driverIndex]).Points; } return(driverChampionship); }
public ActionResult Timeline(EntranceTableData data) { if (data.Validation()) { return(Content(string.Format("<b class=\"message_error\">Internal error. '{0}'</b>", data.ErrorMessage))); } StatisticManager manager = new StatisticManager(); TimelineModel model = new TimelineModel(); model.Data = manager.LoadTimeline(data); return(View("~/Views/Statistic/Timeline.cshtml", model)); }
private IEnumerable <StatisticViewModel> GetStatistic(int _quizId) { var st = new StatisticManager(); var statistic = new List <StatisticViewModel>(); var Questions = repository.GetMultipleQuestionsByQuizId(_quizId); foreach (MultipleChoiceQuestion question in Questions) { statistic.Add(st.GetQuestionStatistic(question)); } return(statistic); }
// Use this for initialization void Awake() { statistics = new Dictionary <PlayerID, Statistic>(); if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
private void OnTriggerEnter(Collider other) { if (other.name == "fallTrigger" && !falling) { //Trigger fall falling = true; this.transform.Find("Sounds").GetComponent <AudioSource>().Play(); } else if (other.name == "exitTrigger") { //Game over this.hitPoints = 0; StatisticManager.calculatePlayerDeathStatistics(this, StatisticManager.Death.byJump); } }
public ActionResult GetQuizResult(MultipleChoiceAnswer _answer) { if (string.IsNullOrEmpty(_answer.Answer)) { ModelState.AddModelError("", "You need to choose answer"); ViewBag.Radiobutton = GetRandomRadiobutton(); return(PartialView("StatisticPartialView", new StatisticViewModel())); } var sm = new StatisticManager(); repository.AddAnswer(_answer); StatisticViewModel statisticView = sm.GetQuestionStatistic(repository.GetMultipleQuestion(_answer.QuestionId)); return(PartialView("StatisticPartialView", statisticView)); }
public StatisticPage(IMainSwitch context) { InitializeComponent(); this.context = context; DataContext = this; statisticManager = new StatisticManager(new StatisticComponents() { BtnNext = btnNextDay, BtnPrevious = btnPreviousDay, GroupBox = groupThisDevice, TextDownload = labelCurrentDownload, TextUpload = labelCurrentUpload }); statisticManager.Start(); }
protected void Page_Load(object sender, EventArgs e) { var theme = ServerModel.DB.Load <TblThemes>(ThemeId); var currentUser = ServerModel.User.Current; if (currentUser != null) { var user = ServerModel.DB.Load <TblUsers>(UserId); SetHeaderText(theme.Name, CurriculumnName, StageName, user.DisplayName); int totalPageRank = 0; int totalUserRank = 0; var userResults = StatisticManager.GetStatisticForThemeForUser(user.ID, theme.ID); foreach (var ur in userResults) { if (ur.Status != ResultStatus.NotIncluded) { totalUserRank += ur.UserRank; totalPageRank += ur.PageRank; var row = new TableRow(); SetPageName(row, ur.Page.PageName); SetStatus(row, ur.Status); SetUserRank(row, ur.UserRank); SetPageRank(row, (int)ur.Page.PageRank); SetUserAnswersLink(row, ur.Page.ID, user.ID); if (ServerModel.User.Current.Islector()) { SetCorrectAnswersLink(row, ur.Page.ID); } if (StatisticManager.IsContainCompiledQuestions(ur.Page)) { SetCompiledDetailsLink(row, ur.Page.ID, user.ID); } _resultTable.Rows.Add(row); } } SetTotalRow(totalPageRank, (totalUserRank < 0) ? 0 : totalUserRank); } }
protected internal void Application_BeginRequest(object sender, EventArgs e) { // Get objects. HttpContext context = base.Context; var q = context.Request; var statistcs = new Statistic { Date = DateTime.Now, Url = context.Request.Path }; using (var manager = new StatisticManager()) { manager.Save(statistcs); } }
void Start() { _statistic = GameManager.Instance.GetManager <StatisticManager>(); _timelineManager = GameManager.Instance.GetManager <ObjectsTimelineManager>(); if (_statistic == null) { Debug.LogError("Failed to get StatisticManager!"); } EventManager e = GameManager.Instance.GetManager <EventManager>(); if (e != null) { e.StatisticChanged.AddListener(OnUnitKilled); e.StatisticChanged.AddListener(OnUnitMissed); e.GameTimeIncreased.AddListener(OnTimeIncreased); e.GameResumed.AddListener(OnGameResumed); } }
public void affect(GameObject target) { var e = target.GetComponent <ITarget>(); if (e != null && target != this.shooter && !e.invulnerable) { var d = this.transform.position - target.transform.position; float damage = dampeningFunction.Evaluate(Mathf.Clamp(Vector3.Magnitude(d) / this.effectRadius, 0f, 1f)) * this.damage; if (curOther == target) { damage = this.damage; Debug.Log("Use this damage"); } Debug.Log("damage: " + damage); float blocked = damage * Mathf.Clamp((e.armor), 0.1f, 1f); float before = e.hitPoints; float rawDamage = damage - blocked; e.hitPoints -= rawDamage; StatisticManager.calculateDamageStatistics(this, target, damage, rawDamage); if (this.shooter.tag == "Player") { StatisticManager.calculateHitStatistics(this.shooter.GetComponent <Player>(), target.tag == "Player" ? StatisticManager.Targets.enemy : StatisticManager.Targets.spawner, 1); } //Weaken armor by blocked amount. Divider is just some weakening value that needs to be tweaked. e.armor -= blocked / 15f; if (e.armor < 0) { e.armor = 0f; } if (e.dead && before > 0) { // Target just died StatisticManager.calculateKillStatistics(this, target); } } }
public AdapterSTUMeng(StatisticManager mng) : base(mng) { #if UNITY_ANDROID //导入app key 标识应用 (Android) _appkey = "5f5c6059b4739632429e12a6"; #elif UNITY_IPHONE //导入app key 标识应用 (ios) _appkey = "$$$$$$$$$$$$$$$$$$$$$$$"; #endif //设置Umeng Appkey GA.StartWithAppKeyAndChannelId(_appkey, "Baidu"); //调试时开启日志 发布时设置为false GA.SetLogEnabled(true); //触发统计事件 开始关卡 GA.StartLevel("enter game test"); //var testInfoMac = GA.GetTestDeviceInfo(1); //LDebug.Log( "===>Umeng "+ testInfoMac ); }
public void OpenTestButtonClick(object sender, EventArgs e) { if (CurriculumnTreeView.SelectedNode != null) { var selectedNode = (IdendtityNode)CurriculumnTreeView.SelectedNode; if (selectedNode.Type == NodeType.Theme) { var shifter = new PageShifter(selectedNode.ID); StatisticManager.MarkNotIncludedPages(shifter.NotUsedPages); StatisticManager.MarkUsedPages(shifter.UsedPages); RedirectToController(new OpenTestController { BackUrl = string.Empty, ThemaId = selectedNode.ID, CurriculumnId = ((IdendtityNode)selectedNode.Parent.Parent).ID, StageId = ((IdendtityNode)selectedNode.Parent).ID, PageIndex = 0, PagesIds = shifter.GetRequestParameter() }); } } }
/// <summary> /// Initialize the statistic mananger. /// </summary> public void InitStatisticMananger() { if (gameObject.GetComponent("StatisticManager") == null) { gameObject.AddComponent<StatisticManager>(); statManagerRef = gameObject.GetComponent("StatisticManager") as StatisticManager; } }
// Initialize the statistic mananger. public void AssignStatisticMananger() { // Stat ref should only assigned once. if(gameObject.GetComponent("StatisticManager") == null){ gameObject.AddComponent<StatisticManager>(); } statManagerRef = gameObject.GetComponent("StatisticManager") as StatisticManager; }