public ICollection <PlayerStatistic> Cast() { string path = @"..\..\DataSource\playerstats20120510040.txt"; var x = new TxtParse(); string[,] array = x.Parse(path); int min = 4; int SpossF = 5; int SpointsF = 7; int SorebF = 12; for (int index = 2; index < array.GetLength(0); index++) { if (string.IsNullOrEmpty(array[index, 0])) { break; } var playerStats = new PlayerStatistic() { Minutes = float.Parse(array[index, min], CultureInfo.InvariantCulture), SimplePossFor = int.Parse(array[index, SpossF], CultureInfo.InvariantCulture), SimplePointsFor = int.Parse(array[index, SpointsF], CultureInfo.InvariantCulture), SimpleORebFor = int.Parse(array[index, SorebF], CultureInfo.InvariantCulture) }; playersStatsCollection.Add(playerStats); } return(playersStatsCollection); }
private void ReadPlayerStateSuccess(string json, object cb) { m_mainScene.AddLog("SUCCESS"); m_mainScene.AddLogJson(json); m_mainScene.AddLog(""); JsonData jObj = JsonMapper.ToObject(json); JsonData jStats = jObj["data"]["statistics"]; IDictionary dStats = jStats as IDictionary; if (dStats != null) { foreach (string key in dStats.Keys) { PlayerStatistic stat = new PlayerStatistic(); stat.name = (string)key; JsonData value = (JsonData)dStats[key]; // silly that LitJson can't upcast an int to a long... stat.value = value.IsInt ? (int)value : (long)value; m_stats[stat.name] = stat; } } }
public string CreatePlayerCommand() { using (var unitOfWork = new UnitOfWork(new NbaContext())) { this.unitOfWork = unitOfWork; var player = new Player(); var playerStatistic = new PlayerStatistic(); this.writer.WriteLine("Insert player First Name:"); player.FirstName = this.reader.ReadLine(); this.writer.WriteLine("Insert player Last Name:"); player.LastName = this.reader.ReadLine(); this.writer.WriteLine("Insert player Position:"); float position; bool result = float.TryParse(this.reader.ReadLine(), out position); if (!result) { return("incorect value"); } player.Position = position; player.PlayerStatistic = playerStatistic; playerStatistic.Player = player; unitOfWork.Players.Add(player); unitOfWork.PlayerStatistic.Add(playerStatistic); unitOfWork.Complete(); return("success"); } }
public static void createPlayerStatistic(string name, Team team, int key) { PlayerStatistic ps = new PlayerStatistic(); ps.playerKey = key; ps.playerName = name; ps.playerTeam = team; playerStatstics.Add(ps); }
void OnEnable() { pointsText.text = PlayerStatistic.GetInstance().pointsScored.score.ToString(); roundsText.text = PlayerStatistic.GetInstance().roundsPassed.score.ToString(); DataSaver.GetInstance().TrySetHighScore( PlayerStatistic.GetInstance().pointsScored.score, PlayerStatistic.GetInstance().roundsPassed.score); }
public async Task <PlayerStatistic> Add(PlayerStatistic playerStats) { await _db.PlayerStatistics.AddAsync(playerStats); await _db.SaveChangesAsync(); var result = await this.Get(playerStats.PlayerId); return(result.FirstOrDefault(s => s.SeasonId == playerStats.SeasonId && s.TeamId == playerStats.TeamId)); }
public async Task <IActionResult> AddStats([FromBody] PlayerStatistic stats) { try { var result = await _statsRepository.Add(stats); return(Ok(result)); } catch (Exception ex) { #if DEBUG Console.WriteLine(ex.Message); #endif return(NoContent()); } }
void ReadPlayerStatsSuccess(string json, object cb) { Dictionary <string, object> jObj = JsonReader.Deserialize <Dictionary <string, object> >(json); Dictionary <string, object> data = (Dictionary <string, object>)jObj["data"]; Dictionary <string, object> stats = (Dictionary <string, object>)data["statistics"]; if (stats != null) { foreach (string key in stats.Keys) { PlayerStatistic stat = new PlayerStatistic(); stat.name = key; stat.value = System.Convert.ToInt64(stats[key]); m_stats[stat.name] = stat; } } }
public async Task ProcessAsync(Stream stream, CancellationToken cancellationToken = default) { var results = _csvParser.ParseResult(stream); _logger.LogInformation($"Processing {results.Count} results."); // Last chance to cancel. After this point, we allow all results to be calculated and posted, even if cancellation is signaled. // We don't want to send results for half of a file. cancellationToken.ThrowIfCancellationRequested(); foreach (var result in results) { // NOTE: We could use a cache to avoid so many API calls in a real production system var playerOneTask = _tennisPlayerApiClient.GetPlayerAsync(result.PlayerOneId); var playerTwoTask = _tennisPlayerApiClient.GetPlayerAsync(result.PlayerTwoId); await Task.WhenAll(playerOneTask, playerTwoTask); var playerOne = playerOneTask.Result; var playerTwo = playerTwoTask.Result; if (playerOne is object && playerTwo is object) { // calculate match result and player stats await Task.Delay(500); // simulate more intestive processing time and actual generation of results and stats var matchResult = new TennisMatchResult(); var playerOneStats = new PlayerStatistic(); var playerTwoStats = new PlayerStatistic(); // post winner and stats to API var resultTask = _statisticsApiClient.PostResultAsync(matchResult); var statPlayerOneTask = _statisticsApiClient.PostStatisticAsync(playerOneStats); var statPlayerTwoTask = _statisticsApiClient.PostStatisticAsync(playerTwoStats); await Task.WhenAll(resultTask, statPlayerOneTask, statPlayerTwoTask); } } }
void Update() { if (enemiesAlive > 0) { return; } if (nextWaveCountdown <= 0f) { PlayerStatistic.GetInstance().nextWaveCountdownPanel.SetActive(false); PlayerStatistic.GetInstance().pointsPerRoundPanel.SetActive(true); StartCoroutine(SpawnWave()); nextWaveCountdown = timeBetweenWaves; return; } else { nextWaveCountdownText.text = Mathf.Round(nextWaveCountdown).ToString(); } nextWaveCountdown -= Time.deltaTime; }
private void ReadPlayerStateSuccess(string json, object cb) { m_mainScene.AddLog("SUCCESS"); m_mainScene.AddLogJson(json); m_mainScene.AddLog(""); JsonData jObj = JsonMapper.ToObject(json); JsonData jStats = jObj["data"]["statistics"]; IDictionary dStats = jStats as IDictionary; if (dStats != null) { foreach (string key in dStats.Keys) { PlayerStatistic stat = new PlayerStatistic(); stat.name = (string) key; JsonData value = (JsonData) dStats[key]; // silly that LitJson can't upcast an int to a long... stat.value = value.IsInt ? (int) value : (long) value; m_stats[stat.name] = stat; } } }
public static void EnsureSeedData(this MLBStatsContext db) { if (!db.Players.Any()) { var players = new List <Player> { new Player { Name = "Didi Gregorius", BirthDate = new DateTime(1990, 2, 18), Height = "6'03", WeightLbs = 205, BirthPlace = "Amsterdan, Netherlands" }, new Player { Name = "Yuliesky Gurriel", BirthDate = new DateTime(1984, 6, 9), Height = "6'00", WeightLbs = 190, BirthPlace = "Sancti Spiritus, Cuba" }, //new Player { Name = "Xander Bogaerts", BirthDate = new DateTime(1992,1,1), Height = "6'01",WeightLbs = 210, BirthPlace = "Oranjestad, Aruba"}, new Player { Name = "Jose Abreu", BirthDate = new DateTime(1987, 1, 29), Height = "6'03", WeightLbs = 255, BirthPlace = "Cienfuegos, Cuba" }, //new Player { Name = "Khris Davis", BirthDate = new DateTime(1987,12,21), Height = "5'11",WeightLbs = 203, BirthPlace = "California, USA"}, new Player { Name = "Starlin Castro", BirthDate = new DateTime(1990, 3, 24), Height = "6'02", WeightLbs = 230, BirthPlace = "Monte Cristi, Dom. Rep." }, //new Player { Name = "Todd Frazier", BirthDate = new DateTime(1986,2,12), Height = "6'03",WeightLbs = 220, BirthPlace = "New Jersey, USA"}, //new Player { Name = "Eugenio Suarez", BirthDate = new DateTime(1991,7,18), Height = "5'11",WeightLbs = 213, BirthPlace = "Puerto Ordaz, Venezuela"}, new Player { Name = "Yasmani Grandal", BirthDate = new DateTime(1988, 11, 8), Height = "6'01", WeightLbs = 235, BirthPlace = "Havana, Cuba" }, //new Player { Name = "Cody Bellinger", BirthDate = new DateTime(1995,7,13), Height = "6'04",WeightLbs = 203, BirthPlace = "Arizona, USA"}, }; db.Players.AddRange(players); db.SaveChanges(); } if (!db.Seasons.Any()) { var seasons = new List <Season> { new Season { Name = RegularSeason2016 }, new Season { Name = RegularSeason2017 }, new Season { Name = RegularSeason2018 } }; db.Seasons.AddRange(seasons); db.SaveChanges(); } if (!db.Leagues.Any()) { var al = new League { Name = "American League", Abbreviation = "AL" }; var nl = new League { Name = "National League", Abbreviation = "NL" }; var leagues = new List <League> { al, nl }; db.Leagues.AddRange(leagues); db.SaveChanges(); if (!db.Teams.Any()) { var teams = new List <Team> { new Team { Name = "New York Yankees", Abbreviation = "NYY", LeagueId = al.Id }, new Team { Name = "Boston Red Sox", Abbreviation = "BOS", LeagueId = al.Id }, new Team { Name = "Houston Astros", Abbreviation = "HOU", LeagueId = al.Id }, new Team { Name = "Chicago White Sox", Abbreviation = "CWS", LeagueId = al.Id }, new Team { Name = "Oakland Athletics", Abbreviation = "OAK", LeagueId = al.Id }, new Team { Name = "Miami Marlins", Abbreviation = "MIA", LeagueId = nl.Id }, new Team { Name = "New York Mets", Abbreviation = "NYM", LeagueId = nl.Id }, new Team { Name = "Cincinnati Reds", Abbreviation = "CIN", LeagueId = nl.Id }, new Team { Name = "Milwaukee Brewers", Abbreviation = "MIL", LeagueId = nl.Id }, new Team { Name = "Los Angeles Dodgers", Abbreviation = "LAD", LeagueId = nl.Id }, }; db.Teams.AddRange(teams); db.SaveChanges(); } } if (!db.PlayerStatistics.Any()) { #region regular seasons var regularSeason2016 = db.Seasons.Single(s => s.Name == RegularSeason2016); var regularSeason2017 = db.Seasons.Single(s => s.Name == RegularSeason2017); var regularSeason2018 = db.Seasons.Single(s => s.Name == RegularSeason2018); #endregion // players var dGregorius = db.Players.Single(p => p.Name == "Didi Gregorius"); var yGurriel = db.Players.Single(p => p.Name == "Yuliesky Gurriel"); //var xBogaerts = db.Players.Single(p => p.Name == "Xander Bogaerts"); var jAbreu = db.Players.Single(p => p.Name == "Jose Abreu"); var sCastro = db.Players.Single(p => p.Name == "Starlin Castro"); //var tFrazier = db.Players.Single(p => p.Name == "Todd Frazier"); var yGrandal = db.Players.Single(p => p.Name == "Yasmani Grandal"); //var cBellinger = db.Players.Single(p => p.Name == "Cody Bellinger"); // teams var nyy = db.Teams.Single(t => t.Abbreviation == "NYY"); var hou = db.Teams.Single(t => t.Abbreviation == "BOS"); var bos = db.Teams.Single(t => t.Abbreviation == "HOU"); var cws = db.Teams.Single(t => t.Abbreviation == "CWS"); var oak = db.Teams.Single(t => t.Abbreviation == "OAK"); var mia = db.Teams.Single(t => t.Abbreviation == "MIA"); var nym = db.Teams.Single(t => t.Abbreviation == "NYM"); var cin = db.Teams.Single(t => t.Abbreviation == "CIN"); var mil = db.Teams.Single(t => t.Abbreviation == "MIL"); var lad = db.Teams.Single(t => t.Abbreviation == "LAD"); #region didi gregorius var dGregoriusSeason2016 = new PlayerStatistic { SeasonId = regularSeason2016.Id, PlayerId = dGregorius.Id, TeamId = nyy.Id, GamesPlayed = 153, AtBat = 562, Hits = 155, RBIs = 70, HomeRuns = 20, }; var dGregoriusSeason2017 = new PlayerStatistic { SeasonId = regularSeason2017.Id, PlayerId = dGregorius.Id, TeamId = nyy.Id, GamesPlayed = 136, AtBat = 534, Hits = 135, RBIs = 87, HomeRuns = 25, }; var dGregoriusSeason2018 = new PlayerStatistic { SeasonId = regularSeason2018.Id, PlayerId = dGregorius.Id, TeamId = nyy.Id, GamesPlayed = 134, AtBat = 504, Hits = 135, RBIs = 86, HomeRuns = 27, }; db.PlayerStatistics.Add(dGregoriusSeason2016); db.PlayerStatistics.Add(dGregoriusSeason2017); db.PlayerStatistics.Add(dGregoriusSeason2018); #endregion #region yuli gurriel var yGurrielSeason2016 = new PlayerStatistic { SeasonId = regularSeason2016.Id, PlayerId = yGurriel.Id, TeamId = hou.Id, GamesPlayed = 36, AtBat = 130, Hits = 34, RBIs = 15, HomeRuns = 3, }; var yGurrielSeason2017 = new PlayerStatistic { SeasonId = regularSeason2017.Id, PlayerId = yGurriel.Id, TeamId = hou.Id, GamesPlayed = 139, AtBat = 529, Hits = 158, RBIs = 75, HomeRuns = 18, }; var yGurrielSeason2018 = new PlayerStatistic { SeasonId = regularSeason2018.Id, PlayerId = yGurriel.Id, TeamId = hou.Id, GamesPlayed = 136, AtBat = 537, Hits = 156, RBIs = 85, HomeRuns = 13, }; db.PlayerStatistics.Add(yGurrielSeason2016); db.PlayerStatistics.Add(yGurrielSeason2017); db.PlayerStatistics.Add(yGurrielSeason2018); #endregion #region jose abreu var jAbreuSeason2016 = new PlayerStatistic { SeasonId = regularSeason2016.Id, PlayerId = jAbreu.Id, TeamId = cws.Id, GamesPlayed = 159, AtBat = 624, Hits = 183, RBIs = 100, HomeRuns = 25, }; var jAbreuSeason2017 = new PlayerStatistic { SeasonId = regularSeason2017.Id, PlayerId = jAbreu.Id, TeamId = cws.Id, GamesPlayed = 156, AtBat = 621, Hits = 189, RBIs = 102, HomeRuns = 33, }; var jabreuSeason2018 = new PlayerStatistic { SeasonId = regularSeason2018.Id, PlayerId = jAbreu.Id, TeamId = cws.Id, GamesPlayed = 128, AtBat = 499, Hits = 132, RBIs = 78, HomeRuns = 22, }; db.PlayerStatistics.Add(jAbreuSeason2016); db.PlayerStatistics.Add(jAbreuSeason2017); db.PlayerStatistics.Add(jabreuSeason2018); #endregion #region starlin castro var sCastroSeason2016 = new PlayerStatistic { SeasonId = regularSeason2016.Id, PlayerId = sCastro.Id, TeamId = nyy.Id, GamesPlayed = 154, AtBat = 577, Hits = 156, RBIs = 70, HomeRuns = 21, }; db.PlayerStatistics.Add(sCastroSeason2016); #endregion #region yasmani grandal var yGrandalSeason2016 = new PlayerStatistic { SeasonId = regularSeason2016.Id, PlayerId = yGrandal.Id, TeamId = lad.Id, GamesPlayed = 126, AtBat = 390, Hits = 89, RBIs = 72, HomeRuns = 27, }; var yGrandalSeason2017 = new PlayerStatistic { SeasonId = regularSeason2017.Id, PlayerId = yGrandal.Id, TeamId = lad.Id, GamesPlayed = 129, AtBat = 438, Hits = 108, RBIs = 58, HomeRuns = 22, }; var yGrandalSeason2018 = new PlayerStatistic { SeasonId = regularSeason2018.Id, PlayerId = yGrandal.Id, TeamId = lad.Id, GamesPlayed = 140, AtBat = 440, Hits = 106, RBIs = 68, HomeRuns = 24, }; db.PlayerStatistics.Add(yGrandalSeason2016); db.PlayerStatistics.Add(yGrandalSeason2017); db.PlayerStatistics.Add(yGrandalSeason2018); #endregion db.SaveChanges(); } }
public IActionResult Index() { var teams = _context.Teams.ToList(); var matches = _context.Matches.ToList(); var players = _context.Players.ToList(); var goals = _context.Goals.ToList(); List <PlayerStatistic> playerStatistics = new List <PlayerStatistic>(); List <TeamStatistic> teamStatistics = new List <TeamStatistic>(); Statistic statistics = new Statistic(); foreach (Team t in teams) { TeamStatistic ts = new TeamStatistic(); ts.team = t; int numOfWins = 0; int numOfDraws = 0; int numOfLosses = 0; foreach (Match m in matches) { if (m.HostTeamId == t.TeamId || (m.GuestTeamId == t.TeamId)) { string result = m.Result; int res1 = int.Parse(result.Split(":")[0]); int res2 = int.Parse(result.Split(":")[1]); if (res1 > res2) { if (m.HostTeamId == t.TeamId) { numOfWins++; } else { numOfLosses++; } } else if (res1 == res2) { numOfDraws++; } } } ts.numOfDraws = numOfDraws; ts.numOfLosses = numOfLosses; ts.numOfWins = numOfWins; teamStatistics.Add(ts); } foreach (Player p in players) { PlayerStatistic ps = new PlayerStatistic(); Team team = _context.Teams.FirstOrDefault(t => t.TeamId == p.TeamId); p.Team = team; ps.player = p; int numOfMatches = 0; int numOfGoals = 0; foreach (Goal g in goals) { if (g.PlayerId == p.PlayerId) { numOfMatches++; numOfGoals += g.NumberOfGoals; } } ps.numOfGoals = numOfGoals; ps.numOfMatches = numOfMatches; playerStatistics.Add(ps); } statistics.playerStatistics = playerStatistics; statistics.teamStatistics = teamStatistics; return(View("~/Views/Statistics/Index.cshtml", statistics)); }
static void Main(string[] args) { using (var context = new BettingContext()) { var user = new User(); user.Name = "Bob"; user.Username = "******"; user.Balance = 77777; user.Email = "*****@*****.**"; context.Users.Add(user); var country = new Country(); country.Name = "Italy"; var town = new Town(); town.Name = "Rome"; town.Country = country; context.Towns.Add(town); var team = new Team(); team.Name = "Lacio"; team.Budget = 1000000; team.Initials = "LAC"; context.Teams.Add(team); var position = new Position(); position.Name = "attack"; context.Positions.Add(position); var player = new Player(); player.Name = "Chiro"; player.IsInjured = false; player.SquadNumber = 27; player.Position = position; player.Team = team; context.Players.Add(player); context.Countries.Add(country); var game = new Game(); game.AwayTeamBetRate = 3; game.HomeTeamBetRate = 2; game.DrawBetRate = 4; game.AwayTeamGoals = 7; game.HomeTeamGoals = 17; game.DateTime = DateTime.Today; context.Games.Add(game); var playerStatistic = new PlayerStatistic(); playerStatistic.Assist = 5; playerStatistic.MinutesPlayed = 179; playerStatistic.ScoredGoals = 9; context.PlayerStatistics.Add(playerStatistic); context.SaveChanges(); } }
static TestData() { //MainViewModel.MainViewModelStatic.ItemClasses.Add(Editor.ObjectTypes.ItemClass.GetBaseItemClass()); TestScript = new Script(); TestScript.ScriptLines.Clear(); TestScript.ScriptLines.Add(new Comment { CommentText = "test comment" }); TestScript.ScriptLines.Add(new Comment { CommentText = "another test comment" }); TestCondition1 = new Conditional(TestScript); TestCondition1.ThenStatement.AddBeforeSelected(new Comment { CommentText = "Test Conditional Comment" }); TestCondition1.ElseStatement.AddBeforeSelected(new Comment { CommentText = "Test Else Comment" }); TestConditionNested = new Conditional(TestScript); TestConditionChild = new Conditional(TestScript); TestConditionChild.ThenStatement.AddBeforeSelected(new Comment { CommentText = "Another comment" }); TestConditionChild.ElseStatement.AddBeforeSelected(new Comment { CommentText = "Another else comment" }); TestConditionNested.ThenStatement.AddBeforeSelected(TestConditionChild); TestConditionChild = new Conditional(TestScript); TestScript.ScriptLines.Add(TestCondition1); TestScript.ScriptLines.Add(TestConditionNested); TestScript.ScriptLines.Add(new Blank()); TestComment = new Comment { CommentText = "This is my comment." }; TestDisplayText = new DisplayText { Text = "The room is dark and reeks of old milk.\n\nThere is an unlit chandalier." }; TestAddText = new AddText { Text = "A fresh, crisp, tasty looking apple." }; TestRoom = new Room(); TestRoom.RoomName = "Test Room"; TestRoom.Description = "Test Room Description"; TestRoom.HasPlaintextDescription = false; TestRoom.RoomID = new Guid("{1CF2C7E6-276C-4678-951C-2D1B1F239620}"); TestRoom.RoomDescriptionScript = TestScript; TestScriptRoom = new Room(); TestScriptRoom.RoomName = "Test Room"; TestScriptRoom.Description = "Test Room Description"; TestScriptRoom.HasPlaintextDescription = true; TestScriptRoom.RoomID = new Guid("{1CF2C7E6-276C-4678-951C-2D1B1F239620}"); TestScriptRoom.RoomDescriptionScript = TestScript; TestInteractable = new Interactable(); TestInteractable.InteractableName = "Bookshelf"; TestInteractable.DefaultDisplayName = "Old Bookshelf"; TestInteractable.CanExamine = true; TestInteractable.CanExamineUsesScript = true; TestInteractable.CanInteract = true; TestInteractable.CanInteractUsesScript = false; Script testIntCanExScript = new Script(); testIntCanExScript.AddBeforeSelected(new Comment { CommentText = "Test Can Examine Script" }); Script testIntCanInScript = new Script(); testIntCanInScript.AddBeforeSelected(new Comment { CommentText = "Test Can Interact Script" }); Script testIntExScript = new Script(); testIntExScript.AddBeforeSelected(new Comment { CommentText = "Test Examine Script" }); Script testIntInScript = new Script(); testIntInScript.AddBeforeSelected(new Comment { CommentText = "Test Interaction Script" }); TestInteractable.ExamineScript = testIntExScript; TestInteractable.InteractScript = testIntInScript; TestInteractable.CanInteractScript = testIntCanInScript; TestInteractable.CanExamineScript = testIntCanExScript; TestInteractable.GroupName = "Furniture"; TestInteractableGroup = MainViewModel.MainViewModelStatic.InteractableGroups.FirstOrDefault(); TestRoom.DefaultInteractables.Add(new InteractableRef(TestInteractable.InteractableID)); TestDateTimeVariable = new Variable(); TestDateTimeVariable.IsDateTime = true; TestDateTimeVariable.DefaultDateTime = new DateTime(2015, 1, 30, 10, 20, 5); TestDateTimeVariable.Name = "Test Date Time"; TestStringVariable = new Variable(); TestStringVariable.IsString = true; TestStringVariable.DefaultString = "Test Data"; TestStringVariable.Name = "Test String"; TestNumberVariable = new Variable(); TestNumberVariable.IsNumber = true; TestNumberVariable.DefaultNumber = 5; TestNumberVariable.Name = "Test Number"; TestSetVariable = new SetVariable(); TestSetVariable.SelectedVariable = new VarRef(TestNumberVariable.Id); //var testParent = new ItemClass() { Name = "Item" }; //MainViewModel.MainViewModelStatic.ItemClasses.Add(TestItemClass); TestItemClass = new ItemClass { Name = "Clothing", ParentClass = ItemClass.GetBaseItemClass() }; TestItemClass.ItemProperties.Add(new Variable { Name = "Slot", IsString = true, DefaultString = "Body" }); TestItemClass.ItemProperties.Add(new Variable { Name = "Weight", IsNumber = true, DefaultNumber = 40 }); //MainViewModel.MainViewModelStatic.ItemClasses.Add(TestItemClass); var testChild1 = new ItemClass() { Name = "Shirts", ParentClass = TestItemClass }; var testChild2 = new ItemClass() { Name = "Pants", ParentClass = TestItemClass }; var testChild3 = new ItemClass() { Name = "Underwear", ParentClass = TestItemClass }; var testChild4 = new ItemClass() { Name = "Food", ParentClass = TestItemClass }; testChild4.ParentClass = TestItemClass.ParentClass; var testItem = new Item() { ItemClassParent = TestItemClass, DefaultName = "Helmet" }; var testItem2 = new Item() { ItemClassParent = TestItemClass, DefaultName = "Bracers" }; var testItem3 = new Item() { ItemClassParent = TestItemClass, DefaultName = "Apple" }; testItem3.ItemClassParent = TestItemClass.ParentClass; TestItemClass.SelectedProperty = TestItemClass.ItemProperties.First(); testItem2.ItemName = "BasicBracers"; testItem2.IsEquipment = true; testItem2.SelectedProperty = testItem.ItemProperties.First(); TestItem = testItem2; TestAddItem = new AddItemToInventory { ItemReference = new ItemRef(testItem.ItemID) }; TestGetProperty = new GetItemProperty { VarRef = new VarRef(TestStringVariable.Id), SelectedItemClass = TestItemClass }; TestGetProperty.SelectedProperty = TestGetProperty.SelectedItemClass.ItemProperties.First(); TestSetProperty = new SetItemProperty { VarRef = new VarRef(TestStringVariable.Id), SelectedItemClass = TestItemClass }; TestSetProperty.SelectedProperty = TestSetProperty.SelectedItemClass.ItemProperties.First(); Settings1 = new PlayerSettings(); Settings1.PlayerDescription.AddBeforeSelected(new AddText { Text = "You are a {{Age}} year old {{Gender}}" }); PlayerStatistic testHunger = new PlayerStatistic { Label = "Hunger" }; testHunger.DisplayCondition.AddBeforeSelected(new ReturnFalse()); testHunger.AssociatedVariable = new VarRef(TestNumberVariable.Id); testHunger.IsProgressBar = true; testHunger.HighWarning = false; testHunger.LowWarning = true; testHunger.MaximumValueVariable = true; testHunger.MaximumValueVariableValue = new VarRef(TestNumberVariable.Id); PlayerStatistic testSpecies = new PlayerStatistic { Label = "Species" }; testSpecies.Label = "Species"; testSpecies.AssociatedVariable = new VarRef(TestNumberVariable.Id); testSpecies.IsPlaintext = true; Settings1.PlayerStatistics.Add(testHunger); Settings1.PlayerStatistics.Add(testSpecies); Settings1.SelectedStatistic = testHunger; Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Body" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Legs" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Wrists" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Feet" }); Settings1.EquipmentSlots.Add(new EquipmentSlot { Name = "Head" }); Settings1.SelectedEquipmentSlot = Settings1.EquipmentSlots.First(); testItem2.EquipmentRef.OccupiesSlots.Add(Settings1.SelectedEquipmentSlot); TestCommonEvent = new CommonEvent(); //TestCommonEvent.Name = "Test"; //TestCommonEvent.EventType = CommonEvent.CommonEventTypes.First(); TestConversation = new Conversation(); TestConversation.Name = "Test"; TestConversation.StartingStage = 10; ConversationStage TestStage1 = new ConversationStage(); TestStage1.StageName = "Test Intro Point"; TestStage1.StageAction.AddBeforeSelected(new DisplayText { Text = "Test Stuff" }); TestStage1.StageId = 10; TestStage1.Choices.Add(new ConversationChoice() { ChoiceText = "Choice 1", Target = 20 }); TestStage1.Choices.Add(new ConversationChoice() { ChoiceText = "Choice 2", Target = 30 }); ConversationStage TestStage2 = new ConversationStage(); TestStage2.StageName = "Stage #2"; ConversationStage TestStage3 = new ConversationStage(); TestStage3.StageName = "Stage #3"; TestStage2.StageId = 20; TestStage3.StageId = 30; TestConversation.Stages.Add(TestStage1); TestConversation.Stages.Add(TestStage2); TestConversation.SelectedStage = TestStage1; TestConversation.Stages.Add(TestStage3); TestStage1.SelectedChoice = TestStage1.Choices.First(); TestStage1.SelectedChoice.ChoiceVisibility.AddBeforeSelected(new ReturnTrue()); //var tempRooms = new System.Collections.ObjectModel.ObservableCollection<Room>(); //tempRooms.Add(TestData.TestRoom); //MainViewModel.MainViewModelStatic.Zones.Add(new Zone { ZoneName = "Test", Rooms = tempRooms }); //TestArray.IsNumber = true; //TestArray.Name = "Test"; //TestArray.Group = "Test Group"; TestStatusEffect = new StatusEffect(); TestStatusEffect.Name = "Sample Status Effect"; TestStatusEffect.OnInitialize.AddBeforeSelected(new Comment { CommentText = "On Initialize Script" }); TestStatusEffect.OnMove.AddBeforeSelected(new Comment { CommentText = "On Move Script" }); TestStatusEffect.OnStack.AddBeforeSelected(new Comment { CommentText = "On Stack Script" }); TestStatusEffect.OnFinish.AddBeforeSelected(new Comment { CommentText = "On Finish Script" }); TestStatusEffect.CheckIfCleared.AddBeforeSelected(new Comment { CommentText = "Check If Cleared Script" }); TestStatusEffect.CanOccurMultipleTimes = false; TestStatusEffect.Arguments.Add(new StatusEffectValue { Name = "Duration", IsNumber = true }); TestStatusEffect.Arguments.Add(new StatusEffectValue { Name = "Text Test", IsString = true }); TestStatusEffect.SelectedArgument = TestStatusEffect.Arguments.Last(); //AddStatusEffectTest = new AddStatusEffect(); //AddStatusEffectTest.AssociatedEffect = new GenericRef<StatusEffect>((id) => TestStatusEffect, (statusEffect) => TestStatusEffect.Id) { Ref = TestStatusEffect.Id }; //AddStatusEffect.UpdateAllArguments(TestStatusEffect); }
public PlayerStatisticWrapper(PlayerStatistic ps) { PlayerStat = ps; }
private void Start() { statistics = new PlayerStatistic(); }
public void Update(PlayerStatistic playerStatistic) { _playerStatisticDal.Update(playerStatistic); }
public void Add(PlayerStatistic playerStatistic) { _playerStatisticDal.Add(playerStatistic); }
public void Delete(PlayerStatistic playerStatistic) { _playerStatisticDal.Delete(playerStatistic); }
public void Add(PlayerStatistic playerStatistic) { _context.PlayerStatistics.Add(playerStatistic); _context.SaveChanges(); }
void Die() { PlayerStatistic.GetInstance().KillEnemy(killPoints); Destroy(gameObject); }
// Retrieves player statistics of a particular game. public PlayerStatistic[] GetPlayerStatistics(long playerId, int appId) { return(PlayerStatistic.Query(Key, playerId, appId)); }