當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。