Example #1
0
    public void BuyItem()
    {
        if (selectedItem == -1)
        {
            return;
        }

        ItemShop item = myDetails.sellingItems[selectedItem];

        switch (item.coinType)
        {
        case ShopCoin.Gold:
            if (inventory.Gold < item.value)
            {
                return;
            }
            inventory.Gold -= item.value;
            break;

        case ShopCoin.Secret:
            if (inventory.SecretGold < item.value)
            {
                return;
            }
            inventory.SecretGold -= item.value;
            break;
        }

        item.sellingItem.OnBuy(GameManager.Player.gameObject);
        inventory.AddItem(item.sellingItem);

        RefreshShop();
    }
 public void LoadShop()
 {
     if (_core._gameMode == GAMESTATE.LAND)
     {
         _itemShopList = _core._landShopList;
     }
     else
     {
         string[] item = _core._dungeon[_core._player.currentDungeonFloor].data.shopList.Split(',');
         _itemShopList = new List <ItemShop>();
         for (int i = 0; i < item.Length; i++)
         {
             foreach (ItemDataSet data in _core.dataItemList)
             {
                 if (Calculator.IntParseFast(item[i]) == data.id)
                 {
                     ItemShop newItem = new ItemShop();
                     newItem.item     = data;
                     newItem.buyCount = 0;
                     _itemShopList.Add(newItem);
                     break;
                 }
             }
         }
     }
     ViewShop();
 }
Example #3
0
 public static void InDoors(ICharacters character)
 {
     if (CityMap.PositionX == 20 && CityMap.PositionY == 19)
     {
         BuildingMessages.BuldingMessage("Arena");
         Arena.FightInArena(character, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 26 && CityMap.PositionY == 11)
     {
         BuildingMessages.BuldingMessage("WeaponSmith");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Strength + " Strength!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetWeaponsAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Strength"));
         WeaponShop.Weapon(character, buildingitems, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 30 && CityMap.PositionY == 7)
     {
         BuildingMessages.BuldingMessage("ArmorSmith");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Durability + " Durability!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetArmorAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Durability"));
         ArmorSmith.Armor(character, buildingitems, OnInputWork.ChoiceHandler());
     }
     else if (CityMap.PositionX == 16 && CityMap.PositionY == 4)
     {
         BuildingMessages.BuldingMessage("Shop");
         Console.WriteLine("You have: " + character.Money + " money, " + character.Alchemics + " Alchemics!");
         List <CreatingItems> buildingitems = new List <CreatingItems>();
         buildingitems = ProductsInBuldings.GetShopAvailable(character);
         Console.WriteLine(ProductsInBuldings.ShowProductsAvailable(buildingitems, "Alchemics"));
         ItemShop.Item(character, buildingitems, OnInputWork.ChoiceHandler());
     }
 }
Example #4
0
    protected virtual void CreateItem(ItemShop itemShop)
    {
        GameObject copy;

        copy = Instantiate(_itemTemplate, transform);
        copy.GetComponent <BaseItemShopSlot>().ITEMSHOP = itemShop;
    }
Example #5
0
        public async Task <IActionResult> ItemShop()
        {
            ItemShop itemShop = await AwaitShop();

            ViewBag.featured = itemShop.Featured;
            return(View());
        }
Example #6
0
        private void btnShop_Click(object sender, EventArgs e)
        {
            GoldUpdateAndVisible();

            shopType = ShopType.Item;
            dgvUI.Rows.Clear();
            ItemShop currentShop = World.ItemShopByID(Player.CurrentTown.ItemShop.ID);

            dgvUI.Visible          = true;
            buttonPurchase.Visible = true;
            HidePanels();
            panelList.Visible        = true;
            labelGold.Visible        = true;
            btnViewGladiator.Visible = false;
            labelGold.Text           = "Gold: " + Player.Gold.ToString();
            dgvUI.RowHeadersVisible  = false;
            dgvUI.ColumnCount        = 2;
            dgvUI.Columns[0].Name    = "Item";
            dgvUI.Columns[1].Name    = "Price";
            rtbUI.Text += Environment.NewLine + currentShop.Name + Environment.NewLine
                          + currentShop.Description + Environment.NewLine + currentShop.VendorName + ": What can I do for ya?" + Environment.NewLine;

            foreach (Item item in currentShop.Stock)
            {
                dgvUI.Rows.Add(item.Name, item.Value);
            }
            dgvUI.Width            = 150;
            dgvUI.Columns[0].Width = 97;
            dgvUI.Columns[1].Width = 47;
        }
    public void ShowItem(ItemShop item)
    {
        itemIcon.sprite = item.sellingItem.icon;

        System.Random rand  = new System.Random();
        int           index = rand.Next(item.sellerDescriptions.Length);

        shopMessage.text = item.sellerDescriptions[index];
        itemName.text    = item.sellingItem.itemName;


        itemPriceGoldVisible.SetActive(item.coinType == ShopCoin.Gold);
        itemPriceSecretGoldVisible.SetActive(item.coinType == ShopCoin.Secret);

        switch (item.coinType)
        {
        case ShopCoin.Gold:
            itemPriceGold.text     = item.value.ToString();
            buyButton.interactable = lastGold >= item.value;
            break;

        case ShopCoin.Secret:
            itemPriceSecret.text   = item.value.ToString();
            buyButton.interactable = lastSecretGold >= item.value;
            break;
        }
    }
 void LoadShop()
 {
     if (_core._gameMode == _GameStatus.LAND)
     {
         _itemShopList = _core._landShopList;
     }
     else
     {
         string[] item = _core._dungeon[_core._currentDungeonLayer].dungeon.shopList.Split(',');
         _itemShopList = new List <ItemShop>();
         for (int i = 0; i < item.Length; i++)
         {
             foreach (ItemDataSet data in _core.dataItemList)
             {
                 if (_cal.IntParseFast(item[i]) == data.id)
                 {
                     ItemShop newItem = new ItemShop();
                     newItem.item     = data;
                     newItem.buyCount = 0;
                     _itemShopList.Add(newItem);
                     break;
                 }
             }
         }
     }
     ViewShop();
 }
