예제 #1
0
        public LoadMenu(ScreenManager screenManager, Renderer parent) : base(screenManager, parent)
        {
            background = GUIElement.CreateImage(screenContainer.renderer, new Vector3(0f, 0f, 0f), new Vector2(19.2f, 10.8f), "GUI/ConfigureScreen/BackSett");

            var label = GUIElement.CreateEmpty(screenContainer.renderer, new Vector3(0f, 4.5f, -2f), new Vector2(10f, 1.08f));

            label.renderer.name = "Label";
            {
                var textBox = label.Entity.CreateComponent <TextBox>(name);
                textBox.InitFromRenderer();
                textBox.CharHeight = 0.45f;
                textBox.FontName   = "Furore";
                textBox.Text       = "Загрузить";
                textBox.Align      = ODEngine.Core.Text.TextAlign.Center;
            }

            var buttonCancel = GUIElement.CreateContainer(screenContainer.renderer, new Vector3(0f, -4f, -2f), new Vector2(3f, 0.56f), "Game/Color");

            {
                buttonCancel.renderer.name = "Cancel";
                ODEngine.Helpers.GUIHelper.TextButton(buttonCancel, new Vector3(0f, 0.02f, 0f), "Furore", 0.4f, "Вернуться", new Color4(160, 185, 198, 255), Color4.White);
                buttonCancel.MouseClick += ButtonCancel_MouseClick;
            }

            screenContainer.renderer.isVisible = false;
        }
예제 #2
0
        //private WaveOutEvent menuMusic;

        public SettingsScreen(ScreenManager screenManager, Renderer parent) : base(screenManager, parent)
        {
            screenContainer.renderer.name      = "ConfigurationRenderer";
            screenContainer.renderer.isVisible = false;
            GUIElement.CreateImage(screenContainer.renderer, Vector3.Zero, parent.size, "GUI/ConfigureScreen/BackSett");

            CreateButtons();
            CreateTextBoxes();
        }
예제 #3
0
        private void CreateButtonBack()
        {
            var nsr = GPUTextureLoader.LoadAsync("Images/" + "GUI/ConfigureScreen/Buttons/little_notarget" + ".png");

            buttonBack = GUIElement.CreateContainer(screenContainer.renderer, new Vector3(0f, -4f, -1f), new Vector2(6f, 0.6f), "Game/Color");
            GUIHelper.TextButton(buttonBack, new Vector3(0f, 0.02f, 0f), "Furore", 0.45f, "Назад", new Color4(160, 185, 198, 255), Color4.White);
            buttonBack.MouseClick += ButtonBack_MouseClick;

            GUIElement.CreateImage(screenContainer.renderer, buttonBack.renderer.Position + new Vector3(0f, 0.03f, 0.5f), buttonBack.renderer.size, "GUI/ConfigureScreen/desk");
        }
