Example #1
0
        public OpenUOSDK(string path = "")
        {
            if (_ClientData == null && (path != "" || path != null))
            {
                if (Directory.Exists(path))
                {
                    _ClientData = path;
                }
            }

            IoCContainer container = new IoCContainer();

            container.RegisterModule <UltimaSDKCoreModule>();
            container.RegisterModule <UltimaSDKBitmapModule>();

            InstallLocation location = (_ClientData == null ? InstallationLocator.Locate().FirstOrDefault() : (InstallLocation)_ClientData);

            if (!Directory.Exists(location.ToString()))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("OpenUO Error: Client files not found.");
                Utility.PopColor();
            }

            _animationDataFactory = new AnimationDataFactory(location, container);
            _animationFactory     = new AnimationFactory(location, container);
            _artworkFactory       = new ArtworkFactory(location, container);
            _asciiFontFactory     = new ASCIIFontFactory(location, container);
            _clilocFactory        = new ClilocFactory(location, container);
            _gumpFactory          = new GumpFactory(location, container);
            _skillsFactory        = new SkillsFactory(location, container);
            _soundFactory         = new SoundFactory(location, container);
            _texmapFactory        = new TexmapFactory(location, container);
            _unicodeFontFactory   = new UnicodeFontFactory(location, container);
        }
        public void TestUnicodeFontWriteableBitmapAdapter()
        {
            UnicodeFontFactory factory = new UnicodeFontFactory(Install, Container);
            ImageSource        text    = factory.GetText <ImageSource>(0, "This is a test", 0);

            Guard.AssertIsNotNull(text, "Unicode Font was not created.");
        }
Example #3
0
        public void TestUnicodeFontBitmapAdapter()
        {
            var factory = new UnicodeFontFactory(Install, Container);
            var text    = factory.GetText <Bitmap>(0, "This is a test", 0);

            Guard.RequireIsNotNull(text, "Unicode Font was not created.");
        }
Example #4
0
 public int GetStringWidth(string text)
 {
     if ((text == null) || (text.Length <= 0))
     {
         return(2);
     }
     if (this.m_Factory == null)
     {
         this.m_Factory = new UnicodeFontFactory(this);
     }
     return(this.m_Factory.MeasureWidth(text));
 }
Example #5
0
 Texture IFontFactory.CreateInstance(string String, IHue Hue)
 {
     if ((String == null) || (String.Length <= 0))
     {
         return(Texture.Empty);
     }
     if (Hue == Hues.Default)
     {
         Hue = Hues.Bright;
     }
     if (this.m_Factory == null)
     {
         this.m_Factory = new UnicodeFontFactory(this);
     }
     return(this.m_Factory.Load(String, Hue));
 }
Example #6
0
        public override void Start()
        {
            base.Start();

            var dataDirectory = Settings.UltimaOnline.DataDirectory;

            if (string.IsNullOrEmpty(dataDirectory) || !Directory.Exists(dataDirectory))
            {
                using (var form = new SelectInstallForm("CoreAdapterTests"))
                {
                    if (form.ShowDialog() == DialogResult.Cancel)
                    {
                        //TODO: End game
                    }

                    var version = form.SelectedInstall.Version;

                    Settings.UltimaOnline.DataDirectory = dataDirectory = form.SelectedInstall.Directory;
                    Settings.UltimaOnline.ClientVersion = version.ToString();
                }
            }

            var install = new InstallLocation(dataDirectory);

            _spriteBatch = new SpriteBatch(GraphicsDevice)
            {
                VirtualResolution = new Vector3(_virtualResolution, 1)
            };

            _artworkFactory     = new ArtworkFactory(install, _container);
            _texmapFactory      = new TexmapFactory(install, _container);
            _animationFactory   = new AnimationFactory(install, _container);
            _gumpFactory        = new GumpFactory(install, _container);
            _asciiFontFactory   = new ASCIIFontFactory(install, _container);
            _unicodeFontFactory = new UnicodeFontFactory(install, _container);

            // register the renderer in the pipeline
            var scene      = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);

            compositor.Master.Renderers.Add(new ClearRenderFrameRenderer());
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
        }