Example #9
0
    private void LoadItems()
    {
        ItemDesc   itemDesc;
        GameObject mItemGrab;
        ItemShop   shop = this.GetComponent <ItemShop>();
        Item       item;

        for (int i = 0; i < this.Data.Spots.Length; i++)
        {
            string name = this.Data.Spots[i];
            if (!string.IsNullOrEmpty(name))
            {
                string prefabName = name.Replace(" ", "_").Replace("é", "e");
                mItemGrab     = GameObject.Instantiate(Resources.Load("Prefabs/Item/" + prefabName)) as GameObject;
                itemDesc      = shop.GetItem(name);
                item          = mItemGrab.GetComponent <Item>();
                item.ItemDesc = itemDesc;
                item.usedSlot = (eObjectType)(i + 1);
                item.PlaceToSlot(Slots[i]);

                foreach (GameObject carton in MenuManager.Get.SlotsRenderer[i].GetComponent <cObject>().Cartons)
                {
                    carton.renderer.enabled = false;
                }
            }
        }
    }
Example #10
0
    public void Build(ItemShop item, GuiBuyBuilding BuyGui)
    {
        this.BuyGui = BuyGui;
        if (BuildObjectPlacingToGrid == null)
        {
            BuildObjectPlacingToGrid = BuildingSkeleton;
            BuildObjectSprite = TMPsprite;
            BuildObjectPlacingToGrid.ReloadNormal();

        }
        shopitem = item;
        Debug.Log("BUILDER: " + item.DefaultGroup.name);

        Vector3 Position = Camera.main.ScreenToWorldPoint( new Vector3(Camera.main.transform.position.x + Screen.width / 2 ,
                                       Camera.main.transform.position.y + Screen.height / 2,
                                       0));
        Position.z = 0;

           // Building build = item.DefaultGroup.AddBuild(Position);

        GridElement element =  Grid.DetechTouchPositionOnGrid(Position);
           // PlacingToGrid placetogrid = build.GetComponent<PlacingToGrid>();

           // placetogrid.Col = element.getCol();
           // placetogrid.Row = element.getRow();

        BuildObjectSprite.sprite = item.Sprite.sprite;
        BuildObjectSprite.gameObject.SetActive(true);
        BuildObjectSprite.transform.localScale = item.transform.localScale;

        BuildObjectPlacingToGrid.Col_size = item.GetPlacingToGrid().Col_size;
        BuildObjectPlacingToGrid.Row_size = item.GetPlacingToGrid().Row_size;

        BuildObjectPlacingToGrid.setNormalSpace_x( item.GetPlacingToGrid().getNormalSpace_x());
        BuildObjectPlacingToGrid.setNormalSpace_y( item.GetPlacingToGrid().getNormalSpace_y());

        BuildObjectPlacingToGrid.setMirrorSpace_x(item.GetPlacingToGrid().getMirrorSpace_x());
        BuildObjectPlacingToGrid.setMirrorSpace_y(item.GetPlacingToGrid().getMirrorSpace_y());

        BuildObjectPlacingToGrid.Col = element.getCol();
        BuildObjectPlacingToGrid.Row = element.getRow();

        BuildObjectPlacingToGrid.ReloadNormal();

        BoxCollider2D boxcollider = item.GetComponent<BoxCollider2D>();

        Collider2D.size = new Vector2(boxcollider.size.x ,boxcollider.size.y);

        Grid.Place(BuildObjectPlacingToGrid);

        isBuild = true;
        BuildObjectPlacingToGrid.gameObject.SetActive(true);

        CheckGridCollision();

        FirstObjectPosition.Col = BuildObjectPlacingToGrid.Col;
        FirstObjectPosition.Row = BuildObjectPlacingToGrid.Row;
        FirstObjectPosition.scale = BuildObjectPlacingToGrid.scale;
    }
 public void setPrice(ItemShop item, GuiBuyBuilding BuyGui)
 {
     BuyGui.GoldText.text = BuyGui.Gold.get() + " / " + item.Gold;
     BuyGui.WoodText.text = BuyGui.Wood.get() + " / " + item.Wood;
     BuyGui.StoneText.text = BuyGui.Stone.get() + " / " + item.Stone;
     BuyGui.ObsydianText.text = BuyGui.ObsydianBrick.get() + " / " + item.ObsydianBrick;
     BuyGui.RecipeText.text = (int)item.Recipe.simpladata.Value + " / " + item.Recipe.Cost;
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     itemShop           = GetComponent <ItemShop>();
     towerCost.text     = "$" + itemShop.towerBase.cost.ToString();
     basicCost.text     = "$" + itemShop.standardTurret.cost.ToString();
     secondaryCost.text = "$" + itemShop.secondaryTurret.cost.ToString();
     tercearyCost.text  = "$" + itemShop.laserBeamTurret.cost.ToString();
 }
