예제 #1
0
    //Generate items
    public void CreateItems(List <ItemInfos> infos)
    {
        //Reset values
        item.SetStatusTo(true);
        ClearAllSlides();

        Transform parent = item.GetParent();

        for (int gridIndex = 0; gridIndex < infos.Count; gridIndex++)
        {
            ItemInfos info    = infos[gridIndex];
            ItemInfo  newItem = null;
            newItem = Instantiate(item, parent) as ItemInfo;

            //Set properties to item
            if (newItem != null)
            {
                newItem.SetStatusTo(true);

                newItem.name = info.itemName;
                newItem.SetItemDetails(info);

                allItems.Add(newItem);
            }
        }

        //Save all item info
        itemInfos = infos;
        //Disable sample item
        item.SetStatusTo(false);
    }
예제 #2
0
    void Start()
    {
        resetAllSaves();         //
        LoadDatas();
        buttonItems = new GameObject[shopItems.Length];
        int number = 0;

        foreach (Item i in shopItems)
        {
            GameObject thingy = (GameObject)Instantiate(button);
            buttonItems [number] = thingy;
            ItemInfos scp = thingy.GetComponent <ItemInfos>();
            scp.name.text   = i.name;
            scp.cost.text   = "Cost: " + i.cost.ToString("D");
            scp.effect.text = i.effect.ToString("D");
            scp.pieces.text = i.piece.ToString("D");
            scp.icon.sprite = i.image;
            thingy.transform.SetParent(this.transform);

            Item thisItem = i;
            scp.thisButton.onClick.AddListener(() => Purchase(thisItem));
            number++;
        }
        int n = 0;

        foreach (Item i in shopItems)
        {
            buttonItems [n].SetActive(false);
            n++;
        }
    }
예제 #3
0
    void SetItemDetails(int itemCount, int categoryId)
    {
        int itemsCount = itemCount;

        if (itemsCount > 0)
        {
            for (int itemsIndex = 0; itemsIndex < itemsCount; itemsIndex++)
            {
                //Set item info
                ItemInfos info = new ItemInfos();
                info.itemId         = itemsIndex;
                info.itemName       = categoryList[categoryId] + itemsIndex;
                info.itemCategory   = categoryList[categoryId];
                info.itemCategoryId = categoryId;
                //Assign random price
                info.itemPrice       = Random.Range(minPriceList[categoryId], maxPriceList[categoryId]);
                info.itemDescription = commonDescriptionList[categoryId];
                //Assign random gender
                int index = Random.Range(0, gender.Length);
                info.itemGender = gender[index];

                info.itemRating = Random.Range(1f, 5f);

                itemInfos.Add(info);
            }
        }
    }
예제 #4
0
 public SerializableDictionaryItem(ItemInfos item)
 {
     Id           = item.Id ?? Guid.NewGuid();
     Key          = item.Key;
     Translations = item.Values.Select(x => new SerializableItemInfosTranslation(x.Key, x.Value)).ToArray();
     ParentId     = item.ParentId;
 }
예제 #5
0
 //Set selected item details in UI
 public void SetItemDetails(ItemInfos info)
 {
     itemNameTxt.text        = info.itemName;
     itemDescriptionTxt.text = info.itemDescription;
     itemRatingTxt.text      = "Rating - " + String.Format("{0:0.0}", info.itemRating);
     itemPriceTxt.text       = info.itemPrice.ToString() + " Rs";
     itemGenderTxt.text      = info.itemGender;
 }
예제 #6
0
        public void TestMethodReadItemsInfo()
        {
            var ecf = new ConfigEcfAccess();

            ecf.ReadConfigEcf(@"C:\steamcmd\empyrion\Content", null, null, null);
            var localization = new Localization(@"C:\steamcmd\empyrion\Content", null);
            var items        = new ItemInfos(ecf, localization).ItemInfo;

            Assert.IsTrue(items.Count() > 0);
        }
예제 #7
0
    void GenerateItems()
    {
        //Shuffle the info list - to generate items in different order - mix
        for (int infoIndex = 0; infoIndex < itemInfos.Count; infoIndex++)
        {
            ItemInfos temp        = itemInfos[infoIndex];
            int       randomIndex = Random.Range(infoIndex, itemInfos.Count);
            itemInfos[infoIndex]   = itemInfos[randomIndex];
            itemInfos[randomIndex] = temp;
        }

        //Create Items
        itemsPanel.CreateItems(itemInfos);
    }
        private void ImportItemWithChildren(ItemInfos importedDictionaryItem, List <ItemInfos> itemsToImport)
        {
            var childrens = itemsToImport.Where(x => x.ParentId == importedDictionaryItem.Id).ToList();

            ItemInfosRepository.Save(importedDictionaryItem);

            foreach (var child in childrens)
            {
                child.ParentId = importedDictionaryItem.Id;
            }

            foreach (var child in childrens)
            {
                ImportItemWithChildren(child, itemsToImport);
            }
        }
