Exemplo n.º 1
0
 void Awake()
 {
     Instance = this;
     foreach (var item in itemsPickup)
     {
         if (item.item.HaveItem)
         {
             items.Add(item.item);
         }
     }
 }
Exemplo n.º 2
0
        public async Task WorkWithSets()
        {
            if (realm == null)
            {
                realm = await Realm.GetInstanceAsync();
            }

            //:code-block-start:query-sets
            //:replace-start: {
            //  "terms": {
            //   "PlantInventory": "Inventory"}
            // }
            var inventory = new PlantInventory();

            inventory.PlantSet.Add(new Plant()
            {
                Name = "Prickly Pear"
            });
            inventory.DoubleSet.Add(123.45);

            realm.Write(() =>
            {
                realm.Add <PlantInventory>(inventory);
            });

            // convert the Plant Set to an IQueryable and apply a filter
            var pricklyPear = inventory.PlantSet.AsRealmQueryable()
                              .Where(p => p.Name == "Prickly Pear");
            // Alternatively, apply a filter directly on the Plant Set
            var pricklyPearPlants = inventory.PlantSet
                                    .Filter("Name == 'Prickly Pear'");

            // Find all Inventory items that have at least one value in their
            // IntDict that is larger than 5
            var moreThan100 = realm.All <PlantInventory>()
                              .Filter("DoubleSet.@values > 100");

            // :replace-end:
            //:code-block-end:

            Assert.IsNotNull(pricklyPear);
            Assert.IsNotNull(pricklyPearPlants);
            Assert.IsNotNull(moreThan100);
        }
Exemplo n.º 3
0
        public async Task WorkWithSets()
        {
            if (realm == null)
            {
                realm = await Realm.GetInstanceAsync();
            }

            //:code-block-start:query-sets
            //:replace-start: {
            //  "terms": {
            //   "PlantInventory": "Inventory"}
            // }
            var inventory = new PlantInventory();

            inventory.PlantSet.Add(new Plant()
            {
                Name = "Prickly Pear"
            });
            inventory.DoubleSet.Add(123.45);

            realm.Write(() =>
            {
                realm.Add <PlantInventory>(inventory);
            });

            // Find all Plants that have "Prickly Pear" in the name
            var pricklyPear = realm.All <PlantInventory>()
                              .Filter("PlantSet.Name CONTAINS 'Prickly Pear'");

            // Find all Inventory items that have at least one value in their
            // IntDict that is larger than 5
            var moreThan100 = realm.All <PlantInventory>()
                              .Filter("DoubleSet.@values > 100");

            // :replace-end:
            //:code-block-end:

            Assert.IsNotNull(pricklyPear);
            Assert.IsNotNull(moreThan100);
        }