コード例 #1
0
    public ToolSelectMenu(GuiManager gameMenuManager)
    {
        background = Resources.Load(ResourcePaths.toolSelectBackground) as Texture;
        tipStyle   = GuiFunctions.getTipStyle();

        gmm = gameMenuManager;

        int xSpace = Screen.width / 6;
        int ySpace = Screen.height / 6;

        backgroundRect = new Rect(xSpace, ySpace, Screen.width - xSpace * 2, Screen.height - ySpace * 2);

        guiRect = new Rect(backgroundRect.xMin + Screen.width / 40, backgroundRect.yMin + Screen.height / 40,
                           backgroundRect.width - Screen.width / 20, backgroundRect.height - Screen.height / 20);

        float toolIconSize  = guiRect.width / 5;
        float mouseIconSize = toolIconSize / 2;

        toolIconSpacing = toolIconSize / 4;
        toolGuiOptions  = new GUILayoutOption[2] {
            GUILayout.Width(toolIconSize), GUILayout.Height(toolIconSize)
        };
        mouseGuiOptions = new GUILayoutOption[2] {
            GUILayout.Width(mouseIconSize), GUILayout.Height(mouseIconSize)
        };
    }
コード例 #2
0
        public String filterSubtreeOfApplication()
        {
            if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition())
            {
                try
                {
                    IntPtr          points         = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition();
                    IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
                    int             pointX;
                    int             pointY;
                    strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY);
                    Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Descendants, -1);
                    if (grantTree.filteredTree != null)
                    {
                        List <Object> result = treeOperation.searchNodes.getNodesByProperties(grantTree.filteredTree, strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties, OperatorEnum.and);
                        if (result.Count == 1)
                        {
                            GuiFunctions guiFunctions = new GuiFunctions(strategyMgr, grantTree, treeOperation);
                            treeOperation.updateNodes.filterSubtreeWithCurrentFilterStrtegy(strategyMgr.getSpecifiedTree().GetData(result[0]).properties.IdGenerated);

                            // guiFunctions.filterAndAddSubtreeOfApplication(strategyMgr.getSpecifiedTreeOperations().getFilteredTreeOsmElementById("7CA0B5B9845D7906E3BD235A600F3546"));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An error occurred: '{0}'", ex);
                }
            }
            return("");
        }
コード例 #3
0
        public void Initialize()
        {
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();

            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();
            List <Strategy> str = settings.getPossibleTrees();

            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className);
            strategyMgr.getSpecifiedBrailleDisplay().setStrategyMgr(strategyMgr);
            strategyMgr.getSpecifiedBrailleDisplay().setTreeOperation(treeOperation);
            strategyMgr.getSpecifiedBrailleDisplay().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);
            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);
            strategyMgr.setSpecifiedExternalScreenreader(settings.getPossibleExternalScreenreaders()[0].className);
            strategyMgr.setSpecifiedBrailleConverter(settings.getPossibleBrailleConverter()[0].className);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);

            treePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "SavedTrees", "calc.grant");
        }
コード例 #4
0
        public void Initialize()
        {
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();

            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();
            List <Strategy> str = settings.getPossibleTrees();

            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            // strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);

            /* strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
             * strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
             * strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);*/
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);

            /*strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className);
             * strategyMgr.getSpecifiedBrailleDisplay().setGeneratedGrantTrees(grantTrees);
             * strategyMgr.getSpecifiedBrailleDisplay().setStrategyMgr(strategyMgr);
             * strategyMgr.getSpecifiedBrailleDisplay().setTreeOperation(treeOperation);*/
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);

            //Anwendung starten
            HelpFunctions hf = new HelpFunctions(strategyMgr, grantTrees);

            hf.startApp(applicationName, applicationPathName);
        }
コード例 #5
0
        public void Initialize()
        {
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();

            searchNodes   = new SearchNodes(strategyMgr, grantTrees, treeOperation);
            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);
            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();

            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);

            pathToTemplate = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Template");
            pathToTemplate = System.IO.Path.Combine(pathToTemplate, "TemplateUi.xml");
            //
            guiFuctions.deleteGrantTrees();
        }
