private void OnErase(MenuPageEventArgs e)
        {
            _eraseButton.Disable();

            _file0Button.ResetEventHandlers();
            _file1Button.ResetEventHandlers();
            _file2Button.ResetEventHandlers();
            _file0Button.OnSelected += OnEraseFile;
            _file1Button.OnSelected += OnEraseFile;
            _file2Button.OnSelected += OnEraseFile;
            _file0Button.Args        = new OpenDialogEventArgs();
            _file1Button.Args        = new OpenDialogEventArgs();
            _file2Button.Args        = new OpenDialogEventArgs();
            _file0Button.OnSelected += RaiseOpenDialogEvent;
            _file1Button.OnSelected += RaiseOpenDialogEvent;
            _file2Button.OnSelected += RaiseOpenDialogEvent;

            HighlightFileBasedOnIndex();
        }
Beispiel #2
0
        protected void SetupButons(int layerIndex)
        {
            RelativeRect rect = new RelativeRect(RelativeLoc.XLeftBorder + RelativeLoc.BorderOffset, RelativeLoc.YLowerBorder + RelativeLoc.BorderOffset, ButtonWidth, RelativeSize.HalfHeight, OriginLocation.LowerLeft);

            Columns[0] = new VerticalLayoutGroup(rect);
            Columns[0].ChildSpacing    = 5;
            Columns[0].MaxChildSize    = 45;
            Columns[0].TopDown         = false;
            Columns[0].FitChildToWidth = true;

            MenuButton quit = new MenuButton(new RelativeRect(), MenuRes.Quit);

            quit.Clicked += Quit_Clicked;
            Columns[0].AddChild(quit);

            MenuButton options = new MenuButton(new RelativeRect(), MenuRes.Options);

            options.Clicked += Options_Clicked;
            Columns[0].AddChild(options);

            MenuButton startClient = new MenuButton(new RelativeRect(), MenuRes.StartClient);

            startClient.Clicked += StartClient_Clicked;
            Columns[0].AddChild(startClient);

            MenuButton startServer = new MenuButton(new RelativeRect(), MenuRes.StartServer);

            startServer.Clicked += StartServer_Clicked;
            Columns[0].AddChild(startServer);

            AddElement(Columns[0], layerIndex);

            // column 2 buttons
            rect = new RelativeRect(RelativeLoc.XLeftBorder + (RelativeLoc.BorderOffset * 2 + ButtonWidth.Paramater), RelativeLoc.YLowerBorder + RelativeLoc.BorderOffset, ButtonWidth, RelativeSize.HalfHeight, OriginLocation.LowerLeft);

            Columns[1] = new VerticalLayoutGroup(rect);
            Columns[1].ChildSpacing    = ButtonSpacing.Paramater;
            Columns[1].MaxChildSize    = ButtonHeight.Paramater;
            Columns[1].TopDown         = false;
            Columns[1].FitChildToWidth = true;

            MenuButton tutorials = new MenuButton(new RelativeRect(), MenuRes.Tutorials);

            tutorials.Clicked += Tutorials_Clicked;
            tutorials.Disable();
            Columns[1].AddChild(tutorials);
            AddElement(Columns[1], layerIndex);
        }