Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 public Simulations(ILogger logger, IWarehouse warehouse, ICustomerBase customerBase, IShop shop)
 {
     this.logger  = logger;
     Warehouse    = warehouse;
     CustomerBase = customerBase;
     Shop         = shop;
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 new public void TestInitialise()
 {
     base.TestInitialise();
     shop = roar.Shop;
     Assert.IsNotNull(shop);
     Assert.IsFalse(shop.HasDataFromServer);
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 public Buyer(ILogger logger, ICustomerBase customerBase, IWarehouse warehouse, IShop shop)
 {
     this.logger  = logger;
     CustomerBase = customerBase;
     Warehouse    = warehouse;
     Shop         = shop;
 }
Ejemplo n.º 7
0
 protected Shop(IShop successor, int capacity)
 {
     this.capacity     = capacity;
     this.successor    = successor;
     this.usedCapacity = 0;
     this.products     = new List <IProduct>();
 }
Ejemplo n.º 8
0
    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));
    }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
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();
 }
Ejemplo n.º 12
0
        /// <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();
        }
Ejemplo n.º 13
0
 public void addShop(IShop shop)
 {
     if (this.AreaAvailable >= shop.AreaSize)
     {
         Shops.Add(shop);
         this.AreaAvailable -= shop.AreaSize;
     }
 }
Ejemplo n.º 14
0
        public void Setup()
        {
            _shopController             = GlobalGameObject.AddComponent <MockShopController>();
            _shopController.Credentials = new ShopCredentials(Utils.TestShopDomain, Utils.TestAccessToken);

            _shop = Substitute.For <IShop>();
            _shopController.Shop = _shop;
        }
Ejemplo n.º 15
0
 public AddCategory(ShopClient _Shop)
 {
     InitializeComponent();
     this.shop  = _Shop;
     this.Text  = "Введите категории(ю)";
     this.Width = 400;
     tabConstr();
 }
Ejemplo n.º 16
0
        /// <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);
        }
Ejemplo n.º 17
0
        /// <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();
        }
Ejemplo n.º 18
0
 public Form1()
 {
     InitializeComponent();
     shop           = new Shop();
     timer          = new Timer();
     timer.Tick    += timer_Tick;
     timer.Interval = 200;
     timer.Start();
 }
Ejemplo n.º 19
0
 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;
 }
Ejemplo n.º 20
0
    public override bool Buy(Cell cell, IShop shop)
    {
        if (Cost <= PlayerAttributes.PlayerProperties.Money)
        {
            OnChooseMuscle?.Invoke(() => PlayerAttributes.RemoveMoney(Cost));
            return(true);
        }

        return(false);
    }
Ejemplo n.º 21
0
        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;
        }
Ejemplo n.º 22
0
 /// <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;
 }
Ejemplo n.º 23
0
        /// <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();
        }
Ejemplo n.º 24
0
        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();
        }
Ejemplo n.º 25
0
    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);
    }
Ejemplo n.º 26
0
 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;
 }
Ejemplo n.º 27
0
        public void Activate()
        {
            gameObject.SetActive(true);

            shop      = GameController.Instance.Shop;
            inventory = GameController.Instance.Inventory;

            //weaponsWorldUI.Activate();

            SetWeaponItem(currentWeapon);
        }
Ejemplo n.º 28
0
 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
                ));
 }
Ejemplo n.º 29
0
 public virtual bool Buy(Cell cell, IShop shop)
 {
     if (PlayerAttributes.RemoveMoney(cell.Properties.Cost))
     {
         cell.Remove(shop.Cells);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 30
0
    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;
    }
Ejemplo n.º 31
0
 public HomeController(IShop shop, IGoods goods)
 {
     this.shopRepository = shop;
     this.goodsRepository = goods;
 }
Ejemplo n.º 32
0
 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);
 }
Ejemplo n.º 33
0
 public new void TestInitialise()
 {
     base.TestInitialise();
     shop = roar.Shop;
     Assert.IsNotNull(shop);
     Assert.IsFalse(shop.HasDataFromServer);
 }