Exemple #1
0
 /// <summary>
 /// Make peace with another nation
 /// </summary>
 /// <param name="nation">Nation to make peace with</param>
 public void MakePeaceWith(Nation nation)
 {
     if (!Allies.Contains(nation))
         Allies.Add(nation);
     if (Enemies.Contains(nation))
         Enemies.Remove(nation);
 }
Exemple #2
0
 /// <summary>
 /// Go to war with another nation
 /// </summary>
 /// <param name="nation">Nation to go to war with</param>
 public void GoToWarWith(Nation nation)
 {
     if (!Enemies.Contains(nation))
         Enemies.Add(nation);
     if (Allies.Contains(nation))
         Allies.Remove(nation);
 }
        public static bool TestRace( PlayerMobile m, Nation nation1, Nation nation2, Nation nation3, Nation nation4 )
        {
            if( TestRace( m, nation1 ) || TestRace( m, nation2 ) || TestRace( m, nation3 ) || TestRace( m, nation4 ) )
                return true;

            return false;
        }
        public static bool TestRace( PlayerMobile m, Nation nation1 )
        {
            if( m.Nation == nation1 )
                return true;

            return false;
        }
		public LobbyForm(List<CrewSlotConfiguration> crewSlotConfigurations, Nation selectedNation, NationSelectForm nationSelectForm, VehicleType vehicleType = null)
		{
			InitializeComponent();

			_crewSlotConfigurations = crewSlotConfigurations;
			_nationSelectForm = nationSelectForm;

			if(_vehicleType == null && vehicleType != null)
				_vehicleType = vehicleType;

			Rectangle screenBounds = Screen.FromControl(this).Bounds;

			_groupBoxSize = new Size(149, 85);
			_vehicleTypeSize = new Size(138, 32);
			_crewSkillsSize = new Size(138, 32);

			ScreenWidth = screenBounds.Width;
			int offsetFromTopOfScreen = screenBounds.Height - Constants.OffsetFromTheBottomOfTheScreenForTheLobbyFormToStart;

			NationStartingXCoordinate = 198;

			Top = offsetFromTopOfScreen;
			Width = ScreenWidth;

			cbSelectedNation.Items.AddRange(Enum.GetValues(typeof(Nation)).Cast<object>().ToArray());

			SetSelectedNationAndStartingCoordinates(selectedNation);
			PopulateGroupBoxDictionary();

			cbSelectedNation_SelectedIndexChanged(null, null);
		}
		private void SetSelectedNationAndStartingCoordinates(Nation selectedNation)
		{
			_selectedNation = selectedNation;

			// Pixel perfect for 1920 wide, these magic numbers don't work for other resolutions though :-(
			if (_selectedNation == Nation.American)
			{
				NationStartingXCoordinate = 198;
			}
			else if (_selectedNation == Nation.German)
			{
				NationStartingXCoordinate = 224;
			}
			else if (_selectedNation == Nation.Russian)
			{
				NationStartingXCoordinate = 250;
			}
			else if (_selectedNation == Nation.British)
			{
				NationStartingXCoordinate = 276;
			}
			else if (_selectedNation == Nation.Japanese)
			{
				NationStartingXCoordinate = 302;
			}
		}
		private void SetupElements(NationSelectForm nationSelectForm, Nation selectedNation, int numberOfCrewSlots)
		{
			_nationSelectForm = nationSelectForm;
			_selectedNation = selectedNation;
			_numberOfCrewSlots = numberOfCrewSlots;
			_vehicleType = new VehicleType();	// Crappy default value
			_crewSlotData = Helpers.LoadCrewSlotDataFromFile(CrewSlotDataFileName) ?? new List<CrewSlotData>();	// Load from file, if null is returned, creates a new (empty) list

			if (_crewSlotData.Count < 1) // Happens only when nothing comes from reading the file with data.
			{
				_crewSlotData.Add(new CrewSlotData(_selectedNation));
			}

			#region Setup fields for form controls
			List<string> vehicleNames = Helpers.LoadVehicleDataFromJson(Helpers.GetVehicleJsonDataForNation(_selectedNation)).OrderBy(v => v.VehicleName).Select(v => v.VehicleName).ToList();
			_faytVehicleSource = new AutoCompleteStringCollection();
			_faytVehicleSource.AddRange(vehicleNames.ToArray());

			List<string> vehicleTypes = Helpers.LoadVehicleTypesDataFromJson(Helpers.GetVehicleTypesJsonData()).OrderBy(t => t.VehicleTypeLongName).Select(t => t.VehicleTypeLongName).ToList();
			_faytVehicleTypeSource = new AutoCompleteStringCollection();
			_faytVehicleTypeSource.AddRange(vehicleTypes.ToArray());

			_crewSlotConfigurations = new List<CrewSlotConfiguration>();
			_crewSlotGroupBoxes = new Dictionary<int, GroupBox>();
			_crewNameComboBoxes = new Dictionary<int, ComboBox>();
			_crewTrainedMembersNumericScrollers = new Dictionary<int, NumericUpDown>();
			_crewVehicleTypeComboBoxes = new Dictionary<int, ComboBox>();
			#endregion

			SetFormHeight();
			Helpers.ChangeBackground(this, selectedNation);
			PopulateFormControls();
		}
Exemple #8
0
 public static bool IsValid(string citizenNumber,Nation nation = Nation.Turkey)
 {
     switch (nation)
     {
         case Nation.Turkey: return Turkey(citizenNumber);
         default: return false;
     }
 }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            m_CriminalNation = (Nation) reader.ReadInt();
            int version = reader.ReadInt();

            Delete();
        }
		public CrewSlotConfiguration(int crewId, Nation crewNation, string vehicleName, int trainedMembers, VehicleTypeEnum vehicleType, VehicleCategoryEnum vehicleCategory)
		{
			CrewId = crewId;
			CrewNation = crewNation;
			VehicleName = vehicleName;
			TrainedMembers = trainedMembers;
			VehicleType = vehicleType;
			VehicleCategory = vehicleCategory;
		}
        public List<Country> getAllCountriesOfState(Nation state)
        {
            List<Country> listCo = new List<Country>();
            var coutries = db.Coutries.Where(s => s.idState == state.Id);

            foreach (CarpoolingDAL.Coutry mem in coutries) {
                listCo.Add(RepositoryUtility.createCoutryFromDALCoutry(mem as CarpoolingDAL.Coutry));
            }
            return listCo;
        }
 public BaseStorageContainer( int itemid, Nation nation )
     : base(itemid)
 {
     Weight = 10.0;
     LockLevel = 200;
     MaxLockLevel = 200;
     RequiredSkill = 200;
     Name = "For Sale: " + m_Price + " copper pieces";
     Movable = false;
     Nation = nation;
 }
Exemple #13
0
        public Treasury(Nation n)
            : base(0x9A8)
        {
            Name = "a treasury";
            Nation = n;

            LockLevel = 350;
            MaxLockLevel = 400;

            Treasuries.Add( this );
        }
        public XmlCriminal(Mobile attacher)
        {
            m_Attacher = attacher;

            if ((Attacher is PlayerMobile) && (Attacher as PlayerMobile).Nation != null && (Attacher as PlayerMobile).Nation != Nation.None)
                m_CriminalNation = (Attacher as PlayerMobile).Nation;
            else if ((Attacher is BaseCreature) && (Attacher as BaseCreature).Nation != null && (Attacher as BaseCreature).Nation != Nation.None)
                m_CriminalNation = (Attacher as BaseCreature).Nation;
            else
                Delete();

            Name = m_CriminalNation.ToString();
        }
