示例#1
0
        private async void ShowCamera()
        {
            Image img = new Image();

            if (CrossMedia.Current.IsCameraAvailable && CrossMedia.Current.IsTakePhotoSupported)
            {
                MediaFile file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    SaveToAlbum = true,
                    Directory   = "Clothes",
                    Name        = $"{DateTime.Now.ToString("dd.MM.yyyy_hh.mm.ss")}.jpg"
                });

                if (file == null)
                {
                    return;
                }
                img.Source = ImageSource.FromFile(file.Path);
                string stringSource = (FileImageSource)img.Source;
                Clothes.Add(new ListClothesVM(new ClothesItemDTO
                {
                    ClothesId     = counter + 1,
                    ClothesSource = stringSource,
                    ClothesTitle  = "default"
                }));
                counter++;
            }
        }
        public void RestoreState(IStateSnippet savedState)
        {
            var state = (PlayerControllerStateSnippet)savedState;

            _warmthLevelTimeoutCounter  = state.WarmthLevelTimeoutCounter;
            _wetnessLevelTimeoutCounter = state.WetnessLevelTimeoutCounter;
            _warmthLerpTarget           = state.WarmthLerpTarget;
            _warmthLerpCounter          = state.WarmthLerpCounter;
            _warmthLerpBase             = state.WarmthLerpBase;
            _sleepingCounter            = state.SleepingCounter;
            _sleepDurationGameHours     = state.SleepDurationGameHours;
            _sleepHealthCheckPeriod     = state.SleepHealthCheckPeriod;
            _sleepHealthChecksLeft      = state.SleepHealthChecksLeft;
            _sleepStartTime             = state.SleepStartTime;
            _fatigueValueAfterSleep     = state.FatigueValueAfterSleep;

            _wetnessController.RestoreState((WetnessControllerSnippet)state.ChildStates["WetnessController"]);

            Clothes.Clear();

            foreach (var clothesItem in state.Clothes)
            {
                var newId = state.InventoryData.ItemsMapping.ContainsKey(clothesItem) ? state.InventoryData.ItemsMapping[clothesItem] : (Guid?)null;
                var item  = newId.HasValue ? _gc.Inventory.Items.FirstOrDefault(x => x.Id == newId.Value) : null;

                if (item as ClothesItemBase != null)
                {
                    Clothes.Add((ClothesItemBase)item);
                }
            }

            Appliances.Clear();

            foreach (var applianceItem in state.Appliances)
            {
                var newId = state.InventoryData.ItemsMapping.ContainsKey(applianceItem.ItemId) ? state.InventoryData.ItemsMapping[applianceItem.ItemId] : (Guid?)null;
                var item  = newId.HasValue ? _gc.Inventory.Items.FirstOrDefault(x => x.Id == newId.Value) : null;

                if (item as InventoryMedicalItemBase != null)
                {
                    Appliances.Add(new MedicalBodyAppliance {
                        BodyPart = applianceItem.BodyPart,
                        Item     = (InventoryMedicalItemBase)item
                    });
                }
            }
        }
示例#3
0
        private async void AddClothes()
        {
            Image img = new Image();

            if (CrossMedia.Current.IsPickPhotoSupported)
            {
                MediaFile photo = await CrossMedia.Current.PickPhotoAsync();

                Uri uri = new Uri("http://192.168.0.102:3000/Files/NcJt28shWN0.jpg");
                img.Source = ImageSource.FromFile(photo.Path);
                //string stringSource = (FileImageSource)img.Source;
                Clothes.Add(new ListClothesVM(new ClothesItemDTO
                {
                    ClothesId     = counter + 1,
                    ClothesSource = img.Source,
                    ClothesTitle  = "default"
                }));
                counter++;
            }
        }
示例#4
0
        public void AddItemAdmin()
        {
            if (Clothes.Count < 1)
            {
                Console.WriteLine("There are currently no items listed.");
            }
            else
            {
                GetItems();
            }


            Console.WriteLine();
            Console.WriteLine();
            while (true)
            {
                int  selected;
                bool success;
                bool pick = true;
                Console.WriteLine("ADD ITEM TO SELL IN STORE: \n");

                Garment garment = new Garment();

                DisplayType();
                Console.WriteLine("Pick garment from list, add by entering it's associated number: ");
                do
                {
                    success = Int32.TryParse(Console.ReadLine(), out selected);
                    if (success && Enum.IsDefined(typeof(Item), selected))
                    {
                        garment.Type = (Item)selected;
                        pick         = false;
                    }
                    else
                    {
                        Console.WriteLine("Invalid input: make sure to enter a number from the list!");
                    }
                } while (pick);

                Console.Clear();
                pick = true;
                DisplayColor();
                Console.WriteLine("Pick color from list, add by entering it's associated number: ");
                do
                {
                    success = Int32.TryParse(Console.ReadLine(), out selected);
                    if (success && Enum.IsDefined(typeof(Color), selected))
                    {
                        garment.Color = (Color)selected;
                        pick          = false;
                    }
                    else
                    {
                        Console.WriteLine("Invalid input: make sure to enter a number from the list!");
                    }
                } while (pick);

                Console.Clear();
                pick = true;
                DisplaySize();
                Console.WriteLine("Pick size from list, add by entering it's associated number: ");
                do
                {
                    success = Int32.TryParse(Console.ReadLine(), out selected);
                    if (success && Enum.IsDefined(typeof(Size), selected))
                    {
                        garment.Size = (Size)selected;
                        pick         = false;
                    }
                    else
                    {
                        Console.WriteLine("Invalid input: make sure to enter a number from the list!");
                    }
                } while (pick);

                Console.Clear();
                pick = true;
                DisplaySeason();
                Console.WriteLine("Pick season from list, add by entering it's associated number: ");
                do
                {
                    success = Int32.TryParse(Console.ReadLine(), out selected);
                    if (success && Enum.IsDefined(typeof(Collection), selected))
                    {
                        garment.Season = (Collection)selected;
                        pick           = false;
                    }
                    else
                    {
                        Console.WriteLine("Invalid input: make sure to enter a number from the list!");
                    }
                } while (pick);

                pick = true;
                do
                {
                    Console.WriteLine($"Enter the price of {garment.Type} (in £): ");

                    try
                    {
                        decimal input = decimal.Parse(Console.ReadLine());
                        if (input > 0)
                        {
                            garment.Price = input;
                            pick          = false;
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                } while (pick);

                Console.WriteLine($"Adding..{garment.Type} with the color: {garment.Color}, in size: {garment.Size}, with the price: {garment.Price} £... to the store.");
                Clothes.Add(garment);
                break; //add one item at a time for simplification purposes
            }
        }