コード例 #1
0
        public override void Load()
        {
            base.Load();

            ItemHold.Clear();
            Hotkeys = new HotkeysManager();
            Macros  = new MacroManager();

            // #########################################################
            // [FILE_FIX]
            // TODO: this code is a workaround to port old macros to the new xml system.
            if (ProfileManager.CurrentProfile.Macros != null)
            {
                for (int i = 0; i < ProfileManager.CurrentProfile.Macros.Length; i++)
                {
                    Macros.PushToBack(ProfileManager.CurrentProfile.Macros[i]);
                }

                Macros.Save();

                ProfileManager.CurrentProfile.Macros = null;
            }
            // #########################################################

            Macros.Load();

            InfoBars = new InfoBarManager();
            InfoBars.Load();
            _healthLinesManager = new HealthLinesManager();
            // ## BEGIN - END ## //
            _UOClassicCombatLines = new UOClassicCombatLines();
            _textureManager       = new TextureManager();
            // ## BEGIN - END ## //
            Weather = new Weather();

            WorldViewportGump viewport = new WorldViewportGump(this);

            UIManager.Add(viewport);

            if (!ProfileManager.CurrentProfile.TopbarGumpIsDisabled)
            {
                TopBarGump.Create();
            }


            CommandManager.Initialize();
            NetClient.Socket.Disconnected += SocketOnDisconnected;

            MessageManager.MessageReceived += ChatOnMessageReceived;

            UIManager.ContainerScale = ProfileManager.CurrentProfile.ContainersScale / 100f;

            SDL.SDL_SetWindowMinimumSize(Client.Game.Window.Handle, 640, 480);

            if (ProfileManager.CurrentProfile.WindowBorderless)
            {
                Client.Game.SetWindowBorderless(true);
            }
            else if (Settings.GlobalSettings.IsWindowMaximized)
            {
                Client.Game.MaximizeWindow();
            }
            else if (Settings.GlobalSettings.WindowSize.HasValue)
            {
                int w = Settings.GlobalSettings.WindowSize.Value.X;
                int h = Settings.GlobalSettings.WindowSize.Value.Y;

                w = Math.Max(640, w);
                h = Math.Max(480, h);

                Client.Game.SetWindowSize(w, h);
            }

            // ## BEGIN - END ## //
            if (ProfileManager.CurrentProfile.UOClassicCombatSelf)
            {
                UIManager.Add(new UOClassicCombatSelf
                {
                    X = ProfileManager.CurrentProfile.UOClassicCombatSelfLocation.X,
                    Y = ProfileManager.CurrentProfile.UOClassicCombatSelfLocation.Y
                });
            }
            if (ProfileManager.CurrentProfile.UOClassicCombatBuffbar)
            {
                UIManager.Add(new UOClassicCombatBuffbar
                {
                    X = ProfileManager.CurrentProfile.UOClassicCombatBuffbarLocation.X,
                    Y = ProfileManager.CurrentProfile.UOClassicCombatBuffbarLocation.Y
                });
            }
            if (ProfileManager.CurrentProfile.UOClassicCombatLines)
            {
                UIManager.Add(new UOClassicCombatLines
                {
                    X = ProfileManager.CurrentProfile.UOClassicCombatLinesLocation.X,
                    Y = ProfileManager.CurrentProfile.UOClassicCombatLinesLocation.Y
                });
            }
            if (ProfileManager.CurrentProfile.UOClassicCombatAL)
            {
                UIManager.Add(new UOClassicCombatAL
                {
                    X = ProfileManager.CurrentProfile.UOClassicCombatALLocation.X,
                    Y = ProfileManager.CurrentProfile.UOClassicCombatALLocation.Y
                });
            }
            if (ProfileManager.CurrentProfile.BandageGump)
            {
                UIManager.Add(new BandageGump());
            }
            // ## BEGIN - END ## //

            CircleOfTransparency.Create(ProfileManager.CurrentProfile.CircleOfTransparencyRadius);
            Plugin.OnConnected();

            // ## BEGIN - END ## //
            ModulesManager.Load();
            // ## BEGIN - END ## //

            Camera.SetZoomValues
            (
                new[]
            {
                .5f, .6f, .7f, .8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.1f, 2.2f,
                2.3f, 2.4f, 2.5f
            }
            );

            Camera.Zoom = ProfileManager.CurrentProfile.DefaultScale;
        }