Exemplo n.º 1
0
    private void AddOneStock(GoodType good)
    {
        GameObject       go    = ResourceManager.Singleton.LoadResource <GameObject>(elmPath);
        GameObject       elmGO = Instantiate(go, table.content.transform);
        InventoryElement ie    = elmGO.GetComponent <InventoryElement>();

        //if (ie != null)
        {
            elementGOs.Add(elmGO);
            ie.good           = good;
            ie.sold          += SoldByPlayer;
            ie.colorImg.color = InvestmentManager.Singleton.GetGoodColor(good);
        }

        switch (ie.good)
        {
        case GoodType.TOMATO:
            ie.label.text = "番茄";
            break;

        case GoodType.SILK:
            ie.label.text = "絲綢";
            break;

        case GoodType.PADDY:
            ie.label.text = "稻米";
            break;

        case GoodType.JADE:
            ie.label.text = "翠玉";
            break;
        }
    }
    public string GetGoodName(GoodType good)
    {
        string key = good.ToString();

        //return csvData[key][Language];
        return(csvData[key]["Chinese"]);
    }
Exemplo n.º 3
0
 private void BuildPlayerInventoryView(GoodType good, int numOfGood)
 {
     for (int iGood = 0; iGood < numOfGood; ++iGood)
     {
         AddOneStock(good);
     }
 }
Exemplo n.º 4
0
 public PresentationAction(GoodType myGoodie)
 {
     this.myGoodie = myGoodie;
     setGoodieDefaults();
     isMistake   = false;
     timeStarted = DateTime.Now.TimeOfDay.TotalMilliseconds;
 }
Exemplo n.º 5
0
 public bool CanBeSoldBy(GoodType goodType, IPlayer player)
 {
     return(!IsFull &&
            player.Goods.Exists(g => g.Type == goodType) &&
            (!Goods.Exists(g => g.Type == goodType) ||
             player.Buildings.ContainsWorkingOfType <Office>()));
 }
Exemplo n.º 6
0
 public Good(string type, float stock, float rateMod = 0, float rateMlt = 1)
 {
     this.type    = Types.goods[type];
     this.stock   = stock;
     this.rateMlt = rateMlt;
     this.rateMod = rateMod;
 }
Exemplo n.º 7
0
        public static IEnumerable <PurchaseItem> GetItemsByTypeAtDateRange(GoodType type, DateTime initialDate, DateTime?finalDate)
        {
            using var db = new PurchaseDBContext();

            if (finalDate.HasValue)
            {
                ApproximateDateToLower(ref initialDate);
                ApproximateDateToUpper(ref finalDate);

                return(DistinctCollections(
                           db.Purchases.ToList().Where(x => x.Date >= initialDate && x.Date <= finalDate.Value)
                           .Select(x => new Purchase(x))
                           .Select(x => x.GetPurchaseItems().Where(x => x.Type.Equals(type))),
                           (item1, item2) => item1.Amount += item2.Amount                                                           //Sum amount of equal items
                           ));
            }
            else
            {
                return(DistinctCollections(
                           db.Purchases.ToList().Where(x => x.Date.Year == initialDate.Year &&
                                                       x.Date.Month == initialDate.Month &&
                                                       x.Date.Day == initialDate.Day)
                           .Select(x => new Purchase(x))
                           .Select(x => x.GetPurchaseItems().Where(x => x.Type.Equals(type))),
                           (item1, item2) => item1.Amount += item2.Amount                                                           //Sum amount of equal items
                           ));
            }
        }
Exemplo n.º 8
0
 protected WorldCard(CardCategory category, int cost, int pointValue, bool isMilitary, bool isWindfall, GoodType goodType)
     : base(category, cost, pointValue)
 {
     IsMilitary = isMilitary;
     IsWindfall = isWindfall;
     GoodType = goodType;
 }
Exemplo n.º 9
0
    public void BuyStock(GoodType type, NetworkInstanceId id, int inc)
    {
        for (int i = 0; i < goods.Count; i++)
        {
            var good = goods[i];
            if (good.type == type)
            {
                var positions = good.playerPositions;
                for (int j = 0; j < positions.Length; j++)
                {
                    var pos = positions[j];
                    if (pos.id == id)
                    {
                        // i have you now
                        pos.position   += inc;
                        positions[j]    = pos;
                        good.inventory -= inc;
                        goods[i]        = good;

                        return;
                    }
                }
            }
        }
    }
