예제 #1
0
        private void Canvas_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Grafik neueGrafik = null;

            switch (_ausgewählteGrafikart)
            {
            case Grafikarten.Punkt:
                neueGrafik             = new EinPunkt(e.GetPosition(canvas));
                neueGrafik.Strichdicke = 10;
                neueGrafik.Strichfarbe = Brushes.Fuchsia;
                break;

            case Grafikarten.Rechteck:
                break;

            case Grafikarten.Strich:
                break;

            case Grafikarten.Kreis:
                break;

            default:
                break;
            }
            neueGrafik.ZeichneDich();
            _grafikliste.Add(neueGrafik);
        }
예제 #2
0
        public List <Grafik> PobierzGrafik(DateTime dateTime)
        {
            if (Grafiki.Count == 0)
            {
                PobierzLekarzy();
                PobierzPacjentow();

                if (Lekarze.Count != 0 && Pacjenci.Count != 0)
                {
                    for (int i = 8; i <= 16; i++)
                    {
                        if (i > random.Next(8, 15))
                        {
                            continue;
                        }

                        DateTime godzina = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, i, 0, 0);

                        Grafiki.Add(new Grafik()
                        {
                            Lekarz  = Lekarze[random.Next(0, Lekarze.Count - 1)],
                            Pacjent = Pacjenci[random.Next(0, Pacjenci.Count - 1)],
                            Godzina = godzina
                        });
                    }

                    for (int i = 0; i < Grafiki.Count; i++)
                    {
                        Grafiki[i].Id             = i + 1;
                        Grafiki[i].DataStworzenia = DateTime.Now;
                    }
                }
            }

            List <Grafik> returnGrafiki = new List <Grafik>();

            for (int i = 8; i <= 16; i++)
            {
                returnGrafiki.Add(new Grafik()
                {
                    Godzina = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, i, 0, 0)
                });
            }

            foreach (Grafik grafik in Grafiki.Where(o => o.Godzina.Year == dateTime.Year && o.Godzina.Month == dateTime.Month && o.Godzina.Day == dateTime.Day))
            {
                Grafik searchGrafik = returnGrafiki.FirstOrDefault(o => o.Godzina.Hour == grafik.Godzina.Hour);
                if (searchGrafik == null)
                {
                    returnGrafiki.Add(grafik);
                }
                else
                {
                    returnGrafiki[returnGrafiki.IndexOf(searchGrafik)] = grafik;
                }
            }

            return(returnGrafiki);
        }
예제 #3
0
        public Grafik DodajGrafik(Grafik grafik)
        {
            grafik.Id             = Grafiki.Count > 0 ? Grafiki.Last().Id + 1 : 1;
            grafik.DataStworzenia = DateTime.Now;

            Grafiki.Add(grafik);
            return(grafik);
        }
예제 #4
0
        public frmEinstellungen(ref C_Musik oC_MusikInstanz)
        {
            InitializeComponent();

            lbl_ueberschrift.Font = Grafik.GetStandardFont(Grafik.GetSchriftgRiesig());
            lbl_ueberschrift.Left = this.Width / 2 - lbl_ueberschrift.Width / 2;

            foC_MusikInstanz = oC_MusikInstanz;
        }
예제 #5
0
        public static int NormB(int value, int width, int?bildschirmbreite = null)
        {
            int BildschirmBreite = Grafik.GetNormBildschirmBreite();

            if (bildschirmbreite.HasValue)
            {
                BildschirmBreite = bildschirmbreite.Value;
            }

            return(Convert.ToInt32(value * width / BildschirmBreite));
        }
예제 #6
0
        public static int NormH(int value, int height, int?bildschirmhoehe = null)
        {
            int BildschirmHoehe = Grafik.GetNormBildschirmHoehe();

            if (bildschirmhoehe.HasValue)
            {
                BildschirmHoehe = bildschirmhoehe.Value;
            }

            return(Convert.ToInt32(value * height / BildschirmHoehe));
        }
예제 #7
0
        /// <summary>
        /// Konstruktor, hier wird der Standardcursor sowie das Standard BackgroundImage gesetzt.
        /// </summary>
        public frmBasis()
        {
            InitializeComponent();

            if (File.Exists(Application.StartupPath + "\\" + Grafik.GetStandardCursorName()))
            {
                this.Cursor = NativeMethods.LoadCustomCursor(Application.StartupPath + "\\" + Grafik.GetStandardCursorName());
            }

            this.BackgroundImage = new Bitmap(Properties.Resources.SonstPergament);
        }
예제 #8
0
        public bool UsunGrafik(long id)
        {
            Grafik grafik = Grafiki.FirstOrDefault(o => o.Id == id);

            if (grafik != null)
            {
                Grafiki.Remove(grafik);
                return(true);
            }
            return(false);
        }