Example #13
0
 private void ResetBuildings()
 {
     Building   = null;
     Church     = null;
     ArmorShop  = null;
     WeaponShop = null;
     ItemShop   = null;
 }
Example #14
0
 /// <summary>
 /// Initializes the manager with the itemstocks, and how many items max this shop will contain
 /// </summary>
 /// <param name="data"></param>
 public ItemPriceAndStockManager(ItemShop data)
 {
     _defaultSellPriceMultipler = data.DefaultSellPriceMultiplier;
     _priceMultiplierWhen       = data.PriceMultiplierWhen;
     _itemStocks             = data.ItemStocks;
     _maxNumItemsSoldInStore = data.MaxNumItemsSoldInStore;
     _shopName  = data.ShopName;
     _shopPrice = data.ShopPrice;
 }
Example #15
0
 private bool CheckExist(ItemShop itemsh)
 {
     foreach (ShopItem si in shop.ShopItems)
     {
         if (si.NameItem == itemsh)
         {
             return(true);
         }
     }
     return(false);
 }
Example #16
0
    public void Update()
    {
        if (shop == null)
        {
            bool keyInteract = Input.GetKeyDown(KeyCode.Space);

            if (keyInteract)
            {
                shop = new ItemShop(this);
            }
        }
    }
Example #17
0
    public void SetItemGoods()
    {
        for (int i = 0; i < itemMgr.itemInfoList.Count; i++)
        {
            GameObject itemShopButton = FactoryMgr.Instance.GetUI(StringMgr.ItemShopButton);
            itemShopButton.transform.SetParent(GoodsContent);
            itemShopButton.transform.localScale = Vector3.one;

            ItemShop itemShop = new ItemShop(i, itemShopButton);
            itemShopBtnList.Add(itemShop);
        }
    }
Example #18
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        urlShop = name;
        count   = itemList.Count;

        //Load data
        loading();
        // setup ui
        if (itemList != null)
        {
            itemList[0].bought = true;
            boughtList.Add(itemList[0]);
        }
        for (int i = 0; i < count; i++)
        {
            GameObject obj = Instantiate(prefItem, container, false);
            obj.transform.GetChild(0).GetComponent <Image>().sprite = imageItemList[i];

            // add into list to manage
            itemObjectList.Add(obj);
            snap.btnn.Add(obj.GetComponent <Button>());


            // xet da mua
            if (itemList[i].bought)
            {
                itemObjectList[i].transform.GetChild(0).GetComponent <Image>().material = null;
                itemObjectList[i].transform.GetChild(0).GetComponent <Image>().color
                    = new Color(1, 1, 1, 1);
                itemObjectList[i].transform.GetChild(0).GetComponent <Image>().sprite = imageItemList[i];
                // item chua su dung
                if (itemList[i].itemID != currentItemID)
                {
                }
                // item da mua va su dung
                else
                {
                }
            }
            else
            {
            }
        }
        coinManager.UpdateCoin();
        UpdateUI();
        snap._setupStart(currentItemID);
    }
Example #19
0
 public CurrentBuilding(
     Building building     = null,
     Church church         = null,
     ArmorShop armorShop   = null,
     WeaponShop weaponShop = null,
     ItemShop itemShop     = null
     )
 {
     Building   = building;
     Church     = church;
     ArmorShop  = armorShop;
     WeaponShop = weaponShop;
     ItemShop   = itemShop;
 }
Example #20
0
 public Location(
     string name, Coords coords, Building[] buildings, Citizen[] citizens,
     string category, Church church, ArmorShop armorShop, WeaponShop weaponShop, ItemShop itemShop
     )
 {
     Name       = name;
     Coords     = coords;
     Buildings  = buildings;
     Citizens   = citizens;
     Category   = category;
     Church     = church;
     ArmorShop  = armorShop;
     WeaponShop = weaponShop;
     ItemShop   = itemShop;
 }
Example #21
0
        private void buttonPuchase_Click(object sender, EventArgs e)
        {
            switch (shopType)
            {
            case ShopType.Gladiator:
            {
                try
                {
                    rtbUI.Text += Environment.NewLine +
                                  (World.GladiatorShopByID(Player.CurrentTown.GladiatorShop.ID).PurchaseGladiator
                                       (Gladiator.PickGladiatorFromDGV(MyGladList, (string)dgvUI.CurrentCell.Value)))
                                  + Environment.NewLine;
                    GoldUpdateAndVisible();
                    dgvUI.Rows.Clear();
                    foreach (Gladiator gladiator in Player.CurrentTown.GladiatorShop.Stock)
                    {
                        dgvUI.Rows.Add(gladiator.Name, gladiator.Value);
                    }
                }
                catch
                {
                    return;
                }
                break;
            }

            case ShopType.Item:
            {
                Item selectedItem = Item.PickItemFromDGV((string)dgvUI.CurrentCell.Value);
                if (ItemShop.ItemPurchaseSuccessful(selectedItem))
                {
                    GoldUpdateAndVisible();
                    rtbUI.Text += "Item bought: " + selectedItem.Name + " for " + selectedItem.Value.ToString() + " gold." + Environment.NewLine;
                }
                else
                {
                    rtbUI.Text += "You don't have enough gold to buy this." + Environment.NewLine;
                }


                break;
            }
            }
        }