Example #7
0
        public OpenUOSDK(string path = "")
        {
            if (ClientDataPath == null && !String.IsNullOrWhiteSpace(path))
            {
                if (Directory.Exists(path))
                {
                    ClientDataPath = path;
                }
            }

            var container = new Container();

            container.RegisterModule <UltimaSDKCoreModule>();
            container.RegisterModule <UltimaSDKBitmapModule>();

            InstallLocation location = (ClientDataPath == null
                                                                                        ? InstallationLocator.Locate().FirstOrDefault()
                                                                                        : (InstallLocation)ClientDataPath);

            if (location == null || String.IsNullOrWhiteSpace(location) || !Directory.Exists(location.ToString()))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("OpenUO Error: Client files not found.");
                Utility.PopColor();
            }

            AnimationDataFactory = new AnimationDataFactory(location, container);
            AnimationFactory     = new AnimationFactory(location, container);
            ArtFactory           = new ArtworkFactory(location, container);
            AsciiFontFactory     = new ASCIIFontFactory(location, container);
            ClilocFactory        = new ClilocFactory(location, container);
            GumpFactory          = new GumpFactory(location, container);
            SkillsFactory        = new SkillsFactory(location, container);
            SoundFactory         = new SoundFactory(location, container);
            TexmapFactory        = new TexmapFactory(location, container);
            UnicodeFontFactory   = new UnicodeFontFactory(location, container);
        }
Example #8
0
		public OpenUOSDK(string path = "")
		{
			if (ClientDataPath == null && !String.IsNullOrWhiteSpace(path))
			{
				if (Directory.Exists(path))
				{
					ClientDataPath = path;
				}
			}

			Container container = new Container();
			container.RegisterModule<UltimaSDKCoreModule>();
			container.RegisterModule<UltimaSDKBitmapModule>();

			InstallLocation location = (ClientDataPath == null
											? InstallationLocator.Locate().FirstOrDefault()
											: (InstallLocation)ClientDataPath);

			if (location == null || String.IsNullOrWhiteSpace(location) || !Directory.Exists(location.ToString()))
			{
				Utility.PushColor(ConsoleColor.Red);
				Console.WriteLine("OpenUO Error: Client files not found.");
				Utility.PopColor();
			}

			AnimationDataFactory = new AnimationDataFactory(location, container);
			AnimationFactory = new AnimationFactory(location, container);
			ArtFactory = new ArtworkFactory(location, container);
			AsciiFontFactory = new ASCIIFontFactory(location, container);
			ClilocFactory = new ClilocFactory(location, container);
			GumpFactory = new GumpFactory(location, container);
			SkillsFactory = new SkillsFactory(location, container);
			SoundFactory = new SoundFactory(location, container);
			TexmapFactory = new TexmapFactory(location, container);
			UnicodeFontFactory = new UnicodeFontFactory(location, container);
		}
 public void TestUnicodeFontBitmapAdapter()
 {
     UnicodeFontFactory factory = new UnicodeFontFactory(Install, Container);
     Bitmap text = factory.GetText<Bitmap>(0, "This is a test", 0);
     Guard.AssertIsNotNull(text, "Unicode Font was not created.");
 }
Example #10
0
        public override void Start()
        {
            base.Start();

            var installs = InstallationLocator.Locate();

            _spriteBatch = new SpriteBatch(GraphicsDevice) { VirtualResolution = new Vector3(_virtualResolution, 1) };

            _artworkFactory = new ArtworkFactory(installs.First(), _container);
            _texmapFactory = new TexmapFactory(installs.First(), _container);
            _animationFactory = new AnimationFactory(installs.First(), _container);
            _gumpFactory = new GumpFactory(installs.First(), _container);
            _asciiFontFactory = new ASCIIFontFactory(installs.First(), _container);
            _unicodeFontFactory = new UnicodeFontFactory(installs.First(), _container);

            // register the renderer in the pipeline
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);

            compositor.Master.Renderers.Add(new ClearRenderFrameRenderer());
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
        }
        public void TestUnicodeFontWriteableBitmapAdapter()
        {
            var factory = new UnicodeFontFactory(Install, Container);
            var text = factory.GetText<ImageSource>(0, "This is a test", 0);

            Guard.RequireIsNotNull(text, "Unicode Font was not created.");
        }
