Exemple #1
0
        //--------------------//

        #region Generate
        /// <summary>
        /// Generates a real dialog model from this XML-representation
        /// </summary>
        /// <param name="manager">The <see cref="DialogManager"/> instance that provides the resources for rendering of this dialog</param>
        /// <returns>The generated dialog model</returns>
        internal Render.Dialog GenerateRender(DialogManager manager)
        {
            // Load language XML
            string langName = (Resources.Culture == null) ? "English" : Resources.Culture.EnglishName.GetLeftPartAtFirstOccurrence(' ');

            _locale = LocaleFile.LoadLang(langName).ToDictionary();

            // Generate dialog model object
            DialogRender = TextureFileValid
                ? new Render.Dialog(manager, ColorText.ToColorValue(), _textureFile, _fontName, (uint)(_fontSize * EffectiveScale))
                : new Render.Dialog(manager, ColorText.ToColorValue());

            // Set dialog properites
            DialogRender.SetCaptionText(GetLocalized(_captionText));
            DialogRender.CaptionHeight = _captionHeight;
            UpdateColors();

            // Load custom button styles
            foreach (ButtonStyle style in ButtonStyles)
            {
                style.Parent = this;
                style.Generate();
            }

            // Generate control models from their view counterparts
            foreach (Control control in Controls)
            {
                control.Parent = this;
                control.Generate();
            }

            // Update control positions
            DialogRender.Resize += delegate
            {
                foreach (Control control in Controls)
                {
                    control.UpdateLayout();
                }
            };

            NeedsUpdate = false;
            return(DialogRender);
        }