Esempio n. 1
0
        public ScoreModalPage(ScavengerHuntItem newItem) : this()
        {
            this.item = newItem;

            modalLabel.Text  = this.item.Title;
            itemPhoto.Source = this.item.Photo.Source;
            itemMatch.Text   = String.Format("Match Confidence: {0}", newItem.Points);
            otherItem1.Text  = String.Format("{0}: {1}", newItem.OtherItem1, newItem.OtherItem1Match);
            otherItem2.Text  = String.Format("{0}: {1}", newItem.OtherItem2, newItem.OtherItem2Match);
        }
Esempio n. 2
0
        void Handle_StartClicked(object sender, System.EventArgs e)
        {
            // remove any previously defined items
            app.AppData.ItemList.Items.Clear();


            // select items for the search, based on selection
            // master list
            var itemList   = new List <string>();
            var indoorList = new List <string> {
                "apple", "helmet", "lego", "banana", "stapler", "eraser", "pen"
            };
            var colorList = new List <string> {
                "green", "blue", "red", "pink"
            };
            var expressionList = new List <string> {
                "anger", "smile", "confused", "sad"
            };
            var outdoorList = new List <string> {
                "tree", "car", "bicycle", "lake", "bird"
            };


            if (app.config.UseIndoors)
            {
                itemList.AddRange(indoorList);
            }
            if (app.config.UseColors)
            {
                itemList.AddRange(colorList);
            }
            if (app.config.UserFacialExperssions)
            {
                itemList.AddRange(expressionList);
            }
            if (app.config.UseOutDoors)
            {
                itemList.AddRange(outdoorList);
            }

            int fullCount = itemList.Count;

            for (int i = 0; i < Math.Min(Max_items, fullCount); i++)
            {
                // pick a random prompt
                Random random     = new Random(DateTime.Now.Millisecond);
                int    itemIndex  = random.Next(0, itemList.Count);
                string itemString = itemList[itemIndex];
                itemList.Remove(itemString);

                // create an item
                ScavengerHuntItem newItem = new ScavengerHuntItem();
                newItem.Title       = itemString;
                newItem.Description = $"Find a {itemString}";

                // add it to the list
                app.AppData.ItemList.Items.Add(newItem);
            }

            // Set time to complete task
            switch (app.config.Difficulty)
            {
            case DifficultyLevel.Easy:
                app.AppData.TimeLeftInSeconds = 15 * 60;
                break;

            case DifficultyLevel.Medium:
                app.AppData.TimeLeftInSeconds = 10 * 60;
                break;

            case DifficultyLevel.Hard:
                app.AppData.TimeLeftInSeconds = 3 * 60;
                break;

            default:
                app.AppData.TimeLeftInSeconds = 59;
                break;
            }

            // begin the game
            Navigation.PushAsync(new GamePage(app.config), true);
        }