Exemple #1
0
    // List of quests to copy
    public void Copy()
    {
        // Can copy all quests, not just user
        questList = QuestLoader.GetQuests();
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        // Header
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName() + " To Copy");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        db = new DialogBox(new Vector2(1, 5f), new Vector2(UIScaler.GetWidthUnits() - 2f, 21f), "");
        db.AddBorder();
        db.background.AddComponent <UnityEngine.UI.Mask>();
        UnityEngine.UI.ScrollRect scrollRect = db.background.AddComponent <UnityEngine.UI.ScrollRect>();

        GameObject    scrollArea      = new GameObject("scroll");
        RectTransform scrollInnerRect = scrollArea.AddComponent <RectTransform>();

        scrollArea.transform.parent = db.background.transform;
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, (UIScaler.GetWidthUnits() - 3f) * UIScaler.GetPixelsPerUnit());
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 1);

        scrollRect.content    = scrollInnerRect;
        scrollRect.horizontal = false;

        // List of quests
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 5, 1.2f), "  " + q.Value.name, delegate { Copy(key); }, Color.black, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().material   = (Material)Resources.Load("Fonts/FontMaterial");
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = Color.white;
            tb.background.transform.parent = scrollArea.transform;
            offset += 2;
        }
        scrollInnerRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, (offset - 5) * UIScaler.GetPixelsPerUnit());

        // Back to edit selection
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { CancelCopy(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Exemple #2
0
    public static void Draw()
    {
        Game game = Game.Get();
        // Border around menu items
        UIElement ui = new UIElement();

        ui.SetLocation((UIScaler.GetWidthUnits() - 12) / 2, 6, 12, 13);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 7, 10, 2);
        ui.SetText(UNDO);
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetButton(delegate { Undo(); });
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 10, 10, 2);
        ui.SetText(SAVE);
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetButton(delegate { Save(); });
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 13, 10, 2);
        if (game.testMode)
        {
            ui.SetText(new StringKey("val", "EDITOR"));
            ui.SetButton(delegate { Editor(); });
        }
        else
        {
            ui.SetText(MAIN_MENU);
            ui.SetButton(delegate { Quit(); });
        }
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetFont(game.gameType.GetHeaderFont());
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 16, 10, 2);
        ui.SetText(CommonStringKeys.CANCEL);
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetButton(delegate { Destroyer.Dialog(); });
        new UIElementBorder(ui);
    }
Exemple #3
0
    public void CreateQuotaWindow()
    {
        // Draw text
        DialogBox db = new DialogBox(new Vector2(UIScaler.GetHCenter(-14f), 0.5f), new Vector2(28, 8),
                                     new StringKey(null, text, false));
        float offset = (db.textObj.GetComponent <UnityEngine.UI.Text>().preferredHeight / UIScaler.GetPixelsPerUnit()) + 1;

        db.Destroy();

        if (offset < 4)
        {
            offset = 4;
        }

        db = new DialogBox(new Vector2(UIScaler.GetHCenter(-14f), 0.5f), new Vector2(28, offset),
                           new StringKey(null, text, false));
        db.AddBorder();
        offset += 1;

        if (quota == 0)
        {
            new TextButton(new Vector2(11, offset), new Vector2(2f, 2f), CommonStringKeys.MINUS, delegate {; }, Color.grey);
        }
        else
        {
            new TextButton(new Vector2(11, offset), new Vector2(2f, 2f), CommonStringKeys.MINUS, delegate { quotaDec(); }, Color.white);
        }

        db = new DialogBox(new Vector2(14, offset), new Vector2(2f, 2f), quota);
        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();
        db.AddBorder();

        if (quota >= 10)
        {
            new TextButton(new Vector2(17, offset), new Vector2(2f, 2f), CommonStringKeys.PLUS, delegate {; }, Color.grey);
        }
        else
        {
            new TextButton(new Vector2(17, offset), new Vector2(2f, 2f), CommonStringKeys.PLUS, delegate { quotaInc(); }, Color.white);
        }

        // Only one button, action depends on quota
        new TextButton(
            new Vector2(UIScaler.GetWidthUnits() - 19, offset), new Vector2(8f, 2),
            eventData.GetButtons()[0].GetLabel(), delegate { onQuota(); }, Color.white);

        // Do we have a cancel button?
        if (eventData.qEvent.cancelable)
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-4f), offset + 2.5f), new Vector2(8f, 2), CommonStringKeys.CANCEL, delegate { onCancel(); });
        }
    }