コード例 #6
0
        void filteredTreeOutput_SelectedItemChanged(object sender,
                                                    RoutedPropertyChangedEventArgs <object> e)
        {
            NodeButton.IsEnabled = true;
            var tree = sender as TreeView;

            // ... Determine typeOfTemplate of SelectedItem.
            if (tree.SelectedItem is TreeViewItem)
            {
                // ... Handle a TreeViewItem.
                TreeViewItem item = tree.SelectedItem as TreeViewItem;
                if (item.Header is GuiFunctions.MenuItem && ((GuiFunctions.MenuItem)item.Header).IdGenerated != null)
                {
                    updatePropertiesTable(((GuiFunctions.MenuItem)item.Header).IdGenerated);
                }
                else
                {
                    GuiFunctions.clearTable(filteredTreeProp);
                }
                //Methode MenuItem übergeben - tabelle
            }
            else if (tree.SelectedItem is string)
            {
                // ... Handle a string.
                Console.WriteLine("Fehler: ");
            }
        }
コード例 #7
0
ファイル: MainMenu.cs プロジェクト: shuidong/galactoid
    void OnGUI()
    {
        GUI.DrawTexture(screenArea, splashBackground, ScaleMode.ScaleAndCrop, false, 0);

        GUILayout.BeginArea(guiArea);
        GUILayout.BeginVertical();
        GUILayout.Label("Galactoid", GuiFunctions.getTitleStyle());
        GUILayout.Label(currentSubtitle, GuiFunctions.getSubtitleStyle());
        GUILayout.EndVertical();

        if (currentMenu == Menus.main)
        {
            drawMain();
        }
        if (currentMenu == Menus.loadGame)
        {
            drawLoadGame();
        }
        if (currentMenu == Menus.newGame)
        {
            drawNewGame();
        }

        GUILayout.EndArea();
    }
コード例 #8
0
ファイル: MainMenu.cs プロジェクト: shuidong/galactoid
    private void drawNewGame()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        GUILayout.Label("Ship Name:", GuiFunctions.getButtonStyle());
        newShipName = GUILayout.TextField(newShipName);

        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Begin", GuiFunctions.getButtonStyle()))
            {
                menuAction = MenuActions.submitNewGame;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
        GUILayout.Space(buttonSpace);
        GUILayout.EndHorizontal();
    }
コード例 #9
0
        public void Initialize()
        {
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();

            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();

            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);
            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);
            String projectPath;

            projectPath  = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "SavedTrees");
            treePathUia2 = System.IO.Path.Combine(projectPath, "filteredTree_Rechner.grant");
        }