예제 #9
0
    void UpdateItem()
    {
        int number = 0;

        foreach (Item i in shopItems)
        {
            ItemInfos scp = buttonItems [number].GetComponent <ItemInfos> ();
            scp.cost.text   = "Cost: " + i.cost.ToString("D");
            scp.effect.text = i.effect.ToString("D");
            scp.pieces.text = i.piece.ToString("D");
            PlayerPrefs.SetInt(i.name + "piece", i.piece);
            PlayerPrefs.SetString(i.name + "cost", i.cost.ToString("D"));
            PlayerPrefs.SetString(i.name + "effect", i.effect.ToString("D"));
            number++;
        }
    }
예제 #10
0
    public void SetItemDetails(ItemInfos info)
    {
        itemInfo = info;

        itemId          = itemInfo.itemId;
        itemCategoryId  = itemInfo.itemCategoryId;
        itemName        = itemInfo.itemName;
        itemDescription = itemInfo.itemDescription;
        itemRating      = itemInfo.itemRating;
        itemPrice       = itemInfo.itemPrice;
        itemGender      = itemInfo.itemGender;
        itemCategory    = itemInfo.itemCategory;

        nameTxt.text = itemName;
        //Rating - Show one digit after decimal
        ratingTxt.text = String.Format("{0:0.0}", itemRating);
        priceTxt.text  = itemPrice.ToString() + " Rs";
    }
예제 #11
0
    private void LoadItemDict(string path)
    {
        string json = (Resources.Load(path, typeof(TextAsset)) as TextAsset).text;

        itemDict = new Dictionary <string, Item>();
        ItemInfos infos = JsonUtility.FromJson <ItemInfos>(json);

        foreach (var i in infos.itemData)
        {
            itemDict.Add(i.idName, i);
        }
        foreach (var i in infos.equipmentData)
        {
            itemDict.Add(i.idName, i);
        }
        // TODO: Hard coded
        itemDict.Add("", itemDict["SimpleSword"]);
    }
예제 #12
0
        public void Save(ItemInfos dictionaryItem)
        {
            IDictionaryItem item  = null;
            var             isNew = dictionaryItem.IsNew;

            if (!dictionaryItem.IsNew)
            {
                item = LocalizationService.GetDictionaryItemByKey(dictionaryItem.Key);
                if (item == null)
                {
                    item = LocalizationService.GetDictionaryItemById(dictionaryItem.Id.Value);
                }
            }

            if (item == null)
            {
                isNew = true;
                item  = new DictionaryItem(dictionaryItem.ParentId, dictionaryItem.Key);

                //to be assured that the new item will have the same id as the imported one.
                if (dictionaryItem.Id != null && dictionaryItem.Id.HasValue)
                {
                    item.Key = dictionaryItem.Id.Value;
                }
            }
            else
            {
                item.ItemKey = dictionaryItem.Key;
                if (dictionaryItem.ParentId != null)
                {
                    item.ParentId = dictionaryItem.ParentId;
                }
            }

            UpdateLanguages(item, dictionaryItem.Values);
            LocalizationService.Save(item, CurrentUserId);

            if (isNew)
            {
                //update saved item to have the newly created dictionary item Id.
                dictionaryItem.Id = item.Key;
            }
        }
        public void Save(ItemInfos dictionaryItem)
        {
            IDictionaryItem item;

            if (dictionaryItem.IsNew)
            {
                item = new DictionaryItem(dictionaryItem.ParentId, dictionaryItem.Key);
            }
            else
            {
                item         = LocalizationService.GetDictionaryItemById(dictionaryItem.Id.Value);
                item.ItemKey = dictionaryItem.Key;
                if (dictionaryItem.ParentId != null)
                {
                    item.ParentId = dictionaryItem.ParentId;
                }
            }

            UpdateLanguages(item, dictionaryItem.Values);
            LocalizationService.Save(item, CurrentUserId);
        }
예제 #14
0
        private void LoadLookupReferences(Action <bool> resultCallback)
        {
            var datasourcestotal = 2;
            var datasourcescount = 0;

            UnitOfMeasureInfos.Get(new UnitOfMeasureInfos.Criteria(), (o, e) =>
            {
                if (e.Error != null)
                {
                    throw e.Error;
                }

                this.UnitOfMeasures = e.Object;
                datasourcescount   += 1;

                if (datasourcescount == datasourcestotal)
                {
                    resultCallback(true);
                }
            });

            ItemInfos.Get(new ItemInfos.Criteria()
            {
            }, (o, e) =>
            {
                if (e.Error != null)
                {
                    throw e.Error;
                }
                this.Cargoes      = e.Object;
                datasourcescount += 1;

                if (datasourcescount == datasourcestotal)
                {
                    resultCallback(true);
                }
            });
        }
        public ItemInfos Save(ItemInfos dictionaryItem)
        {
            ItemInfosRepository.Save(dictionaryItem);

            return(dictionaryItem);
        }
예제 #16
0
 public void TestMethodReadItemsInfo()
 {
     var localization = new Localization(@"C:\steamcmd\empyrion\Content");
     var items        = new ItemInfos(@"C:\steamcmd\empyrion\Content", localization).ItemInfo;
 }