Ejemplo n.º 1
0
 public CUIPackage(string name, NLUEngine engine, CUIController controller, CancellationToken ct, params CUIPackage[] subPackages) : base(ct)
 {
     Name       = name;
     NLUEngine  = engine;
     Controller = controller;
     Intents.Add("help", Help);
     Intents.Add("menu", Menu);
     if (subPackages != null && subPackages.Length > 0)
     {
         SubPackages = subPackages.ToList();
     }
     foreach (var vn in VariableNames)
     {
         Variables.Add(Prefixed(vn), null);
     }
     foreach (var i in ItemNames)
     {
         Items.Add(Prefixed(i), null);
         ItemsPageSize.Add(Prefixed(i), 10);
         ItemsCurrentPage.Add(Prefixed(i), 1);
         ItemsSelection.Add(Prefixed(i), -1);
         ItemsDescriptionHandlers.Add(Prefixed(i), null);
     }
     foreach (var m in MenuNames)
     {
         MenuHandlers.Add(Prefixed(m), null);
         MenuIndexes.Add(Prefixed(m), 0);
     }
 }
Ejemplo n.º 2
0
 public bool CanDispatchToMenuSelection()
 {
     if (IsMenuContext)
     {
         string label = CurrentContext.Replace("MENU_", "");
         return(MenuHandlers.ContainsKey(label));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        public void openInTorsion()
        {
            GuiControl GuiEditorContent = "GuiEditorContent";

            if (GuiEditorContent.getCount() == 0)
            {
                return;
            }

            string guiObject = GuiEditorContent.getObject(0);

            MenuHandlers.EditorOpenDeclarationInTorsion(guiObject);
        }
Ejemplo n.º 4
0
        public virtual void Navigate(Option <IMenuModel> item)
        {
            void ExecuteAndHide(IMenuHandler h)
            {
                item.Iter(h.Execute);
                this.Hide();
            }

            this.LogDebug("Navigating to {}.", item.Map(v => v.ToString()).IfNone("(Root)"));

            MenuHandlers
            .Find(h => item.Exists(h.CanExecute))
            .BiIter(ExecuteAndHide, () => _current.OnNext(item));
        }
Ejemplo n.º 5
0
        private void HandleItemsChange(IEnumerable <IMenuModel> items)
        {
            ItemsContainer.GetChildren()
            .OfType <Node>()
            .Filter(c => !EmptyLabel.Contains(c))
            .Iter(ItemsContainer.FreeChild);

            bool IsValid(IMenuModel item)
            {
                var hasChildren = StructureProviders.Exists(p => p.HasChildren(item.Model));
                var executable  = MenuHandlers.Exists(h => h.CanExecute(item));

                return(hasChildren || executable);
            }

            var list = items.Filter(IsValid).Freeze();

            list.Iter((index, item) => CreateItemControl(item, index, ItemsContainer));

            EmptyLabel.Iter(v => v.Visible = !list.Any());
        }
Ejemplo n.º 6
0
        public static void initializeWorldEditor()
        {
            Omni.self.Print(" % - Initializing World Editor");
            Profiles.initialize();
            Cursor.initialize();
            guiCreateNewTerrainGui.initialize();
            GenericPromptDialog.initialize();
            guiTerrainImportGui.initialize();
            guiTerrainExportGui.initialize();
            EditorGui.initialize();
            objectBuilderGui.initialize();
            TerrainEditorVSettingsGui.initialize();
            EditorChooseLevelGui.initialize();
            VisibilityLayerWindow.initialize();
            ManageBookmarksWindow.initialize();
            ManageSFXParametersWindow.initialize();
            TimeAdjustGui.initialize();
            AddFMODProjectDlg.initialize();
            SelectObjectsWindow.initialize();
            ProceduralTerrainPainterGui.initialize();
            MenuHandlers.initialize();
            editor.initialize();
            editor_bind_ed.initialize();
            EditorGui.editorPrefsInitialize();
            ESelectObjectsWindow.initialize();
            TerrainEditorPlugin.LoadTerrainEditorTextureFileSpec();
            // Create the default editor plugins before calling buildMenus.
            ObjectCreator oWorldEditorPlugin = new ObjectCreator("ScriptObject", "WorldEditorPlugin", typeof(WorldEditorPlugin));

            oWorldEditorPlugin["editorGui"] = "EWorldEditor";
            oWorldEditorPlugin.Create();

            // aka. The ObjectEditor.
            ObjectCreator oWorldEditorInspectorPlugin = new ObjectCreator("ScriptObject", "WorldEditorInspectorPlugin", typeof(WorldEditorInspectorPlugin));

            oWorldEditorInspectorPlugin["editorGui"] = "EWorldEditor";
            oWorldEditorInspectorPlugin.Create();

            ObjectCreator oTerrainEditorPlugin = new ObjectCreator("ScriptObject", "TerrainEditorPlugin", typeof(TerrainEditorPlugin));

            oTerrainEditorPlugin["editorGui"] = "ETerrainEditor";
            oTerrainEditorPlugin.Create();

            ObjectCreator oTerrainPainterPlugin = new ObjectCreator("ScriptObject", "TerrainPainterPlugin", typeof(TerrainPainterPlugin));

            oTerrainPainterPlugin["editorGui"] = "ETerrainEditor";
            oTerrainPainterPlugin.Create();

            ObjectCreator oMaterialEditorPlugin = new ObjectCreator("ScriptObject", "MaterialEditorPlugin", typeof(MaterialEditorPlugin));

            oMaterialEditorPlugin["editorGui"] = "EWorldEditor";
            oMaterialEditorPlugin.Create();

            // Expose stock visibility/debug options.
            EVisibility EVisibility = "EVisibility";

            EVisibility.addOption("Render: Zones", "$Zone::isRenderable", "");
            EVisibility.addOption("Render: Portals", "$Portal::isRenderable", "");
            EVisibility.addOption("Render: Occlusion Volumes", "$OcclusionVolume::isRenderable", "");
            EVisibility.addOption("Render: Triggers", "$Trigger::renderTriggers", "");
            EVisibility.addOption("Render: PhysicalZones", "$PhysicalZone::renderZones", "");
            EVisibility.addOption("Render: Sound Emitters", "$SFXEmitter::renderEmitters", "");
            EVisibility.addOption("Render: Mission Area", "EWorldEditor.renderMissionArea", "");
            EVisibility.addOption("Render: Sound Spaces", "$SFXSpace::isRenderable", "");
            EVisibility.addOption("Wireframe Mode", "$gfx::wireframe", "");
            EVisibility.addOption("Debug Render: Player Collision", "$Player::renderCollision", "");
            EVisibility.addOption("Debug Render: Terrain", "TerrainBlock::debugRender", "");
            EVisibility.addOption("Debug Render: Decals", "$Decals::debugRender", "");
            EVisibility.addOption("Debug Render: Light Frustums", "$Light::renderLightFrustums", "");
            EVisibility.addOption("Debug Render: Bounding Boxes", "$Scene::renderBoundingBoxes", "");
            EVisibility.addOption("AL: Disable Shadows", "$Shadows::disable", "");
            EVisibility.addOption("AL: Light Color Viz", "$AL_LightColorVisualizeVar", "toggleLightColorViz");
            EVisibility.addOption("AL: Light Specular Viz", "$AL_LightSpecularVisualizeVar", "toggleLightSpecularViz");
            EVisibility.addOption("AL: Normals Viz", "$AL_NormalsVisualizeVar", "toggleNormalsViz");
            EVisibility.addOption("AL: Depth Viz", "$AL_DepthVisualizeVar", "toggleDepthViz");
            EVisibility.addOption("Frustum Lock", "$Scene::lockCull", "");
            EVisibility.addOption("Disable Zone Culling", "$Scene::disableZoneCulling", "");
            EVisibility.addOption("Disable Terrain Occlusion", "$Scene::disableTerrainOcclusion", "");
        }
Ejemplo n.º 7
0
        public static void toggleEditor(bool make)
        {
            if (((GuiCanvas)"Canvas").isFullscreen())
            {
                messageBox.MessageBoxOK("Windowed Mode Required", "Please switch to windowed mode to access the Mission Editor.");
                return;
            }
            editor editor = "editor";

            if (make)
            {
                string timerID = omni.console.Call("startPrecisionTimer");
                if (omni.bGlobal["$InGuiEditor"])
                {
                    //omni.console.Call("GuiEdit");
                    GuiEditorGui.GuiEdit("");
                }

                if (!omni.bGlobal["$missionRunning"])
                {
                    // Flag saying, when level is chosen, launch it with the editor open.
                    ((GuiControl)"ChooseLevelDlg")["launchInEditor"] = true.AsString();
                    //((GuiCanvas) "canvas").pushDialog("ChooseLevelDlg");
                    MenuHandlers.EditorNewLevel("");
                }
                else
                {
                    omni.Util.pushInstantGroup();
                    if (!"Editor".isObject())
                    {
                        create();

                        ((SimGroup)"MissionCleanup").add(editor);
                        ((SimGroup)"MissionCleanup").add(editor.getUndoManager());
                    }

                    if (Extendable.GuiCanvas.EditorIsActive())
                    {
                        if (((LevelInfo)"theLevelInfo")["Type"] == "DemoScene")
                        {
                            omni.console.commandToServer("dropPlayerAtCamera");
                            editor.close("SceneGui");
                        }
                        else
                        {
                            editor.close("PlayGui");
                        }
                    }
                    else
                    {
                        if (!omni.bGlobal["$GuiEditorBtnPressed"])
                        {
                            ((GuiCanvas)"Canvas").pushDialog("EditorLoadingGui");
                            ((GuiCanvas)"Canvas").repaint(0);
                        }
                        else
                        {
                            omni.bGlobal["$GuiEditorBtnPressed"] = false;
                        }

                        editor.open();

                        // Cancel the scheduled event to prevent
                        // the level from cycling after it's duration
                        // has elapsed.

                        omni.Util.cancel(omni.iGlobal["$Game::Schedule"]);

                        if (((LevelInfo)"theLevelInfo")["type"] == "DemoScene")
                        {
                            omni.console.commandToServer("dropCameraAtPlayer", new string[] { "true" });
                        }

                        ((GuiCanvas)"Canvas").popDialog("EditorLoadingGui");
                    }

                    omni.Util.popInstantGroup();
                }

                string elapsed = omni.console.Call("stopPrecisionTimer", new string[] { timerID });

                omni.Util._warn("Time spent in toggleEditor() : " + (elapsed.AsFloat() / 1000.0) + " s");
            }
        }