Example #22
0
        public async Task <ItemShop> ShowItemShop()
        {
            HttpClient httpClient = new HttpClient();
            string     url        = $"https://fortniteapi.io/shop?lang=en";

            httpClient.DefaultRequestHeaders.Add("Authorization", "0e235bf6-1954f433-5e4caaf7-f6deb034");

            try
            {
                HttpResponseMessage response = await httpClient.GetAsync(url);

                response.EnsureSuccessStatusCode();

                ItemShop itemShop = await response.Content.ReadAsAsync <ItemShop>();

                return(itemShop);
            }
            catch (HttpRequestException)
            {
                return(new ItemShop());
            }
        }
Example #23
0
 void Start()
 {
     itemShop = this; //Makes self/this be the static instance at start of game.
     FillList();
 }
Example #24
0
        public static void Main(string[] args)
        {
            client             = new HttpClient();
            client.BaseAddress = new Uri("https://fortnite-api.theapinetwork.com/");
            client.DefaultRequestHeaders.Add("Authorization", apiKey);
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            List <UnreleasedProduct> FortMap      = new List <UnreleasedProduct>();
            List <BRNews>            FortNews     = new List <BRNews>();
            List <WeaponInfo>        FortWeapon   = new List <WeaponInfo>();
            List <CreativeInfo>      FortCreative = new List <CreativeInfo>();
            List <ItemShop>          FortStore    = new List <ItemShop>();
            ChallengeList            FortChal     = new ChallengeList();

            try
            {
                Console.WriteLine("Enter UI for Upcoming Items");
                Console.WriteLine("Enter GN for In Game News");
                Console.WriteLine("Enter WL for Weapons List");
                Console.WriteLine("Enter CL for Creative List");
                Console.WriteLine("Enter IS for Item Shop");
                Console.WriteLine("Enter CH for Challenges");
                Console.WriteLine("");
                Console.Write("Select what you want to see: ");
                string ans = Console.ReadLine();

                switch (ans)
                {
                case "UI":
                    FortMap = GetUpcomingItems();

                    Console.WriteLine($"Number of upcoming items = {FortMap.Count}");

                    for (int index = 0; index < FortMap.Count; index++)
                    {
                        UnreleasedProduct currentProduct = FortMap[index];
                        Console.WriteLine("");

                        Console.WriteLine($"ItemId = {currentProduct.ItemId} ");

                        Console.WriteLine($"Name = { currentProduct.Item.Name }    Type = { currentProduct.Item.Type}    Rarity = { currentProduct.Item.Rarity} ");
                        Console.WriteLine($"Description = { currentProduct.Item.Description }    Cost = { currentProduct.Item.Cost }    Upcoming = { currentProduct.Item.Upcoming }");

                        Console.WriteLine($"Icon = { currentProduct.Item.Images.Icon }    Featured = { currentProduct.Item.Images.Featured }");
                        Console.WriteLine($"Background = { currentProduct.Item.Images.Background }    Information = { currentProduct.Item.Images.Information }");
                    }
                    Console.WriteLine("");
                    break;

                case "GN":
                    FortNews = GetInGameNews();

                    Console.WriteLine($"Number of in game news = {FortNews.Count}");

                    for (int index = 0; index < FortNews.Count; index++)
                    {
                        BRNews ingameNews = FortNews[index];
                        Console.WriteLine("");

                        Console.WriteLine($"Title = { ingameNews.Title }    Body = { ingameNews.Body } ");
                        Console.WriteLine($"Image = { ingameNews.Image}");
                    }
                    Console.WriteLine("");
                    break;

                case "WL":
                    FortWeapon = GetWeaponList();

                    Console.WriteLine($"Number of weapons = {FortWeapon.Count}");

                    for (int index = 0; index < FortWeapon.Count; index++)
                    {
                        WeaponInfo weaponArsenal = FortWeapon[index];
                        Console.WriteLine("");

                        Console.WriteLine($"Identifier = { weaponArsenal.Identifier }    Name = { weaponArsenal.Name}");
                        Console.WriteLine($"Rarity = { weaponArsenal.Rarity }    Image = { weaponArsenal.Image }");

                        Console.WriteLine($"Dps = { weaponArsenal.Stats.Dps }    HitBody = { weaponArsenal.Stats.HitBody }");
                        Console.WriteLine($"HitHead = { weaponArsenal.Stats.HitHead }    FireRate = { weaponArsenal.Stats.FireRate }");
                        Console.WriteLine($"MagazineSize = { weaponArsenal.Stats.MagazineSize }    ReloadTime = { weaponArsenal.Stats.ReloadTime }");
                        Console.WriteLine($"AmmoCost = { weaponArsenal.Stats.AmmoCost }");
                    }
                    Console.WriteLine("");
                    break;

                case "CL":
                    FortCreative = GetCreativeList();

                    Console.WriteLine($"Number of featured creative islands = {FortCreative.Count}");

                    for (int index = 0; index < FortCreative.Count; index++)
                    {
                        CreativeInfo currentIslands = FortCreative[index];
                        Console.WriteLine("");

                        Console.WriteLine($"Island Code = {currentIslands.Island.Code}    Island Name = {currentIslands.Island.Name}");
                        Console.WriteLine($"Island Description = {currentIslands.Island.Description}");

                        Console.WriteLine($"Creator Username = {currentIslands.Island.Creator.Username}");
                    }
                    Console.WriteLine("");
                    break;

                case "IS":
                    FortStore = GetItemShop();

                    Console.WriteLine($"Number of items in the shop = {FortStore.Count}");

                    for (int index = 0; index < FortStore.Count; index++)
                    {
                        ItemShop currentItems = FortStore[index];
                        Console.WriteLine("");

                        Console.WriteLine($"ItemId = {currentItems.ItemId} ");

                        Console.WriteLine($"Featured = {currentItems.Store.IsFeatured}    Refundable = {currentItems.Store.IsRefundable}");
                        Console.WriteLine($"Cost = {currentItems.Store.Cost}    New = {currentItems.Store.IsNew}");

                        Console.WriteLine($"Name = {currentItems.Item.Name}    Type = {currentItems.Item.Type}");
                        Console.WriteLine($"Rarity = {currentItems.Item.Rarity}");

                        Console.WriteLine($"Icon = {currentItems.Item.Images.Icon}    Background = {currentItems.Item.Images.Background}");
                        Console.WriteLine($"Information = {currentItems.Item.Images.Information}");
                    }
                    Console.WriteLine("");
                    break;

                case "CH":
                    FortChal = GetSeasonChallenges();

                    int challengeCount = 0;
                    FortChal.Challenges.ForEach(week => { challengeCount += week.Entries.Count; });

                    Console.WriteLine($"Number of challenges = {challengeCount}");
                    Console.WriteLine($"Language = {FortChal.Language}    Season = {FortChal.Season}    Star = {FortChal.Star}");

                    for (int index = 0; index < FortChal.Challenges.Count; index++)
                    {
                        ChallengeInfo seasonChallenge = FortChal.Challenges[index];
                        Console.WriteLine("");

                        Console.WriteLine($"Week = {seasonChallenge.Week}    Value = {seasonChallenge.Value}");

                        seasonChallenge.Entries.ForEach(challenge =>
                        {
                            Console.WriteLine($"Identifier = {challenge.Identifier}    Challenge = {challenge.Challenge}");
                            Console.WriteLine($"Total = {challenge.Total}    Stars = {challenge.Stars}");
                            Console.WriteLine($"Difficulty = {challenge.Difficulty}");
                        });
                    }
                    Console.WriteLine("");
                    break;
                }
            }


            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.ReadLine();
        }
