コード例 #1
0
        /// <summary>
        /// Initializes all required modules for the game.
        /// </summary>
        protected virtual void InitializeModules()
        {
            UnityThread.Initialize();

            Dependencies.CacheAs <IGame>(this);

            Dependencies.CacheAs <IPlatformHost>(platformHost = PlatformHost.CreateHost());
            Dependencies.CacheAs <DeepLinker>(deepLinker      = platformHost.CreateDeepLinker());

            Dependencies.CacheAs <IEnvConfiguration>(envConfiguration = new EnvConfiguration(EnvType.Production));

            Dependencies.CacheAs <IModeManager>(modeManager = new ModeManager());

            Dependencies.CacheAs <INotificationBox>(notificationBox = new NotificationBox());

            Dependencies.CacheAs <IGameConfiguration>(gameConfiguration     = new GameConfiguration());
            Dependencies.CacheAs <IMapConfiguration>(mapConfiguration       = new MapConfiguration());
            Dependencies.CacheAs <IMapsetConfiguration>(mapsetConfiguration = new MapsetConfiguration());

            Dependencies.CacheAs <IFontManager>(fontManager       = new FontManager());
            Dependencies.CacheAs <IAtlas <Sprite> >(spriteAtlas   = new ResourceSpriteAtlas());
            Dependencies.CacheAs <IAtlas <AudioClip> >(audioAtlas = new ResourceAudioAtlas());

            Dependencies.CacheAs <IMusicCacher>(musicCacher           = new MusicCacher());
            Dependencies.CacheAs <IBackgroundCacher>(backgroundCacher = new BackgroundCacher());
            Dependencies.CacheAs <IWebImageCacher>(webImageCacher     = new WebImageCacher());
            Dependencies.CacheAs <IWebMusicCacher>(webMusicCacher     = new WebMusicCacher());

            Dependencies.CacheAs <IMusicController>(musicController = MusicController.Create());

            Dependencies.CacheAs <ISoundTable>(soundTable = new DefaultSoundTable(audioAtlas));
            Dependencies.CacheAs <ISoundPool>(soundPool   = new SoundPool(soundTable));

            Dependencies.CacheAs <IMapsetStore>(mapsetStore   = new MapsetStore(modeManager));
            Dependencies.CacheAs <IMapSelection>(mapSelection = new MapSelection(musicCacher, backgroundCacher, gameConfiguration, mapsetConfiguration, mapConfiguration));
            Dependencies.CacheAs <IMapManager>(mapManager     = new MapManager(mapsetStore, notificationBox, mapSelection));
            Dependencies.CacheAs <IMetronome>(metronome       = new Metronome()
            {
                AudioController = musicController
            });
            Dependencies.CacheAs <IMusicPlaylist>(musicPlaylist = new MusicPlaylist());

            Dependencies.CacheAs <IDownloadStore>(downloadStore = new DownloadStore());
            Dependencies.CacheAs <IApi>(api = new Api(envConfiguration, notificationBox, deepLinker));

            Dependencies.CacheAs <IUserManager>(userManager = new UserManager(api, Dependencies));
            Dependencies.CacheAs <IRecordStore>(recordStore = new RecordStore());

            Dependencies.CacheAs <IRootMain>(rootMain                 = RootMain.Create(Dependencies));
            Dependencies.CacheAs <IRoot3D>(root3D                     = Root3D.Create(Dependencies));
            Dependencies.CacheAs <IColorPreset>(colorPreset           = new ColorPreset());
            Dependencies.CacheAs <IAnimePreset>(animePreset           = new AnimePreset());
            Dependencies.CacheAs <IScreenNavigator>(screenNavigator   = new ScreenNavigator(rootMain));
            Dependencies.CacheAs <IOverlayNavigator>(overlayNavigator = new OverlayNavigator(rootMain));
            Dependencies.CacheAs <IDropdownProvider>(dropdownProvider = new DropdownProvider(rootMain));

            Dependencies.CacheAs <ITemporaryStore>(temporaryStore = new TemporaryStore());
        }