Exemple #4
0
        /// <summary>
        /// Method to create language UI elements in the screen
        /// </summary>
        /// <param name="game">current game</param>
        private void CreateLanguageElements()
        {
            // Select langauge text
            UIElement ui = new UIElement();

            ui.SetLocation((0.25f * UIScaler.GetWidthUnits()) - 9, 4, 18, 2);
            ui.SetText(CHOOSE_LANG);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());

            // The list of languages is determined by FFG languages for MoM
            // In D2E there is an additional language
            // It can change in future

            string[] langs = DictionaryI18n.FFG_LANGS.Split(',');
            // For now, English and Spanish languages available.
            HashSet <string> enabled_langs = new HashSet <string> ("English,Spanish,French,Italian,German,Portuguese".Split(','));

            //The first button in the list of buttons should start in this vertical coordinate
            float verticalStart = UIScaler.GetVCenter(-1f) - ((langs.Length - 1) * 1f);

            for (int i = 1; i < langs.Length; i++)
            {
                int position = i;
                // Need current index in order to delegate not point to loop for variable
                string currentLanguage = langs[position];

                ui = new UIElement();
                ui.SetLocation((0.25f * UIScaler.GetWidthUnits()) - 4, verticalStart + (2f * position), 8, 1.8f);
                if (!enabled_langs.Contains(currentLanguage))
                {
                    ui.SetText(currentLanguage, Color.red);
                    new UIElementBorder(ui, Color.red);
                }
                else
                {
                    ui.SetButton(delegate { SelectLang(currentLanguage); });
                    if (currentLanguage == game.currentLang)
                    {
                        ui.SetText(currentLanguage);
                        new UIElementBorder(ui);
                    }
                    else
                    {
                        ui.SetText(currentLanguage, Color.grey);
                        new UIElementBorder(ui, Color.grey);
                    }
                }
                ui.SetFontSize(UIScaler.GetMediumFont());
            }
        }
Exemple #5
0
        /// <summary>
        /// Method to create language UI elements in the screen
        /// </summary>
        /// <param name="game">current game</param>
        private void CreateLanguageElements()
        {
            // Select langauge text
            UIElement ui = new UIElement();

            ui.SetLocation((0.25f * UIScaler.GetWidthUnits()) - 11, 2, 18, 2);
            ui.SetText(CHOOSE_LANG);
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());

            // The list of languages is determined by FFG languages for MoM
            // In D2E there is an additional language
            // It can change in future

            string[] langs = "English,Spanish,French,German,Italian,Portuguese,Polish,Russian,Chinese,Korean,Czech".Split(','); // Japanese removed to fit into screen
            // For now, the languages below are available.
            HashSet <string> enabled_langs = new HashSet <string>("English,Spanish,French,Italian,German,Portuguese,Polish,Russian,Chinese,Korean".Split(','));

            //The first button in the list of buttons should start in this vertical coordinate
            float verticalStart = UIScaler.GetVCenter(-2f) - langs.Length;

            for (int i = 0; i < langs.Length; i++)
            {
                int position = i + 1;
                // Need current index in order to delegate not point to loop for variable
                string currentLanguage = langs[i];

                ui = new UIElement();
                ui.SetLocation((0.25f * UIScaler.GetWidthUnits()) - 6, verticalStart + (2f * position), 8, 1.8f);
                if (!enabled_langs.Contains(currentLanguage))
                {
                    ui.SetText(currentLanguage, Color.red);
                    new UIElementBorder(ui, Color.red);
                }
                else
                {
                    ui.SetButton(delegate { SelectLang(currentLanguage); });
                    if (currentLanguage == game.currentLang)
                    {
                        ui.SetText(currentLanguage);
                        new UIElementBorder(ui);
                    }
                    else
                    {
                        ui.SetText(currentLanguage, Color.grey);
                        new UIElementBorder(ui, Color.grey);
                    }
                }
                ui.SetFontSize(UIScaler.GetMediumFont());
            }
        }
Exemple #6
0
    public static void Create()
    {
        Game game = Game.Get();

        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        // Menu border
        UIElement ui = new UIElement();

        ui.SetLocation((UIScaler.GetWidthUnits() - 20) / 2, 9, 20, 13);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 18) / 2, 10, 18, 2);
        ui.SetText(VALIDATE_SCENARIO, Color.grey);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(Validate_Scenario);
        new UIElementBorder(ui, Color.grey);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 18) / 2, 13, 18, 2);
        ui.SetText(OPTIMIZE_LOCALIZATION, Color.grey);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(Optimize_Localization);
        new UIElementBorder(ui, Color.grey);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 18) / 2, 16, 18, 2);
        ui.SetText(REORDER_COMPONENTS);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(delegate { new ReorderComponents(); });
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 19, 10, 2);
        ui.SetText(CommonStringKeys.CANCEL);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(Destroyer.Dialog);
        new UIElementBorder(ui);
    }
Exemple #7
0
    public static void Create()
    {
        Game game = Game.Get();

        if (GameObject.FindGameObjectWithTag(Game.DIALOG) != null)
        {
            return;
        }

        // Menu border
        UIElement ui = new UIElement();

        ui.SetLocation((UIScaler.GetWidthUnits() - 12) / 2, 9, 12, 13);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 10, 10, 2);
        ui.SetText(SAVE);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(QuestEditor.Save);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 13, 10, 2);
        ui.SetText(RELOAD);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(delegate { QuestEditor.Reload(game.quest.originalPath); });
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 16, 10, 2);
        ui.SetText(MAIN_MENU);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(GameStateManager.MainMenu);
        new UIElementBorder(ui);

        ui = new UIElement();
        ui.SetLocation((UIScaler.GetWidthUnits() - 10) / 2, 19, 10, 2);
        ui.SetText(CommonStringKeys.CANCEL);
        ui.SetFont(game.gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetBGColor(new Color(0.03f, 0.0f, 0f));
        ui.SetButton(Destroyer.Dialog);
        new UIElementBorder(ui);
    }