Example #25
0
        }                                        //Описание

        public ShopItem(ItemShop NameItem)
        {
            this.NameItem = NameItem;

            switch (NameItem)
            {
            case ItemShop.Life:

                Value       = 1;
                Price       = 100;
                Plusprice   = 50;
                Description = "Увеличивает жизнь";
                GameImage   = new Sprite(new string[] { /* "Sprites\\Shop\\ShopLife.png" */ null });
                break;

            case ItemShop.Health:

                Value       = 100;
                Price       = 30;
                Plusprice   = 70;
                Description = "Пополняет здоровье";
                GameImage   = new Sprite(new string[] { /*"Sprites\\Shop\\ShopHealth.png" */ null });
                break;

            case ItemShop.Control:

                Value       = 1;
                Price       = 1000;
                Plusprice   = 1500;
                Description = "Увеличивает уроень контроля";
                GameImage   = new Sprite(new string[] { /*"Sprites\\Shop\\ShopControl.png" */ null });
                break;

            case ItemShop.OpportunityControl:

                Value       = 0;
                Price       = 10000;
                Plusprice   = 0;
                Description = "Возможность держать контроль над ботами";
                GameImage   = new Sprite(new string[] { /*"Sprites\\Shop\\ShopOControl.png"*/ null });
                break;

            case ItemShop.Protection:

                Value       = 0.05;
                Price       = 15000;
                Plusprice   = 500;
                Description = "Увеличивает сопротивление к урону";
                GameImage   = new Sprite(new string[] { /*"Sprites\\Shop\\ShopProtection.png" */ null });
                break;

            case ItemShop.UpHealth:

                Value       = 100;
                Price       = 10000;
                Plusprice   = 200;
                Description = "Увеличивает MAX здоровья";
                GameImage   = new Sprite(new string[] { /*"Sprites\\Shop\\ShopUPMaxHealth.png" */ null });
                break;
            }
        }
 public ItemShopViewModel(GameController gameController)
 {
     this.gameController = gameController;
     this.itemShop       = gameController.ItemShop;
     this.gameController.OnScoreChanged += this.GameController_OnScoreChanged;
 }
        private void filtrage()
        {
            if (this._ComboBoxFournisseur.SelectedItem != null)
            {
                ObservableCollection<ItemShop> toPutOnLine = new ObservableCollection<ItemShop>();

                foreach (GetShopCommandeWithEntrepriseName_Result item in ((App)App.Current).mySitaffEntities.GetShopCommandeWithEntrepriseName(((Fournisseur)this._ComboBoxFournisseur.SelectedItem).Identifiant))
                {
                    bool test = true;

                    if (this._TextBoxDesignation.Text.Trim() != "" && test)
                    {
                        if (item.Designation != null)
                        {
                            if (item.Designation.ToLower().Trim().Contains(this._TextBoxDesignation.Text.ToLower().Trim()))
                            {
                                test = true;
                            }
                            else
                            {
                                test = false;
                            }
                        }
                        else
                        {
                            test = false;
                        }
                    }

                    if (this._TextBoxReference.Text.Trim() != "" && test)
                    {
                        if (this._TextBoxReference.Text.Contains(";"))
                        {
                            ObservableCollection<String> listRef = new ObservableCollection<string>(this._TextBoxReference.Text.Split(';'));
                            bool test2 = false;
                            foreach (String mot in listRef)
                            {
                                if (item.Reference != null)
                                {
                                    if (item.Reference.ToLower().Trim().Contains(mot.ToLower().Trim()))
                                    {
                                        test = true;
                                        test2 = true;
                                    }
                                }
                                else
                                {
                                    test = false;
                                }
                            }
                            if (test && !test2)
                            {
                                test = false;
                            }
                        }
                        else
                        {
                            if (item.Reference != null)
                            {
                                if (item.Reference.ToLower().Trim().Contains(this._TextBoxReference.Text.ToLower().Trim()))
                                {
                                    test = true;
                                }
                                else
                                {
                                    test = false;
                                }
                            }
                            else
                            {
                                test = false;
                            }
                        }
                    }

                    if (test)
                    {
                        ItemShop tmp = new ItemShop(item.Reference, item.Designation, item.Libelle, 0, item.Nb_Fois_Commande, item.Min_Prix_Remise, item.Moyenne_Prix_Remise, item.Max_Prix_Remise, item.Min_Prix_Unitaire, item.Moyenne_Prix_Unitaire, item.Max_Prix_Unitaire);
                        toPutOnLine.Add(tmp);
                    }

                }

                this._dataGridFournisseur.ItemsSource = toPutOnLine;
            }
            else
            {
                ObservableCollection<ItemShop> toPutOnLine = new ObservableCollection<ItemShop>();

                foreach (GetShopCommandeWithoutFournisseurWithEntrepriseName_Result item in ((App)App.Current).mySitaffEntities.GetShopCommandeWithoutFournisseurWithEntrepriseName())
                {
                    bool test = true;

                    if (this._TextBoxDesignation.Text.Trim() != "" && test)
                    {
                        if (item.Designation != null)
                        {
                            if (item.Designation.ToLower().Trim().Contains(this._TextBoxDesignation.Text.ToLower().Trim()))
                            {
                                test = true;
                            }
                            else
                            {
                                test = false;
                            }
                        }
                        else
                        {
                            test = false;
                        }
                    }

                    if (this._TextBoxReference.Text.Trim() != "" && test)
                    {
                        if (this._TextBoxReference.Text.Contains(";"))
                        {
                            ObservableCollection<String> listRef = new ObservableCollection<string>(this._TextBoxReference.Text.Split(';'));
                            bool test2 = false;
                            foreach (String mot in listRef)
                            {
                                if (item.Reference != null)
                                {
                                    if (item.Reference.ToLower().Trim().Contains(mot.ToLower().Trim()))
                                    {
                                        test = true;
                                        test2 = true;
                                    }
                                }
                                else
                                {
                                        test = false;
                                }
                            }
                            if (test && !test2)
                            {
                                test = false;
                            }
                        }
                        else
                        {
                            if (item.Reference != null)
                            {
                                if (item.Reference.ToLower().Trim().Contains(this._TextBoxReference.Text.ToLower().Trim()))
                                {
                                    test = true;
                                }
                                else
                                {
                                    test = false;
                                }
                            }
                            else
                            {
                                test = false;
                            }
                        }
                    }

                    if (test)
                    {
                        ItemShop tmp = new ItemShop(item.Reference, item.Designation, item.Libelle, 0, item.Nb_Fois_Commande, item.Min_Prix_Remise, item.Moyenne_Prix_Remise, item.Max_Prix_Remise, item.Min_Prix_Unitaire, item.Moyenne_Prix_Unitaire, item.Max_Prix_Unitaire);
                        toPutOnLine.Add(tmp);
                    }

                }

                this._dataGridFournisseur.ItemsSource = toPutOnLine;
            }
        }
