ShowHUD() public method

public ShowHUD ( ) : void
return void
Beispiel #1
0
        public static void ShowHUD(string param)
        {
            BaseHUD hud = null;
            param = filterName(param);
            switch(param) {
                case "healthbar":
                    hud = new HealthBar();
                    break;
                case "manabar":
                    hud = new ManaBar();
                    break;
                case "experiencebar":
                    hud = new ExperienceBar();
                    break;
                case "curvedbar":
                case "curvedbars":
                    hud = new CurvedHUD();
                    break;
                case "healthlist":
                    hud = new HealthList();
                    break;
                case "portrait":
                    hud = new Portrait();
                    break;
                case "task":
                case "tasks":
                case "taskhud":
                    hud = new TaskHUD();
                    break;
            }
            if (hud == null) return;
            string hudName = hud.GetHUD();
            string entryName = filterName(hud.GetHUD());
            lock(huds) {
                if (huds.ContainsKey(entryName)) {
                    huds[entryName].Close();
                    huds.Remove(entryName);
                }
                huds.Add(entryName, hud);
                int x = SettingsManager.getSettingInt(hudName + "XOffset");
                int y = SettingsManager.getSettingInt(hudName + "YOffset");
                int width = SettingsManager.getSettingInt(hudName + "Width");
                int height = SettingsManager.getSettingInt(hudName + "Height");
                int anchor = SettingsManager.getSettingInt(hudName + "Anchor");

                width = width < 0 ? 280 : width;
                height = height < 0 ? 60 : height;

                int position_x = 0, position_y = 0;
                Screen screen = ProcessManager.GetScreen();
                int xOffset = x == -1 ? 30 : x;
                int yOffset = y == -1 ? 30 : y;
                switch (anchor) {
                    case 4:
                        position_x = (screen.WorkingArea.Left + screen.WorkingArea.Width / 2) + xOffset - width / 2;
                        position_y = (screen.WorkingArea.Top + screen.WorkingArea.Height / 2) + yOffset - height / 2;
                        break;
                    case 3:
                        position_x = screen.WorkingArea.Right - xOffset - width;
                        position_y = screen.WorkingArea.Bottom - yOffset - height;
                        break;
                    case 2:
                        position_x = screen.WorkingArea.Left + xOffset;
                        position_y = screen.WorkingArea.Bottom - yOffset - height;
                        break;
                    case 1:
                        position_x = screen.WorkingArea.Right - xOffset - width;
                        position_y = screen.WorkingArea.Top + yOffset;
                        break;
                    default:
                        position_x = screen.WorkingArea.Left + xOffset;
                        position_y = screen.WorkingArea.Top + yOffset;
                        break;
                }
                hud.Width = width;
                hud.Height = height;

                hud.LoadHUD();

                hud.StartPosition = FormStartPosition.Manual;
                hud.SetDesktopLocation(position_x, position_y);
                hud.TopMost = true;
                hud.ShowHUD();
            }
        }
Beispiel #2
0
        public static void ShowHUD(string param)
        {
            BaseHUD hud = null;

            param = filterName(param);
            switch (param)
            {
            case "healthbar":
                hud = new HealthBar();
                break;

            case "manabar":
                hud = new ManaBar();
                break;

            case "experiencebar":
                hud = new ExperienceBar();
                break;

            case "curvedbar":
            case "curvedbars":
                hud = new CurvedHUD();
                break;

            case "healthlist":
                hud = new HealthList();
                break;

            case "portrait":
                hud = new Portrait();
                break;

            case "task":
            case "tasks":
            case "taskhud":
                hud = new TaskHUD();
                break;
            }
            if (hud == null)
            {
                return;
            }
            string hudName   = hud.GetHUD();
            string entryName = filterName(hud.GetHUD());

            lock (huds) {
                if (huds.ContainsKey(entryName))
                {
                    huds[entryName].Close();
                    huds.Remove(entryName);
                }
                huds.Add(entryName, hud);
                int x      = SettingsManager.getSettingInt(hudName + "XOffset");
                int y      = SettingsManager.getSettingInt(hudName + "YOffset");
                int width  = SettingsManager.getSettingInt(hudName + "Width");
                int height = SettingsManager.getSettingInt(hudName + "Height");
                int anchor = SettingsManager.getSettingInt(hudName + "Anchor");

                width  = width < 0 ? 280 : width;
                height = height < 0 ? 60 : height;

                int    position_x = 0, position_y = 0;
                Screen screen  = ProcessManager.GetScreen();
                int    xOffset = x == -1 ? 30 : x;
                int    yOffset = y == -1 ? 30 : y;
                switch (anchor)
                {
                case 4:
                    position_x = (screen.WorkingArea.Left + screen.WorkingArea.Width / 2) + xOffset - width / 2;
                    position_y = (screen.WorkingArea.Top + screen.WorkingArea.Height / 2) + yOffset - height / 2;
                    break;

                case 3:
                    position_x = screen.WorkingArea.Right - xOffset - width;
                    position_y = screen.WorkingArea.Bottom - yOffset - height;
                    break;

                case 2:
                    position_x = screen.WorkingArea.Left + xOffset;
                    position_y = screen.WorkingArea.Bottom - yOffset - height;
                    break;

                case 1:
                    position_x = screen.WorkingArea.Right - xOffset - width;
                    position_y = screen.WorkingArea.Top + yOffset;
                    break;

                default:
                    position_x = screen.WorkingArea.Left + xOffset;
                    position_y = screen.WorkingArea.Top + yOffset;
                    break;
                }
                hud.Width  = width;
                hud.Height = height;

                hud.LoadHUD();

                hud.StartPosition = FormStartPosition.Manual;
                hud.SetDesktopLocation(position_x, position_y);
                hud.TopMost = true;
                hud.ShowHUD();
            }
        }