Exemple #8
0
        /// <summary>
        /// Method to create language UI elements in the screen
        /// </summary>
        /// <param name="game">current game</param>
        private void CreateLanguageElements()
        {
            // Select langauge text
            DialogBox dbLanguage = new DialogBox(
                new Vector2(((0.25f * UIScaler.GetWidthUnits()) - 9), 4),
                new Vector2(18, 2),
                CHOOSE_LANG
                );

            dbLanguage.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();
            dbLanguage.SetFont(game.gameType.GetHeaderFont());

            // The list of languages is determined by FFG languages for MoM
            // In D2E there is an additional language
            // It can change in future

            string[] langs = DictionaryI18n.FFG_LANGS.Split(',');
            // For now, English and Spanish languages available.
            HashSet <string> enabled_langs = new HashSet <string> ("English,Spanish".Split(','));

            //The first button in the list of buttons should start in this vertical coordinate
            float verticalStart = UIScaler.GetVCenter(-1f) - ((langs.Length - 1) * 1f);

            languageTextButtons = new TextButton[langs.Length];
            for (int i = 1; i < langs.Length; i++)
            {
                int position = i;
                // Need current index in order to delegate not point to loop for variable
                string currentLanguage = langs[position];
                Color  currentColor    = Color.gray;

                if (currentLanguage == game.currentLang)
                {
                    selectedIndex = position;
                    currentColor  = Color.white;
                }
                languageTextButtons[position] = new TextButton(
                    new Vector2((0.25f * UIScaler.GetWidthUnits()) - 4, verticalStart + (2f * position)),
                    new Vector2(8, 1.8f),
                    new StringKey(currentLanguage, false),
                    delegate { SelectLang(position); },
                    currentColor
                    );

                if (!enabled_langs.Contains(currentLanguage))
                {
                    languageTextButtons[position].setColor(Color.red);
                    languageTextButtons[position].setActive(false);
                }
            }
        }
Exemple #9
0
        // Create the about dialog
        public void About()
        {
            // This will destroy all, because we shouldn't have anything left at the main menu
            Destroyer.Destroy();

            Sprite    bannerSprite;
            Texture2D newTex = Resources.Load("sprites/banner") as Texture2D;

            GameObject banner = new GameObject("banner");

            banner.tag = Game.DIALOG;

            banner.transform.SetParent(Game.Get().uICanvas.transform);

            RectTransform trans = banner.AddComponent <RectTransform>();

            trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit());
            trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit());
            banner.AddComponent <CanvasRenderer>();


            UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>();
            bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1);
            image.sprite = bannerSprite;
            image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit());

            UIElement ui = new UIElement();

            ui.SetLocation((UIScaler.GetWidthUnits() - 30f) / 2, 10, 30, 6);
            ui.SetText(ABOUT_FFG);
            ui.SetFontSize(UIScaler.GetMediumFont());

            ui = new UIElement();
            ui.SetLocation((UIScaler.GetWidthUnits() - 30f) / 2, 18, 30, 5);
            ui.SetText(ABOUT_LIBS);
            ui.SetFontSize(UIScaler.GetMediumFont());

            ui = new UIElement();
            ui.SetLocation(UIScaler.GetWidthUnits() - 5, UIScaler.GetBottom(-3), 5, 2);
            ui.SetText(Game.Get().version);
            ui.SetFontSize(UIScaler.GetMediumFont());

            ui = new UIElement();
            ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
            ui.SetText(CommonStringKeys.BACK);
            ui.SetFont(Game.Get().gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(Destroyer.MainMenu);
            ui.SetBGColor(new Color(0, 0.03f, 0f));
            new UIElementBorder(ui);
        }
Exemple #10
0
    // List of quests to copy
    public void Copy()
    {
        // Can copy all quests, not just user
        questList = QuestLoader.GetQuests(true);
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
        {
            Object.Destroy(go);
        }

        // Header
        UIElement ui = new UIElement();

        ui.SetLocation(2, 1, UIScaler.GetWidthUnits() - 4, 3);
        ui.SetText(new StringKey("val", "SELECT_TO_COPY", game.gameType.QuestName()));
        ui.SetFont(Game.Get().gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetLargeFont());

        UIElementScrollVertical scrollArea = new UIElementScrollVertical();

        scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21);
        new UIElementBorder(scrollArea);

        // List of quests
        int offset = 0;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            LocalizationRead.AddDictionary("qst", q.Value.localizationDict);

            ui = new UIElement(scrollArea.GetScrollTransform());
            ui.SetLocation(1, offset, UIScaler.GetWidthUnits() - 5, 1.2f);
            ui.SetText(new StringKey("val", "INDENT", q.Value.name), Color.black);
            ui.SetTextAlignment(TextAnchor.MiddleLeft);
            ui.SetButton(delegate { Copy(key); });
            ui.SetBGColor(Color.white);
            offset += 2;
        }
        scrollArea.SetScrollSize(offset);

        // Back to edit selection
        ui = new UIElement();
        ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
        ui.SetText(CommonStringKeys.BACK, Color.red);
        ui.SetFont(Game.Get().gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(CancelCopy);
        new UIElementBorder(ui, Color.red);
    }