Exemplo n.º 10
0
        public void StoreGoods(GoodType goodType, IPlayer player)
        {
            var goodsToStore = player.Goods.Where(g => g.Type == goodType).ToList();

            _storedGoods.AddRange(goodsToStore);
            player.Goods.RemoveAll(g => g.Type == goodType);
        }
Exemplo n.º 11
0
        //Update user's list of goodTypes by adding new goodType
        public void UpdateUserGoodTypesByAddingType(int id, GoodType goodType)
        {
            var temp = GetById(id);

            //temp.GoodTypes.Add(goodType);
            goodsContext.Users.Update(temp);
            base.Update(id, temp);
        }
Exemplo n.º 12
0
 public GoodTypeDTO MapGoodType(GoodType value)
 {
     return(new GoodTypeDTO
     {
         Id = value.Id,
         Name = value.Name
     });
 }
Exemplo n.º 13
0
    private int CalculateGoodPoint(GoodType good)
    {
        int price = InvestmentManager.Singleton.GetSharePrice(good);
        int hNum  = stockDictionary[good][hold];
        int sNum  = stockDictionary[good][sold];

        return((price * hNum) - (15 * sNum));
    }
Exemplo n.º 14
0
        //Update good's type
        public void UpdateGoodByChangingType(int id, GoodType goodType)
        {
            var temp = GetById(id);

            temp.GoodType = goodType;
            goodsContext.Goods.Update(temp);
            base.Update(id, temp);
        }
Exemplo n.º 15
0
    private void CreateStockDictionary(GoodType good)
    {
        Dictionary <string, int> d = new Dictionary <string, int>();

        d.Add(hold, 0);
        d.Add(sold, 0);

        stockDictionary.Add(good, d);
    }
Exemplo n.º 16
0
        public float getLastBuildingProduced(GoodType goodType)
        {
            if (buildingLastProduced.ContainsKey(goodType))
            {
                return(buildingLastProduced[goodType]);
            }

            return(0);
        }
Exemplo n.º 17
0
        public float getLastConsumption(GoodType good)
        {
            if (lastTickTotConsumed.ContainsKey(good))
            {
                return(lastTickTotConsumed[good]);
            }

            return(0);
        }
Exemplo n.º 18
0
    public int GetSharePrice(GoodType good)
    {
        if (goodRiseTimes[good] <= 1)
        {
            return(5);
        }

        return(goodsSharePriceTable[good]);
    }
Exemplo n.º 19
0
        //methods



        public float getConsumed(GoodType good)
        {
            if (baseConsumption.ContainsKey(good))
            {
                return(baseConsumption[good]);
            }

            return(0);
        }
Exemplo n.º 20
0
        public float getLastPeopleProduced(GoodType goodType)
        {
            if (peopleLastProduced.ContainsKey(goodType))
            {
                return(peopleLastProduced[goodType]);
            }

            return(0);
        }
Exemplo n.º 21
0
        public float getProduced(GoodType good)
        {
            if (baseProduction.ContainsKey(good))
            {
                return(baseProduction[good]);
            }

            return(0);
        }
Exemplo n.º 22
0
        public float getLastProduction(GoodType good)
        {
            if (lastTickTotProduced.ContainsKey(good))
            {
                return(lastTickTotProduced[good]);
            }

            return(0);
        }
Exemplo n.º 23
0
    /// <summary>
    /// InvestmentManager sell a stock to the boss of round.
    /// </summary>
    /// <param name="good">Good.</param>
    public void SellStockToBoss(GoodType good)
    {
        int    price  = goodsSharePriceTable[good];
        Player player = GameManager.Singleton.CurrentPlayer;

        player.Pay(price);
        player.BuyStock(good);
        UIManager.Singleton.ChangePlayerInfo();
    }
		private int ComboBoxContains(GoodType obj)
		{
			for (int i = 0; i < TypeComboBox.Items.Count; i++)
			{
				if (TypeComboBox.Items[i].ToString() == obj.ToString())
					return i;
			}

			return -1;
		}
Exemplo n.º 25
0
    /// <summary>
    /// InvestmentManager buy a stock from current player in the round.
    /// </summary>
    /// <param name="good">Good.</param>
    public void BuyStockFromPlayer(GoodType good)
    {
        Player player = GameManager.Singleton.CurrentPlayer;
        int    num    = player.SellStock(good);

        if (num > 0)
        {
            player.Earn(12);
        }
    }