Example #12
0
        public OpenUOSDK(string path = "")
        {
            if (_ClientData == null && (path != "" || path != null))
            {
                if (Directory.Exists(path))
                    _ClientData = path;
            }

            IoCContainer container = new IoCContainer();
            container.RegisterModule<UltimaSDKCoreModule>();
            container.RegisterModule<UltimaSDKBitmapModule>();

            InstallLocation location = (_ClientData == null ? InstallationLocator.Locate().FirstOrDefault() : (InstallLocation)_ClientData);

            if (!Directory.Exists(location.ToString()))
            {
                Utility.PushColor(ConsoleColor.Red);
                Console.WriteLine("OpenUO Error: Client files not found.");
                Utility.PopColor();
            }

            _animationDataFactory = new AnimationDataFactory(location, container);
            _animationFactory = new AnimationFactory(location, container);
            _artworkFactory = new ArtworkFactory(location, container);
            _asciiFontFactory = new ASCIIFontFactory(location, container);
            _clilocFactory = new ClilocFactory(location, container);
            _gumpFactory = new GumpFactory(location, container);
            _skillsFactory = new SkillsFactory(location, container);
            _soundFactory = new SoundFactory(location, container);
            _texmapFactory = new TexmapFactory(location, container);
            _unicodeFontFactory = new UnicodeFontFactory(location, container);
        }
Example #13
0
        public override void Start()
        {
            base.Start();

            var dataDirectory = Settings.UltimaOnline.DataDirectory;

            if (string.IsNullOrEmpty(dataDirectory) || !Directory.Exists(dataDirectory))
            {
                using (var form = new SelectInstallForm("CoreAdapterTests"))
                {
                    if (form.ShowDialog() == DialogResult.Cancel)
                    {
                        //TODO: End game
                    }

                    var version = form.SelectedInstall.Version;

                    Settings.UltimaOnline.DataDirectory = dataDirectory = form.SelectedInstall.Directory;
                    Settings.UltimaOnline.ClientVersion = version.ToString();
                }
            }

            var install = new InstallLocation(dataDirectory);

            _spriteBatch = new SpriteBatch(GraphicsDevice) {VirtualResolution = new Vector3(_virtualResolution, 1)};

            _artworkFactory = new ArtworkFactory(install, _container);
            _texmapFactory = new TexmapFactory(install, _container);
            _animationFactory = new AnimationFactory(install, _container);
            _gumpFactory = new GumpFactory(install, _container);
            _asciiFontFactory = new ASCIIFontFactory(install, _container);
            _unicodeFontFactory = new UnicodeFontFactory(install, _container);

            // register the renderer in the pipeline
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers) scene.Settings.GraphicsCompositor);

            compositor.Master.Renderers.Add(new ClearRenderFrameRenderer());
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(RenderQuad));
        }
Example #14
0
 Texture IFontFactory.CreateInstance(string String, IHue Hue)
 {
     if ((String == null) || (String.Length <= 0))
     {
         return Texture.Empty;
     }
     if (Hue == Hues.Default)
     {
         Hue = Hues.Bright;
     }
     if (this.m_Factory == null)
     {
         this.m_Factory = new UnicodeFontFactory(this);
     }
     return this.m_Factory.Load(String, Hue);
 }
Example #15
0
 public int GetStringWidth(string text)
 {
     if ((text == null) || (text.Length <= 0))
     {
         return 2;
     }
     if (this.m_Factory == null)
     {
         this.m_Factory = new UnicodeFontFactory(this);
     }
     return this.m_Factory.MeasureWidth(text);
 }