Exemple #11
0
        /// <summary>
        /// Method to create UI elements in the screen
        /// </summary>
        /// <param name="game">current game</param>
        private void CreateElements()
        {
            // Options screen text
            DialogBox dbTittle = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Options");

            dbTittle.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
            dbTittle.SetFont(game.gameType.GetHeaderFont());

            // Select langauge text
            DialogBox dbLanguage = new DialogBox(new Vector2(2, 4), new Vector2(UIScaler.GetWidthUnits() - 4, 2), "Choose Language");

            dbLanguage.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();
            dbLanguage.SetFont(game.gameType.GetHeaderFont());

            // The list of languages is determined by FFG languages for MoM
            // In D2E there is an additional language
            // It can change in future

            string[] langs = DictionaryI18n.FFG_LANGS.Split(',');

            //The first button in the list of buttons should start in this vertical coordinate
            float verticalStart = UIScaler.GetVCenter(-1f) - ((langs.Length - 1) * 1f);

            languageTextButtons = new TextButton[langs.Length];
            for (int i = 1; i < langs.Length; i++)
            {
                int position = i;
                // Need current index in order to delegate not point to loop for variable
                string currentLanguage = langs[position];
                Color  currentColor    = Color.gray;

                if (currentLanguage == game.currentLang)
                {
                    selectedIndex = position;
                    currentColor  = Color.white;
                }
                languageTextButtons[position] = new TextButton(
                    new Vector2(UIScaler.GetHCenter() - 4, verticalStart + (2f * position)),
                    new Vector2(8, 1.8f),
                    currentLanguage,
                    delegate { SelectLang(position); },
                    currentColor
                    );
            }

            // Button for back to main menu
            TextButton tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Destroyer.MainMenu(); }, Color.red);

            tb.SetFont(game.gameType.GetHeaderFont());
        }
Exemple #12
0
    override public void CreateWindow(bool singleStep = false)
    {
        // If a dialog window is open we force it closed (this shouldn't happen)
        foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
        {
            Object.Destroy(go);
        }

        // ability box - name header
        UIElement ui = new UIElement();

        ui.SetLocation(UIScaler.GetHCenter(-9f), 0.5f, 18, 2);
        ui.SetText(monster.monsterData.name);
        ui.SetFontSize(UIScaler.GetMediumFont());
        new UIElementBorder(ui);

        float offset = 2.5f;

        if (monster.currentActivation.effect.Length > 0)
        {
            // ability text
            string textKey = monster.currentActivation.effect.Replace("\\n", "\n");
            // Add this to the log
            Game.Get().quest.log.Add(new Quest.LogEntry(textKey.Replace("\n", "\\n")));
            ui = new UIElement();
            ui.SetLocation(10, offset, UIScaler.GetWidthUnits() - 20, 4);
            ui.SetText(textKey);
            new UIElementBorder(ui);
            offset += 4.5f;
        }

        ui = new UIElement();
        ui.SetLocation(UIScaler.GetHCenter(-9f), offset, 18, 2);
        ui.SetText(MONSTER_ATTACKS);
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(CreateAttackWindow);
        new UIElementBorder(ui);

        offset += 2.5f;

        ui = new UIElement();
        ui.SetLocation(UIScaler.GetHCenter(-9f), offset, 18, 2);
        ui.SetText(monster.currentActivation.ad.moveButton);
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(CreateMoveWindow);
        new UIElementBorder(ui);

        MonsterDialogMoM.DrawMonster(monster);
    }
Exemple #13
0
    public void CreateWindow()
    {
        // Draw text
        text = eventData.GetText();
        DialogBox db     = new DialogBox(new Vector2(UIScaler.GetHCenter(-14f), 0.5f), new Vector2(28, 8), new StringKey(text, false));
        float     offset = (db.textObj.GetComponent <UnityEngine.UI.Text>().preferredHeight / UIScaler.GetPixelsPerUnit()) + 1;

        db.Destroy();

        if (offset < 4)
        {
            offset = 4;
        }

        db = new DialogBox(new Vector2(UIScaler.GetHCenter(-14f), 0.5f), new Vector2(28, offset),
                           new StringKey(text, false));
        db.AddBorder();

        offset += 1f;
        int   num     = 1;
        float length  = 8f;
        float hOffset = UIScaler.GetWidthUnits() - 19f;

        if (eventData.GetButtons().Count > 2)
        {
            length  = 16f;
            hOffset = UIScaler.GetHCenter(-8f);
        }
        else
        {
            if (eventData.qEvent.cancelable)
            {
                new TextButton(new Vector2(11, offset), new Vector2(8f, 2), CommonStringKeys.CANCEL, delegate { onCancel(); });
            }
        }
        foreach (EventButton eb in eventData.GetButtons())
        {
            int numTmp = num++;
            new TextButton(new Vector2(hOffset, offset), new Vector2(length, 2),
                           new StringKey(eb.label, false), delegate { onButton(numTmp); }, eb.colour);
            offset += 2.5f;
        }

        // Do we have a cancel button?
        if (eventData.qEvent.cancelable && (eventData.GetButtons().Count > 2))
        {
            new TextButton(new Vector2(hOffset, offset), new Vector2(8f, 2), CommonStringKeys.CANCEL, delegate { onCancel(); });
        }
    }
