Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!_2cs_API._2csAPI.InGame())
            {
                MessageBox.Show("This option only works when in a game.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Rectangle MinimapRect = Data.GameData.GetMinimapCoords();

            MainWindow.minimap_location_x = MinimapRect.X;
            MainWindow.minimap_location_y = MinimapRect.Y;
            MainWindow.minimap_size_x     = MinimapRect.Width;
            MainWindow.minimap_size_y     = MinimapRect.Height;
            DirectX_HUDs.SaveMapSettings(MainWindow.minimap_location_x, MainWindow.minimap_location_y, MainWindow.minimap_size_x, MainWindow.minimap_size_y);
            if (MainWindow.HUDs != null && MainWindow.HUDs[1] != null && !MainWindow.HUDs[1].Disposing && !MainWindow.HUDs[1].IsDisposed &&
                MainWindow.HUDs[1].frame != null && !MainWindow.HUDs[1].frame.Disposing && !MainWindow.HUDs[1].frame.IsDisposed)
            {
                Rectangle WindowRect = MainWindow.HUDs[1].frame.DesktopBounds;
                Rectangle ClientRect = MainWindow.HUDs[1].frame.RectangleToScreen(MainWindow.HUDs[1].frame.ClientRectangle);

                MainWindow.HUDs[1].frame.Location   = new Point(MainWindow.minimap_location_x - (ClientRect.Left - WindowRect.Left), MainWindow.minimap_location_y - (ClientRect.Top - WindowRect.Top));
                MainWindow.HUDs[1].frame.ClientSize = new Size(MainWindow.minimap_size_x, MainWindow.minimap_size_y);
            }
        }
Ejemplo n.º 2
0
        private void saveHUDLocation(DirectX_HUDs hud)
        {
            if (hud != null)
            {
                IniFile file = new IniFile(MainWindow.settings_path);
                if (file.Exists())
                {
                    file.Load();
                }
                IniSection section = new IniSection();
                string     str     = hud.ContentHUDType.ToString() + " HUD";
                if (file.HasSection(str))
                {
                    section = file[str];
                    file.Remove(str);
                }

                if (section.ContainsKey("X"))
                {
                    section["X"] = base.Location.X.ToString();
                }
                else
                {
                    section.Add("X", base.Location.X.ToString());
                }

                if (section.ContainsKey("Y"))
                {
                    section["Y"] = base.Location.Y.ToString();
                }
                else
                {
                    section.Add("Y", base.Location.Y.ToString());
                }

                file.Add(str, section);
                file.Save();
            }
        }
Ejemplo n.º 3
0
 public HUDFrame(DirectX_HUDs hud)
 {
     this.InitializeComponent();
     if (hud != null)
     {
         if (hud.ContentHUDType != DirectX_HUDs.HUDType.Map)
         {
             base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
         }
         if (hud.ContentHUDType == DirectX_HUDs.HUDType.Observer)
         {
             this.cbObserverPanel               = new ComboBox();
             this.cbObserverPanel.Name          = "cbObserverPanel";
             this.cbObserverPanel.DropDownStyle = ComboBoxStyle.DropDownList;
             string[] names = Enum.GetNames(typeof(DirectX_HUDs.ObserverPanelTabs));
             foreach (string str in names)
             {
                 string str2  = str;
                 int    index = str2.IndexOf("__");
                 if (index != -1)
                 {
                     str2 = str2.Remove(index);
                 }
                 this.cbObserverPanel.Items.Add(str2.Replace("_", " "));
             }
             this.cbObserverPanel.SelectedIndex         = (int)DirectX_HUDs.CurrentObserverPanelTab;
             this.cbObserverPanel.SelectedIndexChanged += new EventHandler(this.cb_SelectedIndexChanged);
             base.Controls.Add(this.cbObserverPanel);
             int num2 = names.Max <string>((Func <string, int>)(x => x.Length));
             this.cbObserverPanel.Width = num2 * 6;
         }
         this.hud = hud;
         this.updateSize();
         base.Show();
         base.SendToBack();
     }
 }