Пример #1
0
        private void OnClickSave(object sender, EventArgs e)
        {
            string path = Options.OutputPath;

            if ((int)treeView.SelectedNode.Parent.Tag == 1)
            {
                string fileName = UnicodeFonts.Save(path, (int)treeView.SelectedNode.Tag);
                MessageBox.Show(
                    $"Unicode saved to {fileName}",
                    "Save",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);
                Options.ChangedUltimaClass["UnicodeFont"] = false;
            }
            else
            {
                string fileName = Path.Combine(path, "fonts.mul");
                ASCIIText.Save(fileName);
                MessageBox.Show(
                    $"Fonts saved to {fileName}",
                    "Save",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);
                Options.ChangedUltimaClass["ASCIIFont"] = false;
            }
        }
Пример #2
0
        private void OnClickSave(object sender, EventArgs e)
        {
            string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            if ((int)treeView.SelectedNode.Parent.Tag == 1)
            {
                string FileName = UnicodeFonts.Save(path, (int)treeView.SelectedNode.Tag);
                MessageBox.Show(
                    String.Format("Unicode saved to {0}", FileName),
                    "Save",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);
                Options.ChangedUltimaClass["UnicodeFont"] = false;
            }
            else
            {
                string FileName = Path.Combine(path, "fonts.mul");
                ASCIIText.Save(FileName);
                MessageBox.Show(
                    String.Format("Fonts saved to {0}", FileName),
                    "Save",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);
                Options.ChangedUltimaClass["ASCIIFont"] = false;
            }
        }
Пример #3
0
 public override void Draw(SpriteBatchUI spriteBatch)
 {
     if (m_texture == null)
     {
         m_texture = ASCIIText.GetTextTexture(Text, FontID, Area.Width);
     }
     spriteBatch.Draw2D(m_texture, Position, Hue, true, false);
     base.Draw(spriteBatch);
 }
Пример #4
0
 private void OnTextChange(object sender, EventArgs e)
 {
     if (type == 1) //Unicode
     {
         pictureBox1.Image = UnicodeFonts.WriteText(font, textBox1.Text);
     }
     else
     {
         pictureBox1.Image = ASCIIText.DrawText(font, textBox1.Text);
     }
 }
Пример #5
0
        private Bitmap RenderName(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(ASCIIText.DrawText(10, string.Empty));
            }

            name = name.Length <= 12 ? name : name.Substring(0, 12) + "...";
            name = (StatusBar.NamePrefix ?? string.Empty) + name;

            return(ASCIIText.DrawText(10, name));
        }
Пример #6
0
        protected override void Initialize()
        {
            Content.RootDirectory = "Content";

            // Create all the services we need.
            UltimaServices.Register <SpriteBatch3D>(new SpriteBatch3D(this));
            UltimaServices.Register <SpriteBatchUI>(new SpriteBatchUI(this));
            Network       = UltimaServices.Register <INetworkClient>(new NetworkClient());
            Input         = UltimaServices.Register <InputManager>(new InputManager(Window.Handle));
            UserInterface = UltimaServices.Register <UserInterfaceService>(new UserInterfaceService());

            // Make sure we have a UO installation before loading IO.
            if (!FileManager.IsUODataPresent)
            {
                return;
            }
            // Initialize and load data
            AnimData.Initialize();
            Animations.Initialize(GraphicsDevice);
            ArtData.Initialize(GraphicsDevice);

            ASCIIText.Initialize(GraphicsDevice);
            TextUni.Initialize(GraphicsDevice);

            GumpData.Initialize(GraphicsDevice);
            HuesXNA.Initialize(GraphicsDevice);
            TexmapData.Initialize(GraphicsDevice);
            StringData.LoadStringList("enu");
            SkillsData.Initialize();
            GraphicsDevice.Textures[1] = HuesXNA.HueTexture0;
            GraphicsDevice.Textures[2] = HuesXNA.HueTexture1;

            EngineVars.EngineRunning = true;
            EngineVars.InWorld       = false;

            ActiveModel = new LoginModel();
        }
Пример #7
0
        private void GenerateImage()
        {
            Frame[] animFrames = Animations.GetAnimation(m_BodyId, 0, 1, (m_Hue - 1), false);

            Bitmap bmp = null;

            if (Bestiary.UseFixes)
            {
                string fixPath = Path.Combine("Bestiary/fixes", m_MasterType.Name + ".jpg");

                if (File.Exists(fixPath))
                {
                    bmp = new Bitmap(fixPath);
                }
            }

            if (animFrames != null || bmp != null)
            {
                using (Bitmap mobImage = new Bitmap(bmp ?? animFrames[0].Bitmap))
                {
                    using (Bitmap result = new Bitmap(m_BorderImage.Width, m_BorderImage.Height))
                    {
                        using (Bitmap title = ASCIIText.DrawText(3, m_Name, 0x3B2))
                        {
                            using (Graphics gr = Graphics.FromImage(result))
                            {
                                using (Bitmap tz = ASCIIText.DrawText(3, " - The Retelling - Bestiary -", 1260))
                                {
                                    using (SolidBrush blackBrush = new SolidBrush(Color.FromArgb(60, 1, 1, 1)))
                                    {
                                        if (m_Hue > 0)
                                        {
                                            Hue hue = GetHue(m_Hue - 1);

                                            if (hue != null)
                                            {
                                                // explicitely apply the hue, GetAnimation method doesn't work for few bodyIds.
                                                hue.ApplyTo(mobImage, false);
                                            }
                                        }

                                        GraphicsUnit unit = GraphicsUnit.Pixel;
                                        RectangleF   rect = mobImage.GetBounds(ref unit);
                                        int          trX  = (214 - (mobImage.Width >> 1));
                                        int          trY  = (170 - (mobImage.Height >> 1));
                                        int          brX  = (int)(trX + rect.Width);
                                        int          brY  = (int)(trY + rect.Height);

                                        string customBg = Bestiary.TypeRegistry[m_MasterType].Background;

                                        if (!string.IsNullOrEmpty(customBg))
                                        {
                                            using (Bitmap cBg = new Bitmap(customBg))
                                            {
                                                gr.DrawImage(cBg, 0.0f, 0.0f);
                                            }
                                        }
                                        else
                                        {
                                            gr.DrawImage(m_Background, 0.0f, 0.0f);
                                        }

                                        gr.FillRectangle(blackBrush, new Rectangle(22, 22, 385, 30));
                                        gr.DrawImage(
                                            m_WaterMark,
                                            new Rectangle(0, 0, m_BorderImage.Width, m_BorderImage.Height),
                                            0,
                                            0,
                                            m_BorderImage.Width,
                                            m_BorderImage.Height,
                                            GraphicsUnit.Pixel,
                                            imgAttrs
                                            );
                                        gr.DrawImage(title, ((brX + trX) >> 1) - (title.Width >> 1), trY - 5 - title.Height);
                                        gr.DrawImage(mobImage, trX, trY);
                                        gr.DrawImage(m_BorderImage, 0, 0, m_BorderImage.Width, m_BorderImage.Height);
                                        gr.DrawImage(tz, 100, 25);

                                        result.Save(Path.Combine("./Bestiary/images/", m_MasterType.Name + ".jpg"), m_Encoder, m_EncoderParameter);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("Couldn't acquire animation frames for bodyID: {0}, {1}", m_BodyId, m_Name);
            }
        }
Пример #8
0
 private void OnTextChange(object sender, EventArgs e)
 {
     pictureBox1.Image = _type == 1
         ? UnicodeFonts.WriteText(_font, textBox1.Text)
         : ASCIIText.DrawText(_font, textBox1.Text);
 }