Exemple #14
0
        // Create the about dialog
        public void About()
        {
            // This will destroy all, because we shouldn't have anything left at the main menu
            Destroyer.Destroy();

            Sprite    bannerSprite;
            Texture2D newTex = Resources.Load("sprites/banner") as Texture2D;

            GameObject banner = new GameObject("banner");

            banner.tag = "dialog";

            banner.transform.parent = Game.Get().uICanvas.transform;

            RectTransform trans = banner.AddComponent <RectTransform>();

            trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit());
            trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit());
            banner.AddComponent <CanvasRenderer>();


            UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>();
            bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1);
            image.sprite = bannerSprite;
            image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit());

            DialogBox db = new DialogBox(
                new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 10f),
                new Vector2(30, 6),
                ABOUT_FFG);

            db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();

            db = new DialogBox(
                new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 18f),
                new Vector2(30, 5),
                ABOUT_LIBS);
            db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();

            TextButton tb = new TextButton(
                new Vector2(1, UIScaler.GetBottom(-3)),
                new Vector2(8, 2),
                CommonStringKeys.BACK,
                delegate { Destroyer.MainMenu(); });

            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f);
            tb.SetFont(Game.Get().gameType.GetHeaderFont());
        }
    // Create a pack with list of quests to edit
    public QuestEditSelection()
    {
        Game game = Game.Get();

        // Get list of unpacked quest in user location (editable)
        // TODO: open/save in packages
        questList = QuestLoader.GetUserUnpackedQuests();

        // If a dialog window is open we force it closed (this shouldn't happen)
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        // Heading
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName());

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        // List of quests
        // FIXME: requires paging
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
        {
            string key = q.Key;
            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Selection(key); }, Color.white, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
            offset += 2;
        }

        // Main menu
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Cancel(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Delete a user quest
        tb = new TextButton(new Vector2((UIScaler.GetRight() * 3 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Delete", delegate { Delete(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Copy a quest
        tb = new TextButton(new Vector2((UIScaler.GetRight() * 5 / 8) - 4, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Copy", delegate { Copy(); });
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
        // Create a new quest
        tb = new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "New", delegate { NewQuest(); });
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Exemple #16
0
    public InfoDialog(Quest.Monster m)
    {
        if (m == null)
        {
            ValkyrieDebug.Log("Warning: Invalid monster type requested.");
            return;
        }

        // box with monster info
        UIElement ui = new UIElement();

        ui.SetLocation(10, 0.5f, UIScaler.GetWidthUnits() - 20, 12);
        ui.SetText(m.monsterData.info);
        new UIElementBorder(ui);

        // Unique monsters have additional info
        if (m.unique && m.uniqueText.KeyExists())
        {
            ui = new UIElement();
            ui.SetLocation(12, 13, UIScaler.GetWidthUnits() - 24, 2);
            ui.SetText(m.uniqueTitle, Color.red);
            ui.SetFontSize(UIScaler.GetMediumFont());
            new UIElementBorder(ui, Color.red);

            string uniqueText = EventManager.OutputSymbolReplace(m.uniqueText.Translate().Replace("\\n", "\n"));
            ui = new UIElement();
            ui.SetLocation(10, 15, UIScaler.GetWidthUnits() - 20, 8);
            ui.SetText(uniqueText);
            new UIElementBorder(ui, Color.red);

            ui = new UIElement();
            ui.SetLocation(UIScaler.GetWidthUnits() - 21, 23.5f, 10, 2);
            ui.SetText(CommonStringKeys.CLOSE);
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(onClose);
            new UIElementBorder(ui);
        }
        else
        {
            ui = new UIElement();
            ui.SetLocation(UIScaler.GetWidthUnits() - 21, 13, 10, 2);
            ui.SetText(CommonStringKeys.CLOSE);
            ui.SetFontSize(UIScaler.GetMediumFont());
            ui.SetButton(onClose);
            new UIElementBorder(ui);
        }
    }
    // Change the dialog to a delete dialog
    public void Delete()
    {
        questList = QuestLoader.GetUserUnpackedQuests();
        Game game = Game.Get();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag(Game.DIALOG))
        {
            Object.Destroy(go);
        }

        // Header
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3),
                                     new StringKey("val", "SELECT_TO_DELETE", game.gameType.QuestName()));

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(Game.Get().gameType.GetHeaderFont());

        UIElementScrollVertical scrollArea = new UIElementScrollVertical();

        scrollArea.SetLocation(1, 5, UIScaler.GetWidthUnits() - 2f, 21);
        new UIElementBorder(scrollArea);

        // List of quests
        int        offset = 5;
        TextButton tb;

        foreach (KeyValuePair <string, QuestData.Quest> q in questList)
        {
            string key = q.Key;
            LocalizationRead.scenarioDict = q.Value.localizationDict;
            string translation = q.Value.name.Translate();

            tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 5, 1.2f),
                                new StringKey("val", "INDENT", translation), delegate { Delete(key); }, Color.black, offset);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
            tb.button.GetComponent <UnityEngine.UI.Text>().material   = (Material)Resources.Load("Fonts/FontMaterial");
            tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
            tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(1f, 0f, 0f);
            tb.background.transform.SetParent(scrollArea.GetScrollTransform());
            offset += 2;
        }
        scrollArea.SetScrollSize(offset - 5);

        // Back to edit list
        tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), CommonStringKeys.BACK, delegate { CancelDelete(); }, Color.red);
        tb.SetFont(Game.Get().gameType.GetHeaderFont());
    }
