Ejemplo n.º 1
0
        public EditLocationsGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            exitButton = NewButton("Back", 0, Exit);

            label = NewLabel("Add:", 8);

            addBoxButton = NewButton("Box", 7, () => AddBox("box"+(locationCount++)));
            addPointButton = NewButton("Point", 6, () => AddPoint("point"+(locationCount++)));
            setEndLocationButton = NewButton("End zone", 10, () => AddBox(endzone));
            setStartLocationButton = NewButton("StartPoint", 11, () => AddPoint(startpoint));

            deleteButton = NewButton("Delete", 4, Delete);

            locationLabel = NewTextBox("Location label", "", 2);

            BoxDescription endzoneDesc = m_editor.Map.locationData.end;
            if (endzoneDesc != null && endzoneDesc.box != null) {
                makeBox(endzoneDesc.name, endzoneDesc.box);
            }
            PointDescription startpointDesc = m_editor.Map.locationData.start;
            if (startpointDesc != null &&  startpointDesc.point != null) {
                makePoint(startpointDesc.name, startpointDesc.point);
            }
            boxes2boxes.Clear();
            foreach (BoxDescription box in m_editor.Map.locationData.boxes) {
                var rBox = makeBox(box.name, box.box);
                boxes2boxes.Add(rBox, box);
            }
            points2points.Clear();
            foreach (PointDescription point in m_editor.Map.locationData.points) {
                var mPoint = makePoint(point.name, point.point);
                points2points.Add(mPoint, point);
            }
        }
Ejemplo n.º 2
0
        public FileGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor)
            : base(_game, _keyboard, _editor)
        {
            saveButton = NewButton("Save", 3, SaveLevel);
            loadButton = NewButton("Load", 4, LoadLevel);
            filenameBox = NewTextBox("Filename", m_editor.filename, 5);

            widthBox = new NumberBox(m_keyboard, new Vector2f(5,2), m_game.Camera);
            widthBox.Position = new Vector2f(1, 4);
            items.Add(widthBox);
            widthMinusButton = new Button(m_keyboard, "-", m_game.Camera);
            widthMinusButton.Position = new Vector2f(1 + widthBox.Size.X + 0.5f, 4);
            items.Add(widthMinusButton);
            widthPlusButton = new Button(m_keyboard, "+", m_game.Camera);
            widthPlusButton.Position = new Vector2f(6.5f + widthMinusButton.Size.X + 0.5f, 4);
            items.Add(widthPlusButton);

            backButton = NewButton("Back", 0, GoBack);
        }
Ejemplo n.º 3
0
        protected TextBox NewTextBox(string label, string text, int pos)
        {
            Text textLabel = new Text(label);
            textLabel.SetHUD(m_game.Camera);
            textLabel.Position = new Vector2f(1, pos*2+3);
            textItems.Add(textLabel);

            TextBox textBox = new TextBox(m_keyboard, new Vector2f(10, 2), m_game.Camera);
            textBox.Position = new Vector2f(1, pos*2+1);
            textBox.Pressed += () => {buttonClicked = true;};
            textBox.SetLabel(textLabel);
            textBox.Text = text;
            items.Add(textBox);

            return textBox;
        }