Exemple #15
0
 /// <summary>
 /// Change player's nationality
 /// </summary>
 /// <param name="new_nation">Nation to switch to</param>
 public void ChangeNationality(Nation new_nation)
 {
     //make sure you aren't trying to join your own nation and that you aren't trying to join a nation that your current nation is at war with
     //maybe you should be able to join nations at war, but for now, whatever
     if (new_nation != Nationality && !Nationality.Enemies.Contains(new_nation))
     {
         Nationality = new_nation;
         foreach (Nation n in new_nation.Allies)
             ModifyReputation(n.Name, 10);
         foreach (Nation n in new_nation.Enemies)
             ModifyReputation(n.Name, -10);
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nationality"></param>
        public void Bind(Nation nationality)
        {
            Items.Clear();

            List<string> orderedCountries = (from c in System.Enum.GetNames(typeof(Nation)) orderby c select c).ToList();

            foreach (string n in orderedCountries)
            {
                byte countryID = ((byte)((Nation)System.Enum.Parse(typeof(Nation), n, true)));
                DropDownListItem item = new DropDownListItem(n.ToString(), countryID.ToString());
                if ((byte)nationality == countryID) { item.Selected = true; }
                Items.Add(item);
            }
        }
		public NationData(Nation nation)
		{
			Nation = nation;

			CrewString = new Dictionary<int, string>();
			CrewLevel = new Dictionary<int, int>();
			CrewGunner = new Dictionary<int, int>();
			CrewTraining = new Dictionary<int, CrewTraining>();
			for (var x = 1; x < 10; x++)
			{
				CrewString.Add(x, "");
				//CrewLevel.Add(x, 1);
				//CrewGunner.Add(x, 1);
				CrewTraining.Add(x, WTnote.CrewTraining.Normal);
			}
		}
		public static string GetVehicleJsonDataForNation(Nation nation)
		{
			switch (nation)
			{
				case Nation.American:
					return Resources.usa_air_json;
				case Nation.German:
					return Resources.germany_air_json;
				case Nation.Russian:
					return Resources.ussr_air_json;
				case Nation.British:
					return Resources.britain_air_json;
				case Nation.Japanese:
					return Resources.japan_air_json;
			}

			return null;
		}
		public CrewSlotData(Nation nation)
		{
			Nation = nation;

			CrewId = new Dictionary<int, int>();
			CrewVehicleName = new Dictionary<int, string>();
			CrewTrainedMember = new Dictionary<int, int>();
			CrewVehicleType = new Dictionary<int, VehicleTypeEnum>();
			CrewVehicleCategory = new Dictionary<int, VehicleCategoryEnum>();

			// Add form defaults
			for (var i = 0; i < 9; i++)	// find a way to pass in the number of slots to do
			{
				CrewId.Add(i, i + 1);
				CrewVehicleName.Add(i, "");
				CrewTrainedMember.Add(i, 1);
				CrewVehicleType.Add(i, VehicleTypeEnum.Attacker);
				CrewVehicleCategory.Add(i, VehicleCategoryEnum.Aviation);	// TODO: Change this hardcoded value if Ground Forces/Naval units are added
			}
		}
        public MhordulGuard( int choice )
            : base(Nation.Mhordul)
        {
            SetStr( 150 );
            SetDex( 75 );
            SetInt( 75 );

            SetDamage( 10, 15 );

            SetHits( 400 );

            SetDamageType( ResistanceType.Blunt, 100 );

            SetResistance( ResistanceType.Blunt, 10 );
            SetResistance( ResistanceType.Piercing, 10 );
            SetResistance( ResistanceType.Slashing, 10 );

            SetSkill( SkillName.Anatomy, 100.0 );
            SetSkill( SkillName.Archery, 100.0 );
            SetSkill( SkillName.Fencing, 100.0 );
            SetSkill( SkillName.Macing, 100.0 );
            SetSkill( SkillName.Swords, 100.0 );
            SetSkill( SkillName.Tactics, 100.0 );
            SetSkill( SkillName.Polearms, 100.0 );
            SetSkill( SkillName.ExoticWeaponry, 100.0 );
            SetSkill( SkillName.Axemanship, 100.0 );
            SetSkill( SkillName.UnarmedFighting, 100.0 );

            this.Fame = 12000;

            this.VirtualArmor = 0;

            if( choice > 3 || choice < 1 )
                choice = 0;

            BaseKhaerosMobile.RandomGuardEquipment( this, Nation.Mhordul, choice );

            m_speechInterval = DateTime.Now; // Initiatlizing speech delay in the constructor for criminal recognition system.
            ((IKhaerosMobile)this).Feats.SetFeatLevel(FeatList.Alertness, Utility.Random(4)); // Giving guards the potential to detect hidden mobiles.
            guardNation = Nation.Mhordul;
        }
 //private GameObject projectile_skill;
 public Element(int n_4)
 {
     switch(n_4 % 4){
     case 0:
         this.nation = Nation.Fire;
         //projectile_skill = (GameObject)Resources.Load("FireBend", typeof(GameObject));
         break;
     case 1:
         this.nation = Nation.Water;
         //projectile_skill = (GameObject)Resources.Load("WaterBend", typeof(GameObject));
         break;
     case 2:
         this.nation = Nation.Earth;
         //projectile_skill = (GameObject)Resources.Load("EarthBend", typeof(GameObject));
         break;
     case 3:
         this.nation = Nation.Air;
         //projectile_skill = (GameObject)Resources.Load("AirBend", typeof(GameObject));
         break;
     }
 }
		public static void ChangeBackground(Control control, Nation nation)
		{
			switch (nation)
			{
				case Nation.American:
					control.BackgroundImage = Resources.Usa_Selected;
					break;
				case Nation.German:
					control.BackgroundImage = Resources.Germany_Selected;
					break;
				case Nation.Russian:
					control.BackgroundImage = Resources.Ussr_Selected;
					break;
				case Nation.British:
					control.BackgroundImage = Resources.Britain_Selected;
					break;
				case Nation.Japanese:
					control.BackgroundImage = Resources.Japan_Selected;
					break;
			}

			control.BackgroundImageLayout = ImageLayout.Stretch;
		}
Exemple #23
0
 public static Troops Create(int monsterId, int unitsElementAmount, Nation nationality)
 {
     return(new Troops {
         MonsterId = monsterId, Amount = unitsElementAmount, Nationality = nationality
     });
 }
Exemple #24
0
        private static void Main(string[] args)
        {
            string paramNationId = "";
            string paramApiKey   = "";

            if (args.Length % 2 != 0 || args.Length == 0)
            {
                Console.WriteLine("Parameters: -nationid ### -apikey abcd###");
                return;
            }

            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-nationid":
                    paramNationId = args[i + 1];
                    break;

                case "-apikey":
                    paramApiKey = args[i + 1];
                    break;
                }
            }

            using (var httpClient = new HttpClient())
            {
                var nationId = paramNationId;
                var key      = paramApiKey;

                httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
                var    response = httpClient.GetStringAsync(new Uri("http://politicsandwar.com/api/nation/id=" + nationId + "&key=" + key)).Result;
                Nation nation   = JsonConvert.DeserializeObject <Nation>(response);

                var cities = new List <City>();
                foreach (var cityid in nation.cityids)
                {
                    var result      = httpClient.GetStringAsync(new Uri("http://politicsandwar.com/api/city/id=" + cityid + "&key=" + key)).Result;
                    var cityJSON    = JsonConvert.DeserializeObject <City>(result);
                    var infraNeeded = (((cityJSON.Infrastructure - 2500)) * -1);
                    cityJSON.InfrastructureNeeded = (infraNeeded > 0) ? infraNeeded : 0;
                    cities.Add(cityJSON);
                }

                FileInfo       file    = new FileInfo($"{ DateTime.Now.ToString("yyyyMMdd.hhmmssstt") }.xlsx");
                ExcelPackage   package = new ExcelPackage(file);
                ExcelWorksheet ws      = package.Workbook.Worksheets.Add(cities[0].Nation);
                ws.Cells[1, 1].LoadFromCollection(cities, true);

                // Header Row
                ws.Cells[1, 1, 1, 53].Style.Font.Bold = true;
                ws.Cells[1, 1, 1, 53].Style.Font.Color.SetColor(System.Drawing.Color.White);
                ws.Cells[1, 1, 1, 53].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
                ws.Cells[1, 1, 1, 53].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.DarkBlue);

                // Total Row
                ws.Cells[cities.Count() + 2, 1].Value = "Totals";
                ws.Cells[cities.Count() + 2, 1, cities.Count() + 2, 53].Style.Font.Bold        = true;
                ws.Cells[cities.Count() + 2, 1, cities.Count() + 2, 53].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
                ws.Cells[cities.Count() + 2, 1, cities.Count() + 2, 53].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightBlue);
                package.SaveAs(file);

                return;
            }
        }
Exemple #25
0
 public CopyOfDossier(Nation nation) => (Nation, TurnOfReport) = (nation, 0); // turn will be set by server
Exemple #26
0
    protected override void Execute(WorldSimulation Model, GameEventHandler Hanlder)
    {
        Nation newNation = Model.CreateNation(Capital);

        Model.AddLog("A new nation " + newNation.Name + " has emerged. It has called its capital " + newNation.Capital.Name + ".");
    }
 public void Update(Nation obj)
 {
     DbSet.Update(obj);
 }
 public NationPage(Nation nation) : base(nation)
 {
     InitializeComponent();
 }