예제 #4
0
        public MiniMenu(ScreenManagerVN screenManager, Renderer parent) : base(screenManager, parent)
        {
            int menuCounter = 0;

            GUIElement CreateNextButton(string text)
            {
                var ret = GUIElement.CreateContainer(screenContainer.renderer, new Vector3(0f, 1.75f - INTERVAL * menuCounter, -3f), new Vector2(7f, 0.56f), "Game/ColorAlpha");

                ret.renderer.name = text;
                ODEngine.Helpers.GUIHelper.TextButton(ret, new Vector3(0f, 0.02f, 0f), "Furore", 0.4f, text, new Color4(160, 185, 198, 255), Color4.White);
                var menuCounter2 = menuCounter;

                IEnumerator Enable()
                {
                    foreach (var i in CoroutineExecutor.ForTime(0.15f))
                    {
                        ret.renderer.PositionX = ((menuCounter2 % 2) * 2 - 1) * (1f - i) * 5f;
                        ret.material.SetFloat("alpha", MathF.Pow(i, 1.5f));
                        yield return(null);
                    }
                }

                IEnumerator Disable()
                {
                    foreach (var i in CoroutineExecutor.ForTime(0.15f))
                    {
                        ret.renderer.PositionX = ((menuCounter2 % 2) * 2 - 1) * i * 5f;
                        ret.material.SetFloat("alpha", MathF.Pow(1f - i, 1.5f));
                        yield return(null);
                    }
                }

                var menuButton = new MenuElement(ret, Enable, Disable);

                menuElements.Add(menuButton);
                menuCounter++;
                return(ret);
            }

            clickArea            = GUIElement.CreateTransparent(screenContainer.renderer, new Vector3(0f, 0f, -2f), new Vector2(19.2f, 10.8f));
            clickArea.MouseDown += ClickArea_MouseDown;

            buttonMainMenu             = CreateNextButton("Главное меню");
            buttonMainMenu.MouseClick += ButtonMainMenu_MouseClick;

            buttonSave             = CreateNextButton("Сохранить");
            buttonSave.MouseClick += ButtonSave_MouseClick;

            buttonLoad             = CreateNextButton("Загрузить");
            buttonLoad.MouseClick += ButtonLoad_MouseClick;

            buttonShit             = CreateNextButton("Не тыкать");
            buttonShit.MouseClick += ButtonShit_MouseClick;

            buttonSettings             = CreateNextButton("Настройки");
            buttonSettings.MouseClick += ButtonSettings_MouseClick;

            buttonExit             = CreateNextButton("Выход");
            buttonExit.MouseClick += ButtonExit_MouseClick;

            background = GUIElement.CreateImage(screenContainer.renderer, new Vector3(0f, 1.8f - (INTERVAL * (menuCounter - 1)) / 2f, -1f), new Vector2(5f, INTERVAL * menuCounter), "GUI/ec_night", new Material(null, "Game/Alpha"));
            {
                IEnumerator Enable()
                {
                    foreach (var i in CoroutineExecutor.ForTime(0.15f))
                    {
                        background.material.SetFloat("alpha", MathF.Pow(i, 1.5f));
                        yield return(null);
                    }
                }

                IEnumerator Disable()
                {
                    foreach (var i in CoroutineExecutor.ForTime(0.15f))
                    {
                        background.material.SetFloat("alpha", MathF.Pow(1f - i, 1.5f));
                        yield return(null);
                    }
                }

                menuElements.Add(new MenuElement(background, Enable, Disable));
            }

            screenContainer.renderer.isVisible = false;
        }
