Ejemplo n.º 1
0
        public override void LoadSave(object obj)
        {
            PlayerSave save = obj as PlayerSave;

            if (save != null)
            {
                Gender       = (Gender)save.gender;
                Level        = save.level;
                CurrentXP    = save.currentXP;
                XPLevelLimit = save.XPLevelLimit;

                PurchasedProducts.Clear();
                if (save.purchasedProducts == null)
                {
                    save.purchasedProducts = new List <int>();
                }
                foreach (int id in save.purchasedProducts)
                {
                    PurchasedProducts.Add(id);
                }
                StatusPoints             = save.statusPoints;
                LifetimeEarnings         = save.lifetimeEarnings;
                LifetimeEarningsInPlanet = save.lifetimeEarningsInPlanet;
                //MaxCompanyCash = save.maxCompanyCash;
                IsHasMicromanager = save.isHasMicromanager;
                IsLoaded          = true;
            }
            else
            {
                LoadDefaults();
            }
        }
Ejemplo n.º 2
0
 public override void ResetByWinGame()
 {
     Level        = 1;
     CurrentXP    = 0;
     XPLevelLimit = 2000;
     PurchasedProducts.Clear();
     StatusPoints             = 0;
     LifetimeEarnings         = 0f;
     LifetimeEarningsInPlanet = 0f;
     //MaxCompanyCash = 0f;
     IsHasMicromanager = false;
     IsLoaded          = true;
 }
Ejemplo n.º 3
0
        public override void LoadDefaults()
        {
            Gender       = Gender.Male;
            Level        = 1;
            CurrentXP    = 0;
            XPLevelLimit = 2000;
            PurchasedProducts.Clear();
            StatusPoints             = 0;
            LifetimeEarnings         = 0.0;
            LifetimeEarningsInPlanet = 0.0;
            //MaxCompanyCash = 0.0;
            IsHasMicromanager = false;

            IsLoaded = true;
        }
Ejemplo n.º 4
0
        private void FillProducts()
        {
            PurchasedProducts.Clear();
            Products.Clear();

            IReadOnlyCollection <Product> products = _productsCatalog.GetProducts();

            foreach (Product product in products)
            {
                if (product.IsPurchased)
                {
                    PurchasedProducts.Add(product);
                }
                else if (!product.RemovedFromSale)
                {
                    Products.Add(product);
                }
            }
        }
        public async Task GetPurchasedProducts(object sender, RoutedEventArgs e)
        {
            // 抓取已經購買的項目
            var purchased = await storeContext.GetUserCollectionAsync(GetProductKinds());

            if (purchased.ExtendedError != null)
            {
                Errored?.Invoke(this, purchased.ExtendedError);
                return;
            }

            if (purchased.Products == null || purchased.Products.Count == 0)
            {
                Message = "Not purchased any product";
                return;
            }

            PurchasedProducts.Clear();

            foreach (var item in purchased.Products)
            {
                PurchasedProducts.Add(new StoreProductDataWrapper(item.Key, item.Value));
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// ClearCart
 /// </summary>
 public void ClearCart()
 {
     PurchasedProducts.Clear();
 }