Exemple #29
0
    public void UpdateArmyTable()
    {
        App          app          = UnityEngine.Object.FindObjectOfType <App>();
        Nation       player       = State.getNations()[app.GetHumanIndex()];
        MilitaryForm militaryForm = player.GetMilitaryForm();

        Text infantryAttack = armyTable.Rows[1].Cells[1].GetComponentInChildren <Text>();

        infantryAttack.text = militaryForm.infantry.AttackStrength.ToString();

        Text cavAttack = armyTable.Rows[1].Cells[2].GetComponentInChildren <Text>();

        cavAttack.text = militaryForm.cavalry.AttackStrength.ToString();

        Text artAttack = armyTable.Rows[1].Cells[3].GetComponentInChildren <Text>();

        artAttack.text = militaryForm.artillery.AttackStrength.ToString();

        Text fighterAttack = armyTable.Rows[1].Cells[4].GetComponentInChildren <Text>();

        fighterAttack.text = militaryForm.fighter.AttackStrength.ToString();

        Text tankAttack = armyTable.Rows[1].Cells[5].GetComponentInChildren <Text>();

        tankAttack.text = militaryForm.tank.AttackStrength.ToString();

        Text infantryDefend = armyTable.Rows[2].Cells[1].GetComponentInChildren <Text>();

        infantryDefend.text = militaryForm.infantry.DefenseStrength.ToString();

        Text cavDefend = armyTable.Rows[2].Cells[2].GetComponentInChildren <Text>();

        cavDefend.text = militaryForm.cavalry.DefenseStrength.ToString();

        Text artDefend = armyTable.Rows[2].Cells[3].GetComponentInChildren <Text>();

        artDefend.text = militaryForm.artillery.DefenseStrength.ToString();

        Text fighterDefend = armyTable.Rows[2].Cells[4].GetComponentInChildren <Text>();

        fighterDefend.text = militaryForm.fighter.DefenseStrength.ToString();

        Text tankDefend = armyTable.Rows[2].Cells[5].GetComponentInChildren <Text>();

        tankDefend.text = militaryForm.tank.DefenseStrength.ToString();



        Text InfantryShock = armyTable.Rows[3].Cells[1].GetComponentInChildren <Text>();

        InfantryShock.text = militaryForm.infantry.Shock.ToString();

        Text CavShock = armyTable.Rows[3].Cells[2].GetComponentInChildren <Text>();

        CavShock.text = militaryForm.cavalry.Shock.ToString();

        Text ArtShock = armyTable.Rows[3].Cells[3].GetComponentInChildren <Text>();

        ArtShock.text = militaryForm.artillery.Shock.ToString();

        Text FighterShock = armyTable.Rows[3].Cells[4].GetComponentInChildren <Text>();

        FighterShock.text = militaryForm.fighter.Shock.ToString();

        Text TankShock = armyTable.Rows[3].Cells[5].GetComponentInChildren <Text>();

        TankShock.text = militaryForm.tank.Shock.ToString();

        Text InfantryAmmo = armyTable.Rows[4].Cells[1].GetComponentInChildren <Text>();

        InfantryAmmo.text = militaryForm.infantry.AmmoUse.ToString();

        Text CavAmmo = armyTable.Rows[4].Cells[2].GetComponentInChildren <Text>();

        CavAmmo.text = militaryForm.cavalry.AmmoUse.ToString();

        Text ArtAmmo = armyTable.Rows[4].Cells[3].GetComponentInChildren <Text>();

        ArtAmmo.text = militaryForm.artillery.AmmoUse.ToString();

        Text FighterAmmo = armyTable.Rows[4].Cells[4].GetComponentInChildren <Text>();

        FighterAmmo.text = militaryForm.fighter.AmmoUse.ToString();

        Text TankAmmo = armyTable.Rows[4].Cells[5].GetComponentInChildren <Text>();

        TankAmmo.text = militaryForm.tank.AmmoUse.ToString();

        Text InfantryOil = armyTable.Rows[6].Cells[1].GetComponentInChildren <Text>();

        InfantryOil.text = militaryForm.infantry.OilUse.ToString();
        //  Debug.Log("Infantry Oiluse " + militaryForm.infantry.OilUse.ToString());

        Text CavOil = armyTable.Rows[5].Cells[2].GetComponentInChildren <Text>();

        CavOil.text = militaryForm.cavalry.OilUse.ToString();

        Text ArtOil = armyTable.Rows[5].Cells[3].GetComponentInChildren <Text>();

        CavOil.text = militaryForm.artillery.OilUse.ToString();

        Text FighterOil = armyTable.Rows[5].Cells[4].GetComponentInChildren <Text>();

        FighterOil.text = militaryForm.fighter.OilUse.ToString();

        Text TankOil = armyTable.Rows[5].Cells[5].GetComponentInChildren <Text>();

        TankOil.text = militaryForm.tank.OilUse.ToString();

        Text InfWeight = armyTable.Rows[5].Cells[1].GetComponentInChildren <Text>();

        InfantryOil.text = militaryForm.infantry.Weight.ToString();
        // Debug.Log("Infantry Weight: " + militaryForm.infantry.Weight.ToString());

        Text CavWeight = armyTable.Rows[6].Cells[2].GetComponentInChildren <Text>();

        CavWeight.text = militaryForm.cavalry.Weight.ToString();

        Text ArtWeight = armyTable.Rows[6].Cells[3].GetComponentInChildren <Text>();

        ArtWeight.text = militaryForm.artillery.Weight.ToString();

        Text FighterWeight = armyTable.Rows[6].Cells[4].GetComponentInChildren <Text>();

        FighterWeight.text = militaryForm.fighter.Weight.ToString();

        Text TankWeight = armyTable.Rows[6].Cells[5].GetComponentInChildren <Text>();

        TankWeight.text = militaryForm.tank.Weight.ToString();

        Text NumInf   = armyTable.Rows[7].Cells[1].GetComponentInChildren <Text>();
        Text NumArt   = armyTable.Rows[7].Cells[2].GetComponentInChildren <Text>();
        Text NumCav   = armyTable.Rows[7].Cells[3].GetComponentInChildren <Text>();
        Text NumFight = armyTable.Rows[7].Cells[4].GetComponentInChildren <Text>();
        Text NumTank  = armyTable.Rows[7].Cells[5].GetComponentInChildren <Text>();

        float infantryCount  = 0;
        float artilleryCount = 0;
        float cavalryCount   = 0;
        float fighterCount   = 0;
        float tankCount      = 0;

        for (int i = 0; i < player.GetArmies().Count; i++)
        {
            infantryCount  += player.GetArmy(i).GetInfantry();
            artilleryCount += player.GetArmy(i).GetArtillery();
            cavalryCount   += player.GetArmy(i).GetCavalry();
            fighterCount   += player.GetArmy(i).GetFighter();
            tankCount      += player.GetArmy(i).GetTank();
        }
        NumInf.text   = infantryCount.ToString();
        NumArt.text   = artilleryCount.ToString();
        NumCav.text   = cavalryCount.ToString();
        NumFight.text = fighterCount.ToString();
        NumTank.text  = tankCount.ToString();

        Text recInf   = armyTable.Rows[8].Cells[1].GetComponentInChildren <Text>();
        Text recArt   = armyTable.Rows[8].Cells[2].GetComponentInChildren <Text>();
        Text recCav   = armyTable.Rows[8].Cells[3].GetComponentInChildren <Text>();
        Text recFight = armyTable.Rows[8].Cells[4].GetComponentInChildren <Text>();
        Text recTank  = armyTable.Rows[8].Cells[5].GetComponentInChildren <Text>();

        recInf.text   = player.getArmyProducing(MyEnum.ArmyUnits.infantry).ToString();
        recArt.text   = player.getArmyProducing(MyEnum.ArmyUnits.artillery).ToString();
        recCav.text   = player.getArmyProducing(MyEnum.ArmyUnits.cavalry).ToString();
        recFight.text = player.getArmyProducing(MyEnum.ArmyUnits.fighter).ToString();
        recTank.text  = player.getArmyProducing(MyEnum.ArmyUnits.tank).ToString();

        Button recruitInfButton = armyTable.Rows[10].Cells[1].GetComponentInChildren <Button>();

        if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 1)
        {
            recruitInfButton.interactable = false;
        }
        else
        {
            recruitInfButton.interactable = true;
        }

        Button recruitArtButton = armyTable.Rows[10].Cells[3].GetComponentInChildren <Button>();

        if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 2)
        {
            recruitArtButton.interactable = false;
        }
        else
        {
            recruitArtButton.interactable = true;
        }

        Button recruitCavButton = armyTable.Rows[10].Cells[2].GetComponentInChildren <Button>();

        if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.arms) < 1 ||
            player.getNumberResource(MyEnum.Resources.wheat) < 1)
        {
            recruitCavButton.interactable = false;
        }
        else
        {
            recruitCavButton.interactable = true;
        }

        Button recruitFighterButton = armyTable.Rows[10].Cells[4].GetComponentInChildren <Button>();

        if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.fighter) < 1)
        {
            recruitFighterButton.interactable = false;
        }
        else
        {
            recruitFighterButton.interactable = true;
        }

        Button recruitTankButton = armyTable.Rows[10].Cells[5].GetComponentInChildren <Button>();

        if (player.getUrbanPOP() < 1 || player.getNumberGood(MyEnum.Goods.tank) < 1)
        {
            recruitTankButton.interactable = false;
        }
        else
        {
            recruitTankButton.interactable = true;
        }
    }
Exemple #30
0
 //[ApiAuthorizeAttribute(Roles = "A")]
 public EntityHttpResponse Update([FromBody] Nation value)
 {
     return(ControlBeforeAddorUpdate(value, ModelState, Request, _nationManager, false));
 }
 private double GetPoints(Nation nation)
 {
     return((nation.benders.Sum(p => p.Power) / 100) *
            (nation.monuments.Sum(m => m.affinity)));
 }
