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


C# ObjectCreator.addItem方法代码示例

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


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

示例1: onRightMouseUp

        public override void onRightMouseUp(int itemId, string mousePos, SimObject obj)
        {
            MenuBuilder popup;
            GuiCanvas Canvas = "Canvas";

            bool haveObjectEntries = false;
            bool haveLockAndHideEntries = true;

            // Handle multi-selection.
            if (this.getSelectedItemsCount() > 1)
                {
                popup = "ETMultiSelectionContextPopup";
                if (!popup.isObject())
                    {
                    ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETMultiSelectionContextPopup", typeof (MenuBuilder));
                    popCreator["isPopup"] = true.AsString();

                    popCreator["item[0]"] = "Delete" + '\t' + "" + '\t' + "EditorMenuEditDelete();";
                    popCreator["item[1]"] = "Group" + '\t' + "" + '\t' + "EWorldEditor.addSimGroup( true );";

                    popup = popCreator.Create();
                    }
                }

                // Open context menu if this is a CameraBookmark
            else if (obj.isMemberOfClass("CameraBookmark"))
                {
                popup = "ETCameraBookmarkContextPopup";
                if (!popup.isObject())
                    {
                    ObjectCreator popupCreator = new ObjectCreator("PopupMenu", "ETCameraBookmarkContextPopup", typeof (MenuBuilder));
                    popupCreator["isPopup"] = true.AsString();

                    popupCreator["item[0]"] = "Go To Bookmark" + '\t' + "" + '\t' + "EditorGui.jumpToBookmark( this.bookmark.getInternalName() );";

                    popupCreator["bookmark"] = "-1";

                    popup = popupCreator.Create();
                    }

                ((MenuBuilder) "ETCameraBookmarkContextPopup")["bookmark"] = obj;
                }
   
                // Open context menu if this is set CameraBookmarks group.
            else if (obj.name == "CameraBookmarks")
                {
                popup = "ETCameraBookmarksGroupContextPopup";
                if (!popup.isObject())
                    {
                    popup = new ObjectCreator("PopupMenu", "ETCameraBookmarksGroupContextPopup", typeof (MenuBuilder)).Create();
                    popup.isPopup = true;

                    popup.addItem("0", "Add Camera Bookmark" + '\t' + "" + '\t' + "EditorGui.addCameraBookmarkByGui();");
                    }
                }

                // Open context menu if this is a SimGroup
            else if (obj.isMemberOfClass("SimGroup"))
                {
                popup = "ETSimGroupContextPopup";
                if (!popup.isObject())
                    {
                    ObjectCreator popupCreator = new ObjectCreator("PopupMenu", "ETSimGroupContextPopup", typeof (MenuBuilder));
                    popupCreator["isPopup"] = true.AsString();

                    popupCreator["item[0]"] = "Rename" + '\t' + "" + '\t' + "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( ETSimGroupContextPopup.object ) );";
                    popupCreator["item[1]"] = "Delete" + '\t' + "" + '\t' + "EWorldEditor.deleteMissionObject( ETSimGroupContextPopup.object );";
                    popupCreator["item[2]"] = "Inspect" + '\t' + "" + '\t' + "inspectObject( ETSimGroupContextPopup.object );";
                    popupCreator["item[3]"] = "-";
                    popupCreator["item[4]"] = "Toggle Lock Children" + '\t' + "" + '\t' + "EWorldEditor.toggleLockChildren( ETSimGroupContextPopup.object );";
                    popupCreator["item[5]"] = "Toggle Hide Children" + '\t' + "" + '\t' + "EWorldEditor.toggleHideChildren( ETSimGroupContextPopup.object );";
                    popupCreator["item[6]"] = "-";
                    popupCreator["item[7]"] = "Group" + '\t' + "" + '\t' + "EWorldEditor.addSimGroup( true );";
                    popupCreator["item[8]"] = "-";
                    popupCreator["item[9]"] = "Add New Objects Here" + '\t' + "" + '\t' + "EWCreatorWindow.setNewObjectGroup( ETSimGroupContextPopup.object );";
                    popupCreator["item[10]"] = "Add Children to Selection" + '\t' + "" + '\t' + "EWorldEditor.selectAllObjectsInSet( ETSimGroupContextPopup.object, false );";
                    popupCreator["item[11]"] = "Remove Children from Selection" + '\t' + "" + '\t' + "EWorldEditor.selectAllObjectsInSet( ETSimGroupContextPopup.object, true );";

                    popupCreator["object"] = "-1";

                    popup = popupCreator.Create();
                    }

                popup["object"] = obj;

                bool hasChildren = ((SimGroup) obj).getCount() > 0;
                popup.enableItem(10, hasChildren);
                popup.enableItem(11, hasChildren);

                haveObjectEntries = true;
                haveLockAndHideEntries = false;
                }
   
                // Open generic context menu.
            else
                {
                popup = "ETContextPopup";
                if (!popup.isObject())
                    {
                    ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETContextPopup", typeof (MenuBuilder));
//.........这里部分代码省略.........
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:101,代码来源:EditorTree.cs


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