예제 #9
0
        private void StuetzpunktFlaggenEinblenden()
        {
            pictureBox1.Top = s1_top;
            pictureBox2.Top = s2_top;
            pictureBox3.Top = s3_top;
            pictureBox4.Top = s4_top;
            pictureBox5.Top = s5_top;
            pictureBox6.Top = s6_top;
            pictureBox7.Top = s7_top;
            pictureBox8.Top = s8_top;

            pictureBox1.Left = s1_right + 3;
            pictureBox2.Left = s2_right + 3;
            pictureBox3.Left = s3_right + 3;
            pictureBox4.Left = s4_right + 3;
            pictureBox5.Left = s5_right + 3;
            pictureBox6.Left = s6_right + 3;
            pictureBox7.Left = s7_right + 3;
            pictureBox8.Left = s8_right + 3;

            pictureBox1.Width = 25;
            pictureBox2.Width = pictureBox1.Width;
            pictureBox3.Width = pictureBox1.Width;
            pictureBox4.Width = pictureBox1.Width;
            pictureBox5.Width = pictureBox1.Width;
            pictureBox6.Width = pictureBox1.Width;
            pictureBox7.Width = pictureBox1.Width;
            pictureBox8.Width = pictureBox1.Width;

            pictureBox1.Height = 35;
            pictureBox2.Height = pictureBox1.Height;
            pictureBox3.Height = pictureBox1.Height;
            pictureBox4.Height = pictureBox1.Height;
            pictureBox5.Height = pictureBox1.Height;
            pictureBox6.Height = pictureBox1.Height;
            pictureBox7.Height = pictureBox1.Height;
            pictureBox8.Height = pictureBox1.Height;

            //Flaggen einblenden
            for (int i = 1; i <= SW.Dynamisch.GetStuetzpunkte().Length; i++)
            {
                this.Controls["pictureBox" + i.ToString()].Visible = false;

                // Wenn der Stützpunkt einem menschlichen Spieler gehört, soll die Flagge angezeigt werden
                if (SW.Dynamisch.GetStuetzpunkte()[i - 1].Besitzer < SW.Statisch.GetMinKIID())
                {
                    Grafik.SwitchBanner("pictureBox" + i.ToString(), SW.Dynamisch.GetHumWithID(SW.Dynamisch.GetStuetzpunkte()[i - 1].Besitzer).GetBanner(), this);
                    this.Controls["pictureBox" + i.ToString()].Visible = true;
                    this.Controls["pictureBox" + i.ToString()].BringToFront();
                }
            }
        }
예제 #10
0
 public void DeleteGrafik(int id)
 {
     try
     {
         Grafik _grafik = _context.GRAFIKLER.FirstOrDefault(w => w.ID == id);
         _context.GRAFIKLER.Remove(_grafik);
         _context.SaveChanges();
     }
     catch (System.Exception ex)
     {
         var ss = ex.Message;
     }
 }
예제 #11
0
        private void frmKampfereignisse_Load(object sender, System.EventArgs e)
        {
            trtText.Left = UI.NormB(trtText.Left, this.Width);
            trtText.Top  = UI.NormH(trtText.Top, this.Height);

            trtText.Width  = UI.NormB(trtText.Width, this.Width);
            trtText.Height = UI.NormH(trtText.Height, this.Height);

            lbl_nachrichten_titel.Left = UI.NormB(lbl_nachrichten_titel.Left, this.Width);
            lbl_nachrichten_titel.Top  = UI.NormH(lbl_nachrichten_titel.Top, this.Height);

            lbl_nachrichten_titel.Width = UI.NormB(lbl_nachrichten_titel.Width, this.Width);

            trtText.Font = Grafik.GetStandardFont(Convert.ToInt16(trtText.Font.Size));
            trtText.Text = "";
            lbl_nachrichten_titel.Text = "Militärische Ereignisse " + SW.Dynamisch.GetAktuellesJahr().ToString();
        }
예제 #12
0
        /// <summary>
        /// Hier wird allen Objekten einheitlich die Standard Schriftart zugewiesen. Zusätzlich wird allen TransparentRichText Controls der Standardcursor zugeordnet.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmBasis_Load(object sender, EventArgs e)
        {
            // Allen Objekten einheitlich die Schrift zuweisen
            // Muss im Load, statt im Konstruktor passieren, damit die Controls und auch der Standardfont schon vorhanden sind

            if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)  // Nicht im Design Mode von VS?
            {
                foreach (Control C in this.Controls)
                {
                    C.Font = Grafik.GetStandardFont(Convert.ToInt16(C.Font.Size));

                    if (C is TransparentRichText)
                    {
                        C.Cursor = this.Cursor;
                    }
                }
            }
        }