コード例 #10
0
    public MenuActions draw()
    {
        MenuActions menuAction = MenuActions.none;

        GUI.DrawTexture(backgroundRect, background, ScaleMode.ScaleAndCrop, false, 0);

        GUILayout.BeginArea(guiRect);
        GUILayout.BeginVertical();
        {
            GUILayout.Label("Set left and right mouse buttons", GuiFunctions.getNormalStyle(Color.black));

            GUILayout.BeginHorizontal();
            foreach (GameOptions.toolModes toolMode in Enum.GetValues(typeof(GameOptions.toolModes)))
            {
                if (GUILayout.Button(ResourceLookup.getToolModeTexture(toolMode), toolGuiOptions))
                {
                    setMouseButton(toolMode);
                }
                GUILayout.Space(toolIconSpacing);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(toolIconSpacing);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            drawMouseIcon(0);
            GUILayout.FlexibleSpace();
            drawMouseIcon(1);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();

        return(menuAction);
    }
コード例 #11
0
        public GUIInspector()
        {
            InitializeComponent();

            settings       = new Settings();
            strategyMgr    = new StrategyManager();
            grantTrees     = new GeneratedGrantTrees();
            treeOperations = new TreeOperation(strategyMgr, grantTrees);

            // Setzen des Eventmanager
            List <Strategy> possibleEventManager = settings.getPossibleEventManager();

            strategyMgr.setSpecifiedEventStrategy(possibleEventManager[0].className);
            List <Strategy> possibleOperationSystems = settings.getPossibleOperationSystems();
            String          cUserOperationSystemName = possibleOperationSystems[0].userName; // muss dynamisch ermittelt werden

            strategyMgr.setSpecifiedOperationSystem(Settings.strategyUserNameToClassName(cUserOperationSystemName));
            IOperationSystemStrategy operationSystemStrategy = strategyMgr.getSpecifiedOperationSystem();
            List <Strategy>          possibleTrees           = settings.getPossibleTrees();

            strategyMgr.setSpecifiedTree(possibleTrees[0].className);
            ITreeStrategy <OSMElements.OSMElement> treeStrategy = strategyMgr.getSpecifiedTree();
            List <Strategy> possibleFilter  = Settings.getPossibleFilters();
            String          cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden

            strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName));
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperations);
            IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();

            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperations);
            strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className); // muss dynamisch ermittelt werden

            #region setzen der neuen (Juni 2017) Event Interfaces
            strategyMgr.setSpecifiedEventAction(settings.getPossibleEventAction()[0].className);
            strategyMgr.getSpecifiedEventAction().setGrantTrees(grantTrees);
            strategyMgr.getSpecifiedEventAction().setTreeOperation(treeOperations);
            strategyMgr.setSpecifiedEventManager(settings.getPossibleEventManager2()[0].className);
            strategyMgr.setSpecifiedEventProcessor(settings.getPossibleEventProcessor()[0].className);
            strategyMgr.getSpecifiedEventProcessor().setGrantTrees(grantTrees);
            strategyMgr.getSpecifiedEventProcessor().setTreeOperations(treeOperations);
            #endregion


            strategyMgr.setSpecifiedExternalScreenreader(settings.getPossibleExternalScreenreaders()[0].className);
            strategyMgr.setSpecifiedBrailleConverter(settings.getPossibleBrailleConverter()[0].className);

            filteredTreeOutput.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(filteredTreeOutput_SelectedItemChanged);
            guiFunctions         = new GuiFunctions(strategyMgr, grantTrees, treeOperations);
            root                 = new TreeViewItem();
            NodeButton.IsEnabled = false;
            SaveButton.IsEnabled = false;
            filteredPropRoot     = new GuiFunctions.MyViewModel();
        }
コード例 #12
0
    public GameHud(BlockSelectMenu blockSelectMenu)
    {
        normalStyle          = GuiFunctions.getNormalStyle(Color.white);
        this.blockSelectMenu = blockSelectMenu;

        float slotWidth = Screen.width / 20;

        selectedBlockScale    = slotWidth / 16;
        selectedBlockPosition = new Vector2(Screen.width - (float)(slotWidth * 1.5),
                                            Screen.height - (float)(slotWidth * 2.5));
    }
コード例 #13
0
    public void drawSelectedBlock()
    {
        int blockSelectKey = getBlockSelectButton();

        if (blockSelectKey > 0 && blockSelectMenu.selectedBlockStacks[blockSelectKey - 1] != null)
        {
            selectedBlockStack = (BlockStack)blockSelectMenu.selectedBlockStacks[blockSelectKey - 1];
        }

        if (selectedBlockStack != null)
        {
            GuiFunctions.drawSlotTexture(selectedBlockStack.blockTexture, selectedBlockPosition.x,
                                         selectedBlockPosition.y, selectedBlockScale);
        }
    }
コード例 #14
0
ファイル: BlockSelectMenu.cs プロジェクト: shuidong/galactoid
    public BlockSelectMenu(ShipInfo shipInfo)
    {
        this.shipInfo = shipInfo;
        background    = Resources.Load(ResourcePaths.toolSelectBackground) as Texture;
        normalStyle   = GuiFunctions.getNormalStyle(Color.black);

        slotWidth  = Screen.width / 12;
        slotHeight = slotWidth * 2;

        float ySpace = Screen.height / 2 - (float)(slotHeight * 1.2);

        backgroundRect = new Rect(0, ySpace, Screen.width, Screen.height - ySpace * 2);

        slotGuiOptions = new GUILayoutOption[4] {
            GUILayout.Width(slotWidth),
            GUILayout.Height(slotHeight), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)
        };
        selectedBlockStacks = new BlockStack[slotPositions];
    }