Exemple #32
0
    // Bug: Den tegner strek UANSETT om den treffer en av sine egne linjer. Tenker ikke noe på om det finnes en strek som er nærmere eller om den går igjennom en annen sitt land.
    internal void SuggestConquest(InputEventMouseButton key)
    {
        double d1;

        differ = 0.025;

        d1 = Math.Tan(Map.mousePointingDegree * Math.PI / 180);

        Nation    targetNation = (Nation)(nations[Map.mousePointingNation]);
        ArrayList points       = targetNation.GetPoints();
        Vector2   mp           = GetGlobalMousePosition();

        suggestedPoints = new ArrayList();
        ArrayList tempLineSuggestions = new ArrayList();
        int       previous            = -1;
        int       next = -1;



        for (int i = 0; i < points.Count; i++)
        {
            // GD.Print("------------" + points.Count);
            Vector2 p1 = (Vector2)points[i];
            Vector2 p2 = (Vector2)points[(i + 1) % points.Count];
            double  a  = (p2.y + size) - (p1.y + size);
            double  b  = (p2.x + size) - (p1.x + size);
            double  d2 = a / b;

            double x;
            double y;

            if (!(d1 > d2 - differ && d1 < d2 + differ))
            {
                //TODO flytt dette til en generell sjekk hvor kuttes metode - Da kan jeg lett(ere) få til NATIONTEXT yalll!

                if (p1.x == p2.x)
                {
                    // Få til spesial tilfelle der x = 0 eller y = inf
                    x = p1.x;
                    y = (mp.y + (d1 * (x - mp.x)));
                }
                else
                {
                    double y1 = (mp.y + (d1 * -mp.x));
                    double y2 = (p1.y + (d2 * -p1.x));
                    x = ((y2 - y1) / (d1 - d2));
                    y = (d1 * x + y1);
                }

                // GD.Print("X: " + x + ", Y: " + y + " I mellom punkt: (" + p1.x + ", " + p1.y + ") og (" + p2.x + ", " + p2.y + ")");
                if (CheckX(p1, p2, x))
                {
                    if (CheckY(p1, p2, y))
                    {
                        tempLineSuggestions.Add(new LineSuggestion(new Vector2((float)(x), (float)(y)), i, tempLineSuggestions.Count));
                    }
                }
            }
        }

        if (tempLineSuggestions.Count < 2)
        {
            return;
        }

        LineSuggestion suggestionPoint1 = FindSmallestDistance(tempLineSuggestions.ToArray(typeof(LineSuggestion)) as LineSuggestion[], mp, null);

        tempLineSuggestions.RemoveAt(suggestionPoint1.tempindex);
        LineSuggestion suggestionPoint2 = FindSmallestDistance(tempLineSuggestions.ToArray(typeof(LineSuggestion)) as LineSuggestion[], mp, suggestionPoint1);

        if (suggestionPoint1.index < suggestionPoint2.index)
        {
            previous = suggestionPoint1.index;
            suggestedPoints.Add(suggestionPoint1.line);

            next = suggestionPoint2.index + 1;
            suggestedPoints.Add(suggestionPoint2.line);
        }
        else
        {
            previous = suggestionPoint2.index;
            suggestedPoints.Add(suggestionPoint2.line);

            next = suggestionPoint1.index + 1;
            suggestedPoints.Add(suggestionPoint1.line);
        }

        while (suggestedConquestLine2D.GetPointCount() != 0)
        {
            suggestedConquestLine2D.RemovePoint(suggestedConquestLine2D.GetPointCount() - 1);
        }
        for (int i = 0; i < suggestedPoints.Count; i++)
        {
            suggestedConquestLine2D.AddPoint(mp);
            suggestedConquestLine2D.AddPoint((Vector2)suggestedPoints[i]);
        }

        if (key != null && key.IsPressed() && key.ButtonIndex == 2)
        {
            TryConquest(previous, next, targetNation, key.Shift);
        }
    }
Exemple #33
0
    //Det er en bug som gjelder øyer.
    //Hvis target har ingen punkt som er på kanten og ikke flere naboer enn 1, init (om ikke finnes) en ny mengde med punkt som er designert til targets playernr.

    /*
     *      Basically ha en referanse til rød sine punkter som blir en nogozone og så fjern her alle punkt som er lik noen av disse.
     */
    //Sjekk dette hver gang og om dette er usant så sjekk om man har en øy for denne nasjonen. Slett så om sant.

    //Også: Sett nasjonen som øy eller ei lokalt i nasjonen; om nasjonen er en øy så øk z verdien - ellers mink z verdien.

    /*
     *      Grunnen til at noen ganger så kommer verdensrommet inn i landet med vanlig kutt (ingen øy) er fordi jeg ikke sjekker Contains() i innlegging av originale punkter i InsertPointsIntoFriendlyBorder.
     *      Da kommer det vektorer som dette etterhverandre: (x1, y1) -> (x2, y2) -> (x2, y2) -> (x1, y1)
     *      Dette er relativt OK OM du ikke kutter noe mer... Men man må jo kutte >:)
     */


    private void TryConquest(int prev, int next, Nation targetNation, bool away)
    {
        Nation myNation = (Nation)nations[Map.player.playernr];

        //Sjekk om det er samme nasjon
        if (targetNation.playernr == myNation.playernr)
        {
            return;
        }

        Vector2[] targetPoints = targetNation.GetPoints().ToArray(typeof(Vector2)) as Vector2[];
        Vector2[] myPoints     = myNation.GetPoints().ToArray(typeof(Vector2)) as Vector2[];
        //Sjekk om minst to punkter er like


        //First change enemyborder

        Queue <Vector2> newTargetBorder   = new Queue <Vector2>();
        Stack <Vector2> newFriendlyBorder = new Stack <Vector2>();

        Vector2[] newBorderPoints;



        //Basically sjekk om LShift er nede
        if (away)
        {
            //Først kutt target
            DrawNewTargetBorderAwayFromCenter(prev, targetPoints, newTargetBorder, next);
            newBorderPoints = GatherTargetBorderTowardsCenter(prev, targetPoints, next);
        }
        else
        {
            //Først kutt target
            DrawNewTargetBorderTowardsCenter(prev, targetPoints, newTargetBorder, next);
            newBorderPoints = GatherTargetBorderAwayFromCenter(prev, targetPoints, next);
        }



        Vector2 found = IsBorderTouching(myPoints, newBorderPoints);

        if (found.x == -1)
        {
            return;
        }

        Vector2 targetIsIsland = IsIsland(newTargetBorder.ToArray() as Vector2[], targetNation.playernr);

        if (targetIsIsland.x == -1)
        {
            DrawNewFriendlyBorder(myPoints, newFriendlyBorder, newBorderPoints, (int)found.x, (int)found.y, false, null);
            RemoveOwnerOfIsland(targetNation);
        }
        else
        {
            //FIXME
            GD.Print("ISLAND!!!");
            DrawNewFriendlyBorder(myPoints, newFriendlyBorder, newBorderPoints, (int)found.x, (int)found.y, true, newTargetBorder.ToArray() as Vector2[]);
            SetOwnerOfIsland(targetNation, (int)targetIsIsland.y);
        }

        //Sjekk også om at NOEN har blitt island... under myNation faktisk.

        // Sjekk om myNation også er island. Hvis så: Sjekk om den vil være island etter kutt. Hvis ikke flytt z verdi til vanlig posisjon, sett island (elns) til false og fjern alle island referanser til myNation.
        DecipherWhichNationsAreIslands(targetNation);


        //Clean up before adding new points
        targetNation.ClearBorderPoints();
        myNation.ClearBorderPoints();

        //Change target borders
        Vector2 firstPoint = newTargetBorder.Peek();

        while (newTargetBorder.Count != 0)
        {
            if (newTargetBorder.Count > 1)
            {
                targetNation.NewBorder(newTargetBorder.Dequeue(), newTargetBorder.Peek());
            }
            else
            {
                targetNation.NewBorder(newTargetBorder.Dequeue(), firstPoint);
            }
        }
        targetNation.CleanNewBorders();
        UpdateGenericPointer(targetNation);

        //Change my borders
        Vector2[] nfb = newFriendlyBorder.ToArray() as Vector2[];
        for (int b = nfb.Length - 1; b >= 1; b--)
        {
            myNation.NewBorder(nfb[b], nfb[b - 1]);
        }
        myNation.NewBorder((Vector2)nfb[0], (Vector2)nfb[nfb.Length - 1]);
        myNation.CleanNewBorders();
        UpdateGenericPointer(myNation);
    }