예제 #13
0
        public Form2()
        {
            InitializeComponent();

            //System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;   //без этого не работает


            this.pictureBox1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseWheel);


            gr1 = new Grafik(DataClass.x, DataClass.y, pictureBox1, pictureBox1.Size, Color.Red, scale, scale);

            p = int.Parse(numericUpDown1.Text);


            textBox1.Text = Math.Round(gr1.Scale_x, 1).ToString();
            pictureBox1.Focus();
        }
예제 #14
0
        public void UpdateGrafik(string model, string timespan)
        {
            tempGrafik grafik = new tempGrafik();

            //Newtonsoft.Json.JsonConvert.PopulateObject(model, grafik);
            grafik = Newtonsoft.Json.JsonConvert.DeserializeObject <tempGrafik>(model);
            try
            {
                int      _hour = Convert.ToInt32(timespan.Split(":")[0]);
                int      _min  = Convert.ToInt32(timespan.Split(":")[1]);
                TimeSpan gulu  = new TimeSpan(_hour, _min, 0);
                grafik.ZAMANARALIK = gulu;
                if (grafik.ID == 0)
                {
                    Grafik _grafik = new Grafik();
                    _grafik.GRAFIKADI   = grafik.GRAFIKADI;
                    _grafik.ZAMANARALIK = grafik.ZAMANARALIK.Value;
                    _grafik.BASLAMA     = grafik.BASLAMA.Value;
                    _context.GRAFIKLER.Add(_grafik);
                    _context.SaveChanges();
                }
                else
                {
                    //Grafik _grafik = new Grafik();
                    Grafik _grafik = _context.GRAFIKLER.FirstOrDefault(w => w.ID == grafik.ID);
                    _grafik.GRAFIKADI   = grafik.GRAFIKADI;
                    _grafik.ZAMANARALIK = grafik.ZAMANARALIK.Value;
                    _grafik.BASLAMA     = grafik.BASLAMA.Value;
                    //_context.GRAFIKLER.Add(_grafik);
                    _context.SaveChanges();
                }
                //Grafik _grafik = new Grafik();
                //_grafik.ID = grafik.ID;
                //_grafik.ZAMANARALIK = grafik.ZAMANARALIK.Value;
            }
            catch (System.Exception ex)
            {
                var ss = ex.Message;
            }
        }
예제 #15
0
        /* Kod za prikazivanje vrednosti na grafiku prelaskom misa preko linije grafika */

        //Grafik pozicije
        private void Grafik_MouseMove(object sender, MouseEventArgs e)
        {
            Point?prevPosition = null;
            var   pos          = e.Location;

            if (prevPosition.HasValue && pos == prevPosition.Value)
            {
                return;
            }

            prevPosition = pos;
            var results = Grafik.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint);

            foreach (var result in results)
            {
                if (result.ChartElementType == ChartElementType.DataPoint)
                {
                    double xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
                    double yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);

                    txtLoc.Text = "Vrednost X: " + xVal.ToString() + "\r\nVrednost Y:  " + yVal.ToString();
                }
            }
        }
예제 #16
0
        protected override void Seed(MuseumContext context)
        {
            List <string> ExpositionName = new List <string> {
                "Cigar and world", "Space", "Brain", "Fluid or sphere", "Nut", "Give me a cake"
            };
            List <string> GuideNames = new List <string>()
            {
                "Kari Hensien", "Terry Adams", "Dan Park", "Peter Houston", "Lukas Keller", "Mathew Charles", "John Smith"
            };
            List <string> ExpositionTheme = new List <string> {
                "Philosophy", "Science", "Science", "Abstraction", "Rave", "Rave"
            };
            int time = 2;

            for (int i = 0; i < ExpositionName.Count; i++)
            {
                var exposition = new Exposition()
                {
                    ExpositionName = ExpositionName[i], Theme = ExpositionTheme[i], TargetAudience = 16, Plane = "+_+", Price = 150
                };
                var grafik = new Grafik()
                {
                    //Id = exposition.Id,
                    Exposition = exposition,
                    StartTime  = new TimeSpan(6 + i + i, 0, 15),
                    EndTime    = new TimeSpan(6 + i + i + time, 0, 15)
                };

                var excursionsSchedule = new ExcursionsSchedule()
                {
                    Id = grafik.Id, Grafik = grafik
                };

                var guide = new Guide()
                {
                    Name = GuideNames[i]
                };
                var excursion = new Excursion()
                {
                    Guide = guide, StartTime = grafik.StartTime, Time = time, ExcursionsSchedule = excursionsSchedule, Id = excursionsSchedule.Id
                };
                guide.Excursions.Add(excursion);

                excursionsSchedule.Excursion = excursion;
                var customExcursion = new CustomExcursion()
                {
                    Guide = guide, StartTime = grafik.StartTime, Time = time, ExcursionsSchedule = excursionsSchedule
                };
                guide.CustomExcursion.Add(customExcursion);

                for (int j = 0; j < 10; j++)
                {
                    var customer = new Customer {
                        Name = "Tourist_" + j * (i + 1), Age = 20, CustomExcursions = customExcursion
                    };
                    customExcursion.Customers.Add(customer);
                    context.Customer.Add(customer);
                }
                excursionsSchedule.CustomExcursions.Add(customExcursion);
                context.Exposition.Add(exposition);
                context.Grafik.Add(grafik);
                context.ExcursionsSchedules.Add(excursionsSchedule);
                context.Guide.Add(guide);
                context.Excursion.Add(excursion);
                context.CustomExcursions.Add(customExcursion);
            }
            context.SaveChanges();;
        }