Example #28
0
 // Use this for initialization
 void Start()
 {
     itemShop = this;
     FillList();
 }
Example #29
0
 private void Awake()
 {
     // 퀵 등록
     script = this;
 }
        protected override void Seed(DibiloFourContext context)
        {
            // Initialize types
            var city    = new LocationType(1, "City");
            var village = new LocationType(2, "Village");
            var cave    = new LocationType(3, "Cave");

            context.LocationTypes.Add(city);
            context.LocationTypes.Add(village);
            context.LocationTypes.Add(cave);

            context.SaveChanges();

            var noLock       = new LockType(1, "No Lock", 0);
            var simpleLock   = new LockType(2, "Simple Lock", 5);
            var advancedLock = new LockType(3, "Advanced Lock", 10);

            context.LockTypes.Add(noLock);
            context.LockTypes.Add(simpleLock);
            context.LockTypes.Add(advancedLock);

            context.SaveChanges();

            var sword             = new ItemType(1, "Sword");
            var armour            = new ItemType(2, "Armour");
            var healthPotion      = new ItemType(3, "Health Potion");
            var lockpickSkillBook = new ItemType(4, "Lockpick Skill Book");

            context.ItemTypes.Add(sword);
            context.ItemTypes.Add(armour);
            context.ItemTypes.Add(healthPotion);
            context.ItemTypes.Add(lockpickSkillBook);

            context.SaveChanges();

            // Initialize Locations
            var windhelmCity  = new Location(1, "Windhelm", "Windy city of Windhelm is located near crystal clear river and has good farming land", 1);
            var helgenVillage = new Location(2, "Helgen", "Helgen is located in the skirts of Snowy Mountain. Home of the best blacksmiths.", 2);
            var banditCave    = new Location(3, "Bandit Cave", "The entrance of the cave is facing Windhelm city. Bandits usually hide here.", 3);

            context.Locations.Add(windhelmCity);
            context.Locations.Add(helgenVillage);
            context.Locations.Add(banditCave);

            context.SaveChanges();

            // Initialize Inventories
            var OwenShopKeeperInventory  = new Inventory(1);
            var OwenShopInventory        = new Inventory(2);
            var NaskoTheBanditInventory  = new Inventory(3);
            var KermitTheFarmerInventory = new Inventory(4);
            var treasureChestOne         = new Inventory(5);
            var treasureChestTwo         = new Inventory(6);

            context.Inventories.Add(OwenShopKeeperInventory);
            context.Inventories.Add(OwenShopInventory);
            context.Inventories.Add(NaskoTheBanditInventory);
            context.Inventories.Add(KermitTheFarmerInventory);
            context.Inventories.Add(treasureChestOne);
            context.Inventories.Add(treasureChestTwo);

            context.SaveChanges();

            // проблем
            // Initialize Dibils
            var OwenShopKeeper  = new Villain(1, "Owen", 100, 1, OwenShopKeeperInventory);
            var NaskoTheBandit  = new Villain(2, "Nasko", 100, 2, NaskoTheBanditInventory);
            var KermitTheFarmer = new Villain(3, "Kermit", 100, 3, KermitTheFarmerInventory);

            context.Villains.Add(OwenShopKeeper);
            context.Villains.Add(NaskoTheBandit);
            context.Villains.Add(KermitTheFarmer);

            context.SaveChanges();

            // Initialize ItemShops
            var OwenShop = new ItemShop(1, "Owen Shop", 1000M, 1, 1, 2);

            context.ItemShops.Add(OwenShop);

            context.SaveChanges();

            // Initialize Chests
            var chestOneInBanditCave = new Chest(1, 1, 3, 5);
            var chestTwoInBanditCave = new Chest(2, 2, 3, 6);

            context.Chests.Add(chestOneInBanditCave);
            context.Chests.Add(chestTwoInBanditCave);

            context.SaveChanges();

            // Initialize Items
            var ironSwordInShop = new Weapon(1, "Iron Sword", "Sword made of iron.", Material.Iron, 10, 10, 2)
            {
                Inventory = OwenShopKeeperInventory
            };
            var ironSwordInBandit = new Weapon(2, "Iron Sword", "Sword made of iron. Little used.", Material.Iron, 9, 10, 3)
            {
                Inventory = NaskoTheBanditInventory
            };
            var woodenSwordInKermit = new Weapon(3, "Wooden Sword", "Sword made of wood", Material.Iron, 2, 5, 4)
            {
                Inventory = KermitTheFarmerInventory
            };
            var steelSwordInChestTwo = new Weapon(4, "Steel Sword", "Sword made of steel", Material.Steel, 20, 30, 6)
            {
                Inventory = treasureChestTwo
            };

            context.Weapons.Add(ironSwordInShop);
            context.Weapons.Add(ironSwordInBandit);
            context.Weapons.Add(woodenSwordInKermit);
            context.Weapons.Add(steelSwordInChestTwo);

            context.SaveChanges();

            var ironArmourInShop = new Apprael(1, "Iron Armour", "Armour made of iron.", Material.Iron, 10, 10, 2)
            {
                Inventory = OwenShopInventory
            };

            context.Appraels.Add(ironArmourInShop);

            context.SaveChanges();

            var bookOfMajorLockpickingInChestOne = new Book(1, "Book Of Lockpicking", "Book of major lockpicking", 4, 5)
            {
                BonusLockpickingSkills = 10,
                BonusSpeechSkills      = 0,
                Inventory = treasureChestTwo
            };

            context.Books.Add(bookOfMajorLockpickingInChestOne);

            context.SaveChanges();

            var potionOfMajorHealthInChestOne = new Potion(1, "Health Potion", "Potion of major health", 3, 100, 10)
            {
                Inventory = treasureChestOne
            };

            context.Potions.Add(potionOfMajorHealthInChestOne);

            context.SaveChanges();

            // Adding swords/armour to npc Dibils
            context.Villains.FirstOrDefault(d => d.Id == 2).CurrentWeaponItemId = 2;
            context.Villains.FirstOrDefault(d => d.Id == 3).CurrentWeaponItemId = 3;

            context.SaveChanges();

            base.Seed(context);
        }