예제 #5
0
    private static void TextManager_InterfaceCreating(object sender, EventArgs e)
    {
        TextManager textManager = (TextManager)sender;

        textManager.guiRoot      = new Entity().CreateComponent <Renderer>("GUI Root");
        textManager.gameTextADV  = new Entity().CreateComponent <GameText>("ADV");
        textManager.gameTextNVL  = new Entity().CreateComponent <GameText>("NVL");
        textManager.gameTextName = new Entity().CreateComponent <GameText>("Name");
        Renderer renderer;

        { // GUI Root
            textManager.guiRoot.SetParent(GameKernel.screenManager.scenarioScreen.screenRenderer);
            textManager.guiRoot.Position = new Vector3(0f, 0f, -6f);
        }

        { // ADV
            var size = new Vector2(19.2f, 3.5f);
            textManager.containerADV      = GUIElement.CreateContainer(textManager.guiRoot, new Vector3(0f, -3.7f, -1f), size + new Vector2(6f, 6f), "Game/Alpha");
            textManager.containerADV.name = "containerADV";
            renderer = textManager.gameTextADV.Entity.GetComponent <Renderer>();
            renderer.SetParent(textManager.containerADV.renderer);
            //var background = GUIElement.CreateImage(textManager.containerADV.renderer, new Vector3(0f, 0f, 1f), new Vector2(19.2f, 3.5f), "GUI/newdialogue", 0.8f);
            var background = GUIElement.CreateImage(textManager.containerADV.renderer, new Vector3(0f, -0.45f, 1f), new Vector2(15.56f, 1.71f), "GUI/adv_box");
            background.renderer.name = "ADV Background";
            var clickArea = GUIElement.CreateEmpty(textManager.containerADV.renderer, new Vector3(0f, 0f, 0f), textManager.containerADV.renderer.size);
            clickArea.name          = "clickAreaADV";
            clickArea.renderer.name = "clickAreaADV";
            clickArea.MouseDown    += scenarioScreen.ClickArea_MouseDown;

            ADVNormalTransform(textManager);
        }

        { // NVL
            var size = new Vector2(14.93f, 9.5187f);
            textManager.containerNVL      = GUIElement.CreateContainer(textManager.guiRoot, new Vector3(0f, -0.192f, -1f), size + new Vector2(4f, 4f), "Game/Alpha");
            textManager.containerNVL.name = "containerNVL";
            renderer = textManager.gameTextNVL.Entity.GetComponent <Renderer>();
            textManager.gameTextNVL.UpdateSize(size);
            textManager.gameTextNVL.FontName = "BloggerSans";
            textManager.gameTextNVL.Refresh();
            renderer.SetParent(textManager.containerNVL.renderer);
            var background = GUIElement.CreateImage(textManager.containerNVL.renderer, new Vector3(0f, 0f, 1f), size + new Vector2(0.5f, 0.5f), "GUI/NVL_New", 0.8f);
            background.renderer.name = "NVL Background";
            var clickArea = GUIElement.CreateEmpty(textManager.containerNVL.renderer, new Vector3(0f, 0f, 0f), textManager.containerNVL.renderer.size);
            clickArea.name          = "clickAreaNVL";
            clickArea.renderer.name = "clickAreaNVL";

            textManager.nvlSetPosition += e => TextManager_NvlSetPosition(textManager, background, e);
            TextManager_NvlSetPosition(textManager, background, TextManager.NVLPosition.Center);

            clickArea.MouseDown += scenarioScreen.ClickArea_MouseDown;
        }

        { // Name
            textManager.containerName = GUIElement.CreateContainer(textManager.guiRoot, new Vector3(-5.624f, -3.097f, 0f), new Vector2(4.14f, 0.49f), "Game/Alpha");
            renderer = textManager.gameTextName.Entity.GetComponent <Renderer>();
            textManager.gameTextName.UpdateSize(4.14f, 0.49f);
            textManager.gameTextName.outline  = true;
            textManager.gameTextName.FontName = "BloggerSans";
            textManager.gameTextName.Refresh();
            renderer.SetParent(textManager.containerName.renderer);
        }
    }
