/// <summary> /// Checks whether the game load parameters are valid and returns whether validation is a success. /// </summary> private bool ValidateLoadParams(IPlayableMap map, IModeService modeService) { // If invalid parameters, loading must fail. if (map == null) { NotificationBox?.Add(new Notification() { Message = "Map is not specified!", Type = NotificationType.Error }); loadState.Value = GameLoadState.Fail; return(false); } if (modeService == null) { NotificationBox?.Add(new Notification() { Message = "Game mode is not specified!", Type = NotificationType.Error }); loadState.Value = GameLoadState.Fail; return(false); } return(true); }
/// <summary> /// Refreshes the types of columns displayed for judgemnt type hit count. /// </summary> public void RefreshColumns(IModeService service) { // In case of a null service, just display all labels. if (service == null) { Logger.LogWarning($"RankingColumn.RefreshColumn - The specified mode service is null."); judgementLabels.ForEach(l => l.Active = true); return; } // Only display judgement types that are used by this mode. var timing = service.CreateTiming(); int activeCount = 0; judgementLabels.ForEach(l => l.Active = false); foreach (var result in timing.SupportedHitResults()) { activeCount++; judgementLabels[(int)result].Active = true; } // Position these labels. for (int i = 0; i < judgementLabels.Count; i++) { if (judgementLabels[i].Active) { activeCount--; judgementLabels[i].X = JudgementLabelStartX - (activeCount * JudgementLabelInterval); } } }
public SupplierController(ISupplierService supplierService, IItemService itemService, IItemMaterialService itemMaterialService, IModeService modeService) { this._supplierService = supplierService; _itemService = itemService; _itemMaterialService = itemMaterialService; _modeService = modeService; }
public ActivityController(IActivityService service, IModeService modeService, IIdentityService identityService, ICheckpointService checkpointService) { this.service = service; this.modeService = modeService; this.identityService = identityService; this.checkpointService = checkpointService; }
/// <summary> /// Initializes the cell state using the specified mode service. /// </summary> public void SetModeService(IModeService modeService) { this.ModeService = modeService; label.Text = modeService.Name; IconName = modeService.GetIconName(32); RefreshFocus(); }
public SubjectController(IItemService itemService, IModeService modeService, IDictService dictService, IItemModeService itemModeService, IItemMaterialService itemMaterialService, IItemSureService itemSureService, ISupplierService supplierService, IPurchaserService purchaserService) { this._itemService = itemService; this._modeService = modeService; this._dictService = dictService; this._itemModeService = itemModeService; this._itemMaterialService = itemMaterialService; this._itemSureService = itemSureService; this._supplierService = supplierService; this._purchaserService = purchaserService; }
/// <summary> /// Creates a playable map for specified service. /// </summary> private IPlayableMap CreatePlayable(IModeService service) { if (service == null) { Logger.LogWarning($"OriginalMap.CreatePlayable - A null servicer is passed. Skipping this mode."); return(null); } // Conversion var converter = service.CreateConverter(this); if (!converter.IsConvertible) { return(null); } var convertedMap = converter.Convert(); if (convertedMap == null) { Logger.LogWarning($"OriginalMap.CreatePlayable - Failed to convert map for mode: {service.GameMode}"); return(null); } // Processing var processor = service.CreateProcessor(convertedMap); processor.PreProcess(); foreach (var o in convertedMap.HitObjects) { o.ApplyMapProperties(convertedMap.ControlPoints, convertedMap.Detail.Difficulty); } processor.PostProcess(); // Calculate difficulty. var difficultyCalculator = service.CreateDifficultyCalculator(convertedMap); if (difficultyCalculator == null) { Logger.LogWarning($"OriginalMap.CreatePlayable - Difficulty calculator is null for mode: {service.GameMode}"); return(null); } convertedMap.Difficulty = difficultyCalculator.Calculate(); if (convertedMap.Difficulty == null) { Logger.LogWarning($"OriginalMap.CreatePlayable - Failed to calculate difficulty for mode: {service.GameMode}"); return(null); } // Finished convertedMap.PlayableMode = service.GameMode; return(convertedMap); }
protected override void OnPostHide() { base.OnPostHide(); loadState.Value = GameLoadState.Idle; DisposeSession(); DisposeLoader(); currentParameter = null; currentModeService = null; lastRecord = null; }
/// <summary> /// Starts loading the game for the specified map and mode service. /// </summary> public void LoadGame(GameParameter parameter, IModeService modeService) { if (loadState.Value != GameLoadState.Idle) { return; } if (!ValidateLoadParams(parameter.Map, modeService)) { return; } loadState.Value = GameLoadState.Loading; currentParameter = parameter; currentModeService = modeService; InitSession(parameter); CleanUpResources(); InitLoader(); }
public SubjectController(IItemService itemService, IModeService modeService) { this._itemService = itemService; this._modeService = modeService; }
public ModesController(IModeService service) { this.service = service; }
public ModeController(IModeService modeService) { this._modeService = modeService; }
public ModeController(IModeService lobbyGameService, IMapper mapper) { this.modeService = lobbyGameService; this.mapper = mapper; }
public Mode(IModeService modeService) { m_modeService = modeService; }
public FansController(IModeService modeService) { _modeService = modeService; }
/// <summary> /// Sets the current game mode to the specified one. /// </summary> public void SelectMode(IModeService modeService) { GameConfiguration.RulesetMode.Value = modeService.GameMode; }