예제 #1
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);
                }
            }
        }
예제 #2
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());
            }
        }
예제 #3
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());
            }
        }
예제 #4
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());
        }
예제 #5
0
    /// <summary>
    /// Parse the downloaded remote manifest and start download of individual quest files
    /// </summary>
    public void DownloadManifest_callback(string data, bool error)
    {
        if (error)
        {
            // Hide loading screen
            Destroyer.Dialog();

            // draw error message
            float     error_string_width = 0;
            UIElement ui = new UIElement();
            if (data == "ERROR NETWORK")
            {
                StringKey ERROR_NETWORK = new StringKey("val", "ERROR_NETWORK");
                ui.SetText(ERROR_NETWORK, Color.red);
                error_string_width = ui.GetStringWidth(ERROR_NETWORK, UIScaler.GetMediumFont());
            }
            else
            {
                StringKey ERROR_HTTP = new StringKey("val", "ERROR_HTTP", game.stats.error_download_description);
                ui.SetText(ERROR_HTTP, Color.red);
                error_string_width = ui.GetStringWidth(ERROR_HTTP, UIScaler.GetMediumFont());
            }
            ui.SetLocation(UIScaler.GetHCenter() - (error_string_width / 2f), UIScaler.GetVCenter(), error_string_width, 2.4f);
            ui.SetTextAlignment(TextAnchor.MiddleCenter);
            ui.SetFontSize(UIScaler.GetLargeFont());
            ui.SetBGColor(Color.clear);

            // draw return button
            ui = new UIElement();
            ui.SetLocation(1, UIScaler.GetBottom(-3), 8, 2);
            ui.SetText(CommonStringKeys.BACK, Color.red);
            ui.SetButton(delegate { Cancel(); });
            ui.SetFont(game.gameType.GetHeaderFont());
            ui.SetFontSize(UIScaler.GetMediumFont());
            new UIElementBorder(ui, Color.red);

            return;
        }

        IniData remoteManifest = IniRead.ReadFromString(data);

        foreach (KeyValuePair <string, Dictionary <string, string> > kv in remoteManifest.data)
        {
            remoteQuests.Add(new RemoteQuest(kv));
        }
        DownloadQuestFiles();
    }
예제 #6
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);
    }