コード例 #1
0
 public void Load()
 {
     damnedMaps    = new DamnedMaps(directory);
     damnedObjects = new DamnedObjects(directory);
     damnedSounds  = new DamnedSounds(directory);
     damnedImages  = new DamnedImages(directory, damnedMaps, damnedObjects);
 }
コード例 #2
0
        private void ButtonSelectHighlightedLobbyButtons_Click(object sender, EventArgs e)
        {
            FileDialog dialog = new OpenFileDialog();

            dialog.Filter = "PNG Files (*.png)|*.png";

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }


            Dimensions dimensions = DamnedImages.GetDimensions(dialog.FileName);

            if (dimensions.x != 900 || dimensions.y != 100)
            {
                string imageName = Path.GetFileName(dialog.FileName);
                MessageBox.Show(String.Format("The image \"{0}\" does not have the correct dimensions. Please select another image.", imageName), "Incorrect image dimensions", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (damnedNewStage.lobbyImageButtonHighlightedPath == String.Empty)
            {
                damnedNewStage.count++;
            }

            damnedNewStage.lobbyImageButtonHighlightedPath     = dialog.FileName;
            pictureLobbyButtonHighlightedExample.ImageLocation = dialog.FileName;
            labelSelectedHighlightedButton.Text      = Path.GetFileName(dialog.FileName);
            labelSelectedHighlightedButton.ForeColor = Color.FromArgb(255, 168, 38);
            buttonSelectMapLoadingScreen.Enabled     = true;
        }
コード例 #3
0
 public void Refresh()
 {
     SetDirectories();
     damnedMaps    = new DamnedMaps(directory);
     damnedObjects = new DamnedObjects(directory);
     damnedSounds  = new DamnedSounds(directory);
     damnedImages  = new DamnedImages(directory, damnedMaps, damnedObjects);
 }
コード例 #4
0
    // Loads the variables from a zip file  into the DamnedMappingForm assuming that it is packaged correctly.
    public void Load()
    {
        FileInfo[] info = new DirectoryInfo(tempDirectory).GetFiles("*", SearchOption.AllDirectories);
        objectsCount = 0;

        for (int i = 0; i < info.Length; i++)
        {
            string fileNamePath  = info[i].FullName;
            string fileExtension = Path.GetExtension(fileNamePath);

            if (fileExtension == ".png")
            {
                Dimensions dimensions = DamnedImages.GetDimensions(fileNamePath);

                if (dimensions.x == 300 && dimensions.y == 100)
                {
                    lobbyButtonImagePath = fileNamePath;
                }

                else if (dimensions.x == 900 && dimensions.y == 100)
                {
                    lobbyButtonImageHighlightedPath = fileNamePath;
                }
            }

            else if (fileExtension == ".jpg")
            {
                Dimensions dimensions = DamnedImages.GetDimensions(fileNamePath);

                if (dimensions.x == 1920 && dimensions.y == 1080)
                {
                    loadingImagePath = fileNamePath;
                }
            }


            else if (fileExtension == ".scene")
            {
                scenePath = fileNamePath;
            }

            else if (fileExtension == ".stage")
            {
                stagePath = fileNamePath;
            }


            else if (fileExtension == ".object")
            {
                objectsPath.Add(fileNamePath);
                objectsCount++;
            }
        }
    }
コード例 #5
0
        private void ButtonSelectMapLoadingScreen_Click(object sender, EventArgs e)
        {
            string loadingImage = String.Empty;

            FileDialog dialog = new OpenFileDialog
            {
                Filter = "JPG Files (*.jpg)|*.jpg"
            };

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            loadingImage = dialog.FileName;

            if (Path.GetExtension(loadingImage) != ".jpg")
            {
                MessageBox.Show("You did not pick a jpg file. Please select one that is a .jpg file", "Please select a different file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            Dimensions dimensions = DamnedImages.GetDimensions(loadingImage);

            if (dimensions.x != 1920 || dimensions.y != 1080)
            {
                string imageName = Path.GetFileName(loadingImage);
                MessageBox.Show(String.Format("The image \"{0}\" does not have the correct dimensions. It must be 1920 x 1080. Please select a different one.", imageName), "Incorrect image dimension", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (damnedNewStage.loadingImagePath == String.Empty)
            {
                damnedNewStage.count++;
            }

            damnedNewStage.loadingImagePath = loadingImage;
            buttonAddStageToList.Enabled    = true;
            checkBoxCustomObjects.Enabled   = true;

            if (checkBoxCustomObjects.Checked)
            {
                buttonAddStageToList.Enabled        = false;
                buttonSelectObjectsForStage.Enabled = true;
            }

            labelLoadingScreenImage.Text      = Path.GetFileName(damnedNewStage.loadingImagePath);
            labelLoadingScreenImage.ForeColor = Color.FromArgb(255, 168, 38);
        }
コード例 #6
0
 public DamnedMappingForm(DamnedMaps damnedMaps, DamnedImages damnedImages, DamnedMainForm mainForm)
 {
     InitializeComponent();
     this.mainForm = mainForm;
     this.mainForm.Hide();
     this.damnedMaps        = damnedMaps;
     this.damnedImages      = damnedImages;
     this.tempDirectory     = String.Empty;
     damnedRemoveStage      = new DamnedRemoveStage();
     damnedNewStage         = new DamnedNewStage();
     damnedNewStagesList    = new List <DamnedNewStage>();
     damnedRemoveStagesList = new List <DamnedRemoveStage>();
     RefreshDamnedStagesList();
 }
コード例 #7
0
        private void ButtonSelectLobbyButtonPicture_Click(object sender, EventArgs e)
        {
            string buttonImage = String.Empty;

            FileDialog dialog = new OpenFileDialog
            {
                Filter = ("PNG Files (*.png)|*.png")
            };

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            buttonImage = dialog.FileName;

            if (Path.GetExtension(buttonImage) != ".png")
            {
                MessageBox.Show("You did not pick a png file. Please select one that is a .png file", "Please select a different file", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Dimensions dimensions = DamnedImages.GetDimensions(buttonImage);

            if (dimensions.x != 300 || dimensions.y != 100)
            {
                string imageName = Path.GetFileName(buttonImage);
                MessageBox.Show(String.Format("The image \"{0}\" does not have the correct dimensions. It must be 300 x 100. Please select a different one", imageName), "Incorrect image dimensions", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (damnedNewStage.lobbyImageButtonPath == String.Empty)
            {
                damnedNewStage.count++;
            }

            damnedNewStage.lobbyImageButtonPath           = buttonImage;
            labelLobbyButtonPicture.Text                  = Path.GetFileName(damnedNewStage.lobbyImageButtonPath);
            labelLobbyButtonPicture.ForeColor             = Color.FromArgb(255, 168, 38);
            buttonSelectHighlightedLobbyButtons.Enabled   = true;
            pictureDamnedButtonLobbyPicture.ImageLocation = buttonImage;
        }
コード例 #8
0
    private bool CheckImage(string imagePath)
    {
        string directoryPath = Path.GetDirectoryName(imagePath);
        string directoryName = Path.GetFileName(directoryPath);

        if (directoryName != "GUI" && directoryName != "TerrorImages")
        {
            string imageName = Path.GetFileName(imagePath);
            reasonForFailedCheck = String.Format("Check failed because \"{0}\" does not reside in either the GUI directory or the TerrorImages directory.", imageName);
            return(false);
        }

        string fileExtension = Path.GetExtension(imagePath);

        if (fileExtension == ".png")
        {
            Dimensions dimensions = DamnedImages.GetDimensions(imagePath);

            if (dimensions.x != 300 && dimensions.y != 100 || dimensions.x != 900 && dimensions.y != 100)
            {
                string imageName = Path.GetFileName(imagePath);
                reasonForFailedCheck = String.Format("Check failed because the dimensions for the image \"{0}\" is not 300 X 100 or 900 X 100", imageName);
                return(false);
            }
        }

        else if (fileExtension == ".jpg")
        {
            Dimensions dimensions = DamnedImages.GetDimensions(imagePath);

            if (dimensions.x != 1920 && dimensions.y != 1080)
            {
                string imageName = Path.GetFileName(imagePath);
                reasonForFailedCheck = String.Format("Check failed because the dimensions for the image \"{0}\" is not 1920 X 1080", imageName);
                return(false);
            }
        }

        return(true);
    }