예제 #1
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            RCGame game = RCGame.RatchetAndClank;

            // might need to improve this part
            if (radioButton1.Checked)
            {
                game = RCGame.RatchetAndClank;
            }
            else if (radioButton2.Checked)
            {
                game = RCGame.GoingCommando;
            }
            else if (radioButton3.Checked)
            {
                game = RCGame.UpYourArsenal;
            }
            else if (radioButton4.Checked)
            {
                game = RCGame.Deadlocked;
            }

            if (mapDirTextBox.Text != "")
            {
                main.loadLevelFiles(mapDirTextBox.Text, Path.GetFileName(fileName), game);
                Hide();
            }
            else
            {
                Main.reportError(5);
            }
        }
예제 #2
0
        // Read the file and display it line by line.
        public void getModelNames(RCGame game)
        {
            modelNames = new List <string>();
            string       stringCounter;
            StreamReader stream = null;

            try
            {
                switch (game)
                {
                case RCGame.RatchetAndClank:
                    stream = new StreamReader(Application.StartupPath + "/ModelLists/RC1.txt");
                    Console.WriteLine("Loaded model names for Ratchet & Clank.");
                    break;

                case RCGame.GoingCommando:
                    stream = new StreamReader(Application.StartupPath + "/ModelLists/GC.txt");
                    Console.WriteLine("Loaded model names for Ratchet & Clank: Going Commando.");
                    break;

                case RCGame.UpYourArsenal:
                    stream = new StreamReader(Application.StartupPath + "/ModelLists/UYA.txt");
                    Console.WriteLine("Loaded model names for Ratchet & Clank: Up Your Arsenal.");
                    break;

                case RCGame.Deadlocked:
                    stream = new StreamReader(Application.StartupPath + "/ModelLists/DL.txt");
                    Console.WriteLine("Loaded model names for Ratchet: Deadlocked.");
                    break;
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Model list file not found! No names for you!");
                modelNames = null;
                return;
            }
            while ((stringCounter = stream.ReadLine()) != null)
            {
                modelNames.Add(stringCounter);
            }
            stream.Close();
        }
예제 #3
0
        public void loadLevelFiles(string directory, string fileName, RCGame game)
        {
            //Determine what format we will be working with
            currentGame = game;

            getModelNames(currentGame);

            //Set our working directory, this will be referenced around the entire editor
            workingDirectory           = directory;
            DataStore.workingDirectory = workingDirectory;

            //Identify file with a trailing number, such as skin20.ps3
            string fileNumber = Regex.Match(fileName, @"\d+").Value;

            if (fileNumber == "")
            {
                fileNumber = "-1";
            }
            var regex   = new Regex(Regex.Escape(fileNumber));
            var newText = regex.Replace(fileName, "%d", 1);

            //First we interate through all of the known files in constants
            for (int i = 0; i < Constants.fileNames.GetLength(0); i++)
            {
                if (fileName == Constants.fileNames[i, 0] || regex.Replace(fileName, "%d", 1) == Constants.fileNames[i, 0])
                {
                    for (int subFiles = 0; subFiles < 3; subFiles++)
                    {
                        //catch null files in subfiles object
                        try
                        {
                            if (Constants.fileNames[i, subFiles] != null && File.Exists(directory + "/" + Constants.fileNames[i, subFiles].Replace("%d", fileNumber)))
                            {
                                switch (Constants.fileNames[i, subFiles])
                                {
                                case "engine.ps3":
                                    switch (currentGame)
                                    {
                                    case RCGame.RatchetAndClank:
                                    case RCGame.GoingCommando:
                                    case RCGame.UpYourArsenal:
                                        MapParser_UYA.parseMap(directory, Constants.fileNames[i, subFiles]);
                                        break;

                                    case RCGame.Deadlocked:
                                        MapParser_DL.parseMap(directory, Constants.fileNames[i, subFiles]);
                                        break;
                                    }
                                    break;

                                case "gadgets.ps3":
                                    GadgetsParser.parseGadgets(directory, Constants.fileNames[i, subFiles]);
                                    break;

                                case "mobyload%d.ps3":
                                    MobyParser.parseMoby(directory, Constants.fileNames[i, subFiles].Replace("%d", fileNumber));
                                    break;
                                }
                            }
                            else if (!errorShown && Constants.fileNames[i, subFiles] != null)
                            {
                                reportError(1, Constants.fileNames[i, subFiles]);
                            }
                        }
                        catch (Exception nullFiles)
                        {
                            Console.WriteLine(nullFiles);
                        }
                    }
                    break;
                }
                else
                {
                    if (!errorShown && i >= Constants.fileNames.GetLength(0) - 1)
                    {
                        reportError(0, fileName);
                        break;
                    }
                }
            }

            //Once we are done loading everything, check DataSource and enable our buttons as needed
            texToolStripButton.Enabled = DataStore.textures.Count > 0;
            bool hasModels = (
                DataStore.spawnableModels.Count > 0
                ||
                DataStore.levelModels.Count > 0
                ||
                DataStore.sceneryModels.Count > 0
                );

            modelToolStripButton.Enabled = hasModels;

            objEditTool.Enabled = DataStore.mobs.Count > 0;
        }