private void Init(IColorPreset colorPreset)
        {
            Color = colorPreset.DarkBackground;

            menuHolder = CreateChild <MenuHolder>("menu", 0);
            {
                menuHolder.Anchor   = AnchorType.TopStretch;
                menuHolder.Pivot    = PivotType.Top;
                menuHolder.RawWidth = 0f;
                menuHolder.Y        = 0f;
                menuHolder.Height   = 56f;
            }
            versionDisplay = CreateChild <VersionDisplay>("version", 1);
            {
                versionDisplay.Anchor   = AnchorType.TopStretch;
                versionDisplay.Pivot    = PivotType.Top;
                versionDisplay.RawWidth = 0f;
                versionDisplay.Y        = -56f;
                versionDisplay.Height   = 72f;
            }
            contentScroll = CreateChild <UguiScrollView>("content", 2);
            {
                contentScroll.Anchor = AnchorType.Fill;
                contentScroll.Offset = new Offset(0f, 128f, 0f, 0f);

                contentScroll.Background.Alpha = 0f;

                metaContainer = contentScroll.Container.CreateChild <MetaContainer>("meta");
                {
                    metaContainer.Anchor = AnchorType.TopStretch;
                    metaContainer.Pivot  = PivotType.Top;
                    metaContainer.Y      = -32f;
                    metaContainer.Height = 360f;
                    metaContainer.SetOffsetHorizontal(64f);
                }
                rankingContainer = contentScroll.Container.CreateChild <RankingContainer>("ranking");
                {
                    rankingContainer.Anchor = AnchorType.TopStretch;
                    rankingContainer.Pivot  = PivotType.Top;
                    rankingContainer.Y      = -424f;
                    rankingContainer.Height = 360f;
                    rankingContainer.SetOffsetHorizontal(64f);
                }
                actionsContainer = contentScroll.Container.CreateChild <ActionsContainer>("actions");
                {
                    actionsContainer.Anchor = AnchorType.TopStretch;
                    actionsContainer.Pivot  = PivotType.Top;
                    actionsContainer.Y      = -816f;
                    actionsContainer.Height = 48f;
                    actionsContainer.SetOffsetHorizontal(64f);
                }

                // Calculate height of the scrollview content.
                contentScroll.Container.Height = GetContentHeight();
            }
        }
예제 #2
0
        private static void activateIntrfaceVersion()
        {
            Interfaces.MenuItem  m_VersionsAndActions = new Interfaces.MenuItem("Versions and Actions", null);
            Interfaces.IDoAction showVersion          = new VersionDisplay();
            Interfaces.MenuItem  m_ShowVersion        = new Interfaces.MenuItem("Show Version", showVersion);

            m_VersionsAndActions.AddMenuItem(m_ShowVersion);

            Interfaces.MenuItem  m_Actions     = new Interfaces.MenuItem("Actions", null);
            Interfaces.IDoAction charsCount    = new CharsCount();
            Interfaces.MenuItem  m_CharsCount  = new Interfaces.MenuItem("Chars Count", charsCount);
            Interfaces.IDoAction countSpaces   = new SpacesCount();
            Interfaces.MenuItem  m_CountSpaces = new Interfaces.MenuItem("Count Spaces", countSpaces);

            m_Actions.AddMenuItem(m_CharsCount);
            m_Actions.AddMenuItem(m_CountSpaces);
            m_VersionsAndActions.AddMenuItem(m_Actions);

            // Show Time and Date menu
            Interfaces.MenuItem  m_ShowDateAndTime = new Interfaces.MenuItem("Show Date/Time", null);
            Interfaces.IDoAction showTime          = new TimeDisplay();
            Interfaces.MenuItem  m_ShowTime        = new Interfaces.MenuItem("Show Time", showTime);
            Interfaces.IDoAction showDate          = new DateDisplay();
            Interfaces.MenuItem  m_ShowDate        = new Interfaces.MenuItem("Show Date", showDate);

            m_ShowDateAndTime.AddMenuItem(m_ShowTime);
            m_ShowDateAndTime.AddMenuItem(m_ShowDate);

            // Main menu
            Interfaces.MenuItem firstMenu = new Interfaces.MenuItem("My Menu implemented with Interfaces", null);
            Interfaces.MainMenu mainMenu  = new Interfaces.MainMenu(firstMenu);

            firstMenu.AddMenuItem(m_VersionsAndActions);
            firstMenu.AddMenuItem(m_ShowDateAndTime);

            mainMenu.Show();
        }
예제 #3
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _cursorTexture = Content.Load <Texture2D>("Sprites/ui/walk-cursor");

            var uiContentStorage = ServiceProvider.GetRequiredService <IUiContentStorage>();

            uiContentStorage.LoadContent(Content);

            var personVisualizationContentStorage =
                ServiceProvider.GetRequiredService <IPersonVisualizationContentStorage>();

            personVisualizationContentStorage.LoadContent(Content);

            var gameobjectVisualizationContentStorage =
                ServiceProvider.GetRequiredService <IGameObjectVisualizationContentStorage>();

            gameobjectVisualizationContentStorage.LoadContent(Content);

            var personSoundContentStorage = ServiceProvider.GetRequiredService <IPersonSoundContentStorage>();

            personSoundContentStorage.LoadContent(Content);

            var uiSoundStorage = ServiceProvider.GetRequiredService <IUiSoundStorage>();

            uiSoundStorage.LoadContent(Content);
            UiThemeManager.SoundStorage = uiSoundStorage;

            var screenManager = new ScreenManager(this);
            var titleScreen   = new TitleScreen(this, _spriteBatch);

            screenManager.ActiveScreen = titleScreen;

            Components.Add(screenManager);

            var font = Content.Load <SpriteFont>("Fonts/Main");

#if DEBUG
            var fpsCounter = new FpsCounter(this, _spriteBatch, font);
            Components.Add(fpsCounter);

            var cheatInput = new CheatInput(this, _spriteBatch, font);
            Components.Add(cheatInput);

            _graphics.IsFullScreen              = false;
            _graphics.PreferredBackBufferWidth  = 800;
            _graphics.PreferredBackBufferHeight = 480;
            _graphics.ApplyChanges();
#endif

            var soundtrackManagerComponent = new SoundtrackManagerComponent(this);
            var soundtrackManager          = ServiceProvider.GetRequiredService <SoundtrackManager>();
            var titleSong = Content.Load <Song>("Audio/TitleBackgroundTrack");
            soundtrackManager.Initialize(titleSong);
            soundtrackManagerComponent.Initialize(soundtrackManager);
            Components.Add(soundtrackManagerComponent);
#if !DEBUG
            _graphics.IsFullScreen = true;
            _graphics.PreferredBackBufferWidth
                = 1280;
            _graphics.PreferredBackBufferHeight
                = 720;
            _graphics.ApplyChanges();
#endif

            var versionDisplay = new VersionDisplay(this, _spriteBatch, font);
            Components.Add(versionDisplay);
        }