Exemple #18
0
        public QuestSelectionScreen(Dictionary <string, QuestLoader.Quest> ql)
        {
            questList = ql;
            Game game = Game.Get();

            // If a dialog window is open we force it closed (this shouldn't happen)
            foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
            {
                Object.Destroy(go);
            }

            // Clean up downloader if present
            foreach (GameObject go in GameObject.FindGameObjectsWithTag("questui"))
            {
                Object.Destroy(go);
            }

            // Heading
            DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Select " + game.gameType.QuestName());

            db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
            db.SetFont(game.gameType.GetHeaderFont());

            TextButton tb;
            // Start here
            int offset = 5;

            // Loop through all available quests
            // FIXME: this isn't paged
            foreach (KeyValuePair <string, QuestLoader.Quest> q in questList)
            {
                string key = q.Key;
                // Size is 1.2 to be clear of characters with tails
                tb = new TextButton(new Vector2(2, offset), new Vector2(UIScaler.GetWidthUnits() - 4, 1.2f), "  " + q.Value.name, delegate { Selection(key); }, Color.white, offset);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize   = UIScaler.GetSmallFont();
                tb.button.GetComponent <UnityEngine.UI.Text>().alignment  = TextAnchor.MiddleLeft;
                tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 0.1f);
                offset += 2;
            }

            tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Cancel(); }, Color.red);
            tb.SetFont(game.gameType.GetHeaderFont());

            tb = new TextButton(new Vector2(UIScaler.GetRight(-9), UIScaler.GetBottom(-3)), new Vector2(8, 2), "Download", delegate { Download(); }, Color.green);
            tb.SetFont(game.gameType.GetHeaderFont());
        }
Exemple #19
0
    public static void Create()
    {
        if (GameObject.FindGameObjectWithTag("dialog") != null)
        {
            return;
        }

        DialogBox db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 12) / 2, 9), new Vector2(12, 7), "");

        db.AddBorder();

        TextButton tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 10), new Vector2(10, 2f), "Main Menu", delegate { Destroyer.MainMenu(); }, Color.white);

        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);

        tb = new TextButton(new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 13), new Vector2(10, 2f), "Cancel", delegate { Cancel(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
    }
Exemple #20
0
    public HorrorCheck(Quest.Monster m)
    {
        Game game = Game.Get();
        List <HorrorData> horrors = new List <HorrorData>();

        foreach (KeyValuePair <string, HorrorData> kv in game.cd.horrorChecks)
        {
            if (m.monsterData.sectionName.Equals("Monster" + kv.Value.monster))
            {
                horrors.Add(kv.Value);
            }
        }

        QuestMonster qm = m.monsterData as QuestMonster;

        if (horrors.Count == 0 && qm != null && qm.derivedType.Length > 0)
        {
            foreach (KeyValuePair <string, HorrorData> kv in game.cd.horrorChecks)
            {
                if (qm.derivedType.Equals("Monster" + kv.Value.monster))
                {
                    horrors.Add(kv.Value);
                }
            }
        }

        // If a dialog window is open we force it closed (this shouldn't happen)
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog"))
        {
            Object.Destroy(go);
        }

        string    text = horrors[Random.Range(0, horrors.Count)].text.Translate().Replace("{0}", m.monsterData.name.Translate());
        DialogBox db   = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8),
                                       new StringKey(null, text, false));

        db.AddBorder();

        new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); });

        MonsterDialogMoM.DrawMonster(m);
    }
