/// <summary> /// Attempts to start shopping at a shop owned by the <paramref name="shopkeeper"/>. /// </summary> /// <param name="shop">The shop to start shopping at.</param> /// <param name="shopkeeper">The owner of the shop to try to start shopping at.</param> /// <param name="entityMap">The map that the <paramref name="shopkeeper"/> is on.</param> /// <returns> /// True if the shopping was successfully started at the <paramref name="shopkeeper"/>'s /// shop; otherwise false. /// </returns> bool TryStartShopping(IShop <TShopItem> shop, TShopOwner shopkeeper, IMap entityMap) { ThreadAsserts.IsMainThread(); if (shop == null || shopkeeper == null || entityMap == null) { return(false); } if (GetCharacterMap(Character) != entityMap) { return(false); } if (!IsValidDistance(Character, shopkeeper)) { return(false); } // If the User was already shopping somewhere else, stop that shopping if (_shoppingAt != null) { SendStopShopping(Character); } // Start the shopping _shoppingAt = shop; _shopOwner = shopkeeper; _shopMap = entityMap; SendStartShopping(Character, shop); return(true); }
public Simulations(ILogger logger, IWarehouse warehouse, ICustomerBase customerBase, IShop shop) { this.logger = logger; Warehouse = warehouse; CustomerBase = customerBase; Shop = shop; }
public void SetInfo(IShop shop, IWeaponItem weaponItem, IAmmoItem ammoItem, Texture image) { this.shop = shop; this.weaponItem = weaponItem; this.ammoItem = ammoItem; // firstly, set const info nameText.text = GetTranslation(weaponItem.TranslationKey); ammoImage.sprite = ammoItem.Icon; SetPercentage(damageIndicatorImage, maxIndicatorsWidth, Mathf.Clamp(weaponItem.Damage / IndicatorMaxDamage, 0, 1)); SetPercentage(durabilityIndicatorImage, maxIndicatorsWidth, Mathf.Clamp(weaponItem.Durability / IndicatorMaxDurability, 0, 1)); SetPercentage(fireRateIndicatorImage, maxIndicatorsWidth, Mathf.Clamp(weaponItem.RoundsPerMinute / IndicatorMaxFireRate, 0, 1)); SetPercentage(accuracyIndicatorImage, maxIndicatorsWidth, Mathf.Clamp(weaponItem.Accuracy / IndicatorMaxAccuracy, 0, 1)); // then updateable info UpdateInfo(); SetImage(image); }
new public void TestInitialise() { base.TestInitialise(); shop = roar.Shop; Assert.IsNotNull(shop); Assert.IsFalse(shop.HasDataFromServer); }
public IShop AddProductToShop(string shopType, int productId) { IProduct product = this.GetProductById(productId); if (product == null) { return(null); } if (product.Shop != null) { throw new InvalidOperationException( string.Format( Messages.ProductAlreadyInShop, productId, product.Shop.GetType().Name ) ); } IShop shop = this.shops[shopType]; product.Shop = shop; return(shop.AddProduct(product)); }
public Buyer(ILogger logger, ICustomerBase customerBase, IWarehouse warehouse, IShop shop) { this.logger = logger; CustomerBase = customerBase; Warehouse = warehouse; Shop = shop; }
protected Shop(IShop successor, int capacity) { this.capacity = capacity; this.successor = successor; this.usedCapacity = 0; this.products = new List <IProduct>(); }
protected virtual void Inititalize <T>(IShop shop, Transform parent) where T : Item { shop.ItemsDB = Resources.Load <TextAsset>(shop.Path); shop.Cells = new List <Cell>(); shop.Cells.AddRange(SetParametres(GetItemsJson <T>(shop.ItemsDB), shop, parent)); }
public void Activate() { gameObject.SetActive(true); IShop shop = GameController.Instance.Shop; IInventory inventory = GameController.Instance.Inventory; List <WeaponIndex> availableWeapons = inventory.Weapons.GetAvailableWeapons(); List <AmmunitionType> availableAmmo = inventory.Ammo.GetNecessaryAmmo(availableWeapons); // activate needed for (int i = 0; i < availableAmmo.Count; i++) { ammoShopItems[i].gameObject.SetActive(true); ammoShopItems[i].SetInfo(shop, inventory.Ammo.Get(availableAmmo[i])); } // deactivate other for (int i = availableAmmo.Count; i < ammoShopItems.Length; i++) { ammoShopItems[i].gameObject.SetActive(false); } noAvailableAmmoText.SetActive(availableAmmo.Count == 0); }
/// <summary> /// When overridden in the derived class, notifies the <paramref name="character"/> that they have /// started shopping at the given <paramref name="shop"/>. /// </summary> /// <param name="character">The character doing the shopping.</param> /// <param name="shop">The shop that the <paramref name="character"/> is shopping at..</param> protected override void SendStartShopping(User character, IShop <ShopItem> shop) { using (var pw = ServerPacket.StartShopping(ShopOwner.MapEntityIndex, shop)) { character.Send(pw, ServerMessageType.GUI); } }
public ItemViewModel(IShop shop, ShariandoService shariandoService) { _shariandoService = shariandoService; Shop = shop; UpdateAttributes(); InitCommands(); }
/// <summary> /// Удалить магазин из БД /// </summary> /// <param name="shop_"></param> public void Delete(IShop shop_) { var shop = _dbContext.Shop.Where(sh => sh.Id == shop_.Id).First(); _dbContext.Shop.Remove(shop); _dbContext.SaveChanges(); }
public void addShop(IShop shop) { if (this.AreaAvailable >= shop.AreaSize) { Shops.Add(shop); this.AreaAvailable -= shop.AreaSize; } }
public void Setup() { _shopController = GlobalGameObject.AddComponent <MockShopController>(); _shopController.Credentials = new ShopCredentials(Utils.TestShopDomain, Utils.TestAccessToken); _shop = Substitute.For <IShop>(); _shopController.Shop = _shop; }
public AddCategory(ShopClient _Shop) { InitializeComponent(); this.shop = _Shop; this.Text = "Введите категории(ю)"; this.Width = 400; tabConstr(); }
/// <summary> /// Добавить магазин в БД /// </summary> /// <param name="shop_"></param> public Shop Create(IShop shop_) { var shop = EntitiesFactory.Get().CreateShop(shop_.Id, shop_.Name, shop_.Address); var sh = _dbContext.Shop.Add(shop); _dbContext.SaveChanges(); return(sh); }
/// <summary> /// Обновить магазин в БД /// </summary> /// <param name="shop_"></param> public void Update(IShop shop_) { var shop = _dbContext.Shop.Where(sh => sh.Id == shop_.Id).First(); shop.Name = shop_.Name; shop.Address = shop_.Address; _dbContext.SaveChanges(); }
public Form1() { InitializeComponent(); shop = new Shop(); timer = new Timer(); timer.Tick += timer_Tick; timer.Interval = 200; timer.Start(); }
public static PacketWriter StartShopping(MapEntityIndex shopOwnerIndex, IShop<ShopItem> shop) { var pw = GetWriter(ServerPacketID.StartShopping); pw.Write(shopOwnerIndex); pw.Write(shop.CanBuy); pw.Write(shop.Name); shop.WriteShopItems(pw); return pw; }
public override bool Buy(Cell cell, IShop shop) { if (Cost <= PlayerAttributes.PlayerProperties.Money) { OnChooseMuscle?.Invoke(() => PlayerAttributes.RemoveMoney(Cost)); return(true); } return(false); }
public void Setup() { _gameObject = new GameObject("TestShopControllerBase"); _shopController = _gameObject.AddComponent <MockShopController>(); _shopController.Credentials = new ShopCredentials(Utils.TestShopDomain, Utils.TestAccessToken); _shopController.LoaderProvider = new UnityEditorLoaderProvider(); _shop = Substitute.For <IShop>(); _shopController.Shop = _shop; }
/// <summary> /// Constructor /// </summary> /// <param name="quota"> /// Sets the quota for product to be made for each backroom /// </param> /// <param name="typeOfShop"> /// Enum of types of shop to be created. /// </param> public Store(int quota, ShopType typeOfShop) { Quota = quota; Shop = ShopFactory.ShopFactory.CreateShop(typeOfShop); Name = Shop.GetName(); Backroom = new Backroom(); ProductsForSale = Backroom.CreateMultipleStatues(5); ProductsSold = new List <IStatue>(); StoreIsOpen = true; }
/// <summary> /// Set info about ammo item /// </summary> public void SetInfo(IShop shop, IAmmoItem item) { this.shop = shop; this.ammoItem = item; nameText.text = GetTranslation(ammoItem.TranslationKey); ammoImage.sprite = ammoItem.Icon; UpdateInfo(); }
static void ListRemainingBooksInShop(IShop shop) { var shopItems = shop.GetBooks(); foreach (var shopItem in shopItems) { Console.WriteLine($"Book ID: {shopItem.Id} / book name: {shopItem.Name} / book quantity: {shopItem.Quantity}"); } Console.WriteLine(); }
public override bool Buy(Cell cell, IShop shop) { if (PlayerAttributes.RemoveMoney(cell.Properties.Cost) && (BoostDatabase.Boosts.Count < BoostsHandler.MaxBoosts)) { OnBought?.Invoke(this); return(true); } //TODO: message return(false); }
public ShopPresenter(IShop view) { this.view = view; view.Presenter = this; view.FLineDoubleClick += View_FLineDoubleClick; view.ReelDoubleClick += View_ReelDoubleClick; view.RoadDoubleClick += View_RoadDoubleClick; view.LureDoubleClick += View_LureDoubleClick; view.BaitDoubleClick += View_BaitDoubleClick; view.HookDoubleClick += View_HookDoubleClick; }
public void Activate() { gameObject.SetActive(true); shop = GameController.Instance.Shop; inventory = GameController.Instance.Inventory; //weaponsWorldUI.Activate(); SetWeaponItem(currentWeapon); }
public static IShopData ToShopData(this IShop shop) { return(new ShopData( id: shop.Id, tenantId: shop.TenantId, name: shop.Name, shortName: shop.ShortName, logoImage: shop.LogoImage, coverImage: shop.CoverImage, description: shop.Description )); }
public virtual bool Buy(Cell cell, IShop shop) { if (PlayerAttributes.RemoveMoney(cell.Properties.Cost)) { cell.Remove(shop.Cells); return(true); } else { return(false); } }
protected override void Inititalize <T>(IShop type, Transform thisGO) { Shops.Add(this); Cells = new List <Cell>(); Path = "Shop/ProteinShop"; base.Inititalize <T>(type, thisGO); PlayerAttributes.Properties.OnLevelChanged += LevelChanged_OnLevelChanged; }
public HomeController(IShop shop, IGoods goods) { this.shopRepository = shop; this.goodsRepository = goods; }
public Listing(FccShop shop, Item rewardItem, Item costItem, int costCount, FCRank requiredFcRank) { _Shop = shop; _Cost = new ShopListingItem(this, costItem, costCount, false); _Reward = new ShopListingItem(this, rewardItem, 1, false); }
public new void TestInitialise() { base.TestInitialise(); shop = roar.Shop; Assert.IsNotNull(shop); Assert.IsFalse(shop.HasDataFromServer); }