Esempio n. 1
0
    /// <summary>
    /// Initializes it to display the document
    /// </summary>
    /// <param name="resultDoc">document to display</param>
    public void Initialize(Document resultDoc)
    {
        if (resultDoc.Get("isClothing").Equals("0"))
        {
            prefab = Spawn.GetPrefabByName(resultDoc.Get("name"));
            Sprite toUse = prefab.GetComponentInChildren <SpriteRenderer>()?.sprite;
            if (toUse != null)
            {
                image.sprite = toUse;
            }

            detailText.text = "Prefab";
        }
        else
        {
            var newClothingData = Spawn.GetClothDataNamed(resultDoc.Get("name"));
            if (newClothingData != null)
            {
                detailText.text = $"{newClothingData.name}";
                clothingData    = newClothingData;
                image.sprite    = newClothingData.SpawnerIcon();
            }
            else
            {
                detailText.text = "ERROR";
            }
        }
        titleText.text = resultDoc.Get("name");
    }