public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Build")) { chooser = (LevelChooser)target; chooser.Setup(); } }
public void Reset() { if (welcomeSound != null) { welcomeSound.Stop(); } //components.Remove(profil); profil = null; components.Remove(chooser); if (chooser != null) { chooser.Dispose(); } chooser = null; components.Remove(intro); if (intro != null) { intro.Dispose(); } intro = null; components.Remove(credits); if (credits != null) { credits.Dispose(); } credits = null; components.Remove(menu); menu = null; components.Remove(level); level = null; components.Remove(hud); hud = null; components.Remove(console); console = null; components.Clear(); if (game.World != null) { //components.Remove(game.World); game.World.Dispose(); game.World = null; } /* * if (score != null) * { * score.Reset(); * } * score = null;*/ Material.ClearSharedPool(); }
private void fileTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag is Directory) { e.Node.Expand(); return; } File f = e.Node.Tag as File; String filename = f.name; filename = filename.ToLowerInvariant(); try { if (filename == "banner.bin") { LevelChooser.showImgMgr(); File imgFile = new InlineFile(f, 0x20, 0x200, f.name); File palFile = new InlineFile(f, 0x220, 0x20, f.name); LevelChooser.imgMgr.m.addImage(new Image2D(imgFile, 32, true, false)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".enpg")) { LevelChooser.showImgMgr(); LZFile fileLz = new LZFile(f, LZFile.CompressionType.LZ); File imgFile = new InlineFile(fileLz, 0, 0x10000, f.name); File palFile = new InlineFile(fileLz, 0x10000, 0x200, f.name); LevelChooser.imgMgr.m.addImage(new EnpgImage2D(imgFile)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } else if (filename.EndsWith(".bncd")) { new Bncd(f); } if (filename.EndsWith(".nsbtx") || filename.EndsWith(".nsbmd")) { new NSBTX(f); } else if (filename.EndsWith(".nscr") || filename.EndsWith(".ncgr") || filename.EndsWith(".nclr")) { SectionFileLoader.load(f); } else if (filename.EndsWith(".narc")) { new FilesystemBrowserDialog(new NarcFilesystem(f)).Show(); } else if (filename.EndsWith(".carc")) { new FilesystemBrowserDialog(new NarcFilesystem(f, true)).Show(); } else if (filename.Contains("_ncl.bin")) { new PaletteViewer(new LZFile(f, LZFile.CompressionType.MaybeLZ)).Show(); } else if (filename.Contains("_nsc.bin")) { if (LevelChooser.imgMgr == null) { return; } Image2D img = LevelChooser.imgMgr.m.getSelectedImage(); Palette[] pals = LevelChooser.imgMgr.m.getPalettes(); if (img == null) { return; } if (pals == null) { return; } if (pals.Length == 0) { return; } Tilemap t = new Tilemap(f, 32, img, pals, 0, 0); new TilemapEditorWindow(t).Show(); } else if (filename.Contains("_ncg.bin")) { LevelChooser.showImgMgr(); LevelChooser.imgMgr.m.addImage(new Image2D(f, 256, false)); } } catch (AlreadyEditingException ex) { MessageBox.Show(this, (LanguageManager.Get("Errors", "File"))); } }
private void fileTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag is Directory) { e.Node.Expand(); return; } File f = e.Node.Tag as File; try { if (!(f.id < 0)) { f = new CompressedFile(f, CompressedFile.CompressionType.MaybeCompressed); } switch (getFileTypeForFile(f)) { case "BANNER": { LevelChooser.showImgMgr(); File imgFile = new InlineFile(f, 0x20, 0x200, f.name); File palFile = new InlineFile(f, 0x220, 0x20, f.name); LevelChooser.imgMgr.m.addImage(new Image2D(imgFile, 32, true)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } break; case "ENPG": { LevelChooser.showImgMgr(); File imgFile = new InlineFile(f, 0, 0x10000, f.name); File palFile = new InlineFile(f, 0x10000, 0x200, f.name); LevelChooser.imgMgr.m.addImage(new EnpgImage2D(imgFile)); LevelChooser.imgMgr.m.addPalette(new FilePalette(palFile)); } break; case "BNCD": { DialogResult result = MessageBox.Show("Is this a 256 colors BNCD?\n(No by default, Yes if using the 256 worldmap icons ASM hack)", LanguageManager.Get("General", "Question"), MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { new Bncd256(f); } else if (result == DialogResult.No) { new Bncd(f); } } break; case "BTX0": case "BMD0": { new NSBTX(f); } break; case "NSCR": case "NCGR": case "NCLR": { SectionFileLoader.load(f); } break; case "NARC": { //CARC is just the LZ compressed form of the NARC and because //NSMBe can now detect the LZ form it won't be needed anymore new FilesystemBrowserDialog(new NarcFilesystem(f)).Show(); } break; case "NCL": { new PaletteViewer(f).Show(); } break; case "NSC": { if (LevelChooser.imgMgr != null) { Image2D img = LevelChooser.imgMgr.m.getSelectedImage(); Palette[] pals = LevelChooser.imgMgr.m.getPalettes(); if (img != null && pals != null && pals.Length > 0) { NSCPrompt nscPrompt = new NSCPrompt(f.getContents().Length); if (!nscPrompt.canceled) { Tilemap t = new Tilemap(f, nscPrompt.tileWidth, img, pals, nscPrompt.imgOffs, nscPrompt.palOffs); new TilemapEditorWindow(t).Show(); } break; } } MessageBox.Show("Please make sure you have at least a bitmap and a palette opened in the 2D Viewer before opening an NSC file.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case "NCG": { LevelChooser.showImgMgr(); LevelChooser.imgMgr.m.addImage(new Image2D(f, 256, false)); } break; case "BNBL": { new BNBL(f); } break; case "BNCL": { new BNCL(f); } break; } } catch (AlreadyEditingException ex) { MessageBox.Show(this, (LanguageManager.Get("Errors", "File"))); } }
// Use this for initialization public void Setup(LevelChooser _ch, DirectionList _direc) { chooser = _ch; direction = _direc; _spr = GetComponentInChildren<OTSprite>(); }
public void SetStateLevelChoose() { Reset(); level = new LevelChooser(game); components.Add(level); }
void Awake() { Screen.SetResolution(1366,768, false); name = "TitleMenu"; base.Setup(); SETUP = Resources.Load ("Tuning/GameSetup") as GameSetup; Chooser = FETool.findWithinChildren(gameObject, "LevelChooser").GetComponent<LevelChooser>(); SETUP.startTranslate(SETUP.ChosenLanguage); SETUP.translateSceneText(); levelInformations = new List<LevelInfo> (); if (GameObject.Find("Frameworks") == null) { GameObject fmObj = Instantiate(Resources.Load("Presets/Frameworks")) as GameObject; fmObj.name = "Frameworks"; } Chooser.Setup (); awayPlace = FETool.findWithinChildren(gameObject, "AwayPlace"); frontPlace = FETool.findWithinChildren(gameObject, "FrontPlace"); Credits = FETool.findWithinChildren(gameObject, "Credits").GetComponent<SubMenu>(); Landing = FETool.findWithinChildren(gameObject, "Landing").GetComponent<SubMenu>(); LevelChooser = FETool.findWithinChildren(gameObject, "LevelChooser").GetComponent<SubMenu>(); Options = FETool.findWithinChildren(gameObject, "Options").GetComponent<SubMenu>(); versionDisplay = FETool.findWithinChildren(gameObject, "Landing/Underpanel/GAME_VERSION").GetComponent<TextUI>(); SubMenu[] subMn = GetComponentsInChildren<SubMenu>(); foreach (SubMenu sub in subMn) { sub.SetupSub(this); sub.setupBtn(); } if (Input.GetJoystickNames().Length > 0) { padEntered = true; changeState(MenuStates.Start); } versionDisplay.TranslateThis(); InvokeRepeating("checkPadMenu", 0f, 0.5f); TranslateAllInScene(); versionDisplay.text += SETUP.gameversion; GameEventManager.TriggerGameStart("MainTitle"); // StartCoroutine("DelayMusic"); }