Beispiel #1
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                HeroKitCommon.DrawNoItemsInList(blockName);
                return;
            }

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);

            // display items (move up, move down, int field,
            for (int i = 0; i < items.Count; i++)
            {
                SimpleLayout.BeginHorizontal();
                HeroKitCommon.DrawListArrows(moveItemUp, moveItemDown, i);

                items[i].value = SimpleLayout.BoolListField(items[i], i);
                items[i].name  = SimpleLayout.StringListField(items[i].name, HeroKitCommon.GetWidthForField(289));

                HeroKitCommon.DrawListButtons(addItem, copyItem, pasteItem, deleteItem, i);
                SimpleLayout.EndHorizontal();

                if (i != items.Count - 1)
                {
                    SimpleLayout.Line();
                }
            }

            SimpleLayout.EndVertical();

            SimpleLayout.Space(20);
        }
Beispiel #2
0
        /// <summary>
        /// Draw the body of the block.
        /// </summary>
        private static void DrawItems()
        {
            // exit early if there are no items
            if (items == null || items.Count == 0)
            {
                HeroKitCommon.DrawNoItemsInList(blockName);
                return;
            }

            SimpleLayout.BeginVertical(Box.StyleCanvasBox);

            // display items (move up, move down, int field,
            for (int i = 0; i < items.Count; i++)
            {
                SimpleLayout.BeginHorizontal();
                HeroKitCommon.DrawListArrows(moveItemUp, moveItemDown, i);

                SimpleLayout.BeginVertical();
                items[i].objectType = new UnityObjectTypeField().SetValues(items[i].objectType, HeroKitCommon.GetWidthForField(270, 150));
                switch (items[i].objectType)
                {
                case 1:     // audio
                    items[i].value = SimpleLayout.ObjectField(items[i].value as AudioClip, HeroKitCommon.GetWidthForField(270, 150));
                    break;

                case 2:     // sprite
                    items[i].value = SimpleLayout.ObjectField(items[i].value as Sprite, HeroKitCommon.GetWidthForField(270, 150));
                    break;

                case 3:     // scene
                    items[i].value = SimpleLayout.ObjectField(items[i].value as SceneAsset, HeroKitCommon.GetWidthForField(270, 150));
                    if (items[i].value != null)
                    {
                        // add the scene to the editor build settings if it doesn't already exist there.
                        HeroKitCommon.AddSceneToBuildSettings(items[i].value as SceneAsset);
                    }
                    break;

                case 4:     // particle system
                    items[i].value = SimpleLayout.ObjectField(items[i].value as ParticleSystem, HeroKitCommon.GetWidthForField(270, 150));
                    break;

                case 5:     // mono script
                    items[i].value = SimpleLayout.ObjectField(items[i].value as MonoScript, HeroKitCommon.GetWidthForField(270, 150));
                    break;
                }
                items[i].name = SimpleLayout.StringListField(items[i].name, HeroKitCommon.GetWidthForField(270, 150));
                SimpleLayout.EndVertical();

                HeroKitCommon.DrawListButtons(addItem, copyItem, pasteItem, deleteItem, i);
                SimpleLayout.EndHorizontal();

                if (i != items.Count - 1)
                {
                    SimpleLayout.Line();
                }
            }

            SimpleLayout.EndVertical();

            SimpleLayout.Space(20);
        }