Exemple #21
0
    public void About()
    {
        // This will destroy all, because we shouldn't have anything left at the main menu
        Destroyer.Destroy();

        // Name.  We should replace this with a banner
        DialogBox db = new DialogBox(new Vector2(2, 1), new Vector2(UIScaler.GetWidthUnits() - 4, 3), "Valkyrie");

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();

        db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 8f), new Vector2(30, 6), "Valkyrie is a game master helper tool inspired by Fantasy Flight Games' Descent: Road to Legend.  Most images used are imported from FFG applications are are copyright FFG and other rights holders.");
        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();

        db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 16f), new Vector2(30, 5), "Valkyrie uses DotNetZip-For-Unity and has code derived from Unity Studio.");
        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();

        TextButton tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Destroyer.MainMenu(); });

        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f);
    }
    public void Attack()
    {
        Destroyer.Dialog();
        DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8),
                                     new StringKey(null, attackText, false));

        db.AddBorder();

        if (monster.damage == monster.GetHealth())
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.grey);
        }
        else
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); });
        }

        MonsterDialogMoM.DrawMonster(monster);
        MonsterDialogMoM.DrawMonsterHealth(monster, delegate { Attack(); });
    }
        // Import content
        public void Import(string type)
        {
            Destroyer.Destroy();

            // Create an object
            GameObject logo = new GameObject("logo");

            // Mark it as dialog
            logo.tag = Game.DIALOG;
            logo.transform.SetParent(Game.Get().uICanvas.transform);

            RectTransform transBg = logo.AddComponent <RectTransform>();

            transBg.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, UIScaler.GetHCenter(-3) * UIScaler.GetPixelsPerUnit(), 6 * UIScaler.GetPixelsPerUnit());
            transBg.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 8 * UIScaler.GetPixelsPerUnit(), 6 * UIScaler.GetPixelsPerUnit());

            // Create the image
            Texture2D tex    = Resources.Load("sprites/logo") as Texture2D;
            Sprite    sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero, 1);

            UnityEngine.UI.Image uiImage = logo.AddComponent <UnityEngine.UI.Image>();
            uiImage.sprite = sprite;
            logo.AddComponent <SpritePulser>();

            // Display message
            UIElement ui = new UIElement();

            ui.SetLocation(2, 20, UIScaler.GetWidthUnits() - 4, 2);
            ui.SetText(CONTENT_IMPORTING);
            ui.SetFontSize(UIScaler.GetMediumFont());
            if (type.Equals("D2E"))
            {
                importThread = new Thread(new ThreadStart(delegate { fcD2E.Import(); }));
            }
            if (type.Equals("MoM"))
            {
                importThread = new Thread(new ThreadStart(delegate { fcMoM.Import(); }));
            }
            importThread.Start();
            //while (!importThread.IsAlive) ;
        }
Exemple #24
0
    public void CreateQuotaWindow()
    {
        // Draw text
        DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8),
                                     new StringKey(null, eventData.GetText(), false));

        db.AddBorder();

        if (quota == 0)
        {
            new TextButton(new Vector2(11, 9f), new Vector2(2f, 2f), CommonStringKeys.MINUS, delegate {; }, Color.grey);
        }
        else
        {
            new TextButton(new Vector2(11, 9f), new Vector2(2f, 2f), CommonStringKeys.MINUS, delegate { quotaDec(); }, Color.white);
        }

        db = new DialogBox(new Vector2(14, 9f), new Vector2(2f, 2f), quota);
        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();
        db.AddBorder();

        if (quota >= 10)
        {
            new TextButton(new Vector2(17, 9f), new Vector2(2f, 2f), CommonStringKeys.PLUS, delegate {; }, Color.grey);
        }
        else
        {
            new TextButton(new Vector2(17, 9f), new Vector2(2f, 2f), CommonStringKeys.PLUS, delegate { quotaInc(); }, Color.white);
        }

        // Only one button, action depends on quota
        new TextButton(
            new Vector2(UIScaler.GetWidthUnits() - 19, 9f), new Vector2(8f, 2),
            eventData.GetButtons()[0].GetLabel(), delegate { onQuota(); }, Color.white);

        // Do we have a cancel button?
        if (eventData.qEvent.cancelable)
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-4f), 11.5f), new Vector2(8f, 2), CommonStringKeys.CANCEL, delegate { onCancel(); });
        }
    }
Exemple #25
0
    // This is called when a quest is selected
    public void StartQuest(QuestData.Quest q)
    {
        if (Path.GetExtension(Path.GetFileName(q.path)) == ".valkyrie")
        {
            // extract the full package
            QuestLoader.ExtractSinglePackageFull(ContentData.DownloadPath() + Path.DirectorySeparatorChar + Path.GetFileName(q.path));
        }

        // Fetch all of the quest data and initialise the quest
        quest = new Quest(q);

        // Draw the hero icons, which are buttons for selection
        heroCanvas.SetupUI();

        // Add a finished button to start the quest
        UIElement ui = new UIElement(Game.HEROSELECT);

        ui.SetLocation(UIScaler.GetRight(-8.5f), UIScaler.GetBottom(-2.5f), 8, 2);
        ui.SetText(CommonStringKeys.FINISHED, Color.green);
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(EndSelection);
        new UIElementBorder(ui, Color.green);

        // Add a title to the page
        ui = new UIElement(Game.HEROSELECT);
        ui.SetLocation(8, 1, UIScaler.GetWidthUnits() - 16, 3);
        ui.SetText(new StringKey("val", "SELECT", gameType.HeroesName()));
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetLargeFont());

        heroCanvas.heroSelection = new HeroSelection();

        ui = new UIElement(Game.HEROSELECT);
        ui.SetLocation(0.5f, UIScaler.GetBottom(-2.5f), 8, 2);
        ui.SetText(CommonStringKeys.BACK, Color.red);
        ui.SetFont(gameType.GetHeaderFont());
        ui.SetFontSize(UIScaler.GetMediumFont());
        ui.SetButton(Destroyer.QuestSelect);
        new UIElementBorder(ui, Color.red);
    }
    public void CreateAttackWindow()
    {
        Destroyer.Dialog();

        // ability box - name header
        DialogBox db = new DialogBox(new Vector2(15, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 30, 2), monster.monsterData.name);

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont();
        db.AddBorder();

        float offset = 2.5f;

        db = new DialogBox(new Vector2(10, offset), new Vector2(UIScaler.GetWidthUnits() - 20, 4), monster.currentActivation.ad.masterActions.Replace("\\n", "\n"));
        db.AddBorder();

        offset += 4.5f;

        new TextButton(new Vector2(UIScaler.GetHCenter(-6f), offset), new Vector2(12, 2), "Finished", delegate { activated(); });

        DrawMonsterIcon();
    }