Exemple #34
0
    private void UpdateNavyTable()
    {
        App          app          = UnityEngine.Object.FindObjectOfType <App>();
        Nation       player       = State.getNations()[app.GetHumanIndex()];
        MilitaryForm militaryForm = player.GetMilitaryForm();

        Text frigateAttack = navyTable.Rows[1].Cells[1].GetComponentInChildren <Text>();

        Debug.Log("frigate attack " + militaryForm.frigate.Attack.ToString());
        frigateAttack.text = militaryForm.frigate.Attack.ToString();
        Text ironcladAttack = navyTable.Rows[1].Cells[2].GetComponentInChildren <Text>();

        ironcladAttack.text = militaryForm.ironclad.Attack.ToString();
        Text dreadnoughtAttack = navyTable.Rows[1].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtAttack.text = militaryForm.dreadnought.Attack.ToString();

        Text frigateMaxStrength = navyTable.Rows[2].Cells[1].GetComponentInChildren <Text>();

        frigateMaxStrength.text = militaryForm.frigate.GetStrength().ToString();
        Text ironcladMaxStrength = navyTable.Rows[2].Cells[2].GetComponentInChildren <Text>();

        ironcladMaxStrength.text = militaryForm.ironclad.GetStrength().ToString();
        Text dreadnoughtMaxStrength = navyTable.Rows[2].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtMaxStrength.text = militaryForm.dreadnought.GetStrength().ToString();

        Text frigateMan = navyTable.Rows[3].Cells[1].GetComponentInChildren <Text>();

        frigateMan.text = militaryForm.frigate.Maneuver.ToString();
        Text ironcladMan = navyTable.Rows[3].Cells[2].GetComponentInChildren <Text>();

        ironcladMan.text = militaryForm.ironclad.Maneuver.ToString();
        Text dreadnoughtMan = navyTable.Rows[3].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtMan.text = militaryForm.dreadnought.Maneuver.ToString();

        Text frigateAmmo = navyTable.Rows[4].Cells[1].GetComponentInChildren <Text>();

        frigateAmmo.text = militaryForm.frigate.AmmoUse.ToString();
        Text ironcladAmmo = navyTable.Rows[4].Cells[2].GetComponentInChildren <Text>();

        ironcladAmmo.text = militaryForm.ironclad.AmmoUse.ToString();
        Text dreadnoughtAmmo = navyTable.Rows[4].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtAmmo.text = militaryForm.dreadnought.AmmoUse.ToString();

        Text frigateOil = navyTable.Rows[5].Cells[1].GetComponentInChildren <Text>();

        frigateOil.text = militaryForm.frigate.OilUse.ToString();
        Text ironcladOil = navyTable.Rows[5].Cells[2].GetComponentInChildren <Text>();

        ironcladOil.text = militaryForm.ironclad.OilUse.ToString();
        Text dreadnoughtOil = navyTable.Rows[5].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtOil.text = militaryForm.dreadnought.OilUse.ToString();

        Text frigateCap = navyTable.Rows[6].Cells[1].GetComponentInChildren <Text>();

        frigateCap.text = militaryForm.frigate.Capacity.ToString();
        Text ironcladCap = navyTable.Rows[6].Cells[2].GetComponentInChildren <Text>();

        ironcladCap.text = militaryForm.ironclad.Capacity.ToString();
        Text dreadnoughtCap = navyTable.Rows[6].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtCap.text = militaryForm.dreadnought.Capacity.ToString();

        Text frigateMov = navyTable.Rows[7].Cells[1].GetComponentInChildren <Text>();

        frigateMov.text = militaryForm.frigate.Movement.ToString();
        Text ironcladMov = navyTable.Rows[7].Cells[2].GetComponentInChildren <Text>();

        ironcladMov.text = militaryForm.ironclad.Movement.ToString();
        Text dreadnoughtMov = navyTable.Rows[7].Cells[3].GetComponentInChildren <Text>();

        dreadnoughtMov.text = militaryForm.dreadnought.Movement.ToString();

        Text NumFrig = navyTable.Rows[9].Cells[1].GetComponentInChildren <Text>();
        Text NumIC   = navyTable.Rows[9].Cells[2].GetComponentInChildren <Text>();
        Text NumDN   = navyTable.Rows[9].Cells[3].GetComponentInChildren <Text>();

        float frigCount = 0;
        float ICCount   = 0;
        float DNCount   = 0;

        for (int i = 0; i < player.GetFleets().Count; i++)
        {
            frigCount += player.GetFleet(i).GetFrigate();
            ICCount   += player.GetFleet(i).GetIronClad();
            DNCount   += player.GetFleet(i).GetDreadnought();
        }
        NumFrig.text = frigCount.ToString();
        NumIC.text   = ICCount.ToString();
        NumDN.text   = DNCount.ToString();

        Text recFrig = navyTable.Rows[10].Cells[1].GetComponentInChildren <Text>();
        Text recIC   = navyTable.Rows[10].Cells[2].GetComponentInChildren <Text>();
        Text recDN   = navyTable.Rows[10].Cells[3].GetComponentInChildren <Text>();

        recFrig.text = player.getNavyProducing(MyEnum.NavyUnits.frigates).ToString();
        recIC.text   = player.getNavyProducing(MyEnum.NavyUnits.ironclad).ToString();
        recDN.text   = player.getNavyProducing(MyEnum.NavyUnits.dreadnought).ToString();

        Button recruitFrigateButton = navyTable.Rows[11].Cells[1].GetComponentInChildren <Button>();

        if (PlayerCalculator.canBuildFrigate(player))
        {
            recruitFrigateButton.interactable = true;
        }
        else
        {
            recruitFrigateButton.interactable = false;
        }

        Button recruitIroncladButton = navyTable.Rows[11].Cells[2].GetComponentInChildren <Button>();

        if (PlayerCalculator.canBuildIronclad(player))
        {
            recruitIroncladButton.interactable = true;
        }
        else
        {
            recruitIroncladButton.interactable = false;
        }

        Button recruitDreadnoughtButton = navyTable.Rows[11].Cells[3].GetComponentInChildren <Button>();

        if (PlayerCalculator.canBuildDreadnought(player))
        {
            recruitDreadnoughtButton.interactable = true;
        }
        else
        {
            upgradeShipyard.interactable = false;
        }

        TextMeshProUGUI _shipyardLevel = shipyardLevel.GetComponent <TextMeshProUGUI>();

        _shipyardLevel.SetText("Shipyard Level: " + player.GetShipyardLevel().ToString());
        if (PlayerCalculator.canUpgradeShipyard(player) == true)
        {
            upgradeShipyard.interactable = true;
        }
        else
        {
            upgradeShipyard.interactable = false;
        }
    }
    private static void manageFoodShortage(MyEnum.Resources shortage, MyEnum.Resources firstOther, MyEnum.Resources secondOther, Nation player)
    {
        float deficit = Math.Abs(player.getNumberResource(shortage));
        player.collectResource(shortage, deficit);
        float one = player.getNumberResource(firstOther);
        float two = player.getNumberResource(secondOther);
        if (one + two > deficit)
        {
            if ((one >= System.Math.Abs(deficit / 2)) && (two >= System.Math.Abs(deficit / 2)))
            {
                player.consumeResource(firstOther, deficit / 2);
                player.consumeResource(secondOther, deficit / 2);
                player.increaseFoodImbalance(deficit);

            }
            else
            {
                player.increaseFoodShortage(deficit);
                player.decreasePrestige(1);

            }
        }
    }
Exemple #36
0
 public void Update(String nationName, Nation nationIn) =>
 _nations.ReplaceOne(nation => nation.NationName == nationName, nationIn);
Exemple #37
0
    //just for AI
    public void initalizeFactoryPriorities(Nation player)
    {
        TopLevel aiTopLevel = player.getAI().GetTopLevel();

        foreach (MyEnum.Goods good in Enum.GetValues(typeof(MyEnum.Goods)))
        {
            aiTopLevel.setFactPriority(player, good, 1);
        }

        for (int i = 0; i < player.getProvinces().Count; i++)
        {
            int pIndex = player.getProvinces()[i];
            assemblyCsharp.Province prov = State.getProvinces()[pIndex];

            if (prov.getResource() == MyEnum.Resources.coal)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.steel, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.parts, 0.15f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.arms, 0.15f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.chemicals, 0.2f);
            }
            if (prov.getResource() == MyEnum.Resources.cotton)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.fabric, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.clothing, 0.2f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.furniture, 0.1f);
            }

            if (prov.getResource() == MyEnum.Resources.dyes)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.fabric, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.clothing, 0.2f);
            }

            if (prov.getResource() == MyEnum.Resources.iron)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.steel, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.parts, 0.2f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.arms, 0.2f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.gear, 0.075f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.auto, 0.075f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.tank, 0.12f);
            }

            if (prov.getResource() == MyEnum.Resources.oil)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.auto, 0.15f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.fighter, 0.1f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.tank, 0.1f);
            }
            if (prov.getResource() == MyEnum.Resources.rubber)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.gear, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.telephone, 0.2f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.auto, 0.12f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.fighter, 0.075f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.tank, 0.075f);
            }

            if (prov.getResource() == MyEnum.Resources.wood)
            {
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.lumber, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.paper, 0.25f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.furniture, 0.15f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.telephone, 0.075f);
                aiTopLevel.alterFactPriority(player, MyEnum.Goods.fighter, 0.075f);
            }
        }
    }
Exemple #38
0
        public Soldier(Nation n, int arms, int training, string govName)
            : base(n)
        {
            Armaments = (Armament)arms;
            Training = (Training)training;

            foreach (GovernmentEntity g in GovernmentEntity.Governments)
            {
                if (g.Name == govName)
                {
                    Government = g;
                    break;
                }
            }
            if (Government == null || Government.Deleted)
                Delete();

            Nation = Government.Nation;

            BaseName = Name;

            SpeechInterval = DateTime.Now;

            FightMode = FightMode.Aggressor;
            AI = AIType.AI_Melee;

            EquipSoldier(Nation, m_Armaments);

            if (Training > 0)
                SpecialTraining(Training);
        }
Exemple #39
0
 public void SetNation(Nation nation, ImprovementObjectCity city)
 {
     this.nation = nation;
     this.city   = city;
 }