コード例 #15
0
ファイル: MainMenu.cs プロジェクト: shuidong/galactoid
    private void drawMain()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Space(buttonSpace);
        GUILayout.BeginVertical();

        if (GUILayout.Button("New Ship", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.newGame;
        }
        if (GUILayout.Button("Continue", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.loadGame;
        }
        if (GUILayout.Button("Exit", GuiFunctions.getButtonStyle()))
        {
            menuAction = MenuActions.exitGame;
        }

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
コード例 #16
0
        public void Initialize()
        {
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();

            //  searchNodes = new SearchNodes(strategyMgr, grantTrees);
            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();

            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);
            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);
        }
コード例 #17
0
        public void Initialize()
        {
            #region initialisieren
            strategyMgr = new StrategyManager();
            grantTrees  = new GeneratedGrantTrees();
            Settings settings = new Settings();
            treeOperation = new TreeOperation(strategyMgr, grantTrees);
            List <GRANTManager.Strategy> posibleOS = settings.getPossibleOperationSystems();
            List <Strategy> str = settings.getPossibleTrees();
            strategyMgr.setSpecifiedTree(settings.getPossibleTrees()[0].className);
            strategyMgr.setSpecifiedEventStrategy(settings.getPossibleEventManager()[0].className);
            strategyMgr.setSpecifiedFilter(Settings.getPossibleFilters()[0].className);
            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);

            /* strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
             * strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees);
             * strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);*/
            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
            strategyMgr.setSpecifiedOperationSystem(settings.getPossibleOperationSystems()[0].className);
            strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className);
            strategyMgr.getSpecifiedBrailleDisplay().setGeneratedGrantTrees(grantTrees);
            strategyMgr.getSpecifiedBrailleDisplay().setStrategyMgr(strategyMgr);
            strategyMgr.getSpecifiedBrailleDisplay().setTreeOperation(treeOperation);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            guiFuctions = new GuiFunctions(strategyMgr, grantTrees, treeOperation);
            #endregion

            List <String> viewCategories = Settings.getPossibleTypesOfViews();
            if (viewCategories == null)
            {
                Assert.Fail("Die ViewCategories sind in der Config nicht richtig angegeben!");
            }
            VIEWCATEGORYSYMBOLVIEW = viewCategories[0];
            VIEWCATEGORYLAYOUTVIEW = viewCategories[1];

            pathToTemplate = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Template");
            pathToTemplate = System.IO.Path.Combine(pathToTemplate, "TemplateUiGroups.xml");
        }
コード例 #18
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (grantTrees.filteredTree == null)
            {
                Console.WriteLine("Der Baum muss vor dem Speichern gefiltert werden."); return;
            }
            // Configure save file dialog box
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.FileName         = GuiFunctions.cleanInput("filteredTree_" + strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(grantTrees.filteredTree)).properties.nameFiltered); // Default file name
            dlg.DefaultExt       = ".grant";                                                                                                                                                                 // Default file extension
            dlg.Filter           = "GRANT documents (.grant)|*.grant";                                                                                                                                       // Filter files by extension
            dlg.OverwritePrompt  = true;                                                                                                                                                                     // Hinweis wird gezeigt, wenn die Datei schon existiert
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            // Show save file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process save file dialog box results
            if (result == true)
            {
                // Save document
                guiFunctions.saveProject(dlg.FileName);
            }
        }
