当前位置: 首页>>代码示例>>C#>>正文


C# TreeViewItem.AddItem方法代码示例

本文整理汇总了C#中TreeViewItem.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# TreeViewItem.AddItem方法的具体用法?C# TreeViewItem.AddItem怎么用?C# TreeViewItem.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeViewItem的用法示例。


在下文中一共展示了TreeViewItem.AddItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopulateItem

    public void PopulateItem(TreeViewItem attachTo, string itemName, List<AkWwiseProjectData.GroupValWorkUnit> GroupWorkUnits)
    {
        TreeViewItem attachPoint = attachTo.AddItem(itemName, false, GetExpansionStatus("/" + RootItem.Header + "/" + itemName), new AkTreeInfo(0, AkWwiseProjectData.WwiseObjectType.PHYSICALFOLDER));

        foreach (AkWwiseProjectData.GroupValWorkUnit wwu in GroupWorkUnits)
        {
            foreach(AkWwiseProjectData.GroupValue group in wwu.List)
            {
                TreeViewItem groupItem = AddPathToTreeItem(attachPoint, group);
                AddHandlerEvents(groupItem);

                for (int i = 0; i < group.values.Count; i++)
                {
                    TreeViewItem item = groupItem.AddItem(group.values[i], true, false, new AkTreeInfo(group.valueIDs[i], group.ValueGuids[i].bytes, group.ValueIcons[i].ObjectType));
                    AddHandlerEvents(item);
                }
            }
        }

        AddHandlerEvents(attachPoint);
    }
开发者ID:PurdueSIGGD,项目名称:GrapplingHookFighters,代码行数:21,代码来源:AkWwiseTreeView.cs

示例2: AddEvent

    TreeViewItem AddEvent(TreeViewItem parent, string type, bool createAsset = false)
    {
        try
        {
            int skillId = (parent.DataContext as ItemData).skillId;
            string name = type;
            if (createAsset)
            {
                Skill skill = skillTable[skillId];
                Assembly ass = typeof(SkillEvent).Assembly;
                SkillEvent skillEvent = System.Activator.CreateInstance(ass.GetType(type)) as SkillEvent;
                if (skillEvent is ActiveEvent)
                {
                    name = "ActiveEvent";
                    skill.ActiveEvents.Add(skillEvent as ActiveEvent);

                }
                else
                {
                    if (skill.AnimEvents.Count > 0)
                        name = type + skill.AnimEvents.Count;
                    else
                        name = type;
                    skill.AnimEvents.Add(skillEvent as AnimEvent);

                }
                AssetEditor.CreateAsset(skillEvent, FixedPath + skillId + "/" + name, name);
                EditorUtility.SetDirty(skill);
            }

            ItemData itemData = new ItemData();
            itemData.resPath = ResPath + skillId + "/" + name + "/" + name;
            itemData.type = ItemType.Event;

            TreeViewItem item = parent.AddItem(name);
            item.Header = name;
            item.DataContext = itemData;
            AddEvents(item);

            return item;
        }
        catch (Exception e)
        {
            this.ShowNotification(new GUIContent(e.Message));
        }
        return null;
    }
开发者ID:XmingBunny,项目名称:TempleLight,代码行数:47,代码来源:SkillEditor.cs

示例3: AddSkill

    /// <summary>
    /// 添加技能
    /// </summary>
    TreeViewItem AddSkill(TreeViewItem parent, int skillId, bool createAsset = false)
    {
        try
        {
            //技能节点的数据
            ItemData itemData = new ItemData();
            itemData.resPath = ResPath + skillId + "/Skill";
            itemData.type = ItemType.Skill;

            //增加技能节点
            TreeViewItem item = parent.AddItem(skillId.ToString());
            item.DataContext = itemData;
            AddEvents(item);

            if (createAsset)
            {
                Skill skill = ScriptableObject.CreateInstance<Skill>();
                skill.ID = skillId;
                skillTable.Add(skill.ID, skill);
                AssetEditor.CreateAsset(skill, FixedPath + skillId, "Skill");
                TreeViewItem activeEventItem = AddEvent(item, "ActiveEvent", true);
                AddAction(activeEventItem, "AnimationAction", true);
                AddAction(activeEventItem, "FinishAction", true);
                AddEvent(item, "AnimEvent", true);
            }

            return item;
        }
        catch (Exception e)
        {
            this.ShowNotification(new GUIContent(e.Message));
        }

        return null;
    }
开发者ID:XmingBunny,项目名称:TempleLight,代码行数:38,代码来源:SkillEditor.cs

示例4: AddAction

    TreeViewItem AddAction(TreeViewItem parent, string type, bool createAsset = false)
    {
        try
        {
            ItemData parentData = parent.DataContext as ItemData;
            string name = type;
            string[] arr = parentData.resPath.Split('/');
            string actionResPath = "";
            for (int i = 0; i < arr.Length - 1; i++)
            {
                actionResPath += arr[i];
                actionResPath += "/";
            }

            if (createAsset)
            {
                Assembly ass = typeof(SkillAction).Assembly;
                SkillAction skillAction = System.Activator.CreateInstance(ass.GetType(type)) as SkillAction;

                SkillEvent parentEvent = Resources.Load<SkillEvent>(parentData.resPath);
                parentEvent.actions.Add(skillAction);

                int count = 0;
                foreach (var act in parentEvent.actions)
                {
                    if (act.name.StartsWith(type))
                        count++;
                }

                if (count > 0)
                    skillAction.name = type + count.ToString();
                else
                    skillAction.name = type;
                name = skillAction.name;

                AssetEditor.CreateAsset(skillAction, "Assets/Resources/" + actionResPath + "Actions", name);
                EditorUtility.SetDirty(parentEvent);
            }

            ItemData itemData = new ItemData();
            itemData.resPath = actionResPath + "Actions/" + name;
            itemData.type = ItemType.Aciton;

            TreeViewItem item = parent.AddItem(name);
            item.Header = name;
            item.DataContext = itemData;
            AddEvents(item);

            return item;
        }
        catch (Exception e)
        {
            this.ShowNotification(new GUIContent(e.Message));
        }
        return null;
    }
开发者ID:XmingBunny,项目名称:TempleLight,代码行数:56,代码来源:SkillEditor.cs


注:本文中的TreeViewItem.AddItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。