private void HandleElemntButtonDropped(uint id)
 {
     if (isHovering)
     {
         var idString = id.ToHexString();
         var element  = itemCatalog.FindElementData(id);
         input.text = element.name;
         input.onEndEdit.Invoke(idString);
     }
     isDragging = false;
 }
Exemplo n.º 2
0
        /// <summary>
        /// recieve selected entity and update the info in the entity window
        /// </summary>
        /// <param name="entity"></param>
        private void HandleEntitySelectionEvent(IEntityContainer entity)
        {
            var id = default(uint);

            uint.TryParse(entity.AssetId, System.Globalization.NumberStyles.HexNumber, null, out id);
            var element = itemDatabase.FindElementData(id);

            // Set the description values
            nameText.text        = entity.GameObject.name;
            idText.text          = string.Format("ID: {0}", entity.Entity.id);
            descriptionText.text = element.description;

            // Set the thumbnail
            if (element.thumbnail != null)
            {
                thumbnail.sprite = element.thumbnail;
            }
            else
            {
                thumbnail.sprite = loadingImage;
                StopAllCoroutines();
                StartCoroutine(SetThumbnailAsync(element));
            }

            // Set the tags
            ClearTags();
            GenerateTags(element.tags);

            // Update the entity values in the subwindows
            for (var i = 0; i < windowComponents.Length; ++i)
            {
                windowComponents[i].Entity = entity;
            }

            if (entity.ActiveComponents.Length == 0)
            {
                eventTable.Invoke("OnEntityScriptTabClick");
            }

            TweenWindow(1f, fadeInDuration);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delegate called when the player adds or removes an item from the inventory
        /// </summary>
        /// <param name="entity">The entity that was added or removed</param>
        /// <param name="amount">The amount to add or remove</param>
        private void HandleInventoryChangeEvent(Entity entity, int amount)
        {
            var entities = inventory.StoredEntities;

            elements = new ElementData[spriteImages.Length];

            var length = Mathf.Min(entities.Length, elements.Length);

            for (var i = 0; i < length; ++i)
            {
                elements[i] = itemCatalog.FindElementData(entities[i].assetId.ToUInt());
            }

            if (length == entities.Length)
            {
                for (var i = length; i < elements.Length; ++i)
                {
                    elements[i] = ElementData.Empty;
                }
            }

            PopulateSprites(elements, spriteImages, placeholderSprite);
        }