예제 #17
0
        public frmStuetzpunktVerwalten(int stuetzpunktID)
        {
            InitializeComponent();

            _stuetzpunktID    = stuetzpunktID;
            _stuetzpunktIndex = stuetzpunktID - 1;
            _stuetzpunkt      = SW.Dynamisch.GetStuetzpunkte()[_stuetzpunktIndex];
            _aktuellerWert    = _stuetzpunkt.BerechneWert();

            UI.SpielerInfosAnzeigenUndAusrichten(this, false, _stuetzpunkt.Name, frmStuetzpunktVerwalten_MouseDown);

            nb_einheit_1.ForeColor = Grafik.GetStandardSchriftFarbeGold();

            if (_stuetzpunkt.Art == EnumStuetzpunktArt.Zollburg)
            {
                btn_zoll.Visible = true;
                btn_einheit_1.BackgroundImage = Properties.Resources.SymbSoeldner;
                btn_einheit_2.BackgroundImage = Properties.Resources.SymbMusketier;
                btn_einheit_3.BackgroundImage = Properties.Resources.SymbKanonier;
                btn_einheit_4.BackgroundImage = Properties.Resources.SymbOffizier;

                // Einheitobjekte der Tag Property der Buttons zuweisen für spätere Verwendung
                btn_einheit_1.Tag = new ZollSoeldner();
                btn_einheit_2.Tag = new ZollMusketier();
                btn_einheit_3.Tag = new ZollKanonier();
                btn_einheit_4.Tag = new ZollOffizier();
            }
            else
            {
                btn_zoll.Visible = false;
                btn_einheit_1.BackgroundImage = Properties.Resources.SymbRaeuber;
                btn_einheit_2.BackgroundImage = Properties.Resources.SymbBombenleger;
                btn_einheit_3.BackgroundImage = Properties.Resources.SymbKanonier;
                btn_einheit_4.BackgroundImage = Properties.Resources.SymbSchuetze;

                // Einheitobjekte der Tag Property der Buttons zuweisen für spätere Verwendung
                btn_einheit_1.Tag = new RaubRaeuber();
                btn_einheit_2.Tag = new RaubBombenleger();
                btn_einheit_3.Tag = new RaubKanonier();
                btn_einheit_4.Tag = new RaubSchuetze();
            }

            ttButtons.SetToolTip(btn_sicherheit_tarnung, _stuetzpunkt.SicherheitTarnungAlsString());

            ttButtons.SetToolTip(btn_einheit_1, ((Einheit)btn_einheit_1.Tag).NamePlural);
            ttButtons.SetToolTip(btn_einheit_2, ((Einheit)btn_einheit_2.Tag).NamePlural);
            ttButtons.SetToolTip(btn_einheit_3, ((Einheit)btn_einheit_3.Tag).NamePlural);
            ttButtons.SetToolTip(btn_einheit_4, ((Einheit)btn_einheit_4.Tag).NamePlural);

            nb_einheit_1.Wert = _stuetzpunkt.GetAnzahlTruppen((btn_einheit_1.Tag as Einheit).GetType());
            nb_einheit_2.Wert = _stuetzpunkt.GetAnzahlTruppen((btn_einheit_2.Tag as Einheit).GetType());
            nb_einheit_3.Wert = _stuetzpunkt.GetAnzahlTruppen((btn_einheit_3.Tag as Einheit).GetType());
            nb_einheit_4.Wert = _stuetzpunkt.GetAnzahlTruppen((btn_einheit_4.Tag as Einheit).GetType());

            SetzeMaximalerWertTruppenAktion(true);

            _aktuelleAnzahlEinheit1 = nb_einheit_1.Wert;
            _aktuelleAnzahlEinheit2 = nb_einheit_2.Wert;
            _aktuelleAnzahlEinheit3 = nb_einheit_3.Wert;
            _aktuelleAnzahlEinheit4 = nb_einheit_4.Wert;

            nb_aktion_1_zielland.MaximalerWert        = SW.Statisch.GetMaxLandID() - 1;
            nb_aktion_1_zielland.MinimalerWert        = SW.Statisch.GetMinLandID();
            nb_aktion_1_zielstuetzpunkt.MaximalerWert = SW.Dynamisch.GetStuetzpunkte().Length;
            nb_aktion_1_zielstuetzpunkt.MinimalerWert = 1;

            nb_aktion_2_zielland.MaximalerWert        = SW.Statisch.GetMaxLandID() - 1;
            nb_aktion_2_zielland.MinimalerWert        = SW.Statisch.GetMinLandID();
            nb_aktion_2_zielstuetzpunkt.MaximalerWert = SW.Dynamisch.GetStuetzpunkte().Length;
            nb_aktion_2_zielstuetzpunkt.MinimalerWert = 1;
        }
