Exemple #1
0
 private void btnRecruit_Click(object sender, EventArgs e)
 {
     if (numCount.Value > 0)
     {
         if (frmGame.World.Faction[frmGame.Player].Money - frmGame.World.Unit[unitCard.UnitID].Price * (int)numCount.Value >= 0)
         {
             if (Notice.Show(
                     frmGame.World.Unit[unitCard.UnitID].Description + Environment.NewLine +
                     "___________" + Environment.NewLine +
                     "Recruit this " + lblPrice.Text + "?",
                     frmGame.World.Unit[unitCard.UnitID].Name, "Recruitment")
                 == DialogResult.Yes)
             {
                 frmGame.RecruitUnit(frmGame.Player, unitCard.UnitID, (int)numCount.Value);
                 numCount.Value = 0;
                 SelectUnit(unitCard.UnitID);
                 lblMoney.Text = frmGame.World.Faction[frmGame.Player].Money + " gold";
             }
         }
     }
 }
Exemple #2
0
        public void Add(string msg, string title, string imageSound)
        {
            NoticeIcon icn = new NoticeIcon(imageSound);

            Tip.SetToolTip(icn, title);

            icn.Click += delegate
            {
                Notice.Show(msg, title, imageSound);
                RemoveNotice(icn);
            };

            icn.Disposed += delegate
            {
                base.Controls.Remove(icn);
                ArrangeNotices();
            };

            base.Controls.Add(icn);
            ArrangeNotices();
        }
Exemple #3
0
        private void PopulateList()
        {
            try
            {
                string[,] ss = new string[500, 500];
                int rows = 0, cols = 0;

                using (WebClient wc = new WebClient())
                {
                    string[] sheet = wc.DownloadString("https://docs.google.com/spreadsheet/pub?key=0Am6tel9lYl4ydDEyZUhyYUtNYmFGY2MtODIxUHFxcUE&output=txt").Split('\n');
                    rows = sheet.Length;

                    for (int i = 0; i < rows; i++)
                    {
                        string[] col = sheet[i].Split('\t');

                        for (int j = 0; j < col.Length; j++)
                        {
                            ss[i, j] = col[j];
                        }

                        if (col.Length > cols)
                        {
                            cols = col.Length;
                        }
                    }
                }

                maps = 0;
                for (int i = 1; i < rows; i++)
                {
                    if (ss[i, 0] != string.Empty)
                    {
                        MapListItem mli = new MapListItem(ss[i, 0], ss[i, 1], ss[i, 2], ss[i, 3], ss[i, 4]);

                        mli.Width    = pnlMaps.Width - 30;
                        mli.Location = new Point(0, maps * mli.Height + maps);
                        mli.Click   += mli_Click;

                        if (Directory.Exists(NarivianClass.MapsDirectory + mli.MapInternalName))
                        {
                            mli.Installed = true;

                            XmlDocument xml = new XmlDocument();
                            xml.Load(NarivianClass.MapsDirectory + mli.MapInternalName + "\\World.XML");

                            string version = xml.SelectSingleNode("World/MapVersion").InnerText;

                            if (VersionChecker.CompareVersions(version, mli.MapVersion) >= 0)
                            {
                                mli.UpToDate = true;
                            }
                            else
                            {
                                mli.UpToDate = false;
                            }
                        }
                        else
                        {
                            mli.Installed = false;
                            mli.UpToDate  = false;
                        }

                        pnlMaps.Controls.Add(mli);
                        maps += 1;
                    }
                }
            }
            catch
            {
                Notice.Show("Cannot access maps database\n\nPlease check your internet connection", "Error", "GameVersion");
            }
        }
Exemple #4
0
        public static void CheckVersion(bool silent = false)
        {
            new Thread((ThreadStart) delegate
            {
                try
                {
                    string[,] ss = new string[500, 500];
                    int rows     = 0, cols = 0;

                    bool ok = false;

                    using (WebClient wc = new WebClient())
                    {
                        string[] sheet = wc.DownloadString("https://docs.google.com/spreadsheet/pub?key=0Am6tel9lYl4ydERWZ3Vwak1LUGxfUmxFX1ljQllZblE&single=true&gid=0&output=txt").Split('\n');
                        rows           = sheet.Length;

                        for (int i = 0; i < rows; i++)
                        {
                            string[] col = sheet[i].Split('\t');

                            for (int j = 0; j < col.Length; j++)
                            {
                                ss[i, j] = col[j];
                            }

                            if (col.Length > cols)
                            {
                                cols = col.Length;
                            }
                        }
                    }

                    for (int i = 0; i <= rows; i++)
                    {
                        if (ss[i, 0] == Assembly.GetExecutingAssembly().GetName().Name)
                        {
                            string ver  = ss[i, 1];
                            string link = ss[i, 2];

                            ok = true;

                            if (CompareVersions(Application.ProductVersion.ToString(), ver) < 0)
                            {
                                ShowUpdateDialog(ver, link);
                                Log.WriteLine("INFO: New version availabile (" + ver + ") at " + link);
                            }
                            else if (!silent)
                            {
                                Notice.Show("Congratulations, you have the latest version!\n\nUpdate not necessary",
                                            "No update avalabile!", "GameVersion");
                            }
                        }
                    }

                    if (ok == false)
                    {
                        if (silent == false)
                        {
                            ShowErrorDialog(new Exception());
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (silent == false)
                    {
                        ShowErrorDialog(ex);
                    }
                }
            }).Start();
        }
        private void base_MouseUp(object sender, MouseEventArgs e)
        {
            Cursor = CustomCursor.Load("Default.CUR");

            string body = World.Building[BuildingID].Description + Environment.NewLine + Environment.NewLine;

            if (BuildingID != 0)
            {
                body += "Maintenance: " + World.Building[BuildingID].Maintenance;

                if (World.Building[BuildingID].Income != 0)
                {
                    body += Environment.NewLine + "Income: " + World.Building[BuildingID].Income;
                }
                if (World.Building[BuildingID].AttackBonus != 0)
                {
                    body += Environment.NewLine + "Attack Bonus: " + World.Building[BuildingID].AttackBonus;
                }
                if (World.Building[BuildingID].DefenceBonus != 0)
                {
                    body += Environment.NewLine + "Defence Bonus: " + World.Building[BuildingID].DefenceBonus;
                }
                if (World.Building[BuildingID].RecruitmentBonus != 0)
                {
                    body += Environment.NewLine + "Recruitment Bonus: " + World.Building[BuildingID].RecruitmentBonus;
                }
                if (World.Building[BuildingID].ReligionInfluence != 0)
                {
                    body += Environment.NewLine + "Religion Influence: " + World.Building[BuildingID].ReligionInfluence;
                }
            }
            else
            {
                if (World.Region[RegionID].Type == RegionType.Capital)
                {
                    body += "Income: " + World.BaseRegionIncome * 2;
                }
                else
                {
                    body += "Income: " + World.BaseRegionIncome;
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                Notice.Show(body, BuildingName, "Buildings\\" + BuildingName);
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (BuildingID != 0)
                {
                    if (Notice.Show(
                            "Do you want to demolish this building?",
                            BuildingName, "Buildings\\" + BuildingName) == DialogResult.Yes)
                    {
                        MessageBox.Show("Inca nu se pot sterge cladirile decat din meniu sau din consola cu 'region removebuilding <regId> <buildingId>'");
                    }
                    else
                    {
                        Notice.Show("You cannot demolish this building!", BuildingName, "Buildings\\" + BuildingName);
                    }
                }
            }
        }