예제 #1
0
        private void GetRandomItems()
        {
            RandomItems.Clear();
            var random = CurrentItems.OrderBy(n => Guid.NewGuid()).Take(6).ToList();

            random.ForEach(item => RandomItems.Add(item));
        }
예제 #2
0
        public async Task <bool> LoadRandomFromDB()
        {
            try
            {
                await prepareData();
            }
            catch { };

            var dbPath = "Data/places.db";
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbPath);

            /*var tourist = new RssDataGroup("TouristRandom",
             *  "Случайные достопримечательности", "Достопримечательности", "", "");
             * tourist.Order = 15;*/

            try
            {
                var SomeItems = await conn.QueryAsync <MapItem>("SELECT * FROM MapItem ORDER BY RANDOM() LIMIT 0,200");

                foreach (var item in SomeItems)
                {
                    RandomItems.Add(item);
                }
                ;
                RaisePropertyChanged("RandomItems");
            }
            catch { };
            return(true);
        }
    void OnEnable()
    {
        if (rndItems == null)
        {
            rndItems = (RandomItems)target;
        }

        if (manager == null)
        {
            manager = GetManager();
        }
    }
예제 #4
0
    public void Start()
    {
        if (spawnItems)
        {
            randItems = GetComponent <RandomItems>();

            if (randItems != null)
            {
                foreach (Transform p in positions)
                {
                    //   Debug.Log("Chance: " + GameManager.instance.items.rareWeapons.chance);
                    GameObject g = randItems.GetItem(true);
                    PlaceOnTable(g, p);
                }
            }
        }
    }