Example #31
0
 public void SetCurrentBuilding(ItemShop itemShop)
 {
     ResetBuildings();
     ItemShop = itemShop;
 }
Example #32
0
    void CompilePlayerLog(int SaveNum = 0)
    {
        _player.name        = dataPlayerLog[SaveNum].playerName;
        _player.currentSoul = dataPlayerLog[SaveNum].soul;
        Debug.Log("complie dungeonFloor " + dataPlayerLog[SaveNum].dungeonFloor);
        _player.currentDungeonFloor = dataPlayerLog[SaveNum].dungeonFloor;
        _player.currentStayDunBlock = dataPlayerLog[SaveNum].stayDungeonBlock;
        _player.currentMoney        = dataPlayerLog[SaveNum].money;
        ///------load itemstore------
        if (dataPlayerLog[0].itemStore != "")
        {
            string[] itemStore = dataPlayerLog[0].itemStore.Split(',');
            _itemStore = new List <ItemStore>();
            int rowReal = 0;
            for (int i = 0; i < itemStore.Length; i++)
            {
                string[] itemData = itemStore[i].Split(':');

                foreach (ItemDataSet data in dataItemList)
                {
                    if (Calculator.IntParseFast(itemData[1]) == data.id)
                    {
                        //ItemStore item = new ItemStore();
                        //item.id = _cal.IntParseFast(itemData[0]);
                        //item.itemId = data.id;
                        //item.amount = _cal.IntParseFast(itemData[2]);
                        //item.item = data;
                        //_itemStore.Add(item);
                        break;
                    }
                    rowReal++;
                }
            }
            Debug.Log("foreach row " + rowReal);
            int dataCount = 0;
            int row       = 0;
            int itemCount = 0;
            do
            {
                if (dataCount >= dataItemList.Length)
                {
                    dataCount = 0;
                }
                else if (dataCount < 0)
                {
                    dataCount = dataItemList.Length - 1;
                }
                string[] itemData = itemStore[itemCount].Split(':');
                //Debug.Log(dataItemList[dataCount].id + " == " + _cal.IntParseFast(itemData[1]));
                if (dataItemList[dataCount].id == Calculator.IntParseFast(itemData[1]))
                {
                    //Debug.Log("add item" + row);
                    ItemStore item = new ItemStore();
                    item.id     = Calculator.IntParseFast(itemData[0]);
                    item.itemId = dataItemList[dataCount].id;
                    item.amount = Calculator.IntParseFast(itemData[2]);
                    item.data   = dataItemList[dataCount];
                    _itemStore.Add(item);
                    itemCount++;
                }
                else
                {
                    if (dataItemList[dataCount].id >= Calculator.IntParseFast(itemData[1]))
                    {
                        dataCount--;
                    }
                    else
                    {
                        dataCount++;
                    }
                }
                row++;
            } while (itemCount < itemStore.Length);
            Debug.Log("do while row" + row);
        }

        ///-------end load itemstore---------------

        ///-------load herostore ------------
        _heroStore = new List <Hero>();
        string[] heroStore = dataPlayerLog[0].heroStore.Split(',');
        CreateHeroFromData(heroStore);

        ///-----end load herostore-----
        ///-----load playerAvatar-----
        foreach (Hero hero in _heroStore)
        {
            if (hero.getStoreId() == dataPlayerLog[SaveNum].heroIsPlaying)
            {
                _player._heroIsPlaying = hero;
                getCampCon().LoadCampAvatar();
                Debug.Log("current hp " + _player._heroIsPlaying.getStatus().currentHP);
                break;
            }
        }

        ///-----end load playerAvatar-----
        ///-----load dungeonClear-----
        _dungeon = new Dungeon[dataDungeonList.Length];
        for (int i = 0; i < dataDungeonList.Length; i++)
        {
            Dungeon dun = new Dungeon();
            dun.data    = dataDungeonList[i];
            _dungeon[i] = dun;
        }

        string[] floorData = dataPlayerLog[SaveNum].floorIsPlayed.Split(',');
        for (int i = 0; i < floorData.Length; i++)
        {
            string[] floor = floorData[i].Split('_');
            string[] block = floor[1].Split(':');
            for (int a = 0; a < block.Length; a++)
            {
                string[]     blockData = block[a].Split('-');
                DungeonBlock newBlock  = new DungeonBlock(Calculator.IntParseFast(blockData[0]), Calculator.IntParseFast(blockData[1]), Calculator.IntParseFast(blockData[2]));
                _dungeon[Calculator.IntParseFast(floor[0]) - 1].blockIsPlayed.Add(newBlock);
            }
        }
        ///-----End load dungeonClear-----
        string[] shopList = dataPlayerLog[SaveNum].shopList.Split(',');
        _landShopList = new List <ItemShop>();
        for (int i = 0; i < shopList.Length; i++)
        {
            string[] shopCut = shopList[i].Split(':');
            ItemShop newShop = new ItemShop();
            newShop.id       = Calculator.IntParseFast(shopCut[0]);
            newShop.buyCount = Calculator.IntParseFast(shopCut[1]);
            foreach (ItemDataSet data in dataItemList)
            {
                if (newShop.id == data.id)
                {
                    newShop.item = data;
                    break;
                }
            }
            _landShopList.Add(newShop);
        }
    }
Example #33
0
 public virtual void CreateTemplate(ItemShop itemShop)
 {
     _itemTemplate.SetActive(true);
     CreateItem(itemShop);
 }