Beispiel #1
0
    void UpdateDate()
    {
        if (Rounds > 1)
        {
            Player.PlayerData.CurrentDate = DateUtils.AddDay(Player.PlayerData.CurrentDate, 3);
            UpdateDateText(Player.PlayerData.CurrentDate);
        }

        Rounds++;
    }
Beispiel #2
0
    public void CreatePlayer()
    {
        PlayerData = new PlayerData
        {
            CurrentDate = "1970-1-1",
            Money       = 100,
            StoreCount  = 1,
            Level       = 1
        };

        var sales = new List <Sales>();

        var days = 365;
        var date = "1970-1-1";

        var productTypes = new List <string> {
            "Technology", "Home/Furniture", "Kitchen", "Sports/Fitness", "Outdoor"
        };

        var random = new System.Random();

        for (var i = 0; i < days; i++)
        {
            var totalSales = random.Next(0, 500);
            var type       = productTypes[random.Next(0, productTypes.Count)];

            while (string.IsNullOrEmpty(type))
            {
                type = productTypes[random.Next(0, productTypes.Count)];
            }

            sales.Add(new Sales
            {
                Date        = date,
                Season      = DateUtils.DetermineSeason(date),
                Month       = DateUtils.GetMonth(date),
                Day         = DateUtils.GetDay(date),
                Year        = DateUtils.GetYear(date),
                TotalSales  = totalSales,
                ProductType = type
            });

            date = DateUtils.AddDay(date, 10);
        }

        var seasons = new List <string>()
        {
            "Spring", "Fall", "Summer", "Winter"
        };

        for (var i = 0; i < productTypes.Count; i++)
        {
            var quantity = random.Next(0, 15);
            var season   = seasons[random.Next(0, seasons.Count)];

            PlayerData.Products.Add(new Product(quantity, 0, productTypes[i], season));
        }

        PlayerData.SalesInfo       = new SalesInfo();
        PlayerData.SalesInfo.Sales = sales;
    }