コード例 #2
0
        private void Init(IRoot3D root3D)
        {
            Dependencies = Dependencies.Clone();

            // Cache this navigation view.
            Dependencies.Cache(this);

            if (IsRoot3D)
            {
                SetParent(root3D);
                myTransform.ResetTransform();
            }

            model = CreateModel() ?? new TModel();
            Dependencies.CacheAndInject(model);

            Depth = ViewDepth;
        }
コード例 #3
0
        private void Init(IRoot3D root3D)
        {
            float labelColor = 0.4f;

            AccuracyDisplay = CreateChild <AccuracyDisplay>("accuracy");
            {
                AccuracyDisplay.Anchor   = AnchorType.Bottom;
                AccuracyDisplay.Position = new Vector3(-600f, 64f);

                var label = AccuracyDisplay.Label;
                {
                    label.Alignment = TextAnchor.MiddleLeft;
                    label.FontSize  = 32;
                    label.IsBold    = true;
                    label.Color     = new Color(labelColor, labelColor, labelColor);
                    label.AddEffect(new AdditiveShaderEffect());
                }
            }
            ScoreDisplay = CreateChild <ScoreDisplay>("score");
            {
                ScoreDisplay.Anchor   = AnchorType.Bottom;
                ScoreDisplay.Position = new Vector3(0, 64f);

                var label = ScoreDisplay.Label;
                {
                    label.Alignment = TextAnchor.MiddleCenter;
                    label.FontSize  = 40;
                    label.IsBold    = true;
                    label.Color     = new Color(labelColor, labelColor, labelColor);
                    label.AddEffect(new AdditiveShaderEffect());
                }
            }
            ComboDisplay = CreateChild <ComboDisplay>("combo");
            {
                ComboDisplay.Anchor   = AnchorType.Bottom;
                ComboDisplay.Position = new Vector3(600f, 64f);

                var label = ComboDisplay.Label;
                {
                    label.Alignment = TextAnchor.MiddleRight;
                    label.FontSize  = 32;
                    label.IsBold    = true;
                    label.Color     = new Color(labelColor, labelColor, labelColor);
                    label.AddEffect(new AdditiveShaderEffect());
                }
            }
            HealthDisplay = CreateChild <HealthDisplay>("health");
            {
                HealthDisplay.Anchor = AnchorType.Bottom;
                HealthDisplay.Size   = new Vector2(
                    Mathf.Min(root3D.Resolution.x, PixelDefinition.PlayAreaWidth),
                    16
                    );

                var progressBar = HealthDisplay.ProgressBar;
                {
                    progressBar.Anchor = AnchorType.Fill;
                    progressBar.Offset = Offset.Zero;

                    var bg = progressBar.Background;
                    {
                        bg.Color = new Color(0f, 0f, 0f, 0.75f);
                    }
                    var fg = progressBar.Foreground;
                    {
                        fg.Offset = new Offset(0f, 0f, 0f, 12f);
                    }
                    var thumb = progressBar.Thumb;
                    {
                        thumb.Parent.Offset = new Offset(0f, -6f, 0f, 6f);
                    }
                }
                var indicator = HealthDisplay.Indicator;
                {
                    indicator.Anchor = AnchorType.CenterStretch;
                    indicator.X      = 0f;
                    indicator.Width  = 2f;
                    indicator.SetOffsetVertical(-8f);
                }
            }
            var laneComboDisplay = CreateChild <LaneComboDisplay>("lane-combo");

            {
                laneComboDisplay.Anchor    = AnchorType.Top;
                laneComboDisplay.Position  = new Vector3(0f, -150f);
                laneComboDisplay.RotationX = 25f;
            }
            DamagedDisplay = CreateChild <DamagedDisplay>("damaged-display");
            {
                DamagedDisplay.Anchor = AnchorType.Fill;
                DamagedDisplay.Offset = Offset.Zero;
            }
            TouchEffectDisplay = CreateChild <TouchEffectDisplay>("touch-effect");
            {
                TouchEffectDisplay.Anchor = AnchorType.Fill;
                TouchEffectDisplay.Offset = Offset.Zero;
            }
        }