コード例 #19
0
        private void ExternalScreenreader_Click(object sender, RoutedEventArgs e)
        {
            OSMElements.OSMElement osm = strategyMgr.getSpecifiedExternalScreenreader().getScreenreaderContent();
            if (osm != null)
            {
                treeOperations.updateNodes.addNodeExternalScreenreaderInFilteredTree(osm);
                filteredTreeOutput.Items.Clear();
                root.Items.Clear();
                //  root.Header = "Filtered - Tree";
                guiFunctions.createTreeForOutput(grantTrees.filteredTree, ref root);
                SaveButton.IsEnabled = true;
                filteredTreeOutput.Items.Add(root);
                NodeButton.IsEnabled = false;

                /* updatePropertiesTable(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(grantTrees.filteredTree)).properties.IdGenerated);
                 * ((TreeViewItem)filteredTreeOutput.Items[0]).IsSelected = true;
                 * ((TreeViewItem)filteredTreeOutput.Items[0]).IsExpanded = true;*/
                GuiFunctions.clearTable(filteredTreeProp);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Can't find content from an external screenreader!");
            }
        }
コード例 #20
0
    public MenuActions draw()
    {
        MenuActions menuAction = MenuActions.none;

        GUI.DrawTexture(splashArea, mainBackground, ScaleMode.ScaleAndCrop, false, 0);

        GUILayout.BeginArea(guiArea);
        GUILayout.BeginVertical();
        {
            GUILayout.Label("Galactoid", GuiFunctions.getTitleStyle());
            GUILayout.Label("Pause", GuiFunctions.getSubtitleStyle());

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(buttonSpace);
                GUILayout.BeginVertical();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Resume", GuiFunctions.getButtonStyle()))
                {
                    menuAction = MenuActions.resumeGame;
                }
                if (GUILayout.Button("Save & Exit", GuiFunctions.getButtonStyle()))
                {
                    menuAction = MenuActions.gotoMainMenu;
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();

        return(menuAction);
    }
コード例 #21
0
        private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            IOperationSystemStrategy operationSystemStrategy = strategyMgr.getSpecifiedOperationSystem();

            ITreeStrategy <OSMElements.OSMElement> treeStrategy = strategyMgr.getSpecifiedTree();

            if (e.Key == Key.F1)
            {
                if (operationSystemStrategy.deliverCursorPosition())
                {
                    try
                    {
                        IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
                        int             pointX;
                        int             pointY;
                        operationSystemStrategy.getCursorPoint(out pointX, out pointY);
                        Console.WriteLine("Pointx: " + pointX);
                        Console.WriteLine("Pointy: " + pointY);
                        OSMElements.OSMElement   osmElement = filterStrategy.getOSMElement(pointX, pointY);
                        System.Drawing.Rectangle rect       = operationSystemStrategy.getRect(osmElement);
                        if (osmElement.properties.isOffscreenFiltered == false)
                        {
                            operationSystemStrategy.paintRect(rect);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("An error occurred: '{0}'", ex);
                    }
                }
            }

            if (e.Key == Key.F5)
            {
                if (operationSystemStrategy.deliverCursorPosition())
                {
                    try
                    {
                        //Filtermethode
                        IntPtr          points         = operationSystemStrategy.getHWNDByCursorPosition();
                        List <Strategy> possibleFilter = Settings.getPossibleFilters();
                        if (strategyMgr.getSpecifiedFilter() == null)
                        {
                            // auslesen aus GUI.....
                            String cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden
                            strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName));
                            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees);
                            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperations);
                        }
                        guiFunctions.deleteGrantTrees();
                        IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter();
                        Object          tree           = filterStrategy.filtering(operationSystemStrategy.getProcessHwndFromHwnd(filterStrategy.deliverElementID(points)));
                        grantTrees.filteredTree = tree;
                        filteredTreeOutput.Items.Clear();
                        root.Items.Clear();
                        root.Header = "Filtered - Tree";
                        guiFunctions.createTreeForOutput(tree, ref root);
                        SaveButton.IsEnabled = true;
                        filteredTreeOutput.Items.Add(root);
                        NodeButton.IsEnabled = false;

                        /* updatePropertiesTable(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties.IdGenerated);
                         * ((TreeViewItem)filteredTreeOutput.Items[0]).IsSelected = true;
                         * ((TreeViewItem)filteredTreeOutput.Items[0]).IsExpanded = true;*/
                        GuiFunctions.clearTable(filteredTreeProp);
                    }

                    catch (Exception ex)
                    {
                        Console.WriteLine("An error occurred: '{0}'", ex);
                    }
                }
            }
        }
