Пример #1
0
    public ItemFish getItemFishByBaseId(string baseId) // creates temporary a new fish based on the baseId
    {
        FishItemData fishItemData = this.GetItemFishDataById(baseId);
        ItemFish     itemFish     = new ItemFish(fishItemData);

        return(itemFish);
    }
Пример #2
0
 public void addItemFishToPlayerInventory(ItemFish itemFish)
 {
     itemFishObject = (GameObject)Instantiate(Resources.Load("Prefabs/ItemFish"));                        // gets the prefab
     itemFishObject.transform.SetParent(UIGameManager.instance.coolerSpace.transform, false);             // set where it will be in the hierarchy
     itemFishObject.GetComponent <RectTransform>().localPosition = Vector2.zero + new Vector2(100, -100); // set the position that the item fish will spawn inside the inventory UI panel
     itemFishObject.GetComponent <UIItemFish>().itemFish         = itemFish;                              // sends the fish attributes stuff
     itemFishObject.GetComponent <RectTransform>().localScale    = new Vector2(1f + ((float)itemFish.length / 25), 1f + ((float)itemFish.length / 25));
 }
Пример #3
0
    public ItemFish createItemFish(string baseId)
    {
        FishItemData fishItemData = this.GetItemFishDataById(baseId);
        ItemFish     itemFish     = new ItemFish(fishItemData);

        GameManager.instance.saveItemData.savedFish.Add(itemFish);
        return(itemFish);
    }
Пример #4
0
    public bool saveFishRecordToDatabase(ItemFish itemFish)
    {
        FishRecord fishRecord = new FishRecord();
        FishRecord oldRecord  = getFishRecordById(itemFish.baseId);
        bool       newRecord  = false;

        fishRecord.baseId = itemFish.baseId;
        if (oldRecord != null)
        {
            fishRecord.totalCaught = oldRecord.totalCaught + 1;

            if (oldRecord.smallestCaught > itemFish.length)
            {
                fishRecord.smallestCaught = itemFish.length;
            }
            else
            {
                fishRecord.smallestCaught = oldRecord.smallestCaught;
            }

            if (oldRecord.biggestCaught < itemFish.length)
            {
                fishRecord.biggestCaught = itemFish.length;
                newRecord = true;
            }
            else
            {
                fishRecord.biggestCaught = oldRecord.biggestCaught;
            }

            if (oldRecord.highestStar < itemFish.star)
            {
                fishRecord.highestStar = itemFish.star;
            }
            else
            {
                fishRecord.highestStar = oldRecord.highestStar;
            }

            GameManager.instance.saveItemData.savedFishRecord[getFishRecordIndexById(itemFish.baseId)] = fishRecord;
            return(newRecord);
        }
        else
        {
            fishRecord.totalCaught    = 1;
            fishRecord.smallestCaught = itemFish.length;
            fishRecord.biggestCaught  = itemFish.length;
            fishRecord.highestStar    = itemFish.star;
            GameManager.instance.saveItemData.savedFishRecord.Add(fishRecord);
            return(true);
        }
    }
    // Use this for initialization
    void Start()
    {
        obtainedFish     = ItemManager.instance.obtainedFish;
        obtainedFishData = ItemManager.instance.GetItemFishDataById(obtainedFish.baseId);

        itemName.text            = TranslatorManager.instance.GetTranslationById("fish_name_" + obtainedFishData.id);
        itemLength.text          = obtainedFish.length.ToString() + " " + TranslatorManager.instance.GetTranslationById("measurement_inches");
        itemWeight.text          = obtainedFish.weight.ToString() + " " + TranslatorManager.instance.GetTranslationById("measurement_pounds");
        itemRarity.text          = TranslatorManager.instance.GetTranslationById("rarity_" + obtainedFishData.rarity);
        itemImage.preserveAspect = true;
        itemImage.sprite         = obtainedFishData.fishPortraitImage;
        newRecordText.gameObject.SetActive(false);
        gameObject.SetActive(true);
    }
Пример #6
0
 public void showObtainedItemWindow(ItemFish itemFish)
 {
     ItemManager.instance.obtainedFish = itemFish;
     obtainedItemWindow.refresh(); // Setting it active on start()
 }
Пример #7
0
 public void Init(ItemFish itemFish)
 {
     //sprite.sprite = itemFish.fishSprite; //get the fish image
 }
Пример #8
0
 public void saveFishToDatabase(ItemFish itemFish)
 {
     GameManager.instance.saveItemData.savedFish.Add(itemFish);
 }