Exemple #40
0
 public Negotiation(AEmpire empire, Phase negotiationSituation, Nation opponent)
 {
     TheEmpire = empire;
     Situation = negotiationSituation;
     Opponent  = opponent;
 }
    private void updateFactoryPanel()
    {
        App    app        = UnityEngine.Object.FindObjectOfType <App>();
        int    humanIndex = app.GetHumanIndex();
        Nation player     = State.getNations()[humanIndex];

        goodTypeText.text = goodType;

        //   modelDummy = buildingModel;
        factoryType          = (MyEnum.Goods)System.Enum.Parse(typeof(MyEnum.Goods), goodType);
        amountToMake.text    = player.industry.getGoodProducing(factoryType).ToString();
        inventoryAmount.text = player.getNumberGood(factoryType).ToString();

        string goodCaps = char.ToUpper(goodType.ToString()[0]) + goodType.ToString().Substring(1);

        factoryName.text      = goodCaps + " Factory";
        goodTypeImage.sprite  = Resources.Load("FinishedGoods/" + goodType, typeof(Sprite)) as Sprite;
        factoryLevelText.text = "Factory Level: " + player.industry.getFactoryLevel(factoryType).ToString();
        inventoryAmount.text  = player.getNumberGood(factoryType).ToString();
        int turn = State.turn;

        marketPrice.text = State.market.getPriceOfGood(factoryType).ToString();
        //Dictionary<string, float> inputString = ProductionCosts.GetCosts(factoryType);
        float ableToProduce = player.industry.determineCanProduce(factoryType, player);

        canProduce.text        = ableToProduce.ToString();
        factorySlider.maxValue = (float)Math.Floor(ableToProduce);
        factorySlider.value    = 0;
        Debug.Log("Max slider value: " + factorySlider.maxValue);

        if (factorySlider.maxValue >= 1 && player.industry.getGoodProducing(factoryType) == 0)
        {
            factorySlider.interactable = true;
            produceGoods.interactable  = true;
        }
        else
        {
            factorySlider.interactable = false;
            produceGoods.interactable  = false;
        }

        if (player.industry.getGoodProducing(factoryType) > 0)
        {
            produceGoods.transform.localScale = new Vector3(0, 0, 0);
            produceGoods.interactable         = false;
            cancel.transform.localScale       = new Vector3(1, 1, 1);
            cancel.interactable = true;
        }
        else
        {
            cancel.transform.localScale       = new Vector3(0, 0, 0);
            cancel.interactable               = false;
            produceGoods.transform.localScale = new Vector3(1, 1, 1);
        }
        int factoryLevel = player.industry.getFactoryLevel(factoryType);

        factoryLevelText.text = "Factory Level: " + factoryLevel;
        goodType = factoryType.ToString();

        marketPrice.text = State.market.getPriceOfGood(factoryType).ToString();
        // produceGoods.GetComponent<ComfirmManufacture>().good = factoryType;
        //  upgrade.GetComponent<UpgradeFactoryButton>().good = factoryType;

        if (factoryLevel == 0)
        {
            canProduce.text = ableToProduce.ToString();

            factoryLevelImage.sprite = Resources.Load("Sprites/GUI/workshop",
                                                      typeof(Sprite)) as Sprite;
        }
        if (factoryLevel == 1)
        {
            factoryLevelImage.sprite = Resources.Load("Sprites/GUI/factorySmall", typeof(Sprite)) as Sprite;
        }
        if (factoryLevel == 2)
        {
            factoryLevelImage.sprite = Resources.Load("Sprites/GUI/factoryMedium", typeof(Sprite)) as Sprite;
        }
        if (factoryLevel == 3)
        {
            factoryLevelImage.sprite = Resources.Load("Sprites/GUI/FactoryBig", typeof(Sprite)) as Sprite;
        }

        bool upgradeCheck = player.industry.CheckIfCanUpgradeFactory(factoryType);

        if (upgradeCheck == true)
        {
            Debug.Log("Can upgrade");
            upgrade.interactable = true;
        }
        else
        {
            Debug.Log("Cannot upgrade");
            upgrade.interactable = false;
        }
        //-----------------------------------
        upgrade.interactable = true;
    }
Exemple #42
0
        static void Main(string[] args)
        {
            ConsoleKeyInfo saisie;

            do
            {
                //menu principal
                int startMenu = ViewMenu.StartMenu();
                //scores
                if (startMenu == 1)
                {
                    ContMenu.ExecScores();
                }
                //points
                if (startMenu == 2)
                {
                    ContMenu.ExecPoints();
                }
                //nations
                if (startMenu == 3)
                {
                    int confMenu = ViewConf.MenuConf();
                    //Europe
                    Conf europe = new Conf("Europe", "European", 54, "2018");
                    ViewConf.DoViewConf(europe);
                    TimeZoneInfo euZone = TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time");
                    if (confMenu == 1)
                    {
                        int natMenu = ViewNation.MenuNations();
                        //France
                        if (natMenu == 1)
                        {
                            Nation france = new Nation("France", 302.40, 0, europe, "Stade de France", "2018", 10, 3);
                            ViewNation.DoViewNation(france);
                            ViewCup.DoViewCup("World Cup", 0, "qualifications", "2021");
                            string confCup = france.Conf.Adj + " Cup";
                            ViewCup.DoViewCup(confCup, 1, "finalist", "2019");
                            String confLeague = "League of Nations - " + france.Conf.Name;
                            ViewLeague.DoViewLeague(confLeague, "1A", "N/A");
                            char[] results = new char[5];
                            for (int i = 0; i < results.Length; i++)
                            {
                                results[i] = 'V';
                            }
                            for (int i = 0; i < results.Length; i++)
                            {
                                Console.Write(results[i]);
                            }
                            Console.Write("\n\n");
                            List <Match> tabMatches = new List <Match>();

                            DateTime locDate1 = new DateTime(2020, 03, 06, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches.Add(new Match("France", 18, "Albania", 9, locDate1));

                            DateTime locDate2 = new DateTime(2020, 02, 12, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches.Add(new Match("France", 23, "Cyprus", 9, locDate2));

                            DateTime locDate3 = new DateTime(2020, 02, 07, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches.Add(new Match("France", 23, "Israel", 9, locDate3));

                            DateTime locDate4 = new DateTime(2020, 01, 08, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches.Add(new Match("France", 23, "Moldova", 16, locDate4));

                            DateTime locDate5 = new DateTime(2020, 01, 03, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches.Add(new Match("France", 23, "Italy", 13, locDate5));

                            foreach (Match item in tabMatches)
                            {
                                ViewMatches.DoViewMatches(item, euZone);
                            }
                        }

                        //Italy
                        if (natMenu == 2)
                        {
                            Nation italy = new Nation("Italy", 127.58, 0, europe, "Stadio Olympico", "2018", 31, 11);
                            ViewNation.DoViewNation(italy);
                            ViewCup.DoViewCup("World Cup", 0, "qualifications", "2021");
                            String confCup = italy.Conf.Adj + " Cup";
                            ViewCup.DoViewCup(confCup, 1, "quarter-finalist", "2019");
                            String confLeague = "League of Nations - " + italy.Conf.Name;
                            ViewLeague.DoViewLeague(confLeague, "2A", "N/A");
                            char[] results = new char[5];
                            results[0] = 'V';
                            results[1] = 'V';
                            results[2] = 'V';
                            results[3] = 'V';
                            results[4] = 'D';
                            for (int i = 0; i < results.Length; i++)
                            {
                                Console.Write(results[i]);
                            }
                            Console.Write("\n\n");
                            Match[] tabMatches = new Match[5];

                            DateTime locDate1 = new DateTime(2020, 03, 06, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches[0] = new Match("Italy", 18, "Cyprus", 13, locDate1);

                            DateTime locDate2 = new DateTime(2020, 02, 12, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches[1] = new Match("Italy", 18, "Albania", 9, locDate2);

                            DateTime locDate3 = new DateTime(2020, 02, 07, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches[2] = new Match("Italy", 16, "Moldova", 9, locDate3);

                            DateTime locDate4 = new DateTime(2020, 01, 08, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches[3] = new Match("Italy", 18, "Israel", 13, locDate4);

                            DateTime locDate5 = new DateTime(2020, 01, 03, 20, 00, 00, DateTimeKind.Utc);
                            tabMatches[4] = new Match("France", 23, "Italy", 13, locDate5);

                            for (int i = 0; i < tabMatches.Length; i++)
                            {
                                ViewMatches.DoViewMatches(tabMatches[i], euZone);
                            }
                        }
                    }
                }
                Console.WriteLine("Quitter ? y/n");
                saisie = Console.ReadKey(true);
            } while (saisie.Key != ConsoleKey.Y);
        }
 public void Add(Nation obj)
 {
     DbSet.Add(obj);
 }
Exemple #44
0
        public static String CriminalAlertMessage(Nation n)
        {
            String alertMessage = "The authorities have been alerted of your deeds!";

            switch (n)
            {
                case Nation.Alyrian:    alertMessage = "The Alyrians have been alerted of your deeds!";     break;
                case Nation.Azhuran:    alertMessage = "The Azhurans have been alerted of your deeds!";     break;
                case Nation.Khemetar:   alertMessage = "The Khemetar have been alerted of your deeds!";     break;
                case Nation.Mhordul:    alertMessage = "The Mhordul have been alerted of your deeds!";      break;
                case Nation.Tyrean:     alertMessage = "The Tyreans have been alerted of your deeds!";      break;
                case Nation.Vhalurian:  alertMessage = "The Vhalurians have been alerted of your deeds!";   break;
                case Nation.Imperial:   alertMessage = "The Empire has been alerted of your deeds!";        break;
                case Nation.Sovereign:  alertMessage = "The Sovereign have been alerted of your deeds!";    break;
                case Nation.Society:    alertMessage = "The Society has been alerted of your deeds!";       break;
                case Nation.Insularii:  alertMessage = "The Insularii has been alerted of your deeds!";       break;
            }

            return alertMessage;
        }
Exemple #45
0
 public CopyOfMilitaryReport(Nation nation) => (Nation, TurnOfReport) = (nation, 0); // turn to be set by server
Exemple #46
0
 public Soldier(Nation n)
     : this(n, Utility.RandomMinMax(1, 4))
 {
 }
Exemple #47
0
 public Soldier(Nation n, int arms, int training)
     : this(n, arms, training, GovernmentEntity.Governments[Utility.Random(GovernmentEntity.Governments.Count)])
 {
 }
Exemple #48
0
    public void initalizeResourcePriorities(Nation player)
    {
        TopLevel aiTopLevel = player.getAI().GetTopLevel();

        aiTopLevel.setResPriority(player, MyEnum.Resources.wheat, 3);
        aiTopLevel.setResPriority(player, MyEnum.Resources.meat, 2.5f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.fruit, 2.5f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.coal, 1);
        aiTopLevel.setResPriority(player, MyEnum.Resources.cotton, 1.5f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.dyes, 2.5f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.gold, 3f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.iron, 2.25f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.oil, 0.25f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.rubber, 0.25f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.spice, 2.75f);
        aiTopLevel.setResPriority(player, MyEnum.Resources.wood, 1.5f);

        for (int i = 0; i < player.getProvinces().Count; i++)
        {
            int pIndex = player.getProvinces()[i];
            assemblyCsharp.Province prov = State.getProvinces()[pIndex];
            if (prov.getResource() == MyEnum.Resources.wheat)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.wheat, -0.2f);
            }
            if (prov.getResource() == MyEnum.Resources.meat)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.meat, -0.15f);
            }
            if (prov.getResource() == MyEnum.Resources.fruit)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.fruit, -0.15f);
            }
            if (prov.getResource() == MyEnum.Resources.coal)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.iron, 0.15f);
                aiTopLevel.alterResPriority(player, MyEnum.Resources.coal, -0.05f);
            }
            if (prov.getResource() == MyEnum.Resources.cotton)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.dyes, 0.16f);
                aiTopLevel.alterResPriority(player, MyEnum.Resources.cotton, -0.075f);
                aiTopLevel.alterResPriority(player, MyEnum.Resources.wood, 0.075f);
            }

            if (prov.getResource() == MyEnum.Resources.dyes)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.cotton, 0.2f);
            }
            if (prov.getResource() == MyEnum.Resources.gold)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.gold, -0.15f);
            }
            if (prov.getResource() == MyEnum.Resources.iron)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.coal, 0.1f);
                aiTopLevel.alterResPriority(player, MyEnum.Resources.iron, -0.075f);
            }
            if (prov.getResource() == MyEnum.Resources.oil)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.oil, -0.075f);
            }
            if (prov.getResource() == MyEnum.Resources.rubber)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.rubber, -0.075f);
            }
            if (prov.getResource() == MyEnum.Resources.spice)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.gold, -0.075f);
            }
            if (prov.getResource() == MyEnum.Resources.wood)
            {
                aiTopLevel.alterResPriority(player, MyEnum.Resources.wood, -0.1f);
                aiTopLevel.alterResPriority(player, MyEnum.Resources.cotton, 0.075f);
            }
        }
    }
