예제 #1
0
    public static void DisplayTransitionWindow(Quest.MoMPhase phase)
    {
        // do NOT delete dialog, they are hidden behing the mythos phase
        //Destroyer.Dialog();

        Game      game = Game.Get();
        UIElement text;

        // dot NOT display transition screen while we are in Editor mode
        if (game.testMode)
        {
            return;
        }

        // Background picture in full screen
        UIElement bg = new UIElement(Game.TRANSITION);
        Texture2D bgTex;

        if (phase == Quest.MoMPhase.investigator)
        {
            bgTex = ContentData.FileToTexture(game.cd.Get <ImageData>(IMG_BG_INVESTIGATORS_PHASE).image);
        }
        else
        {
            bgTex = ContentData.FileToTexture(game.cd.Get <ImageData>(IMG_BG_MYTHOS_PHASE).image);
        }
        bg.SetImage(bgTex);
        bg.SetLocation(0, 0, UIScaler.GetWidthUnits(), UIScaler.GetHeightUnits());

        // Text of phase
        text = new UIElement(Game.TRANSITION, bg.GetTransform());
        if (phase == Quest.MoMPhase.investigator)
        {
            // Silver   #C0C0C0     (192,192,192)
            text.SetText(PHASE_INVESTIGATOR, new Color32(192, 192, 192, 255));
            text.SetLocation(5, 3, 30, 3);
        }
        else
        {
            // Dark red #8B0000 (139,0,0)
            text.SetText(PHASE_MYTHOS, new Color32(139, 0, 0, 255));
            text.SetLocation(7, 3, 30, 3);
        }
        text.SetFont(game.gameType.GetHeaderFont());
        text.SetFontSize(UIScaler.GetLargeFont());
        text.SetFontStyle(FontStyle.Italic);
        text.SetTextAlignment(TextAnchor.MiddleLeft);
        text.SetBGColor(Color.clear);


        if (phase == Quest.MoMPhase.investigator)
        {
            // Draw pictures of investigators for investigator phase
            float     offset = (game.quest.GetHeroCount() - 1) * (-1 * offset_size / 2) - (offset_size / 2);
            UIElement ui     = null;
            foreach (Quest.Hero h in game.quest.heroes)
            {
                if (h.heroData != null)
                {
                    // Draw pictures
                    Texture2D newTex = ContentData.FileToTexture(h.heroData.image);

                    ui = new UIElement(Game.TRANSITION, bg.GetTransform());
                    ui.SetLocation(UIScaler.GetHCenter(offset), UIScaler.GetVCenter(), heroSize, heroSize);
                    ui.SetImage(newTex);

                    offset += offset_size;
                }
            }
        }
        else
        {
            // Don't draw anything for Mythos phase
        }

        // Launch timer to remove this window in 'transition_duration' seconds
        if (gameobject_timer == null)
        {
            gameobject_timer = new GameObject("TIMER");
            timer            = gameobject_timer.AddComponent <SimpleTimer>();
        }

        timer.Init(transition_duration, Close);
    }