예제 #18
0
        /// <summary>
        /// Blendet die Spielerinfo (Name und Amt, Taler und Ort sowie Datum) oben im Bereich ein, z.B. bei der Verwaltung eine Stützpunktes.
        /// Die Labels werden dafür auf dem Form gesucht bzw. automatisch erstellt und hinzugefügt, wenn sie noch nicht vorhanden sind.
        /// </summary>
        /// <param name="Form">Aktuelles Form, in dem die Infos angezeigt und ausgerichtet werden sollen</param>
        /// <param name="NurAusrichten">OPTIONAL: Gibt an, ob die Labels nur ausgerichtet oder aber aktualisiert und erstellt werden sollen</param>
        /// <param name="Ort">OPTIONAL: Aktueller Ort, z.B. die Stadt oder der Stützpunkt</param>
        /// <param name="EventHandlerMouseDown">OPTIONAL: Der gewünschte Handler für das Event "MouseDown" auf den Labels</param>
        public static void SpielerInfosAnzeigenUndAusrichten(frmBasis Form, bool NurAusrichten = false, string Ort = "", MouseEventHandler EventHandlerMouseDown = null)
        {
            Label lbl_spielernameundamt = null;
            Label lbl_taler             = null;
            Label lbl_ortdatum          = null;

            Control[] ControlSucheSpielername = Form.Controls.Find("lbl_spielernameundamt", true);
            Control[] ControlSucheTaler       = Form.Controls.Find("lbl_taler", true);
            Control[] ControlSucheOrtDatum    = Form.Controls.Find("lbl_ortdatum", true);

            if (ControlSucheSpielername.Length > 0)
            {
                lbl_spielernameundamt = (Label)ControlSucheSpielername[0];
            }
            else if (!NurAusrichten)
            {
                lbl_spielernameundamt      = LabelErstellen("lbl_spielernameundamt", "Herr/Frau Spielername, ohne Amt", new Point(375, 94), new Size(445, 32), 1, EventHandlerMouseDown);
                lbl_spielernameundamt.Font = Grafik.GetStandardFont(Grafik.GetSchriftgGross());
                Form.Controls.Add(lbl_spielernameundamt);
            }
            else
            {
                return;
            }

            if (ControlSucheTaler.Length > 0)
            {
                lbl_taler = (Label)ControlSucheTaler[0];
            }
            else if (!NurAusrichten)
            {
                lbl_taler = LabelErstellen("lbl_taler", 789910.ToStringGeld(), new Point(113, 29), new Size(176, 32), 2, EventHandlerMouseDown);
                Form.Controls.Add(lbl_taler);
            }
            else
            {
                return;
            }

            if (ControlSucheOrtDatum.Length > 0)
            {
                lbl_ortdatum = (Label)ControlSucheOrtDatum[0];
            }
            else if (!NurAusrichten)
            {
                lbl_ortdatum = LabelErstellen("lbl_ortdatum", "Kontor A.D. 1400", new Point(983, 19), new Size(231, 32), 3, EventHandlerMouseDown);
                Form.Controls.Add(lbl_ortdatum);
            }
            else
            {
                return;
            }

            // Ausrichten
            if (lbl_spielernameundamt != null)
            {
                lbl_spielernameundamt.Left = Form.Width / 2 - lbl_spielernameundamt.Width / 2;
            }
            lbl_spielernameundamt.Top = UI.NormH(51, Form.Height);

            lbl_taler.Left = UI.NormB(35, Form.Width);
            lbl_taler.Top  = UI.NormH(23, Form.Height);

            lbl_ortdatum.Left = Form.Width - lbl_ortdatum.Width - UI.NormB(35, Form.Width);
            lbl_ortdatum.Top  = lbl_taler.Top;

            if (!NurAusrichten)
            {
                // Inhalte aktualisieren
                lbl_spielernameundamt.Text = SW.Dynamisch.GetHumWithID(SW.Dynamisch.GetAktiverSpieler()).GetKompletterName();
                TalerAendern(0, ref lbl_taler);

                if (Ort != "")
                {
                    lbl_ortdatum.Text = Ort + " A.D. " + SW.Dynamisch.GetAktuellesJahr().ToString();
                }
            }
        }
