コード例 #1
0
ファイル: Resource.cs プロジェクト: Jandhi/SettlersOfValgard
 public Resource(string nameText, VColor nameForeground, int size = 1)
 {
     NameText       = nameText;
     NameForeground = nameForeground;
     Size           = size;
     AllResources.Add(this);
 }
コード例 #2
0
 private static void AddLanguage(PropertyInfo[] keys, ResourceManager resourceManager, string languageName, string cultureName)
 {
     if (!AllResources.ContainsKey(languageName) && !string.IsNullOrWhiteSpace(languageName))
     {
         AllResources.Add(languageName, keys.ToDictionary(
                              key => key.Name,
                              key => resourceManager.GetString(
                                  key.Name,
                                  new CultureInfo(cultureName))));
     }
 }
コード例 #3
0
 public void OnFinish(AllResources allResources)
 {
     try
     {
         ResourceListStore.Instance.Save(Paths.Getter().ResourceList(), allResources);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     _outerInstance._isScanning = false;
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: Mazing23/Toets4
        /// <summary>
        /// It takes 3 WOOD, 5 IRON, 2 STONE to upgrade defense
        /// </summary>
        public void AddDefenseToHome()
        {
            Resource wood  = AllResources.Find(x => x.Name.Contains("Wood"));
            Resource iron  = AllResources.Find(x => x.Name.Contains("Iron"));
            Resource stone = AllResources.Find(x => x.Name.Contains("Stone"));

            if (Player.Resources[wood] >= 3 &&
                Player.Resources[iron] >= 5 &&
                Player.Resources[stone] >= 2)
            {
                Home.AddDefense((Home.Defence + 2));
            }
        }
コード例 #5
0
ファイル: Game.cs プロジェクト: Mazing23/Toets4
 /// <summary>
 /// It takes 5 GRAINS to add new citizens.
 /// </summary>
 public void AddCitizenToHome()
 {
     foreach (Resource r in AllResources)
     {
         if (r == AllResources.Find(x => x.Name.Contains("Grain")))
         {
             if (Player.Resources.ContainsKey(r))
             {
                 if (Player.Resources[r] - 5 >= 0)
                 {
                     int i = Player.Resources[r] / 5;
                     Player.Resources[r] = Player.Resources[r] - (5 * i);
                     Home.AddCitizens(Home.Citizens + i);
                 }
             }
         }
     }
 }
コード例 #6
0
ファイル: Game.cs プロジェクト: Mazing23/Toets4
        public void Setup()
        {
            string[] gunnames = new string[] { "Excalibur", "Glock", "Assualt Rifle"
                                               , "Red John", "Heaven Bringer", "Glory", "Lucy" };
            string[] swordnames = new string[] { "Champion", "Wooden sword", "Stormbringer"
                                                 , "Mournblade", "Sword of Dawn", "RavenBrand", "Harry" };
            string[] armournames = new string[] { "Hide Armour", "Iron Armour", "Elestial Armour"
                                                  , "Windbreaker", "A Sheet", "A leaf", "Diamond Glades" };

            // be mindfull of the size of the arrays, as they need to be equal length
            if (gunnames.Length - swordnames.Length != 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (gunnames.Length - armournames.Length != 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            ItemFactory fact = new ItemFactory();

            for (int i = 0; i < gunnames.Length; i++)
            {
                //var gun = fact.CreateItem<Gun>();
                //allItems.Add(gunnames[i], gun);
                //allItems[gunnames[i]].Name = gunnames[i];
                ////AllItems.Add(gun);
                //var sword = fact.CreateItem<Sword>();
                //allItems.Add(swordnames[i], sword);
                //allItems[swordnames[i]].Name = swordnames[i];
                ////AllItems.Add(sword);
                //var armour = fact.CreateItem<Clothing>();
                //allItems.Add(armournames[i], armour);
                //allItems[armournames[i]].Name = armournames[i];
                ////AllItems.Add(armour);

                Item gun = new Gun(gunnames[i]);
                AllItems.Add(gun.Name, gun);
                Item sword = new Sword(swordnames[i]);
                AllItems.Add(sword.Name, sword);
                Item armour = new Clothing(armournames[i]);
                AllItems.Add(armour.Name, armour);
            }

            //var fist = fact.CreateItem<Sword>();
            Item fist = new Weapon("Fist");

            AllItems.Add("Fist", fist);

            Player.MakeItem(AllItems["Fist"]);
            Player.EquipItem(AllItems["Fist"]);

            Player.EquipItem(AllItems["Hide Armour"]);

            Console.WriteLine(Player.EquipedWeapon.ToString());

            AllResources.Add(new Resource("Wood"));  // for home / defence
            AllResources.Add(new Resource("Iron"));  // make weapons / clothes
            AllResources.Add(new Resource("Grain")); // for the citizens
            AllResources.Add(new Resource("Wool"));  // for clothes
            AllResources.Add(new Resource("Stone")); // for home / defence

            string[] enemyList = { "Rebelious Farmer", "Giant Wolf", "Lost Knight", "Sneaky Ninja", "Slow Oger", "Swift Reeves", "Mad Scientist" };

            for (int i = 0; i < enemyList.Length; i++)
            {
                int damageRandom = rand.Next(1, 51);
                Enemys.Add(new Enemy(enemyList[i], damageRandom));
            }

            GenerateMap();
        }
コード例 #7
0
ファイル: ResourceCollection.cs プロジェクト: erikvk/RESTable
 public void CopyTo(IResource[] array, int arrayIndex) => AllResources.CopyTo(array, arrayIndex);
コード例 #8
0
ファイル: ResourceCollection.cs プロジェクト: erikvk/RESTable
 public bool Contains(IResource item) => AllResources.Contains(item);
コード例 #9
0
ファイル: ResourceCollection.cs プロジェクト: erikvk/RESTable
 public IEnumerator <IResource> GetEnumerator() => AllResources.GetEnumerator();