コード例 #22
0
 public static void drawSlotTexture(Texture texture, float x, float y, float slotScale)
 {
     //this function knows how to clip a blockTexture for use as a slotTexture
     GuiFunctions.drawClippedTexture(texture, 48, 24, 16, 32, x, y, slotScale);
 }
コード例 #23
0
        public void isTemplateValidTest()
        {
            bool isValid = GuiFunctions.isTemplateValid(pathToTemplate);

            Assert.AreEqual(true, isValid, "Das Template ist nicht valide!");
        }
コード例 #24
0
        private void InitializeFilterComponent()
        {
            settings      = new Settings();
            strategyMgr   = new StrategyManager();
            grantTree     = new GeneratedGrantTrees();
            searchNodes   = new SearchNodes(strategyMgr, grantTree, treeOperation);
            treeOperation = new TreeOperation(strategyMgr, grantTree);

            // Setzen des Eventmanager
            List <Strategy> possibleEventManager = settings.getPossibleEventManager();

            //abfrage der klassen, debugnamen, des typ für eintragung in strategy.confog - datei für entsprechende erstellung der klasse hier im manager
            //IEvent_PRISMStrategy test = new StrategyEvent_PRISM.Event_PRISM();
            //Type t = test.GetType();

            strategyMgr.setSpecifiedEventStrategy(possibleEventManager[0].className);

            #region setzen der neuen (Juni 2017) Event Interfaces
            strategyMgr.setSpecifiedEventAction(settings.getPossibleEventAction()[0].className);
            strategyMgr.getSpecifiedEventAction().setGrantTrees(grantTree);
            strategyMgr.getSpecifiedEventAction().setTreeOperation(treeOperation);
            strategyMgr.setSpecifiedEventManager(settings.getPossibleEventManager2()[0].className);
            strategyMgr.setSpecifiedEventProcessor(settings.getPossibleEventProcessor()[0].className);

            strategyMgr.getSpecifiedEventProcessor().setGrantTrees(grantTree);
            strategyMgr.getSpecifiedEventProcessor().setTreeOperations(treeOperation);

            //todo: neu, nur in example, noch an application machen
            strategyMgr.getSpecifiedEventManager().setGrantTrees(grantTree);
            strategyMgr.getSpecifiedEventManager().setTreeOperations(treeOperation);
            //test
            strategyMgr.getSpecifiedEventManager().EventExample();
            #endregion


            List <Strategy> possibleOperationSystems = settings.getPossibleOperationSystems();
            String          cUserOperationSystemName = possibleOperationSystems[0].userName; // muss dynamisch ermittelt werden
            strategyMgr.setSpecifiedOperationSystem(Settings.strategyUserNameToClassName(cUserOperationSystemName));

            List <Strategy> possibleTrees = settings.getPossibleTrees();
            strategyMgr.setSpecifiedTree(possibleTrees[0].className);



            List <Strategy> possibleFilter  = Settings.getPossibleFilters();
            String          cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden
            strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName));
            //  strategyMgr.getSpecifiedFilter().setStrategyMgr(strategyMgr);

            strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className); // muss dynamisch ermittelt werden
            //if (strategyMgr.getSpecifiedBrailleDisplay() == null)
            {
                Settings settings = new Settings();
                strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className); // muss dynamisch ermittelt werden

                strategyMgr.getSpecifiedBrailleDisplay().setStrategyMgr(strategyMgr);
                strategyMgr.getSpecifiedBrailleDisplay().setGeneratedGrantTrees(grantTree);
                strategyMgr.getSpecifiedBrailleDisplay().setTreeOperation(treeOperation);
                // strategyMgr.getSpecifiedBrailleDisplay().initializedSimulator();
                //strategyMgr.getSpecifiedBrailleDisplay().setActiveAdapter();
                //strategyMgr.getSpecifiedBrailleDisplay().generatedBrailleUi();
            }
            // brailleDisplayStrategy = strategyMgr.getSpecifiedBrailleDisplay();
            //  brailleDisplayStrategy.setStrategyMgr(strategyMgr);

            strategyMgr.setSpecifiedDisplayStrategy(settings.getPosibleDisplayStrategies()[0].className);

            strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className);
            strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTree);
            strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperation);

            strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTree);
            strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation);
            exampleTree       = new ExampleTree(strategyMgr, grantTree, treeOperation);
            exampleInspectGui = new InspectGui(strategyMgr);
            exampleBrailleDis = new ExampleBrailleDis(strategyMgr, grantTree, treeOperation);
            exampleDisplay    = new ExampleDisplayStrategy(strategyMgr);

            guiFunctions = new GuiFunctions(strategyMgr, grantTree, treeOperation);
        }