예제 #2
0
        // Create a menu which will take up the whole screen and have options.  All items are dialog for destruction.
        public EndGameScreen()
        {
            ValkyrieDebug.Log("INFO: Show end screen");

            Game game = Game.Get();

            // Investigator picture in background full screen
            UIElement bg = new UIElement(Game.ENDGAME);
            Texture2D bgTex;

            if (game.gameType.TypeName() == "MoM")
            {
                bgTex = ContentData.FileToTexture(game.cd.images[IMG_BG_MOM].image);
            }
            else if (game.gameType.TypeName() == "D2E")
            {
                bgTex = ContentData.FileToTexture(game.cd.images[IMG_BG_DESCENT].image);
            }
            else
            {
                // TODO: support a background picture for IA
                Destroyer.MainMenu();
                return;
            }
            bg.SetImage(bgTex);
            bg.SetLocation(0, 0, UIScaler.GetWidthUnits(), UIScaler.GetHeightUnits());

            // Welcome text
            UIElement ui = new UIElement(Game.ENDGAME);

            ui.SetLocation((UIScaler.GetWidthUnits() - TitleWidth) / 2, 1, TitleWidth, 4);
            ui.SetText(STATS_WELCOME);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetSmallFont());
            ui.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(ui);

            float offset = 5;

            // First question : player has won ?
            ui = new UIElement(Game.ENDGAME);
            ui.SetLocation(4, offset + 2, QuestionsWidth, 2);
            ui.SetText(STATS_ASK_VICTORY);
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetSmallFont());
            ui.SetBGColor(new Color(0, 0.03f, 0f, 0.2f));

            // yes button
            button_yes = new UIElement(Game.ENDGAME);
            button_yes.SetLocation((UIScaler.GetWidthUnits() / 10) * 5, offset + 2.5f, VictoryButtonWidth, 1);
            button_yes.SetText(STATS_ASK_VICTORY_YES);
            button_yes.SetFont(game.gameType.GetHeaderFont());
            button_yes.SetFontSize(UIScaler.GetSmallFont());
            button_yes.SetButton(PressVictoryYes);
            button_yes.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(button_yes);

            // no button
            button_no = new UIElement(Game.ENDGAME);
            button_no.SetLocation((UIScaler.GetWidthUnits() / 10) * 7, offset + 2.5f, VictoryButtonWidth, 1);
            button_no.SetText(STATS_ASK_VICTORY_NO);
            button_no.SetFont(game.gameType.GetHeaderFont());
            button_no.SetFontSize(UIScaler.GetSmallFont());
            button_no.SetButton(PressVictoryNo);
            button_no.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(button_no);


            offset += 4;

            // Second question : rating ?
            ui = new UIElement(Game.ENDGAME);
            ui.SetLocation(4, offset + 2, QuestionsWidth, 2);
            ui.SetText(STATS_ASK_RATING);
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetSmallFont());
            ui.SetBGColor(new Color(0, 0.03f, 0f, 0.2f));

            // rating 1 to 10
            rating_buttons = new UIElement[10];
            for (int i = 0; i <= 9; i++)
            {
                rating_buttons[i] = new UIElement(Game.ENDGAME);
                rating_buttons[i].SetLocation((UIScaler.GetWidthUnits() / 22) * (11 + i),
                                              offset + 2.5f,
                                              RatingButtonWidth,
                                              1);
                rating_buttons[i].SetText((i + 1).ToString());
                rating_buttons[i].SetFont(game.gameType.GetHeaderFont());
                rating_buttons[i].SetFontSize(UIScaler.GetSmallFont());
                rating_buttons[i].SetButtonWithParams(PressRatingButton, (i + 1).ToString());
                rating_buttons[i].SetBGColor(new Color(0, 0.03f, 0f));
                new UIElementBorder(rating_buttons[i]);
            }

            offset += 4;


            // Third question : comments ?
            ui = new UIElement(Game.ENDGAME);
            ui.SetLocation(4, offset + 2, QuestionsWidth, 2);
            ui.SetText(STATS_ASK_COMMENTS);
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetSmallFont());
            ui.SetBGColor(new Color(0, 0.03f, 0f, 0.2f));

            comments = new UIElementEditable(Game.ENDGAME);
            comments.SetLocation((UIScaler.GetWidthUnits() / 2), offset + 2, CommentsWidth, 5);
            comments.SetText(" ");
            comments.SetTextAlignment(TextAnchor.UpperLeft);
            comments.SetTextPadding(0.1f);
            comments.SetFont(game.gameType.GetFont());
            comments.SetFontSize(UIScaler.GetSmallFont());
            comments.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(comments);

            offset += 8.5f;


            // Go back to menu button
            ui = new UIElement(Game.ENDGAME);
            ui.SetLocation((UIScaler.GetWidthUnits() / 6) * 2, offset, ActionButtonWidth, 2);
            ui.SetText(STATS_MENU_BUTTON);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(MainMenu);
            ui.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(ui);

            // Publish button
            ui = new UIElement(Game.ENDGAME);
            ui.SetLocation((UIScaler.GetWidthUnits() / 6) * 3, offset, ActionButtonWidth, 2);
            ui.SetText(STATS_SEND_BUTTON);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(SendStats);
            ui.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(ui);

            offset += 3.5f;

            // Error message if any information is missing
            error_message = new UIElement(Game.ENDGAME);
            error_message.SetLocation((UIScaler.GetWidthUnits() - TitleWidth) / 2, offset, TitleWidth, 4);
            error_message.SetText(" ");
            error_message.SetFont(game.gameType.GetHeaderFont());
            error_message.SetTextAlignment(TextAnchor.MiddleCenter);
            error_message.SetFontSize(UIScaler.GetSmallFont());
            error_message.SetBGColor(Color.clear);
        }
