Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        /// <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);
                }
            }
        }
Exemplo n.º 3
0
 public SupplierController(ISupplierService supplierService, IItemService itemService, IItemMaterialService itemMaterialService, IModeService modeService)
 {
     this._supplierService = supplierService;
     _itemService          = itemService;
     _itemMaterialService  = itemMaterialService;
     _modeService          = modeService;
 }
Exemplo n.º 4
0
 public ActivityController(IActivityService service, IModeService modeService,
                           IIdentityService identityService, ICheckpointService checkpointService)
 {
     this.service           = service;
     this.modeService       = modeService;
     this.identityService   = identityService;
     this.checkpointService = checkpointService;
 }
Exemplo n.º 5
0
        /// <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();
        }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
        protected override void OnPostHide()
        {
            base.OnPostHide();

            loadState.Value = GameLoadState.Idle;

            DisposeSession();
            DisposeLoader();

            currentParameter   = null;
            currentModeService = null;
            lastRecord         = null;
        }
Exemplo n.º 9
0
        /// <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();
        }
Exemplo n.º 10
0
 public SubjectController(IItemService itemService, IModeService modeService)
 {
     this._itemService = itemService;
     this._modeService = modeService;
 }
Exemplo n.º 11
0
 public ModesController(IModeService service)
 {
     this.service = service;
 }
Exemplo n.º 12
0
 public ModeController(IModeService modeService)
 {
     this._modeService = modeService;
 }
Exemplo n.º 13
0
 public ModeController(IModeService lobbyGameService, IMapper mapper)
 {
     this.modeService = lobbyGameService;
     this.mapper      = mapper;
 }
Exemplo n.º 14
0
 public Mode(IModeService modeService)
 {
     m_modeService = modeService;
 }
Exemplo n.º 15
0
 public FansController(IModeService modeService)
 {
     _modeService = modeService;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Sets the current game mode to the specified one.
 /// </summary>
 public void SelectMode(IModeService modeService)
 {
     GameConfiguration.RulesetMode.Value = modeService.GameMode;
 }