예제 #19
0
        private void button3_Click(object sender, EventArgs e)
        {
            refresh_angle();

            // матрицы поворота для вектора n
            double[,] N1 = new double[3, 3] {
                { Math.Cos(beta1 + fi1), -Math.Sin(beta1 + fi1), 0 }, { Math.Sin(beta1 + fi1), Math.Cos(beta1 + fi1), 0 }, { 0, 0, 1 }
            };
            double[,] N2 = new double[3, 3] {
                { Math.Cos(beta2 + fi2), -Math.Sin(beta2 + fi2), 0 }, { Math.Sin(beta2 + fi2), Math.Cos(beta2 + fi2), 0 }, { 0, 0, 1 }
            };
            double[,] N3 = new double[3, 3] {
                { Math.Cos(beta3 + fi3), -Math.Sin(beta3 + fi3), 0 }, { Math.Sin(beta3 + fi3), Math.Cos(beta3 + fi3), 0 }, { 0, 0, 1 }
            };
            double[,] N4 = new double[3, 3] {
                { Math.Cos(beta4 + fi4), -Math.Sin(beta4 + fi4), 0 }, { Math.Sin(beta4 + fi4), Math.Cos(beta4 + fi4), 0 }, { 0, 0, 1 }
            };

            // матрицы поворота для вектора альфа
            double[,] A1 = new double[3, 3] {
                { Math.Cos(beta1 + fi1 + delta1), -Math.Sin(beta1 + fi1 + delta1), 0 }, { Math.Sin(beta1 + fi1 + delta1), Math.Cos(beta1 + fi1 + delta1), 0 }, { 0, 0, 1 }
            };
            double[,] A2 = new double[3, 3] {
                { Math.Cos(beta2 + fi2 + delta2), -Math.Sin(beta2 + fi2 + delta2), 0 }, { Math.Sin(beta2 + fi2 + delta2), Math.Cos(beta2 + fi2 + delta2), 0 }, { 0, 0, 1 }
            };
            double[,] A3 = new double[3, 3] {
                { Math.Cos(beta3 + fi3 + delta3), -Math.Sin(beta3 + fi3 + delta3), 0 }, { Math.Sin(beta3 + fi3 + delta3), Math.Cos(beta3 + fi3 + delta3), 0 }, { 0, 0, 1 }
            };
            double[,] A4 = new double[3, 3] {
                { Math.Cos(beta4 + fi4 + delta4), -Math.Sin(beta4 + fi4 + delta4), 0 }, { Math.Sin(beta4 + fi4 + delta4), Math.Cos(beta4 + fi4 + delta4), 0 }, { 0, 0, 1 }
            };

            // матрицы поворота для вектора r
            double[,] R1 = new double[3, 3] {
                { Math.Cos(fi1), -Math.Sin(fi1), 0 }, { Math.Sin(fi1), Math.Cos(fi1), 0 }, { 0, 0, 1 }
            };
            double[,] R2 = new double[3, 3] {
                { Math.Cos(fi2), -Math.Sin(fi2), 0 }, { Math.Sin(fi2), Math.Cos(fi2), 0 }, { 0, 0, 1 }
            };
            double[,] R3 = new double[3, 3] {
                { Math.Cos(fi3), -Math.Sin(fi3), 0 }, { Math.Sin(fi3), Math.Cos(fi3), 0 }, { 0, 0, 1 }
            };
            double[,] R4 = new double[3, 3] {
                { Math.Cos(fi4), -Math.Sin(fi4), 0 }, { Math.Sin(fi4), Math.Cos(fi4), 0 }, { 0, 0, 1 }
            };

            DataClass.clear_vectors();

            //повороты векторов => расчет векторов
            DataClass.alpha1 = Matrix_Vector_Multiply(A1, DataClass.alpha1);
            DataClass.alpha2 = Matrix_Vector_Multiply(A2, DataClass.alpha2);
            DataClass.alpha3 = Matrix_Vector_Multiply(A3, DataClass.alpha3);
            DataClass.alpha4 = Matrix_Vector_Multiply(A4, DataClass.alpha4);

            DataClass.n1 = Matrix_Vector_Multiply(N1, DataClass.n1);
            DataClass.n2 = Matrix_Vector_Multiply(N2, DataClass.n2);
            DataClass.n3 = Matrix_Vector_Multiply(N3, DataClass.n3);
            DataClass.n4 = Matrix_Vector_Multiply(N4, DataClass.n4);

            DataClass.r1 = Matrix_Vector_Multiply(R1, DataClass.r1);
            DataClass.r2 = Matrix_Vector_Multiply(R2, DataClass.r2);
            DataClass.r3 = Matrix_Vector_Multiply(R3, DataClass.r3);
            DataClass.r4 = Matrix_Vector_Multiply(R4, DataClass.r4);

            int    scale = 350;
            double k     = 0.1;

            Grafik plot_r1 = new Grafik(new double[2] {
                0, DataClass.r1[0]
            }, new double[2] {
                0, DataClass.r1[1]
            }, pictureBox2, pictureBox2.Size, Color.Red, scale, scale);
            Grafik plot_r2 = new Grafik(new double[2] {
                0, DataClass.r2[0]
            }, new double[2] {
                0, DataClass.r2[1]
            }, pictureBox2, pictureBox2.Size, Color.Blue, scale, scale);
            Grafik plot_r3 = new Grafik(new double[2] {
                0, DataClass.r3[0]
            }, new double[2] {
                0, DataClass.r3[1]
            }, pictureBox2, pictureBox2.Size, Color.Green, scale, scale);

            Grafik plot_n1 = new Grafik(new double[2] {
                DataClass.r1[0], k * (DataClass.n1[0]) + DataClass.r1[0]
            }, new double[2] {
                DataClass.r1[1], k * (DataClass.n1[1]) + DataClass.r1[1]
            }, pictureBox2, pictureBox2.Size, Color.Red, scale, scale);
            Grafik plot_n2 = new Grafik(new double[2] {
                DataClass.r2[0], k * (DataClass.n2[0]) + DataClass.r2[0]
            }, new double[2] {
                DataClass.r2[1], k * (DataClass.n2[1]) + DataClass.r2[1]
            }, pictureBox2, pictureBox2.Size, Color.Blue, scale, scale);
            Grafik plot_n3 = new Grafik(new double[2] {
                DataClass.r3[0], k * (DataClass.n3[0]) + DataClass.r3[0]
            }, new double[2] {
                DataClass.r3[1], k * (DataClass.n3[1]) + DataClass.r3[1]
            }, pictureBox2, pictureBox2.Size, Color.Green, scale, scale);

            Grafik plot_a1 = new Grafik(new double[2] {
                DataClass.r1[0], k * (DataClass.alpha1[0]) + DataClass.r1[0]
            }, new double[2] {
                DataClass.r1[1], k * (DataClass.alpha1[1]) + DataClass.r1[1]
            }, pictureBox2, pictureBox2.Size, Color.Red, scale, scale);
            Grafik plot_a2 = new Grafik(new double[2] {
                DataClass.r2[0], k * (DataClass.alpha2[0]) + DataClass.r2[0]
            }, new double[2] {
                DataClass.r2[1], k * (DataClass.alpha2[1]) + DataClass.r2[1]
            }, pictureBox2, pictureBox2.Size, Color.Blue, scale, scale);
            Grafik plot_a3 = new Grafik(new double[2] {
                DataClass.r3[0], k * (DataClass.alpha3[0]) + DataClass.r3[0]
            }, new double[2] {
                DataClass.r3[1], k * (DataClass.alpha3[1]) + DataClass.r3[1]
            }, pictureBox2, pictureBox2.Size, Color.Green, scale, scale);



            plot_r1.Step_of_grid = 0.1;

            plot_r1.Setka();
            plot_r1.ris();
            plot_r2.ris();
            plot_r3.ris();
            plot_n1.ris();
            plot_n2.ris();
            plot_n3.ris();
            plot_a1.ris();
            plot_a2.ris();
            plot_a3.ris();

            if (wheels == 4)
            {
                Grafik plot_r4 = new Grafik(new double[2] {
                    0, DataClass.r4[0]
                }, new double[2] {
                    0, DataClass.r4[1]
                }, pictureBox2, pictureBox2.Size, Color.Gold, scale, scale);
                Grafik plot_n4 = new Grafik(new double[2] {
                    DataClass.r4[0], k * (DataClass.n4[0]) + DataClass.r4[0]
                }, new double[2] {
                    DataClass.r4[1], k * (DataClass.n4[1]) + DataClass.r4[1]
                }, pictureBox2, pictureBox2.Size, Color.Gold, scale, scale);
                Grafik plot_a4 = new Grafik(new double[2] {
                    DataClass.r4[0], k * (DataClass.alpha4[0]) + DataClass.r4[0]
                }, new double[2] {
                    DataClass.r4[1], k * (DataClass.alpha4[1]) + DataClass.r4[1]
                }, pictureBox2, pictureBox2.Size, Color.Gold, scale, scale);

                plot_r4.ris();
                plot_n4.ris();
                plot_a4.ris();
            }
        }