예제 #3
0
        // Create a menu which will take up the whole screen and have options.  All items are dialog for destruction.
        public MainMenuScreen()
        {
            // This will destroy all, because we shouldn't have anything left at the main menu
            Destroyer.Destroy();
            Game game = Game.Get();

            List <string> music = new List <string>();

            foreach (AudioData ad in game.cd.Values <AudioData>())
            {
                if (ad.ContainsTrait("menu"))
                {
                    music.Add(ad.file);
                }
            }
            game.audioControl.PlayDefaultQuestMusic(music);

            // Background image.
            UIElement bg = new UIElement();

            bg.SetLocation(0, 0, UIScaler.GetWidthUnits(), UIScaler.GetHeightUnits());
            bg.SetImage(Resources.Load($"sprites/GameBackground{game.gameType.TypeName()}") as Texture2D, true, AspectRatioFitter.AspectMode.EnvelopeParent);

            // Name.  Should this be the banner, or better to print Valkyrie with the game font?
            UIElement ui = new UIElement();

            ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3);
            ui.SetText("Valkyrie");
            ui.SetBGColor(Color.clear);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetLargeFont());
            ui.SetTextOutline(Color.black, 1);


            // Version type : alpha / beta should be displayed
            if (Game.Get().version.EndsWith("a"))
            {
                ui = new UIElement();
                ui.SetLocation(UIScaler.GetRight(-6), 1, 6, 3);
                ui.SetText("alpha version");
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetFontSize(UIScaler.GetMediumFont());
                ui.SetButton(delegate { TestCrash(); });
            }
            if (Game.Get().version.EndsWith("b"))
            {
                ui = new UIElement();
                ui.SetLocation(UIScaler.GetRight(-6), 1, 6, 3);
                ui.SetText("beta version");
                ui.SetTextAlignment(TextAnchor.MiddleLeft);
                ui.SetFontSize(UIScaler.GetMediumFont());
                ui.SetButton(delegate { TestCrash(); });
            }

            float menuButtonsX = UIScaler.GetWidthUnits() * 0.05f;

            // Button for start quest/scenario
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 5, ButtonWidth, 2);
            ui.SetText(START_QUEST);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Start);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);

            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 8, ButtonWidth, 2);
            ui.SetBGColor(BUTTON_BG_COLOR);
            if (SaveManager.SaveExists())
            {
                ui.SetText(LOAD_QUEST);
                ui.SetButton(delegate { new SaveSelectScreen(); });
                new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);
            }
            else
            {
                ui.SetText(LOAD_QUEST, Color.grey);
                new UIElementBorder(ui, BUTTON_BORDER_COLOR_INACTIVE);
            }
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());

            // Content selection page
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 11, ButtonWidth, 2);
            ui.SetText(SELECT_CONTENT);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Content);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);

            // Quest/Scenario editor
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 14, ButtonWidth, 2);
            ui.SetText(new StringKey("val", "QUEST_NAME_EDITOR", game.gameType.QuestName()));
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Editor);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);

            // About page (managed in this class)
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 17, ButtonWidth, 2);
            ui.SetText(ABOUT);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(About);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);

            // Configuration menu
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 20, ButtonWidth, 2);
            ui.SetText(OPTIONS);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Config);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);

            // Exit Valkyrie
            ui = new UIElement();
            ui.SetLocation(menuButtonsX, 23, ButtonWidth, 2);
            ui.SetText(CommonStringKeys.EXIT);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Exit);
            ui.SetBGColor(BUTTON_BG_COLOR);
            new UIElementBorder(ui, BUTTON_BORDER_COLOR_ACTIVE);
        }