public void Initialize() { // Finding GameObjects m_object_player = GameObject.Find("Player"); m_object_helpers = GameObject.Find ("Helpers"); m_object_duckfield = GameObject.Find("Duckfield"); m_object_audio = GameObject.Find("Audio"); m_object_cameraman = GameObject.Find("Main Camera"); // Finding Components m_collision_prober = m_object_player.GetComponent<CollisionProber>(); m_scoring = m_object_player.GetComponent<Scoring>(); m_health = m_object_player.GetComponent<Health>(); m_walker = m_object_player.GetComponent<Walker>(); m_jumper = m_object_player.GetComponent<Jumper>(); m_time_helper = m_object_helpers.GetComponent<TimeHelper>(); m_screen_helper = m_object_helpers.GetComponent<ScreenHelper>(); m_duckfield = m_object_duckfield.GetComponent<DuckField>(); m_duckization = m_object_audio.GetComponent<DuckizationController>(); m_cameraman = m_object_cameraman.GetComponent<Cameraman>(); m_ig_menu = m_object_cameraman.GetComponent<IgMenu>(); }
public void Start() { sc = (Scoring)(this.gameObject.GetComponent("Scoring")); // scoring will be added in an upcomming tutorial // gather information from the camera to find the screen size xa.camRatio = 1.333f; // 4:3 is 1.333f (800x600) xa.orthSize = Camera.mainCamera.camera.orthographicSize; xa.orthSizeX = xa.orthSize * xa.camRatio; }
void PrintInterimOutput(Scoring scoring) { SequencesSaveState currentState = new SequencesSaveState(this); // scoring.designScoreBestState.RestoreAndRescore(); Trace.Assert(DesignScoreResult.ApproximatelyEquals(scoring.designScoreCur, scoring.designScoreBest), "scoring.designScoreCur == scoring.designScoreBest"); // redundant with check in RestoreAndRescore // this.DoPrintAction.PrintInterimOuput(this); // currentState.RestoreAndRescore(); }
// Use this for initialization void Start () { if (scoreKeeper != null) { Destroy(this.gameObject); return; } else { scoreKeeper = this; DontDestroyOnLoad(this.gameObject); score = initialScore; degenerationTimer = gameObject.AddComponent<Timer>(); degenerationTimer.initialize(degenerationTime, false); } }
protected void StatsMenu_MenuItemClick(Object sender, MenuEventArgs e) { int selectedSeason = int.Parse(Dropdown_Seasons.SelectedValue); int selectedPlayer = int.Parse(DropDown_PlayerSelect.SelectedValue); //Check dropdowns to see if they have changed since they were last saved. if (DropdownsChangedOrNotIinitialized()) { Scoring.LeagueStats LeagueStats = null; List <int> CourseIDs = DatabaseFunctions.GetCourseIDs(leagueID); LeagueStats = Scoring.GetSeasonStats(leagueID, selectedSeason, CourseIDs); Session["LeagueStats"] = LeagueStats; UpdateContent(LeagueStats, CourseIDs, leagueID); Session["StatsSeasonDropdownValue"] = Dropdown_Seasons.SelectedValue; Session["StatsPlayerDropdownValue"] = DropDown_PlayerSelect.SelectedValue; } if (e.Item.Value == "AvgAll") { Session["SelectedStatView"] = "AvgAll"; } else if (e.Item.Value == "LowNet") { //Table_LowestNetSingleRoundScores.Style.Remove("display"); Session["SelectedStatView"] = "LowNet"; } else if (e.Item.Value == "LowGross") { Session["SelectedStatView"] = "LowGross"; } else if (e.Item.Value == "IndvPts") { //Table_.Style.Add("display", "block"); } else if (e.Item.Value == "Skins") { Table_Skins.Style.Clear(); Session["SelectedStatView"] = "Skins"; } else if (e.Item.Value == "Birdies") { Session["SelectedStatView"] = "Birdies"; } else if (e.Item.Value == "Pars") { Session["SelectedStatView"] = "Pars"; } else if (e.Item.Value == "Bogeys") { Session["SelectedStatView"] = "Bogeys"; } else if (e.Item.Value == "DoubleBogeys") { Session["SelectedStatView"] = "DoubleBogeys"; } else if (e.Item.Value == "Eagles") { Session["SelectedStatView"] = "Eagles"; } else if (e.Item.Value == "Par3") { Session["SelectedStatView"] = "Par3"; } else if (e.Item.Value == "Par4") { Session["SelectedStatView"] = "Par4"; } else if (e.Item.Value == "Par5") { Session["SelectedStatView"] = "Par5"; } else if (e.Item.Value == "Handicaps") { Session["SelectedStatView"] = "Handicaps"; } else if (e.Item.Value == "CourseStats") { Session["SelectedStatView"] = "CourseStats"; } else if (e.Item.Value == "Graph") { Session["SelectedStatView"] = "Graph"; } else if (e.Item.Value == "EventScores") { Session["SelectedStatView"] = "EventScores"; } else if (e.Item.Value == "IndividualHoles") { Session["SelectedStatView"] = "IndividualHoles"; } Response.Redirect("~/stats.aspx"); }
// The factor by which we reduce raw scale scoring when showing them to the user. // What's appropriate here is related to the accumulation function used both in computing // the pair score of two strands and across strand pairs. If that's 'sum' then the score // tends to vary with the square of the number of nucleotides; if it's 'max' then it's // different. We presently use 'sum' as that allows local improvents even in the face // of global problems. //----------------------------------------------------------------------------------- // Construction //----------------------------------------------------------------------------------- public SequenceDesignContext(NadirContext context) { Trace.Assert(context.SequenceDesignContext == null); this.NadirContext = context; this.NadirContext.SequenceDesignContext = this; this.Scoring = new Scoring(this); }
public void Print(SequenceDesignContext context, Scoring scoring) { if (!this.fTracingEnabled) return; this.context = context; this.scoring = scoring; this.now = System.DateTime.Now; if (context.Program.Verbose || context.Program.DesignVerbose) { if (context.DesignIter % context.Program.DesignVerboseColumnHeadersCount == 0) { this.WriteLine(this.columnHeaders); } StringBuilder line = new StringBuilder(); for (int i = 0; i < this.columnValues.Count; i++) { object value = this.columnValues[i](); string formatted = String.Format(this.columnFormats[i], value); line.Append(formatted); } this.WriteLine(line.ToString()); } else { MiscUtil.Trace($"{scoring.designScoreBest:F1} "); } this.cPrinted++; if (this.cPrinted == cPrintedOmit) { this.cTotalScoringIter = 0; this.nowScoringTrialZero = System.DateTime.Now; } this.nowPrev = this.now; }
public static Scoring Parse(string s) { var arr = s.Split(','); var name = arr[0]; var guesses = int.Parse(arr[1]); var totalTime = double.Parse(arr[2], CultureInfo.InvariantCulture); var score = new Score(guesses, totalTime); var scoring = new Scoring(name, score); return scoring; }
private void cmbRegion_SelectionChangeCommitted(object sender, EventArgs e) { lblRegionalPoints.Text = Scoring.getScore(swp.region, cmbRegion.SelectedIndex).ToString(); updateTotalScore(); }
void Start() { //used for returning the GameObject that is being touched. hitTest = Camera.main.GetComponent<GUILayer> (); //scoring score = gameObject.GetComponent<Scoring>(); //Find all GameObjects on current scene and set them to a variable FindGameObjects (); midButtonColor = new Color(.33725f,.56862f,.18039f,1f); }
void Start() { score = GetComponent<Scoring> (); gl = GetComponent<GameLoop> (); boardSFX = GetComponent<AudioSource> (); }
public void UIInput(string control) { if (target != null) { // Move Left if (control == "Left" && canDrop == true) { // Modify position target.transform.position += new Vector3(-1, 0, 0); sfxSource.PlayOneShot(move); // See if valid if (target.IsValidGridPos()) { // Its valid. Update grid. target.UpdateGrid(); } else { // Its not valid. revert. target.transform.position += new Vector3(1, 0, 0); } } // Move Right else if (control == "Right" && canDrop == true) { // Modify position target.transform.position += new Vector3(1, 0, 0); sfxSource.PlayOneShot(move); // See if valid if (target.IsValidGridPos()) { // It's valid. Update grid. target.UpdateGrid(); } else { // It's not valid. revert. target.transform.position += new Vector3(-1, 0, 0); } } // Rotate else if (control == "Rotate" && target.groupName.ToLower() != "o" && canDrop == true) { sfxSource.PlayOneShot(rotate); target.transform.Rotate(0, 0, -90); // See if valid if (target.IsValidGridPos()) { // It's valid. Update grid. target.UpdateGrid(); } else { // It's not valid. revert. target.transform.Rotate(0, 0, 90); } } else if (control == "Soft Drop") { if (canDrop == true) { Scoring.score++; // Modify position target.transform.position += new Vector3(0, -1, 0); sfxSource.PlayOneShot(move); // See if valid if (target.IsValidGridPos()) { // It's valid. Update grid. target.UpdateGrid(); } else { // It's not valid. revert. target.transform.position += new Vector3(0, 1, 0); // Clear filled horizontal lines BoxGrid.DeleteFullRows(); // Disable script target.enabled = false; // Spawn next Group FindObjectOfType <Spawner>().SpawnNext(); } Scoring.UpdateUI(); } } else if (control == "Hard Drop" && canDrop == true) { target.hardDrop = true; } } }
private void UpdateContent(Scoring.LeagueStats LeagueStats, List <int> CourseIDs, int LeagueID) { Table averageScoresByCourseTable = new Table(); averageScoresByCourseTable.CellPadding = 5; TableRow titleRow = new TableRow(); TableCell titleCell = AddCell(titleRow, "Scoring Averages by Course"); titleCell.ColumnSpan = CourseIDs.Count; titleCell.HorizontalAlign = HorizontalAlign.Center; titleCell.Font.Bold = true; titleCell.Font.Size = 16; averageScoresByCourseTable.Rows.Add(titleRow); Table ScoreCardsTable = new Table(); ScoreCardsTable.CellPadding = 40; TableRow tr = new TableRow(); //Add Scorecards for each course foreach (int courseID in CourseIDs) { CourseInfo courseInfo = DatabaseFunctions.GetCourseInfoFromCourseID(courseID); Table scoreCardTable = BuildEmptyScoreCardTable(courseInfo); scoreCardTable.BorderStyle = BorderStyle.Solid; scoreCardTable.BorderWidth = 5; AddScoreCardRows(scoreCardTable, LeagueStats.LeagueHoleAveragesByCourse[courseID], LeagueStats.LeagueRingerNineByCourse[courseID], LeagueStats.LeagueHighScoreByCourse[courseID]); TableRow scoreCardHolderRow = new TableRow(); TableCell scoreCardHolderCell = new TableCell(); scoreCardHolderCell.Controls.Add(scoreCardTable); scoreCardHolderRow.Cells.Add(scoreCardHolderCell); ScoreCardsTable.Rows.Add(scoreCardHolderRow); Table bestScoresTable = new Table(); BuildAvgScoreTable(bestScoresTable, courseInfo.name, LeagueStats.AverageScoreByCourse[courseID], LeagueStats.NumRoundsByGolferAndCourse[courseID], 12); TableCell tc = new TableCell(); tc.VerticalAlign = VerticalAlign.Top; tc.Controls.Add(bestScoresTable); tr.Cells.Add(tc); } averageScoresByCourseTable.Rows.Add(tr); Panel_AverageScoresByCourse.Controls.Add(averageScoresByCourseTable); Panel_HoleScores.Controls.Add(ScoreCardsTable); BuildAvgScoreTable(Table_AverageScores, "Average Score All Courses", LeagueStats.AvgScores, LeagueStats.NumberOfEventsPlayed, 16); BuildBestScoreTable(Table_LowestGrossSingleRoundScores, "Lowest Rounds (gross)", LeagueStats.LowestGrossSingleRoundScores, 30); BuildBestScoreTable(Table_LowestNetSingleRoundScores, "Lowest Rounds (Net)", LeagueStats.LowestNetSingleRoundScores, 30); BuildHighestTotalTable(Table_Skins, "Skins", LeagueStats.Skins, LeagueStats.NumberOfEventsPlayed); BuildHighestTotalTable(Table_Birdies, "Birdies", LeagueStats.Birdies, LeagueStats.NumberOfEventsPlayed); BuildHighestTotalTable(Table_Pars, "Pars", LeagueStats.Pars, LeagueStats.NumberOfEventsPlayed); BuildHighestTotalTable(Table_Bogeys, "Bogeys", LeagueStats.Bogeys, LeagueStats.NumberOfEventsPlayed); BuildHighestTotalTable(Table_DoubleBogeys, "Double Bogeys", LeagueStats.DoubleBogeys, LeagueStats.NumberOfEventsPlayed); BuildAvgScoreTable(Table_Par3Scoring, "Par 3 Scoring Averages", LeagueStats.ParThreeScoringAvg, 16, "Number of Par3's Played"); BuildAvgScoreTable(Table_Par4Scoring, "Par 4 Scoring Averages", LeagueStats.ParFourScoringAvg, 16, "Number of Par4's Played"); BuildAvgScoreTable(Table_Par5Scoring, "Par 5 Scoring Averages", LeagueStats.ParFiveScoringAvg, 16, "Number of Par5's Played"); try { int lastEventID = DatabaseFunctions.GetMostRecentEventWithScoresPosted(LeagueID.ToString()).EventID; BuildHighestTotalTable(Table_Handicaps, "Handicaps", Scoring.GetHandicapsForEventFromHandicapByGolferIDDictionary(LeagueStats.handicaps, lastEventID), LeagueStats.NumberOfEventsPlayed); } catch { } //BuildHighestTotalTable(Table_Eagles, "Eagles", LeagueStats.Eagles, LeagueStats.NumberOfEventsPlayed); //BuildBestScoreTable(Table_LowestNetSingleRoundScores, "Lowest Rounds (net)", LeagueStats.LowestNetSingleRoundScores); UpdatePlayerContent(); }
static void RunGameTests() { System.TimeSpan simple = new System.TimeSpan(1000); // check the diamond shaped board checkDiamondShape(Game.Difficulty.EASY); checkDiamondShape(Game.Difficulty.NORMAL); checkDiamondShape(Game.Difficulty.HARD); checkFishShape(Game.Difficulty.EASY); checkFishShape(Game.Difficulty.NORMAL); checkFishShape(Game.Difficulty.HARD); //checking if scoring adds the right points and combos Scoring scoring = new Scoring(2500); assert(scoring.Combo == 1 && scoring.Score == 0); for (int i = 0; i < 15; i++) { scoring.AddPoint(1); } assert(scoring.Combo == 32 && scoring.Score == 351); scoring.AddPoint(0); assert(scoring.Combo == 32 && scoring.Score == 351); scoring.AddPoint(-1); assert(scoring.Combo == 32 && scoring.Score == 351); Thread.Sleep(2600); assert(scoring.Combo == 16 && scoring.Score == 351); //creating random boards LevelManager levelManager = new LevelManager(); List <Image> imageList = new List <Image>(); //creates a new empty texture Texture2D t2d = new Texture2D(GameManager.Instance.GraphicsDevice, 100, 100); for (int i = 0; i < 15; i++) { imageList.Add(new Image() { ImageTexture = t2d, Name = "random" + i }); } //checking if a testboard after starting a new game, has a board, and the images to find can be found on the board Board testBoard = levelManager.NewGame(GameMode.NORMAL, Difficulty.EASY, null, imageList); assert(testBoard.X == 5 && testBoard.Y == 5); assert(levelManager.ImagesToFind.ToFind.Count > 0); for (int i = 0; i < levelManager.ImagesToFind.ToFind.Count; i++) { assert(levelManager.ImagesToFind.ToFind[i].ImageTexture == t2d); assert(levelManager.ImagesToFind.ToFind[i].Name.Substring(0, 6).Equals("random")); } testBoard = levelManager.NewGame(GameMode.TIME, Difficulty.NORMAL, null, imageList); assert(testBoard.X == 9 && testBoard.Y == 9); for (int i = 0; i < levelManager.ImagesToFind.ToFind.Count; i++) { assert(levelManager.ImagesToFind.ToFind[i].Name.Substring(0, 6).Equals("random")); } assert(levelManager.ImagesToFind.ToFind.Count > 0); testBoard = levelManager.NewGame(GameMode.ENDLESS, Difficulty.HARD, null, imageList); assert(testBoard.X == 16 && testBoard.Y == 16); assert(levelManager.ImagesToFind.ToFind.Count > 0); for (int i = 0; i < levelManager.ImagesToFind.ToFind.Count; i++) { assert(levelManager.ImagesToFind.ToFind[i].Name.Substring(0, 6).Equals("random")); } //creates a testfield, which cannot be found on any randomly created board Field testField = new Field( new Image() { ImageTexture = t2d, Name = "nemtalalhato" }, 0, 0, 0, false, new Transformator(Difficulty.HARD, 1)); //the testfield cannot be clicked assert(levelManager.TryClickedField(testField) == false); //try to click one random image, which is in the tofind list assert(levelManager.TryClickedField( testBoard.AllFields.Find(field => field.ImageProperty.Name == levelManager.ImagesToFind.ToFind[0].Name) )); //adding and removing fields from the board testBoard.AddToAllFields(testField); assert(testBoard.AllFields.Contains(testField)); testBoard.AllFields.Remove(testField); assert(testBoard.AllFields.Contains(testField) == false); //the board has a square shape, and the size of the hard difficulty int squareSide = (int)Math.Sqrt((double)testBoard.AllFields.Count); assert(squareSide == 16); //creates a new diamond shaped board, and checks some fields if they are on the correct place testBoard = levelManager.NewGame(GameMode.NORMAL, Difficulty.EASY, new BoardDiamond(), imageList); assert(testBoard.GetField(0, 0) == null); assert(testBoard.GetField(3, 0) != null); assert(testBoard.GetField(3, 0).ColumnIndex == 3 && testBoard.GetField(3, 0).RowIndex == 0); //checks if changeField function works properly Field oldField = testBoard.GetField(3, 0); string oldstr = oldField.ImageProperty.Name; testBoard.ChangeField(oldField, Difficulty.EASY, delegate() { levelManager.ImagesToFind.AddNewImageToFind(); }); //can cause exception in odd cases if the random new image is the same as it was assert(oldstr != testBoard.GetField(3, 0).ImageProperty.Name); //checks the ImagesToFind if it doesnt contain an image, which cannot be found on the board, and checkes one, which should be on it ImagesToFind imagesToFind = levelManager.ImagesToFind; assert(imagesToFind.TryToFindField(testField) == false); assert(imagesToFind.TryToFindField(testBoard.AllFields.Find(field => field.ImageProperty.Name == levelManager.ImagesToFind.ToFind[0].Name))); //adds a new image to find, and checks if the images to find count has increased int oldCount = imagesToFind.ToFind.Count; imagesToFind.AddNewImageToFind(); assert(oldCount + 1 == imagesToFind.ToFind.Count); assert(imagesToFind.ToString().Contains(imagesToFind.ToFind[0].Name)); //creates some new images to find, and checks if it is created properly imagesToFind = new ImagesToFind(); assert(imagesToFind.ToString() == ""); imagesToFind = ImagesToFind.CreateNewImagesToFind(GameMode.NORMAL, Difficulty.EASY, testBoard); assert(imagesToFind.ToFind.Count > 0); bool serverworks = false; ServerCommunicator.ScoreboardCommunicator.Instance.GetTop10Scores(GameMode.NORMAL, Difficulty.EASY, delegate(ServerCommunicator.Objects.ScoreboardResponse response) { serverworks = true; }); }
private void Awake() { current = this; }
// Use this for initialization void Start() { omascore = GetComponentInChildren <Scoring> (); }
// Use this for initialization void Start() { score = Scripts.GetComponent <Scoring>(); }
/// <summary> /// Adds evaluation criteria to the question /// </summary> /// <param name="Scoring"></param> public abstract void AddScoring(Scoring Scoring);
// Update is called once per frame void Update() { _highscoreUI.text = "HighScore : " + Scoring.getHighScore(); }
void Start() { sc = (Scoring)gameObject.GetComponent("Scoring"); camRatio = 1.333f; orthSize = Camera.mainCamera.camera.orthographicSize; orthSizeX = orthSize*camRatio; }
public async Task HandleAsync_WhenChallengeClosedIntegrationEventIsValid_ShouldBeCompletedTask() { // Arrange var challengeId = new ChallengeId(); var scoring = new Scoring { { new StatName(Game.LeagueOfLegends), new StatWeighting(50.0f) } }; var challenge = new Challenge( challengeId, new ChallengeName("test"), Game.LeagueOfLegends, BestOf.Five, Entries.Four, new ChallengeTimeline(new DateTimeProvider(DateTime.Now.AddDays(-1)), ChallengeDuration.OneDay), scoring); var mockLogger = new MockLogger <ChallengeClosedIntegrationEventHandler>(); TestMock.ChallengeService.Setup(challengeService => challengeService.ChallengeExistsAsync(It.IsAny <ChallengeId>())).ReturnsAsync(true).Verifiable(); TestMock.ChallengeService.Setup(challengeService => challengeService.FindChallengeAsync(It.IsAny <ChallengeId>())) .ReturnsAsync(challenge) .Verifiable(); TestMock.ChallengeService .Setup( challengeService => challengeService.CloseChallengeAsync( It.IsAny <Challenge>(), It.IsAny <IDateTimeProvider>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new DomainValidationResult <IChallenge>()) .Verifiable(); var handler = new ChallengeClosedIntegrationEventHandler(TestMock.ChallengeService.Object, mockLogger.Object); var integrationEvent = new ChallengeClosedIntegrationEvent { ChallengeId = new ChallengeId(), PayoutPrizes = { { "test1", new CurrencyDto { Amount = 50.0m, Type = EnumCurrencyType.Money } } } }; // Act await handler.HandleAsync(integrationEvent); // Assert TestMock.ChallengeService.Verify(challengeService => challengeService.ChallengeExistsAsync(It.IsAny <ChallengeId>()), Times.Once); TestMock.ChallengeService.Verify(challengeService => challengeService.FindChallengeAsync(It.IsAny <ChallengeId>()), Times.Once); TestMock.ChallengeService.Verify( challengeService => challengeService.CloseChallengeAsync(It.IsAny <Challenge>(), It.IsAny <IDateTimeProvider>(), It.IsAny <CancellationToken>()), Times.Once); mockLogger.Verify(Times.Once()); }
void Start() { currentHealth = maxHealth; Score = GameObject.FindGameObjectWithTag("ScoreBox").GetComponent <Scoring>(); }
/** * Izvrsava se na posebnoj niti za svakog klijenta * */ private void ClientHandler(object obj) { TcpClient client = (TcpClient)obj; NetworkStream ns = client.GetStream(); StreamReader reader = new StreamReader(ns); string name = null; Boolean clientPresent = true; try{ while (mRunning && clientPresent) { String msg = reader.ReadLine(); if (msg == null) { // mRunning = false; // break; Thread.Sleep(2); continue; } Debug.Log("NET MSG: " + msg); if (!checkFormat(msg, 0, 2)) { continue; } String[] commandParts = msg.Split('|'); String player = commandParts[0].ToUpper(); String command = commandParts[1].ToUpper(); // Nov igrac usao u igru if (name == null) { Scoring.GetInstance().newPlayer(player); name = player; } // Pucanj if (command.Equals("SHOOT")) { if (!checkFormat(msg, 4, 0)) { continue; } Debug.Log(commandParts[2] + "," + commandParts[3]); int pW = Int32.Parse(commandParts[2]); int pH = Int32.Parse(commandParts[3]); int x = (Screen.width * pW) / 10000; int y = (Screen.height * pH) / 10000; gameLogic.action = new ShootAction(player, command, x, y); } // Disconnect if (command.Equals("DISCONNECT")) { clientPresent = false; } } }catch (Exception e) { Debug.LogException(e); } finally{ reader.Close(); client.Close(); if (name != null) { Scoring.GetInstance().playerGone(name); Debug.Log("Disconnecting client " + name); } else { Debug.Log("Disconnecting client "); } } }