public async Task ClearMatch() { if (_isRunning) { await EndRound(); } _wsMonitor.DisableScoring(); _wsMonitor.RemoveAllCharacterSubscriptions(); _messageService.DisableLogging(); MatchConfiguration = new MatchConfiguration(); _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _matchState = MatchState.Uninitialized; _currentRound = 0; _matchDataService.CurrentMatchRound = _currentRound; _matchDataService.CurrentMatchId = string.Empty; _latestTimerTickMessage = null; _teamsManager.ClearAllTeams(); SendMatchStateUpdateMessage(); SendMatchConfigurationUpdateMessage(); }
public void Setup(MatchConfiguration matchConfiguration) { this.matchConfiguration = matchConfiguration; SetText(subtitle, GetSubtitleText()); SetText(description, GetDescriptionText(matchConfiguration)); gameObject.SetActive(true); }
private static void CallFoul(int plIdx, String move) { //Determine if this is a no contest or disqualification based on defender's status Player defender = PlayerMan.inst.GetPlObj(plIdx); if (defender.isKO) { //Determine the attacker int foulIndex = 0; if (plIdx > 3) { foulIndex = 1; } if (UnityEngine.Random.Range(0, 3) > foulCeiling - foulCount[foulIndex]) { CallDQ(plIdx); } else { CallNoContest(); } } MatchConfiguration.ShowCommentaryMessage("Foul! " + DataBase.GetWrestlerFullName(PlayerMan.inst.GetPlObj(plIdx).WresParam) + " is warned for usage of an illegal " + move + "."); ForceCleanBreak(); }
private static void SetupRound() { MatchSetting settings = GlobalWork.inst.MatchSetting; MatchMain main = MatchMain.inst; main.RoundCnt = 1; settings.is3GameMatch = true; settings.RoundNum = 0; //Necessary for compatibility with Mods that change attire settings.isCarryOverHP = true; settings.MatchCnt = 1; //Update teams if the player won if (loserIndex > 3) { UpdateTeamMembers(); WrestlerID wrestler = (WrestlerID)SelectOpponent(0).ID; settings = MatchConfiguration.AddPlayers(true, wrestler, 4, 0, false, 0, settings); //Adding new tag partner if (isTag) { wrestler = (WrestlerID)SelectOpponent(1).ID; settings = MatchConfiguration.AddPlayers(true, wrestler, 5, 0, false, 0, settings); } } }
private void SetupController(MatchConfiguration configuration) { SetupNames(agentNames, agentNamesList); SetupNames(teamNames, teamNamesList); SpawnAgents(configuration.teamsConfig); ActivateTeams(); }
private void FindRing(object sender, System.EventArgs e) { try { System.String query = rc_ringSearch.Text; rc_ringResults.Items.Clear(); if (!query.TrimStart().TrimEnd().Equals("")) { foreach (var ring in MatchConfiguration.LoadRings()) { if (query.ToLower().Equals(ring.name.ToLower()) || ring.name.ToLower().Contains(query.ToLower())) { rc_ringResults.Items.Add(ring.name); } } } if (rc_ringResults.Items.Count > 0) { rc_ringResults.SelectedIndex = 0; return; } } catch (Exception ex) { L.D("FindRingError: " + ex); } }
public MatchController(IScrimTeamsManager teamsManager, IScrimMatchEngine matchEngine, IScrimMessageBroadcastService messageService) { _teamsManager = teamsManager; _matchEngine = matchEngine; _messageService = messageService; _configuration = matchEngine.MatchConfiguration; }
private static void SetLegalMen(String forceSwitch) { Player blueMan = PlayerMan.inst.GetPlObj(MatchConfiguration.GetLegalMan(CornerSide.Blue)); Player redMan = PlayerMan.inst.GetPlObj(MatchConfiguration.GetLegalMan(CornerSide.Red)); //Process Blue Corner if (!IsInRing(blueMan) || forceSwitch.Equals("blue")) { Player nextPlayer = PlayerMan.inst.GetPlObj(GetNextTag("blue", blueMan.PlIdx)); blueMan.hasRight = false; nextPlayer.hasRight = true; blueMan.TagStandbyPos = nextPlayer.TagStandbyPos; nextPlayer.isTagPartnerStandby = false; nextPlayer.Start_ForceControl(ForceCtrlEnum.GoBackToRing); blueMan.Start_ForceControl(ForceCtrlEnum.GoBackToApron); } //Process Red Corner if (!IsInRing(redMan) || forceSwitch.Equals("red")) { Player nextPlayer = PlayerMan.inst.GetPlObj(GetNextTag("red", redMan.PlIdx)); redMan.hasRight = false; nextPlayer.hasRight = true; redMan.TagStandbyPos = nextPlayer.TagStandbyPos; nextPlayer.isTagPartnerStandby = false; nextPlayer.Start_ForceControl(ForceCtrlEnum.GoBackToRing); redMan.Start_ForceControl(ForceCtrlEnum.GoBackToApron); } }
private void FindBGM(object sender, System.EventArgs e) { try { System.String query = rc_bgmSearch.Text; rc_bgmResult.Items.Clear(); if (!query.TrimStart().TrimEnd().Equals("")) { foreach (var bgm in MatchConfiguration.LoadBGMs()) { if (query.ToLower().Equals(bgm.ToLower()) || bgm.ToLower().Contains(query.ToLower())) { rc_bgmResult.Items.Add(bgm); } } } if (rc_bgmResult.Items.Count > 0) { rc_bgmResult.SelectedIndex = 0; return; } } catch (Exception ex) { L.D("FindBGMError: " + ex); } }
private void OnTeamOutfitChangeEvent(object sender, ScrimMessageEventArgs <TeamOutfitChangeMessage> e) { if (MatchConfiguration.IsManualWorldId) { return; } int?worldId; var message = e.Message; var changeType = message.ChangeType; bool isRollBack = false; if (changeType == TeamChangeType.Add) { worldId = e.Message.Outfit.WorldId; } else { worldId = _teamsManager.GetNextWorldId(MatchConfiguration.WorldId); isRollBack = true; } if (worldId == null) { MatchConfiguration.ResetWorldId(); SendMatchConfigurationUpdateMessage(); } else if (MatchConfiguration.TrySetWorldId((int)worldId, false, isRollBack)) { SendMatchConfigurationUpdateMessage(); } }
/// <summary> /// Match session information /// </summary> public MatchSessionDiagnosticInfo(MatchConfiguration configuration) { this.Configuration = configuration; this.StartOfSession = DateTimeOffset.Now; this.EndOfSession = null; this.Stages = new List <MatchStageDiagnosticInfo>(); }
public ScrimMatchEngine(IScrimTeamsManager teamsManager, IWebsocketMonitor wsMonitor, IStatefulTimer timer, IScrimMatchDataService matchDataService, IScrimMessageBroadcastService messageService, IScrimRulesetManager rulesetManager, ILogger <ScrimMatchEngine> logger) { _teamsManager = teamsManager; _wsMonitor = wsMonitor; _timer = timer; _messageService = messageService; _matchDataService = matchDataService; _rulesetManager = rulesetManager; // Copy default values to match config var activeRuleset = rulesetManager.ActiveRuleset; MatchConfiguration.TrySetTitle(activeRuleset.DefaultMatchTitle, false); MatchConfiguration.TrySetRoundLength(activeRuleset.DefaultRoundLength, false); MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false); _logger = logger; _messageService.RaiseMatchTimerTickEvent += async(s, e) => await OnMatchTimerTick(s, e); _messageService.RaiseTeamOutfitChangeEvent += OnTeamOutfitChangeEvent; _messageService.RaiseTeamPlayerChangeEvent += OnTeamPlayerChangeEvent; _messageService.RaiseScrimFacilityControlActionEvent += async(s, e) => await OnFacilityControlEvent(s, e); }
public void When_GetScoreCard_WithValidConfigurations_ScoreCardReturns(MatchConfiguration configuration) { //act var result = _domain.GetScoreCard(configuration); //asserts result.ShouldNotBeNull(); result.ScorePerOver.Count.ShouldBeLessThanOrEqualTo(configuration.OversLimit); result.ScorePerOver.First().Value.First().ScoredBy.ShouldBe(configuration.Players.First().Name); result.ScorePerOver.Any(x => x.Value.Sum(y => y.RunScored) > 36).ShouldBeFalse(); result.ScorePerOver.Any(x => x.Value.Any(y => y.RunScored > 6 || y.RunScored < -1)).ShouldBeFalse(); result.ScorePerOver.Sum(x => x.Value.Sum(y => y.RunScored)).ShouldBeLessThanOrEqualTo(configuration.RunsToWin + 5); result.ScorePerOver.Keys.Count.ShouldBeLessThanOrEqualTo(configuration.OversLimit); if (result.ResultSummary.IsBattingTeamWon) { result.ResultSummary.BallsLeft.ShouldNotBeNull(); result.ResultSummary.WicketsLeft.ShouldNotBeNull(); result.ResultSummary.RunsLeft.ShouldBeNull(); } if (!result.ResultSummary.IsBattingTeamWon) { result.ResultSummary.BallsLeft.ShouldBeNull(); result.ResultSummary.WicketsLeft.ShouldBeNull(); result.ResultSummary.RunsLeft.ShouldNotBeNull(); } }
/// <summary> /// Get the specified configuration name /// </summary> /// <param name="name">The configuratio name</param> /// <returns>The matching configuration</returns> public IRecordMatchingConfiguration GetConfiguration(string name) { if (this.m_configurationCache.TryGetValue(name, out IRecordMatchingConfiguration retVal)) { var solutions = ApplicationServiceContext.Current.GetService <IAppletSolutionManagerService>()?.Solutions.Select(o => o.Meta.Id).ToList(); solutions.Add(String.Empty); // Include the default solution // Solution foreach (var sln in solutions) { var amgr = ApplicationServiceContext.Current.GetService <IAppletSolutionManagerService>()?.GetApplets(sln).SelectMany(a => a.Assets).Where(o => o.Name == $"matching/{name}.xml").FirstOrDefault(); try { this.m_tracer.TraceInfo("Will load {0}..", amgr.ToString()); using (var ms = new MemoryStream(amgr.Content as byte[])) retVal = MatchConfiguration.Load(ms); lock (this.m_configurationCache) if (!this.m_configurationCache.ContainsKey(name)) { this.m_configurationCache.Add(name, retVal); } } catch (Exception e) { this.m_tracer.TraceError("Error loading match config {0} : {1}", name, e.ToString()); throw; } } } return(retVal); }
public async Task ClearMatch(bool isRematch) { if (_isRunning) { await EndRound(); } _wsMonitor.DisableScoring(); if (!isRematch) { _wsMonitor.RemoveAllCharacterSubscriptions(); } _messageService.DisableLogging(); var previousWorldId = MatchConfiguration.WorldIdString; var previousIsManualWorldId = MatchConfiguration.IsManualWorldId; var previousEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture; var previousIsManualEndRoundOnFacilityCapture = MatchConfiguration.EndRoundOnFacilityCapture; MatchConfiguration = new MatchConfiguration(); if (isRematch) { MatchConfiguration.TrySetWorldId(previousWorldId, previousIsManualWorldId); MatchConfiguration.TrySetEndRoundOnFacilityCapture(previousEndRoundOnFacilityCapture, previousIsManualEndRoundOnFacilityCapture); } else { var activeRuleset = await _rulesetManager.GetActiveRulesetAsync(); MatchConfiguration.TrySetEndRoundOnFacilityCapture(activeRuleset.DefaultEndRoundOnFacilityCapture, false); } _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _matchState = MatchState.Uninitialized; _currentRound = 0; _matchDataService.CurrentMatchRound = _currentRound; _matchDataService.CurrentMatchId = string.Empty; _latestTimerTickMessage = null; if (isRematch) { _teamsManager.UpdateAllTeamsMatchSeriesResults(CurrentSeriesMatch); _teamsManager.ResetAllTeamsMatchData(); } else { CurrentSeriesMatch = 0; _teamsManager.ClearAllTeams(); } SendMatchStateUpdateMessage(); SendMatchConfigurationUpdateMessage(); }
/// <summary> /// Generates entire score card for the given match configurations /// </summary> /// <param name="matchConfiguration"></param> /// <returns>Scorecard</returns> public ScoreCard GetScoreCard(MatchConfiguration matchConfiguration) { _matchConfig = matchConfiguration; _runsLeft = matchConfiguration.RunsToWin; _wicketsLeft = matchConfiguration.WicketsLeft; _ballsLeft = matchConfiguration.OversLimit * matchConfiguration.BallsPerOver; return(GenerateScoreCard()); }
private void LoadGameSpeed() { foreach (uint speed in MatchConfiguration.LoadSpeed()) { sr_speedList.Items.Add(speed); } sr_speedList.SelectedIndex = 0; }
private void LoadRings() { foreach (var ring in MatchConfiguration.LoadRings()) { sr_ringList.Items.Add(ring); } sr_ringList.SelectedIndex = 0; }
private void LoadDifficulty() { foreach (String i in MatchConfiguration.LoadDifficulty()) { sr_difficultyList.Items.Add(i); } sr_difficultyList.SelectedIndex = 0; }
private void LoadReferees() { foreach (RefereeInfo referee in MatchConfiguration.LoadReferees()) { sr_refereeList.Items.Add(referee); } sr_refereeList.SelectedIndex = 0; }
private void LoadThemes() { foreach (String theme in MatchConfiguration.LoadBGMs()) { sr_bgmList.Items.Add(theme); } sr_bgmList.SelectedIndex = 0; }
private void LoadVenues() { String[] venues = MatchConfiguration.LoadVenue(); foreach (String venue in venues) { sr_venueList.Items.Add(venue); } sr_venueList.SelectedIndex = 0; }
public static bool SetMatchRestrictions(Player matchPlayer) { //Disable for Battle Royal Matches if (!isFirstBlood) { return(false); } else { //Get the player reference targetting the CURRENT player (matchPlayer) being modified. Player playerObj = PlayerMan.inst.GetPlObj(matchPlayer.TargetPlIdx); if (playerObj == null) { return(false); } //Get the attacker's current skill and add it to the sum of bleeding damage done to the receiving (matchPlayer). SkillData currentSkill = playerObj.animator.CurrentSkill; if (currentSkill != null) { bloodMeter[matchPlayer.PlIdx] += currentSkill.bleedingRate; string defender = DataBase.GetWrestlerFullName(matchPlayer.WresParam); string attacker = DataBase.GetWrestlerFullName(playerObj.WresParam); if (bloodMeter[matchPlayer.PlIdx] <= 100) { MatchConfiguration.ShowCommentaryMessage(attacker + " is trying to bust open " + defender + "."); } else if (bloodMeter[matchPlayer.PlIdx] <= 200) { MatchConfiguration.ShowCommentaryMessage(attacker + " is really working over " + defender + "!"); } else { MatchConfiguration.ShowCommentaryMessage(attacker + " is trying to put " + defender + " in the hospital! Such savagery!"); } } //Disable bleeding if match time has not passed the given value if (MatchMain.inst.matchTime.min < UnityEngine.Random.Range(8, 12)) { return(true); } if (bloodMeter[matchPlayer.PlIdx] >= 300) { return(false); } else { return(true); } } }
/// <summary> /// Dummy match configuration provider /// </summary> public DummyMatchConfigurationProvider() { foreach (var n in typeof(DummyMatchConfigurationProvider).Assembly.GetManifestResourceNames().Where(o => o.Contains(".xml"))) { try { this.m_configs.Add(MatchConfiguration.Load(typeof(DummyMatchConfigurationProvider).Assembly.GetManifestResourceStream(n))); } catch { } } }
public void ConfigureMatch(MatchConfiguration configuration) { MatchConfiguration = configuration; _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _wsMonitor.SetFacilitySubscription(MatchConfiguration.FacilityId); _wsMonitor.SetWorldSubscription(MatchConfiguration.WorldId); SendMatchConfigurationUpdateMessage(); }
public void ConfigureMatch(MatchConfiguration configuration) { MatchConfiguration = configuration; _roundSecondsMax = MatchConfiguration.RoundSecondsTotal; _wsMonitor.SetFacilitySubscription(MatchConfiguration.FacilityId); _wsMonitor.SetWorldSubscription(MatchConfiguration.WorldId); SendMatchConfigurationUpdateMessage(); // TODO: why was this commented out before? }
private void LoadDifficulty() { foreach (String i in MatchConfiguration.LoadDifficulty()) { el_difficulty.Items.Add(i); } if (el_difficulty.Items.Count > 0) { el_difficulty.SelectedIndex = 0; } }
public void ShouldLoadConfiguration() { var loaded = MatchConfiguration.Load(typeof(MatchConfigurationTest).Assembly.GetManifestResourceStream("SanteDB.Matcher.Test.Resources.DateOfBirthGenderIdClassified.xml")); Assert.IsNotNull(loaded); Assert.AreEqual(2, loaded.Scoring.Count); Assert.IsNotNull(loaded.Scoring.First().Assertion); Assert.AreEqual(1, loaded.Blocking.Count); Assert.AreEqual(3, loaded.Blocking.First().Filter.Count); Assert.AreEqual(typeof(Patient), loaded.Target.First().ResourceType); Assert.AreNotEqual(0.0d, loaded.Scoring.First().MatchWeight); }
private void LoadGameSpeed() { foreach (uint speed in MatchConfiguration.LoadSpeed()) { el_gameSpeed.Items.Add(speed); } if (el_gameSpeed.Items.Count > 0) { el_gameSpeed.SelectedIndex = 0; } }
private void LoadRings() { foreach (var ring in MatchConfiguration.LoadRings()) { el_ringList.Items.Add(ring); } if (el_ringList.Items.Count > 0) { el_ringList.SelectedIndex = 0; } }