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"]); }
private void BuildPlayerInventoryView(GoodType good, int numOfGood) { for (int iGood = 0; iGood < numOfGood; ++iGood) { AddOneStock(good); } }
public PresentationAction(GoodType myGoodie) { this.myGoodie = myGoodie; setGoodieDefaults(); isMistake = false; timeStarted = DateTime.Now.TimeOfDay.TotalMilliseconds; }
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>())); }
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; }
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 )); } }
protected WorldCard(CardCategory category, int cost, int pointValue, bool isMilitary, bool isWindfall, GoodType goodType) : base(category, cost, pointValue) { IsMilitary = isMilitary; IsWindfall = isWindfall; GoodType = goodType; }
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; } } } } }
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); }
//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); }
public GoodTypeDTO MapGoodType(GoodType value) { return(new GoodTypeDTO { Id = value.Id, Name = value.Name }); }
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)); }
//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); }
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); }
public float getLastBuildingProduced(GoodType goodType) { if (buildingLastProduced.ContainsKey(goodType)) { return(buildingLastProduced[goodType]); } return(0); }
public float getLastConsumption(GoodType good) { if (lastTickTotConsumed.ContainsKey(good)) { return(lastTickTotConsumed[good]); } return(0); }
public int GetSharePrice(GoodType good) { if (goodRiseTimes[good] <= 1) { return(5); } return(goodsSharePriceTable[good]); }
//methods public float getConsumed(GoodType good) { if (baseConsumption.ContainsKey(good)) { return(baseConsumption[good]); } return(0); }
public float getLastPeopleProduced(GoodType goodType) { if (peopleLastProduced.ContainsKey(goodType)) { return(peopleLastProduced[goodType]); } return(0); }
public float getProduced(GoodType good) { if (baseProduction.ContainsKey(good)) { return(baseProduction[good]); } return(0); }
public float getLastProduction(GoodType good) { if (lastTickTotProduced.ContainsKey(good)) { return(lastTickTotProduced[good]); } return(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; }
/// <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); } }
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; }
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); }
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); }
public int GetNumberOfHoldStock(GoodType good) { //return stockDictionary[good]; if (!stockDictionary.ContainsKey(good)) { return(-1); } return(stockDictionary[good][hold]); }
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); }
public Good getGood(GoodType goodToGet) { if (goodTable.ContainsKey(goodToGet)) { return(goodTable[goodToGet]); } else { return(null); } }
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 Good(double price, GoodType goodType, bool isImported) { _price = price; _goodType = goodType; _isImported = isImported; }
public Good(double price, GoodType goodType) { _price = price; _goodType = goodType; }