예제 #6
0
        public MainMenu(ScreenManagerVN screenManager, Renderer parent) : base(screenManager, parent)
        {
            screenContainer.name          = "MainMenu screenContainer";
            screenContainer.renderer.name = "MainMenu screenContainer Renderer";
            screenContainer.material.SetFloat("alpha", 0f);

            var backBack   = GUIElement.CreateImage(screenContainer.renderer, Vector3.Zero, parentRenderer.size, "GUI/MainMenu/BackBack");
            var character1 = GUIElement.CreateImage(screenContainer.renderer, Vector3.Zero, parentRenderer.size, "GUI/MainMenu/Character1");

            buttonsContainer = GUIElement.CreateContainer(screenContainer.renderer, new Vector3(0f, -4.85f, -1f), new Vector2(19.2f, 0.88f), "Game/Alpha");
            deskImage        = GUIElement.CreateImage(buttonsContainer.renderer, Vector3.Zero, new Vector2(19.2f, 0.88f), "GUI/MainMenu/Buttons/desk");
            buttonsContainer.renderer.isVisible = false;
            buttonsContainer.material.SetFloat("alpha", 0f);

            var rays = GUIElement.CreateImage(screenContainer.renderer, Vector3.Zero, parentRenderer.size, "GUI/MainMenu/PostAber", new Material(null, "Game/Alpha"));

            { // Лучи
                IEnumerator AlphaAnimation()
                {
                    while (true)
                    {
                        rays.material.SetFloat("alpha", 0f);
                        yield return(null);

                        for (float i = 0f; i < 7f; i += Kernel.deltaTimeUpdate)
                        {
                            yield return(null);
                        }
                        for (float i = 0f; i < 1f; i += Kernel.deltaTimeUpdate / 2f)
                        {
                            rays.material.SetFloat("alpha", i * i * i * i);
                            yield return(null);
                        }
                        for (float i = 0f; i < MathF.PI * 2; i += Kernel.deltaTimeUpdate * MathF.PI)
                        {
                            rays.material.SetFloat("alpha", (MathF.Cos(i) / 2f + 0.5f) * 0.3f + 0.7f);
                            yield return(null);
                        }
                        for (float i = 0f; i < 1f; i += Kernel.deltaTimeUpdate / 2f)
                        {
                            rays.material.SetFloat("alpha", 1f - i * i * i * i);
                            yield return(null);
                        }
                    }
                }

                var animation = AlphaAnimation();
                CoroutineExecutor.Add(animation);
            }

            buttonStart = GUIElement.CreateEmpty(screenContainer.renderer, new Vector3(-5.69f, -1.73f, -1f), new Vector2(5.64f, 5.29f) * 0.73f);
            { // Кнопка начала игры
                buttonStart.renderer.name = "Start game";
                ODEngine.Helpers.GUIHelper.ImageButton(buttonStart,
                                                       "Images/GUI/MainMenu/BookGo_idle.png",
                                                       "Images/GUI/MainMenu/BookGo_hover.png");

                var imageTicket = ImageLoader.LoadRaw("Images/GUI/MainMenu/BookGo_idle.png", (ticket) =>
                {
                    buttonStart.CreateMask(ticket.rawImage).Wait();
                    ticket.Unload();
                });

                buttonStart.threshold = 0.5f;

                buttonStart.MouseClick += ButtonStart_MouseClick;
            }

            // Надпись "Глубина Холода"
            var labelDOC = GUIElement.CreateFrameAnimation(screenContainer.renderer, new Vector3(-4.64f, 3.46f, -1f), new Vector2(8.67f, 3.54f),
                                                           ("GUI/MainMenu/Title", ColorMatrix.Identity, 10f),
                                                           ("GUI/MainMenu/Title_G1", ColorMatrix.Identity, 0.04f),
                                                           ("GUI/MainMenu/Title_G2", ColorMatrix.Identity, 0.04f),
                                                           ("GUI/MainMenu/Title_G3", ColorMatrix.Identity, 0.04f),
                                                           ("GUI/MainMenu/Title_G4", ColorMatrix.Identity, 0.04f),
                                                           ("GUI/MainMenu/Title", ColorMatrix.Identity, 8f),
                                                           ("GUI/MainMenu/Title_G1", ColorMatrix.Identity, 0.05f),
                                                           ("GUI/MainMenu/Title", ColorMatrix.Identity, 10f),
                                                           ("GUI/MainMenu/Title_G1", ColorMatrix.Identity, 0.03f),
                                                           ("GUI/MainMenu/Title_G2", ColorMatrix.Identity, 0.03f));

            buttonMenu = GUIElement.CreateEmpty(screenContainer.renderer, new Vector3(9.23f, -4.87f, -2f), new Vector2(0.74f, 0.88f));
            {
                buttonMenu.renderer.name = "Menu";

                var imageFile1 = "Images/GUI/MainMenu/Buttons/Triangle_idle.png";
                var texTicket1 = GPUTextureLoader.LoadAsync(imageFile1);
                var imageFile2 = "Images/GUI/MainMenu/Buttons/Triangle_hover.png";
                var texTicket2 = GPUTextureLoader.LoadAsync(imageFile2);
                var imageFile3 = "Images/GUI/MainMenu/Buttons/TriangleBack_idle.png";
                var texTicket3 = GPUTextureLoader.LoadAsync(imageFile3);
                var imageFile4 = "Images/GUI/MainMenu/Buttons/TriangleBack_hover.png";
                var texTicket4 = GPUTextureLoader.LoadAsync(imageFile4);

                buttonMenu.renderer.onRender = (input, output) =>
                {
                    if (!menuIsVisible)
                    {
                        if (!buttonMenu.mouseOnElement)
                        {
                            if (texTicket1 != null)
                            {
                                Graphics.Blit(texTicket1.texture, output);
                            }
                        }
                        else
                        {
                            if (texTicket2 != null)
                            {
                                Graphics.Blit(texTicket2.texture, output);
                            }
                        }
                    }
                    else
                    {
                        if (!buttonMenu.mouseOnElement)
                        {
                            if (texTicket1 != null)
                            {
                                Graphics.Blit(texTicket3.texture, output);
                            }
                        }
                        else
                        {
                            if (texTicket2 != null)
                            {
                                Graphics.Blit(texTicket4.texture, output);
                            }
                        }
                    }
                };

                buttonMenu.isLoaded = () => texTicket1.isLoaded && texTicket2.isLoaded && texTicket3.isLoaded && texTicket4.isLoaded;

                buttonMenu.MouseClick += ButtonMenu_MouseClick;
            }

            buttonExit = GUIElement.CreateContainer(buttonsContainer.renderer, new Vector3(6.75f, 0f, -1f), new Vector2(1.95f, 0.56f), "Game/Color");
            { // Кнопка выхода
                buttonExit.renderer.name = "Exit";
                ODEngine.Helpers.GUIHelper.TextButton(buttonExit, new Vector3(0f, 0.02f, 0f), "Furore", 0.45f, "Выход", new Color4(160, 185, 198, 255), Color4.White);
                buttonExit.MouseClick += ButtonExit_MouseClick;
            }

            buttonSettings = GUIElement.CreateContainer(buttonsContainer.renderer, new Vector3(3.88f, 0f, -1f), new Vector2(3.02f, 0.56f), "Game/Color");
            { // Кнопка "Настройки"
                buttonSettings.renderer.name = "Settings";
                ODEngine.Helpers.GUIHelper.TextButton(buttonSettings, new Vector3(0f, 0.02f, 0f), "Furore", 0.45f, "Настройки", new Color4(160, 185, 198, 255), Color4.White);
                buttonSettings.MouseClick += ButtonSettings_MouseClick;
            }

            buttonLoad = GUIElement.CreateContainer(buttonsContainer.renderer, new Vector3(0.5f, 0f, -1f), new Vector2(3.02f, 0.56f), "Game/Color");
            { // Кнопка "Загрузить"
                buttonLoad.renderer.name = "Load";
                ODEngine.Helpers.GUIHelper.TextButton(buttonLoad, new Vector3(0f, 0.02f, 0f), "Furore", 0.45f, "Загрузить", new Color4(160, 185, 198, 255), Color4.White);
                buttonLoad.MouseClick += ButtonLoad_MouseClick;
            }

            buttonFragment = GUIElement.CreateContainer(buttonsContainer.renderer, new Vector3(-2.65f, 0f, -1f), new Vector2(3.02f, 0.56f), "Game/Color");
            { // Кнопка "Фрагмент"
                buttonFragment.renderer.name = "Fragment";
                ODEngine.Helpers.GUIHelper.TextButton(buttonFragment, new Vector3(0f, 0.02f, 0f), "Furore", 0.45f, "Фрагмент", new Color4(160, 185, 198, 255), Color4.White);
                buttonFragment.MouseClick += ButtonFragment_MouseClick;
            }

            isLoaded = () => backBack.IsLoaded && character1.IsLoaded && deskImage.IsLoaded && rays.IsLoaded &&
                       buttonStart.IsLoaded && labelDOC.IsLoaded && buttonSettings.IsLoaded && buttonExit.IsLoaded && buttonMenu.IsLoaded;
        }