private void initFor(List <ComboItem> vals, bool greaterThanMaxVal, string searchedString)
    {
        //IL_0166: Unknown result type (might be due to invalid IL or missing references)
        CurrentItemID        = -1;
        CurrentSelectedIndex = -1;
        SetController.InitNumbers();
        UI_SearchItem uI_SearchItem = null;

        if (spawnedObjects != null && spawnedObjects.Count > 0)
        {
            foreach (UI_SearchItem spawnedObject in spawnedObjects)
            {
                Destroy(spawnedObject.gameObject);
            }
            spawnedObjects.Clear();
        }
        if (vals.Count < 1)
        {
            MappableText.text     = "No items";
            ItemSelectedName.text = "No item selected";
            MappableText.gameObject.SetActive(true);
            SelectionOverlay.gameObject.SetActive(false);
        }
        else
        {
            SelectionOverlay.gameObject.SetActive(true);
            if (greaterThanMaxVal)
            {
                MappableText.text = "...more entries exist. Refine your search.";
                MappableText.gameObject.SetActive(true);
            }
            else
            {
                MappableText.gameObject.SetActive(false);
            }
            spawnedObjects = new List <UI_SearchItem>();
            for (int i = 0; i < vals.Count; i++)
            {
                GameObject obj = Instantiate(SearchItemPrefab.gameObject);
                obj.gameObject.SetActive(true);
                obj.transform.SetParent(SearchItemPrefab.transform.parent);
                obj.transform.localScale = SearchItemPrefab.transform.localScale;
                UI_SearchItem component = obj.GetComponent <UI_SearchItem>();
                component.InitialiseFor(vals[i].Text, searchedString, vals[i].Value, CurrentFilter, this);
                spawnedObjects.Add(component);
            }
            uI_SearchItem = spawnedObjects[0];
        }
        if (CurrentFilter == ItemFilter.MsgBottle)
        {
            WrapController.WrapToggle.isOn = false;
            WrapController.WrapToggle.gameObject.SetActive(false);
            SetController.FFlagOne.gameObject.SetActive(true);
        }
        else
        {
            WrapController.WrapToggle.gameObject.SetActive(true);
            SetController.FFlagOne.gameObject.SetActive(false);
        }
        if (MappableText.gameObject.activeSelf)
        {
            MappableText.transform.SetAsLastSibling();
        }
        if (uI_SearchItem != null)
        {
            uI_SearchItem.SelectionButton.onClick.Invoke();
        }
    }
    public void SelectItem(ItemFilter itemF, int id, UI_SearchItem sItem)
    {
        if (id == Item.NONE)
        {
            return;
        }
        if (ItemExtensions.IsInternalItem((ushort)id))
        {
            if (!InternalItemWarning.gameObject.activeInHierarchy)
            {
                InternalItemWarning.gameObject.SetActive(true);
            }
            else
            {
                InternalItemWarning.Start();
            }
        }
        SetController.FCount.text = id.ToString();
        ItemSelectedName.text     = sItem.RawValue;
        switch (itemF)
        {
        case ItemFilter.Recipes:
            CurrentItemID = RECIPEITEM;
            break;

        case ItemFilter.Fossils:
            CurrentItemID = FOSSILITEM;
            break;

        case ItemFilter.MsgBottle:
            CurrentItemID = MESSAGEBOTTLEITEM;
            break;

        default:
            CurrentItemID             = id;
            SetController.FCount.text = 0.ToString();
            break;
        }

        CurrentSelectedIndex = spawnedObjects.IndexOf(sItem);
        if (ItemInfo.GetItemKind(Convert.ToUInt16(CurrentItemID)).IsFlower())
        {
            FlowerButtonRoot.SetActive(true);
        }
        else
        {
            FlowerController.ResetToZero();
            FlowerButtonRoot.SetActive(false);
        }

        /*if (new Item((ushort)id).IsMoneyTree())
         *  TreeButtonRoot.gameObject.SetActive(true);
         * else
         *  TreeButtonRoot.gameObject.SetActive(false);*///uncomment this if you want star tree editor again for whatever reason

        short remakeIndex = ItemRemakeUtil.GetRemakeIndex(Convert.ToUInt16(CurrentItemID));

        if (remakeIndex < 0)
        {
            SetController.CreateBody(new string[0]);
            SetController.CreateFabric(new string[0]);
        }
        else
        {
            ItemRemakeInfo itemRemakeInfo = ItemRemakeInfoData.List[remakeIndex];
            string         bodySummary    = itemRemakeInfo.GetBodySummary(GameInfo.Strings, false);
            if (bodySummary.Length != 0)
            {
                string[] values = bodySummary.Split(new string[3]
                {
                    "\r\n",
                    "\r",
                    "\n"
                }, StringSplitOptions.None);
                SetController.CreateBody(values);
            }
            else
            {
                SetController.CreateBody(new string[0]);
            }
            string fabricSummary = itemRemakeInfo.GetFabricSummary(GameInfo.Strings, false, false);
            if (fabricSummary.Length != 0)
            {
                string[] values2 = fabricSummary.Split(new string[3]
                {
                    "\r\n",
                    "\r",
                    "\n"
                }, StringSplitOptions.None);
                SetController.CreateFabric(values2);
            }
            else
            {
                SetController.CreateFabric(new string[0]);
            }
        }
        if (currentAnimationFuction != null)
        {
            StopCoroutine(currentAnimationFuction);
        }
        currentAnimationFuction = StartCoroutine(sendSelectorToSelected());

        UpdateSprite();
    }