Exemplo n.º 26
0
 public ZFGood(ZFGood goodInfo)
 {
     this.ID           = goodInfo.ID;
     this.name         = goodInfo.name;
     this.description  = goodInfo.description;
     this.typePurchase = goodInfo.typePurchase;
     this.marketInfo   = new MarketInfo(goodInfo.marketInfo);
     this.virtualInfo  = new VirtualInfo(goodInfo.virtualInfo);
     this.goodType     = goodInfo.goodType;
 }
Exemplo n.º 27
0
        public float calcBuildingProduced(GoodType goodType)
        {
            float buildingProduced = 0;

            foreach (Building building in DistrictBuildings)
            {
                buildingProduced += building.getProduced(goodType) * BuildingProdMod; //To change to work with dictionary of modifiers
            }
            return(buildingProduced);
        }
Exemplo n.º 28
0
        public float calcBuildingConsumption(GoodType goodType)
        {
            float buildingConsump = 0;

            foreach (Building building in DistrictBuildings)
            {
                buildingConsump += building.getConsumed(goodType) * BuildingConsumpMod; //To change to work with dictionary of modifiers
            }
            return(buildingConsump);
        }
Exemplo n.º 29
0
    public int GetNumberOfHoldStock(GoodType good)
    {
        //return stockDictionary[good];
        if (!stockDictionary.ContainsKey(good))
        {
            return(-1);
        }

        return(stockDictionary[good][hold]);
    }
Exemplo n.º 30
0
        static private string GetScriptFileName(GoodType type, int characterLevel)
        {
            var fileName = string.Empty;

            switch (type)
            {
            case GoodType.Weapon:
            case GoodType.Armor:
            case GoodType.Money:
            {
                var level = characterLevel / 12 + 1;
                if (level > 7)
                {
                    level = 7;
                }
                switch (type)
                {
                case GoodType.Weapon:
                    fileName = level + "级武器.txt";
                    break;

                case GoodType.Armor:
                    fileName = level + "级防具.txt";
                    break;

                case GoodType.Money:
                    fileName = level + "级钱.txt";
                    break;
                }
            }
            break;

            case GoodType.Drug:
                if (characterLevel <= 10)
                {
                    fileName = "低级药品.txt";
                }
                else if (characterLevel <= 30)
                {
                    fileName = "中级药品.txt";
                }
                else if (characterLevel <= 60)
                {
                    fileName = "高级药品.txt";
                }
                else
                {
                    fileName = "特级药品.txt";
                }
                break;
            }

            return(fileName);
        }
Exemplo n.º 31
0
 public Good getGood(GoodType goodToGet)
 {
     if (goodTable.ContainsKey(goodToGet))
     {
         return(goodTable[goodToGet]);
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 32
0
        public byte CustomerBuy(GoodType c, int quantity)
        {
            Good good = _vmAssortment.Goods.FirstOrDefault(x => x.Type == c);
            var Sum = good.Price * quantity;
            if (Sum > _customerBalance) return 0;

            lock (_syncRoot)
            {
                _customerBalance = _customerBalance - Sum;
                _vmAssortment.Goods.FirstOrDefault(x => x.Type == c).Quantity -= quantity;
            }

            return 1;
        }
 public PresentationAction(GoodType myGoodie)
 {
     this.myGoodie = myGoodie;
     setGoodieDefaults();
     isMistake = false;
     timeStarted = DateTime.Now.TimeOfDay.TotalMilliseconds;
 }
Exemplo n.º 34
0
 public Good(double price, GoodType goodType, bool isImported)
 {
     _price = price;
     _goodType = goodType;
     _isImported = isImported;
 }
Exemplo n.º 35
0
	public ZFGood(ZFGood goodInfo)
	{
		this.ID = goodInfo.ID;
		this.name = goodInfo.name;
		this.description = goodInfo.description;
		this.typePurchase = goodInfo.typePurchase;
		this.marketInfo = new MarketInfo(goodInfo.marketInfo);
		this.virtualInfo = new VirtualInfo(goodInfo.virtualInfo);
		this.goodType = goodInfo.goodType;
	}
Exemplo n.º 36
0
 public Good(double price, GoodType goodType)
 {
     _price = price;
     _goodType = goodType;
 }