Exemple #49
0
    void viewGoodResource()
    {
        App    app         = UnityEngine.Object.FindObjectOfType <App>();
        int    playerIndex = app.GetHumanIndex();
        Nation player      = State.getNations()[playerIndex];
        Market market      = State.market;

        MarketHelper.currentItem = SelectionButton.transform.parent.parent.name.ToString();
        string currentItem = SelectionButton.transform.parent.parent.name.ToString();

        // Debug.Log("Grandparent name: " + currentItem);
        if (ress.Contains(currentItem))
        {
            itemImage.sprite = Resources.Load <Sprite>("Resource/" + currentItem) as Sprite;
            MyEnum.Resources _item = (MyEnum.Resources)Enum.Parse(typeof(MyEnum.Resources), currentItem);
            //   Debug.Log(_item);
            numOffBid.text = MarketHelper.ResourceOfferBidAmount[_item].ToString();

            if (State.turn > 1)
            {
                offeredLastTurn.text = "Offered Last Turn: " + market.getNumberOfResourcesOffered(_item).ToString();
                soldLastTurn.text    = "Sold Last Turn: " + market.getNumberResourcesSold(_item).ToString();
            }
            else
            {
                offeredLastTurn.text = "Offered Last Turn: 0";
                soldLastTurn.text    = "Sold Last Turn: 0";
            }
            //   Debug.Log(_item);
            //  Debug.Log(MarketHelper.getResoueceOfferBid(_item));
            //    priceHistory = market.getResourcePriceHistory(_item);
            if (MarketHelper.getResoueceOfferBid(_item) == MyEnum.marketChoice.pass)
            {
                Debug.Log("Pass");
                pass.isOn           = true;
                bid.isOn            = false;
                offer.isOn          = false;
                High.interactable   = false;
                Medium.interactable = false;
                Low.interactable    = false;
                plus.interactable   = false;
                minus.interactable  = false;
            }

            else if (MarketHelper.getResoueceOfferBid(_item) == MyEnum.marketChoice.bid)
            {
                Debug.Log("Bid");

                bid.isOn   = true;
                pass.isOn  = false;
                offer.isOn = false;
                int   turn = State.turn;
                float cost = 3;
                bid.isOn = true;
                {
                    if (turn > 1)
                    {
                        cost = market.getPriceOfResource(_item);
                    }
                    if (player.getTotalCurrentBiddingCost() + cost > player.getGold())
                    {
                        plus.interactable = false;
                    }
                    else
                    {
                        plus.interactable = true;
                    }
                    Debug.Log("Current bid " + MarketHelper.ResourceOfferBidAmount[_item]);
                    if (MarketHelper.ResourceOfferBidAmount[_item] >= 1)
                    {
                        minus.interactable = true;
                    }
                    else
                    {
                        minus.interactable = false;
                    }
                }
            }
            else
            {
                offer.isOn = true;
                pass.isOn  = false;
                bid.isOn   = false;
                Debug.Log("Offer");
                MarketHelper.setResoueceOfferBid(_item, MyEnum.marketChoice.bid);
                if (player.getNumberResource(_item) - MarketHelper.ResourceOfferBidAmount[_item] < 1)
                {
                    plus.interactable = false;
                }
                else
                {
                    plus.interactable = true;
                }
                if (MarketHelper.ResourceOfferBidAmount[_item] >= 1)
                {
                    minus.interactable = true;
                }
                else
                {
                    minus.interactable = false;
                }
            }
        }
        else
        {
            itemImage.sprite = Resources.Load <Sprite>("FinishedGoods/" + currentItem) as Sprite;
            MyEnum.Goods _item = (MyEnum.Goods)Enum.Parse(typeof(MyEnum.Goods), currentItem);
            numOffBid.text = MarketHelper.GoodsOfferBidAmount[_item].ToString();
            if (State.turn > 1)
            {
                offeredLastTurn.text = "Offered Last Turn: " + market.getNumberGoodsOffered(_item).ToString();
                soldLastTurn.text    = "Sold Last Turn: " + market.getNumberOfGoodsSoldLastTurn(_item).ToString();
                //   priceHistory = market.getGoodPriceHistory(_item);
            }
            else
            {
                offeredLastTurn.text = "Offered Last Turn: 0";
                soldLastTurn.text    = "Sold Last Turn: 0";
            }
            // priceHistory = market.getGoodPriceHistory(_item);
            if (MarketHelper.getGoodOfferBid(_item) == MyEnum.marketChoice.pass)
            {
                pass.isOn           = true;
                plus.interactable   = false;
                minus.interactable  = false;
                High.interactable   = false;
                Medium.interactable = false;
                Low.interactable    = false;
            }


            else if (MarketHelper.getGoodOfferBid(_item) == MyEnum.marketChoice.bid)
            {
                int   turn = State.turn;
                float cost = 3;
                bid.isOn = true;
                {
                    if (turn > 1)
                    {
                        cost = market.getPriceOfGood(_item);
                    }
                    if (player.getTotalCurrentBiddingCost() + cost > player.getGold())
                    {
                        plus.interactable = false;
                    }
                    else
                    {
                        plus.interactable = true;
                    }
                    if (MarketHelper.GoodsOfferBidAmount[_item] >= 1)
                    {
                        minus.interactable = true;
                    }
                    else
                    {
                        minus.interactable = false;
                    }
                }
            }
            else
            {
                offer.isOn = true;
                MarketHelper.setGoodOfferBid(_item, MyEnum.marketChoice.bid);
                if (player.getNumberGood(_item) - MarketHelper.GoodsOfferBidAmount[_item] < 1)
                {
                    plus.interactable = false;
                }
                else
                {
                    plus.interactable = true;
                }
                if (MarketHelper.GoodsOfferBidAmount[_item] >= 1)

                {
                    minus.interactable = true;
                }
                else
                {
                    minus.interactable = false;
                }
            }
        }
    }
Exemple #50
0
 public void ReferenceToParent(Nation nation)
 {
     this.nation = nation;
 }
 public string GetRandomBrigade()
 {
     return((Nation.Equals("ANI")) ? Brigades_ANI[rnd.Next(Brigades_ANI.Length)] : Brigades_BCU[rnd.Next(Brigades_BCU.Length)]);
 }
Exemple #52
0
 public bool CreateNation(Nation nation)
 {
     return(_nationRepository.Create(nation));
 }
Exemple #53
0
        public void EquipSoldier(Nation n, Armament a)
        {
            if ((int)a > 6 || (int)a < 1)
                a = (Armament)Utility.RandomMinMax(1, 4);

            switch (n)
            {
                case Nation.Alyrian: SetRank(1); TrainSoldier(a); SetDex(Dex + 20); EquipAlyrian(a, this); break;
                case Nation.Azhuran: SetRank(1); TrainSoldier(a); SetDex(Dex + 20); EquipAzhuran(a, this); break;
                case Nation.Khemetar: SetRank(1); TrainSoldier(a); SetInt(Int + 20); EquipKhemetar(a, this); break;
                case Nation.Mhordul: SetRank(1); TrainSoldier(a); SetStr(Str + 20); EquipMhordul(a, this); break;
                case Nation.Tyrean: SetRank(1); TrainSoldier(a); SetStr(Str + 20); EquipTyrean(a, this); break;
                case Nation.Vhalurian: SetRank(1); TrainSoldier(a); SetHits(Hits + 20); EquipVhalurian(a, this); break;
                case Nation.Imperial: SetRank(1); TrainSoldier(a); SetHits(Hits + 10); SetStr(Str + 10); EquipImperial(a, this); break;
                case Nation.Sovereign: TrainSoldier(a); SetStr(Str + 10); SetDex(Dex + 10); EquipSovereign(a, this); SetRank(1); break;
                case Nation.Society: SetRank(1); TrainSoldier(a); SetStr(Str + 10); SetInt(Int + 10); EquipSociety(a, this); break;
                case Nation.Insularii: SetRank(1); TrainSoldier(a); SetDex(Dex + 20); SetHits(Hits + 20); SetStr(Str + 20); SetInt(Int + 20); EquipInsularii(a, this); break;

                default: TrainSoldier(a);   EquipFreeSoldier(a, this);      break;
            }
        }