示例#3
0
    public void SelectItem(ItemFilter itemF, int id, UI_SearchItem sItem)
    {
        if (id == Item.NONE)
        {
            return;
        }
        SetController.FCount.text = id.ToString();
        ItemSelectedName.text     = sItem.RawValue;
        switch (itemF)
        {
        case ItemFilter.Recipes:
            CurrentItemID = RECIPEITEM;
            break;

        case ItemFilter.Fossils:
            CurrentItemID = FOSSILITEM;
            break;

        case ItemFilter.MsgBottle:
            CurrentItemID = MESSAGEBOTTLEITEM;
            break;

        default:
            CurrentItemID             = id;
            SetController.FCount.text = 0.ToString();
            break;
        }
        CurrentSelectedIndex = spawnedObjects.IndexOf(sItem);
        if (ItemInfo.GetItemKind(Convert.ToUInt16(CurrentItemID)).IsFlower())
        {
            FlowerButtonRoot.SetActive(true);
        }
        else
        {
            FlowerController.ResetToZero();
            FlowerButtonRoot.SetActive(false);
        }
        short remakeIndex = ItemRemakeUtil.GetRemakeIndex(Convert.ToUInt16(CurrentItemID));

        if (remakeIndex < 0)
        {
            SetController.CreateBody(new string[0]);
            SetController.CreateFabric(new string[0]);
        }
        else
        {
            ItemRemakeInfo itemRemakeInfo = ItemRemakeInfoData.List[remakeIndex];
            string         bodySummary    = itemRemakeInfo.GetBodySummary(GameInfo.Strings, tryGetDescriptor: false);
            if (bodySummary.Length != 0)
            {
                string[] values = bodySummary.Split(new string[3]
                {
                    "\r\n",
                    "\r",
                    "\n"
                }, StringSplitOptions.None);
                SetController.CreateBody(values);
            }
            else
            {
                SetController.CreateBody(new string[0]);
            }
            string fabricSummary = itemRemakeInfo.GetFabricSummary(GameInfo.Strings, tryGetDescriptor: false);
            if (fabricSummary.Length != 0)
            {
                string[] values2 = fabricSummary.Split(new string[3]
                {
                    "\r\n",
                    "\r",
                    "\n"
                }, StringSplitOptions.None);
                SetController.CreateFabric(values2);
            }
            else
            {
                SetController.CreateFabric(new string[0]);
            }
        }
        if (currentAnimationFuction != null)
        {
            StopCoroutine(currentAnimationFuction);
        }
        currentAnimationFuction = StartCoroutine(sendSelectorToSelected());
    }