예제 #20
0
        private async void frmKampfereignisse_Shown(object sender, EventArgs e)
        {
            Kampfberechnung Kampfklasse = new Kampfberechnung();
            KampfErgebnis   Ergebnis;
            List <Lib.Gameplay.Kampf.Kampf> lstKaempfe = new List <Lib.Gameplay.Kampf.Kampf>();

            // KI Aktionen ermitteln und durchführen (bezogen auf den Stützpunkt)
            foreach (Stuetzpunkt Stuetzpunkt in SW.Dynamisch.GetStuetzpunkte())
            {
                if (Stuetzpunkt.Besitzer <= SW.Statisch.GetMinKIID())  // Ist es ein menschlicher Spieler?
                {
                    continue;
                }

                string sText = "";

                if (Stuetzpunkt.Art == EnumStuetzpunktArt.Zollburg)
                {
                    sText = (Stuetzpunkt as Zollburg).RundenendeKIAktionenDurchfuehren();
                }
                else if (Stuetzpunkt.Art == EnumStuetzpunktArt.Raeuberlager)
                {
                    sText = (Stuetzpunkt as Raeuberlager).RundenendeKIAktionenDurchfuehren();
                }

                if (sText != "")
                {
                    trtText.AppendText(sText + "\n\n");
                    ZumEndeScrollen();
                    await AufRechtsklickWarten();
                }
            }

            SW.Dynamisch.LandsicherheitenInitialisieren();

            lstKaempfe = Kampfklasse.ErmittleStattfindendeKaempfe();

            string NameAngreifer       = "";
            string NameVerteidiger     = "";
            string NameSpielerKarawane = "";
            Color  TextColor           = trtText.ForeColor;

            foreach (Lib.Gameplay.Kampf.Kampf Kampf in lstKaempfe)
            {
                Ergebnis = Kampfklasse.BerechneKampfErgebnis(Kampf);
                Kampfklasse.KampfErgebnisAnwenden(Ergebnis);

                string[] Texte = Ergebnis.Zusammenfassung.Split(new string[] { "\n\n" }, StringSplitOptions.RemoveEmptyEntries);
                NameAngreifer = SW.Dynamisch.GetSpWithID(Ergebnis.SpielerIDAngreifer).GetKompletterName();

                if (Ergebnis.SpielerIDVerteidiger > 0)
                {
                    NameVerteidiger = SW.Dynamisch.GetSpWithID(Ergebnis.SpielerIDVerteidiger).GetKompletterName();
                }
                else
                {
                    NameVerteidiger = "";
                }

                if (Ergebnis.KampfArt == EnumKampfArt.KarawanenPluenderung)
                {
                    NameSpielerKarawane = SW.Dynamisch.GetSpWithID(Ergebnis.Karawane.SpielerID).GetKompletterName();
                }
                else
                {
                    NameSpielerKarawane = "";
                }

                foreach (string Text in Texte)
                {
                    foC_MusikInstanz.MusikEinschieben_Kampf();

                    if (Text.Contains("Kampf entbrennt"))
                    {
                        foC_MusikInstanz.PlaySound(Properties.Resources.kampf_loop);
                    }
                    else if (Text.Contains("Triumph"))
                    {
                        foC_MusikInstanz.StopSound();
                    }

                    if (Text.Contains("|"))
                    {
                        string[] Teilstrings = Text.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string Str in Teilstrings)
                        {
                            if ((Str != NameAngreifer) && (Str != NameVerteidiger) && (Str != NameSpielerKarawane))
                            {
                                trtText.AddText(Str);
                                continue;
                            }

                            TextColor = trtText.ForeColor;

                            for (int i = 1; i <= SW.Dynamisch.GetAktivSpielerAnzahl(); i++)  // Alle menschlichen Spieler durchgehen
                            {
                                if (SW.Dynamisch.GetSpWithID(i).GetKompletterName() == Str)
                                {
                                    TextColor = Color.DarkRed;
                                    break;
                                }
                            }

                            trtText.AddText(Str, TextColor, new Font(Grafik.GetStandardFont(Convert.ToInt16(trtText.Font.Size)), FontStyle.Bold));  // Text eine Spielers immer fett formatieren (wenn menschlich, dann auch dunkelrot)
                        }

                        trtText.AddText("\n\n");
                    }
                    else
                    {
                        trtText.AppendText(Text + "\n\n");
                    }

                    ZumEndeScrollen();
                    await AufRechtsklickWarten();
                }
            }

            if (trtText.Text == "")
            {
                trtText.AppendText("Dieses Jahr hat sich nichts Besonderes ereignet.");
                ZumEndeScrollen();
                await AufRechtsklickWarten();
            }

            Close();
        }
예제 #21
0
 protected void CurStandardActive()
 {
     Cursor = NativeMethods.LoadCustomCursor(Application.StartupPath + "\\" + Grafik.GetStandardCursorName());
     SetCursorForControls();
 }