Exemple #54
0
 public bool EditNation(Nation nation)
 {
     return(_nationRepository.Update(nation));
 }
Exemple #55
0
 public Soldier(Nation n, int arms)
     : this(n, arms, 0)
 {
 }
Exemple #56
0
 //Create, Update, Remove
 public Nation Create(Nation nation)
 {
     _nations.InsertOne(nation);
     return(nation);
 }
Exemple #57
0
 public Soldier(Nation n, int arms, int training, GovernmentEntity gov)
     : this(n, arms, training, gov.Name)
 {
 }
Exemple #58
0
        // Use this for initialization
        void Start()
        {
            State.turn = 1;
            State.setGamePhase(MyEnum.GamePhase.adminstration);
            map = WMSK.instance;

            SelfProvinceGUI.SetActive(false);
            OtherProvinceGUI.SetActive(false);

            // WMSKMiniMap.Show();


            string nationsPath = Application.dataPath +
                                 "/StreamingAssets/Scenarios/DefaultFictional/Nations";
            string provincesPath = Application.dataPath +
                                   "/StreamingAssets/Scenarios/DefaultFictional/Provinces";



            string[] provFiles = Directory.GetFiles(provincesPath, "*.json");
            //foreach (string file in System.IO.Directory.GetFiles(provincesPath))
            foreach (string file in provFiles)
            {
                string dataAsJson = File.ReadAllText(file);

                //  Debug.Log(dataAsJson);
                //  assemblyCsharp.Province province = assemblyCsharp.Province.CreateFromJSON(dataAsJson);
                //assemblyCsharp.Province province = new assemblyCsharp.Province();
                // assemblyCsharp.Province newProvince = JsonUtility.FromJson<assemblyCsharp.Province>(dataAsJson);
                var newProvince = Newtonsoft.Json.JsonConvert.DeserializeObject <assemblyCsharp.Province>(dataAsJson);
                provinces.Add(newProvince.getIndex(), newProvince);
                // Debug.Log("Culture: " + newProvince.getCulture());

                map.GetProvince(newProvince.getIndex()).name        = newProvince.getProvName();
                map.GetProvince(newProvince.getIndex()).customLabel = newProvince.getProvName();
            }

            string[] nationFiles = Directory.GetFiles(nationsPath, "*.json");

            foreach (string file in nationFiles)
            {
                string dataAsJson = File.ReadAllText(file);
                //   Debug.Log(dataAsJson);
                var newNation = Newtonsoft.Json.JsonConvert.DeserializeObject <assemblyCsharp.Nation>(dataAsJson);
                //   Nation newNation = JsonUtility.FromJson<Nation>(dataAsJson);

                nations.Add(newNation.getIndex(), newNation);
                map.GetCountry(newNation.getIndex()).name = newNation.getNationName();
                Color color = new Color(UnityEngine.Random.Range(0.0f, 1.0f),
                                        UnityEngine.Random.Range(0.0f, 1.0f), UnityEngine.Random.Range(0.0f, 1.0f));
                newNation.setColor(color);
                // map.ToggleCountrySurface(newNation.getIndex(), true, color);
                map.GetCountry(newNation.getIndex()).customLabel = newNation.getNationName();
                map.CountryRename("Country" + newNation.getIndex(), newNation.getNationName());
            }

            map.Redraw();

            for (int k = 0; k < map.countries.Length; k++)
            {
                //Color color = new Color(UnityEngine.Random.Range(0.0f, 1.0f),
                // UnityEngine.Random.Range(0.0f, 1.0f), UnityEngine.Random.Range(0.0f, 1.0f));
                Color color = nations[k].getColor();
                //    Debug.Log("f**k: " + k + " " + color);

                map.ToggleCountrySurface(k, true, color);
            }

            float       left   = 0.78f;
            float       top    = 0.02f;
            float       width  = 0.2f;
            float       height = 0.2f;
            Vector4     normalizedScreenRect = new Vector4(left, top, width, height);
            WMSKMiniMap minimap = WMSKMiniMap.Show(normalizedScreenRect);

            // string path = Application.dataPath + "Alpha9.png";
            minimap.map.earthStyle = EARTH_STYLE.SolidColor;
            //  string absoluteImagePath = Path.Combine(Application.streamingAssetsPath, "ScenarioOne/Alpha9.png");

            //Texture2D  miniMapTexture = loadSprite(path);
            Texture2D miniMapTexture = Resources.Load("AlphaPrime.png", typeof(Texture2D)) as Texture2D;

            minimap.map.earthTexture = miniMapTexture;
            minimap.map.fillColor    = Color.blue;
            minimap.map.earthColor   = Color.blue;

            minimap.duration  = 1.5f;
            minimap.zoomLevel = 0.4f;


            for (int countryIndex = 0; countryIndex < map.countries.Length; countryIndex++)
            {
                Color color = nations[countryIndex].getColor();
                minimap.map.ToggleCountrySurface(countryIndex, true, color);
            }


            Dictionary <int, string> majorNations = NationData.majorDict;
            Dictionary <int, string> minorNations = NationData.minorDict;
            Dictionary <int, string> uncivNations = NationData.uncivDict;

            map.showProvinceNames = true;

            WorldMapStrategyKit.Province prov = map.GetProvince(45);
            Vector2 position = prov.center;

            //  Vector2 position = map.GetProvince(45, 20).center;


            army      = PlaceArmy(position);
            army.name = "first unit";
            army.GetComponent <ArmyController>().army = army;

            Vector2 position2 = map.GetProvince(32).center;

            Nation humanPlayer = nations[16];

            humanPlayer.SetHuman(true);

            //


            //Ship Click

            /*  map.OnClick += (float x, float y, int buttonIndex) => {
             *    Vector2 shipPosition = new Vector2(x, y);
             *    byte byteValue1= 0;
             *
             *    map.waterMaskLevel = byteValue1;
             *    if (map.ContainsWater(shipPosition))
             *    {
             *        Debug.Log("Water!");
             *
             *    }
             *    else
             *    {
             *        Debug.Log("Land!");
             *    }
             *    if (map.GetProvince(shipPosition) == null)
             *    {
             *        ship.MoveTo(shipPosition, 0.1f);
             *    }
             *
             * }; */


            // LaunchShip();

            //Show resources of each provinces
            //  ShowProvinceResources();

            map.OnClick += (float x, float y, int buttonIndex) =>
            {
                Vector2 provincePosition = new Vector2(x, y);
                int     clickedIndex     = map.GetProvinceIndex(provincePosition);
                assemblyCsharp.Province clickedProvince = provinces[clickedIndex];
            };
        }
Exemple #59
0
        public ReportInfo(Mobile m, bool thievery, bool assault)
        {
            if (m == null)
                return;

            m_IsOptional = false;
            m_Thievery = thievery;
            m_Assault = assault;
            m_IsFemale = m.Female;
            m_Location = m.Location;
            m_Location.X += Utility.RandomMinMax(-15,15);
            m_Location.Y += Utility.RandomMinMax(-15,15);
            if (m is PlayerMobile)
            {
                PlayerMobile pm = m as PlayerMobile;
                m_IsPlayer = true;

                m_Height = pm.Height + Utility.RandomMinMax(Utility.RandomMinMax(-10, -1), Utility.RandomMinMax(1, 10));
                m_Weight = pm.Weight + Utility.RandomMinMax(Utility.RandomMinMax(-10, -1), Utility.RandomMinMax(1, 10));

                int sightedAge = pm.Age += Utility.RandomMinMax(Utility.RandomMinMax(-10,-1),Utility.RandomMinMax(1,10));

                if (sightedAge < 20)
                    Age = "teenager";
                else if (sightedAge < 26)
                    Age = "early twenties";
                else if (sightedAge < 30)
                    Age = "late twenties";
                else if (sightedAge < 36)
                    Age = "early thirties";
                else if (sightedAge < 40)
                    Age = "late thirties";
                else if (sightedAge < 55)
                    Age = "middle-aged";
                else if (sightedAge < 75)
                    Age = "elderly";
                else if (sightedAge < 100)
                    Age = "extremely old";
                else
                    Age = "ancient";

                m_Description = pm.Description;
                m_Nation = pm.Nation;

                if (pm.Disguised)
                {
                    m_Nation = pm.GetDisguisedNation();
                    if (pm.Disguise.Age != null)
                        Age = pm.Disguise.Age;
                    if (pm.Disguise.Description1 != null)
                        m_Description = pm.Disguise.Description1;
                }

                foreach (KeyValuePair<CustomGuildStone,CustomGuildInfo> g in pm.CustomGuilds)
                {
                    if (pm.CustomGuilds[g.Key].ActiveTitle)
                    {
                        m_Guild = g.Key.Name.ToString();
                        continue;
                    }
                }
            }
            else if (m is BaseCreature)
            {
                BaseCreature bc = m as BaseCreature;
                m_IsPlayer = false;

                if (bc is Soldier)
                {
                    IsSoldier = true;
                    m_Guild = (bc as Soldier).Government.Name.ToString();
                }
                else
                {
                    IsSoldier = false;
                    m_Name = bc.Name.ToString();
                }
            }

            Information = ReportInfo.WriteReport(this);
        }
        internal Nation AddNation(Nation n)
        {
            nations[n.NationId] = n;

            return(n);
        }