Exemple #27
0
    public void Draw()
    {
        Destroyer.Dialog();
        UIElement ui = new UIElement();

        ui.SetLocation(10, 0.5f, UIScaler.GetWidthUnits() - 20, 8);
        ui.SetText(text);
        new UIElementBorder(ui);

        if (m.damage == m.GetHealth())
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.gray);
        }
        else
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); });
        }

        MonsterDialogMoM.DrawMonster(m);
        MonsterDialogMoM.DrawMonsterHealth(m, delegate { Draw(); });
    }
Exemple #28
0
    public void Draw()
    {
        Destroyer.Dialog();
        DialogBox db = new DialogBox(new Vector2(10, 0.5f), new Vector2(UIScaler.GetWidthUnits() - 20, 8), new StringKey(text, false));

        db.AddBorder();

        int health = Mathf.RoundToInt(m.monsterData.health) + Game.Get().quest.GetHeroCount();

        if (m.damage == health)
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate {; }, Color.gray);
        }
        else
        {
            new TextButton(new Vector2(UIScaler.GetHCenter(-6f), 9f), new Vector2(12, 2), CommonStringKeys.FINISHED, delegate { Destroyer.Dialog(); });
        }

        MonsterDialogMoM.DrawMonster(m);
        MonsterDialogMoM.DrawMonsterHealth(m, delegate { Draw(); });
    }
Exemple #29
0
    public static void Create()
    {
        Game game = Game.Get();

        if (GameObject.FindGameObjectWithTag("dialog") != null)
        {
            return;
        }

        // Menu border
        DialogBox db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 12) / 2, 9), new Vector2(12, 13), StringKey.NULL);

        db.AddBorder();
        db.SetFont(game.gameType.GetHeaderFont());

        TextButton tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 10), new Vector2(10, 2f),
            SAVE, delegate { QuestEditor.Save(); }, Color.white);

        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 13), new Vector2(10, 2f),
            RELOAD, delegate { QuestEditor.Reload(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 16), new Vector2(10, 2f),
            MAIN_MENU, delegate { Destroyer.MainMenu(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());

        tb = new TextButton(
            new Vector2((UIScaler.GetWidthUnits() - 10) / 2, 19), new Vector2(10, 2f),
            CommonStringKeys.CANCEL, delegate { Destroyer.Dialog(); }, Color.white);
        tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0.03f, 0.0f, 0f);
        tb.SetFont(game.gameType.GetHeaderFont());
    }
Exemple #30
0
    // This is called when a quest is selected
    public void StartQuest(QuestData.Quest q)
    {
        // Fetch all of the quest data and initialise the quest
        quest = new Quest(q);

        // Draw the hero icons, which are buttons for selection
        heroCanvas.SetupUI();

        // Add a finished button to start the quest
        TextButton endSelection = new TextButton(
            new Vector2(UIScaler.GetRight(-9),
                        UIScaler.GetBottom(-3)),
            new Vector2(8, 2),
            CommonStringKeys.FINISHED,
            delegate { EndSelection(); },
            Color.green);

        endSelection.SetFont(gameType.GetHeaderFont());
        // Untag as dialog so this isn't cleared away during hero selection
        endSelection.ApplyTag("heroselect");

        // Add a title to the page
        DialogBox db = new DialogBox(
            new Vector2(8, 1),
            new Vector2(UIScaler.GetWidthUnits() - 16, 3),
            new StringKey("val", "SELECT", gameType.HeroesName())
            );

        db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
        db.SetFont(gameType.GetHeaderFont());
        db.ApplyTag("heroselect");

        heroCanvas.heroSelection = new HeroSelection();

        TextButton cancelSelection = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), CommonStringKeys.BACK, delegate { Destroyer.QuestSelect(); }, Color.red);

        cancelSelection.SetFont(gameType.GetHeaderFont());
        // Untag as dialog so this isn't cleared away during hero selection
        cancelSelection.ApplyTag("heroselect");
    }