private void Init(IRootMain rootMain) { Dependencies.Cache(this); infoContainer = CreateChild <InfoContainer>("info", 0); { infoContainer.Anchor = AnchorType.BottomStretch; infoContainer.Pivot = PivotType.Top; infoContainer.RawWidth = 0f; infoContainer.Height = Mathf.Min(infoContainer.FullDetailHeight, rootMain.Resolution.y - InfoDetailedYDiff); infoContainer.Y = InfoBriefY; } versionContainer = CreateChild <VersionContainer>("version", 1); { versionContainer.Anchor = AnchorType.TopStretch; versionContainer.Pivot = PivotType.Top; versionContainer.RawWidth = 0; versionContainer.Y = 0f; versionContainer.Height = 160f; } infoDetailAni = new Anime(); infoDetailAni.AnimateFloat(y => infoContainer.Y = y) .AddTime(0f, () => infoContainer.Y) .AddTime(0.25f, infoContainer.Height) .Build(); infoBriefAni = new Anime(); infoBriefAni.AnimateFloat(y => infoContainer.Y = y) .AddTime(0f, () => infoContainer.Y) .AddTime(0.25f, InfoBriefY) .Build(); OnEnableInited(); }
/// <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()); }
public DropdownProvider(IRootMain rootMain) { if (rootMain == null) { throw new ArgumentNullException(nameof(rootMain)); } this.rootMain = rootMain; recycler = new ManagedRecycler <DropdownMenu>(CreateMenu); }
private void Init(IRootMain rootMain) { // Init the list view. Initialize(OnCreateListItem, OnUpdateListItem); CellSize = new Vector2(rootMain.Resolution.x, 82f); Corner = GridLayoutGroup.Corner.UpperLeft; Axis = GridLayoutGroup.Axis.Vertical; background.SpriteName = "null"; OnEnableInited(); // Recalibrate after a frame due to a limitation where a rect transform's size doesn't update immediately when using anchors. InvokeAfterTransformed(1, Recalibrate); }
private void Init(IRootMain rootMain) { Color = new Color(1f, 1f, 1f, 0.25f); grid = CreateChild <UguiGrid>("grid", 0); { grid.Anchor = AnchorType.Fill; grid.RawSize = Vector2.zero; InvokeAfterTransformed(1, () => grid.CellSize = new Vector2(Width / grid.ChildCount, 56f)); backButton = grid.CreateChild <MenuButton>("back", 0); { backButton.IconName = "icon-arrow-left"; backButton.LabelText = "Back"; backButton.OnTriggered += Model.NavigateToSongs; } infoButton = grid.CreateChild <MenuButton>("info", 1); { infoButton.IconName = "icon-info"; infoButton.LabelText = "Details"; infoButton.OnTriggered += Model.ToggleDetailedMode; } offsetButton = grid.CreateChild <MenuButton>("offset", 2); { offsetButton.IconName = "icon-clock"; offsetButton.LabelText = "Offset"; offsetButton.OnTriggered += Model.ShowOffset; } playButton = grid.CreateChild <MenuButton>("play", 3); { playButton.IconName = "icon-play"; playButton.LabelText = "Play"; playButton.OnTriggered += Model.NavigateToGame; } } }
private void Init(IRootMain root) { blurDisplay = CreateChild <BlurDisplay>("blur", 0); { blurDisplay.Anchor = AnchorType.Fill; blurDisplay.RawSize = Vector2.zero; } bgSprite = CreateChild <UguiSprite>("bg", 1); { bgSprite.Anchor = AnchorType.Fill; bgSprite.RawSize = Vector2.zero; bgSprite.Color = new Color(0f, 0f, 0f, 0.5f); } messageLabel = CreateChild <Label>("message", 2); { float horizontalOffset = root.Resolution.x / 4; messageLabel.Anchor = AnchorType.MiddleStretch; messageLabel.SetOffsetHorizontal(horizontalOffset); messageLabel.Alignment = TextAnchor.LowerCenter; messageLabel.WrapText = true; messageLabel.FontSize = 26; messageLabel.Height = 90f; messageLabel.Y = 140f; } selectionHolder = CreateChild <SelectionHolder>("selection", 3); { selectionHolder.Anchor = AnchorType.MiddleStretch; selectionHolder.Pivot = PivotType.Top; selectionHolder.SetOffsetHorizontal(0f); selectionHolder.Y = 26f; } blocker = CreateChild <Blocker>("blocker", 4); OnEnableInited(); }