コード例 #1
0
ファイル: OpenUOSDK.cs プロジェクト: blasterdude9/ForkUO-1
        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);
        }
コード例 #2
0
        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.");
        }
コード例 #3
0
ファイル: BitmapAdapterTests.cs プロジェクト: uotools/OpenUO
        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.");
        }
コード例 #4
0
ファイル: UnicodeFont.cs プロジェクト: uotools/PlayUO
 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));
 }
コード例 #5
0
ファイル: UnicodeFont.cs プロジェクト: uotools/PlayUO
 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));
 }
コード例 #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));
        }
コード例 #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);
        }
コード例 #8
0
ファイル: OpenUOSDK.cs プロジェクト: greeduomacro/RuneUO
		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);
		}
コード例 #9
0
 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.");
 }
コード例 #10
0
ファイル: Client.cs プロジェクト: TormentedEmu/OpenUO
        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));
        }
コード例 #11
0
        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.");
        }
コード例 #12
0
ファイル: OpenUOSDK.cs プロジェクト: GaeaUO/ForkUO
        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);
        }
コード例 #13
0
ファイル: Client.cs プロジェクト: jeffboulanger/OpenUO
        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));
        }
コード例 #14
0
ファイル: UnicodeFont.cs プロジェクト: Skinny1001/PlayUO
 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);
 }
コード例 #15
0
ファイル: UnicodeFont.cs プロジェクト: Skinny1001/PlayUO
 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);
 }