コード例 #25
0
 private void ClearGui()
 {
     GuiFunctions.ClearPanel(grdMain);
 }
コード例 #26
0
ファイル: BlockSelectMenu.cs プロジェクト: shuidong/galactoid
    public MenuActions draw()
    {
        MenuActions menuAction = MenuActions.none;

        GUI.DrawTexture(backgroundRect, background, ScaleMode.ScaleAndCrop, false, 0);

        GUILayout.BeginArea(backgroundRect);
        GUILayout.BeginVertical();
        GUILayout.Label("Assign blocks to keys 1-9", normalStyle);

        float     slotScale   = slotWidth / 16;
        ArrayList blockStacks = getBlockStacksForSlots();

        {
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(ResourceLookup.getSideButtonTexture(0), slotGuiOptions))
            {
                scrollLeft();
            }

            if (blockStacks.Count == slotPositions)
            {
                GUILayout.FlexibleSpace();
            }

            BlockStack blockStack;
            for (int i = 0; i < blockStacks.Count; i++)
            {
                GUILayout.Box("", slotGuiOptions);
                if (blockStacks[i] == null)
                {
                    break;
                }
                blockStack = (BlockStack)blockStacks[i];
                Rect rect = GUILayoutUtility.GetLastRect();
                GuiFunctions.drawSlotTexture(blockStack.blockTexture, rect.xMin, rect.yMin, slotScale);

                if (Input.GetMouseButtonDown(0) && GuiFunctions.isMouseInGuiRect(rect))
                {
                    mouseDownBlockStack = blockStack;
                }
            }


            GUILayout.FlexibleSpace();

            if (GUILayout.Button(ResourceLookup.getSideButtonTexture(1), slotGuiOptions))
            {
                scrollRight();
            }
            GUILayout.EndHorizontal();
        }

        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            for (int i = 0; i < slotPositions; i++)
            {
                GUILayout.Box((i + 1).ToString(), slotGuiOptions);
                Rect rect = GUILayoutUtility.GetLastRect();
                if (selectedBlockStacks[i] != null)
                {
                    BlockStack blockStack = (BlockStack)selectedBlockStacks[i];
                    GuiFunctions.drawSlotTexture(blockStack.blockTexture, rect.xMin, rect.yMin, slotScale);
                }
                if (Input.GetMouseButtonUp(0) && mouseDownBlockStack != null && GuiFunctions.isMouseInGuiRect(rect))
                {
                    selectedBlockStacks[i] = mouseDownBlockStack;
                    mouseDownBlockStack    = null;
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.EndArea();

        if (mouseDownBlockStack != null)
        {
            GuiFunctions.drawSlotTexture(mouseDownBlockStack.blockTexture, Input.mousePosition.x - slotWidth / 2, Screen.height - Input.mousePosition.y - slotHeight / 2, slotScale);
            if (!Input.GetMouseButton(0) && Event.current.type == EventType.repaint)
            {
                mouseDownBlockStack = null;
            }
        }

        return(menuAction);
    }