public void OnComboChanged(LevelIndex level, int ComboIndex) { if (ComboChanged != null) { ComboChanged(this, new ComboEventArgs(level, ComboIndex)); } }
public void OnStructureChanged(LevelIndex level) { if (StructureChanged != null) { StructureChanged(this, new LevelEventArgs(level)); } }
public void OnObjectEdited(Control sender, LevelIndex level, ObjectInstance item) { if (ObjectEdited != null) { ObjectEdited(sender, new ScreenObjectEventArgs(level, item)); } }
public void OnPaletteChanged(LevelIndex level) { if (PaletteChanged != null) { PaletteChanged(this, new LevelEventArgs(level)); } }
/// <summary> /// Loads animation data/frames for the specified level. /// </summary> /// <param name="level">The level to load data for</param> /// <param name="lastFrame">The index of the first frame after the current area's frame data, or FF to leave unspecified. If an FF terminator is encountered in frame data, parsing will stop sooner.</param> /// <returns></returns> private static ChrAnimationLevelData LoadAnimationsForLevel(MetroidRom rom, LevelIndex level, int lastFrame) { ChrAnimationLevelData data = new ChrAnimationLevelData(level); // CHR usage table has been repurposed in MMC3 ROMs (hence accessor names don't match usage) data.SprBank0 = rom.ChrUsage.GetSprPage(level); data.SprBank1 = rom.ChrUsage.GetBgLastPage(level); // First frame index int frameIndex = rom.ChrUsage.GetBgFirstPage(level); bool keepGoing = true; while (keepGoing && frameIndex < lastFrame && frameIndex < 0xFF) { ChrAnimationTable loadedAnimation = LoadOneAnimation(rom, level, ref frameIndex); if (loadedAnimation == null) { if (data.Animations.Count == 0) { loadedAnimation = new ChrAnimationTable(); ChrAnimationFrame frame = new ChrAnimationFrame(); frame.FrameTime = 1; loadedAnimation.Frames.Add(frame); } else { return(data); } } data.Animations.Add(loadedAnimation); } return(data); }
/// <summary> /// Convert a <seealso cref="LevelIndex"/> /// into <seealso cref="Visibility.Collapsed"/> or /// <seealso cref="Visibility.Visible"/> /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (null == value) { return(Visibility.Collapsed); } if ((value is LevelIndex) == false) { return(Visibility.Collapsed); } LevelIndex levelIndex = (LevelIndex)value; switch (levelIndex) { case LevelIndex.NONE: case LevelIndex.DEBUG: case LevelIndex.INFO: case LevelIndex.WARN: case LevelIndex.ERROR: case LevelIndex.FATAL: return(Visibility.Visible); default: return(Visibility.Collapsed); } }
JsonObject GetAreaData(LevelIndex i) { switch (i) { case LevelIndex.Brinstar: return(brinstarData); case LevelIndex.Norfair: return(norfairData); case LevelIndex.Tourian: return(tourianData); case LevelIndex.Kraid: return(kraidData); case LevelIndex.Ridley: return(ridleyData); case LevelIndex.None: return(globalData); default: throw new ArgumentException("Invalid level index: " + i.ToString()); } }
public override void LoadLevel(LevelIndex _level, ScenarioIndex _scenario) { if (bIsLoadingLevel == false) { StartCoroutine(FadeAndLoadLevelAfterDelay(_level, _scenario)); } }
private void DrawScreen(int gameX, int gameY, int mapx, int mapY) { // Get currentLevelIndex and screen LevelIndex level = levelMap.GetLevel(gameX, gameY); bool invalidLevel = false; if (level == LevelIndex.None || (levelFilter != LevelIndex.None && level != levelFilter)) { return; ////if(!fillEmptySpots) return; ////if(levelFilter != LevelIndex.None) //// level = levelFilter; ////else //// level = GuessLevel(gameX, gameY); ////if(level == LevelIndex.Tourian) //// level = LevelIndex.Kraid; ////invalidLevel = true; } Level levelData = rom.GetLevel(level); int screenIndex = rom.GetScreenIndex(gameX, gameY); if (screenIndex == 0xFF || invalidLevel) // Blank screen { screenIndex = GetBlankScreenIndex(level); } Screen screen = levelData.Screens[screenIndex]; // Load data into renderer renderer.Level = levelData; renderer.SelectedEnemy = -1; // Apply paletteIndex //screen.ApplyLevelPalette(screenBitmap); // Sprites //renderer.ApplyPalette(screenBitmap, levelMap.GetAltPal(gameX, gameY)); // Backgrounds ScreenEditor.ApplyPalette(levelMap.GetAltPal(gameX, gameY), levelData, screenBitmap, HighlightEffect.Invert); // Render Screen renderer.DefaultPalette = screen.ColorAttributeTable; renderer.Clear(); renderer.SelectedDoor = -1; renderer.DrawScreen(screenIndex); IList <EnemyInstance> enemies = hideEnemies ? null : screen.Enemies; renderer.Render(b, screenBitmap, enemies, screen.Doors, showPhysics); Rectangle source = new Rectangle(0, 0, ScreenWidth, ScreenHeight); Rectangle dest = new Rectangle( mapx * ScreenWidth / scale, mapY * ScreenHeight / scale, ScreenWidth / scale, ScreenHeight / scale); gMap.DrawImage(screenBitmap, dest, source, GraphicsUnit.Pixel); }
private void LoadScreenAsm(BinaryReader reader) { LevelIndex level = LevelIndex.None; int screen = 0; string asm = null; try { level = (LevelIndex)(int)reader.ReadByte(); screen = reader.ReadByte(); asm = reader.ReadString(); } catch (IOException ex) { throw new ProjectLoadException("An error was encountered in the project file.", ex); } try { var levelData = rom.Levels[level]; if (screen < levelData.Screens.Count) { levelData.Screens[screen].ScreenLoadASM = asm; return; } } catch (System.Collections.Generic.KeyNotFoundException ex) { // eat it up // (Invalid level value) } var unused = new UnusedScreenLoadASM(); unused.ASM = asm; unused.Level = level; unused.ScreenIndex = screen; unusedAsm.Add(unused); }
private void DrawLevelPatterns(LevelIndex level) { spritePatterns.Clear(); bgPatterns.Clear(); PatternGroupIndexTable groups = GetLevelPatterns(level); spritePatterns.BeginWrite(); bgPatterns.BeginWrite(); for (int i = 0; i < groups.Count; i++) { PatternGroupOffsets offsets = rom.PatternGroupOffsets[groups[i]]; if (offsets.IsPage0) { spritePatterns.LoadTiles(offsets); } else { bgPatterns.LoadTiles(offsets); } } spritePatterns.EndWrite(); bgPatterns.EndWrite(); ApplyPalette(level); SpritePatternBox.Image = spritePatterns.PatternImage; BackgroundPatternBox.Image = bgPatterns.PatternImage; }
private static ChrAnimationTable LoadOneAnimation(MetroidRom rom, LevelIndex level, ref int frameIndex) { ChrAnimationTable result = new ChrAnimationTable(); if (isTerminator(rom, frameIndex)) { return(null); } bool lastFrame = false; while (!lastFrame) { ChrAnimationFrame?loadedFrame = LoadOneFrame(rom, frameIndex, out lastFrame); // If we fail to load a frame, that means there is an erroneous condition and this animation is invalid. if (loadedFrame == null) { return(null); } result.Frames.Add(loadedFrame.Value); frameIndex++; } return(result); }
private void FindDoors() { for (int y = 0; y < 32; y++) { for (int x = 0; x < 32; x++) { LevelIndex level = map.GetLevel(x, y); if (level != LevelIndex.None) { int screenIndex = rom.GetScreenIndex(x, y); if (screenIndex < rom[level].Screens.Count) { Screen screen = rom.GetLevel(level).Screens[screenIndex]; if (screen.RightDoor != null && (screen.RightDoor.Type == DoorType.Missile || screen.RightDoor.Type == DoorType.TenMissile)) { TreeNode n = new TreeNode("(" + x.ToString("x") + ", " + y.ToString("x") + ")", 10, 10); n.Tag = new datTag(new Point(x, y), 10); DoorNode.Nodes.Add(n); checkedItemCount++; } } } } } }
public Level GetLevel(LevelIndex levelIndex) { switch (levelIndex) { case LevelIndex.None: return(null); case LevelIndex.Bank: return(levelBank); case LevelIndex.BlackMarket: return(levelBlackMarket); case LevelIndex.Harbour: return(levelHarbour); case LevelIndex.Jewlery: return(levelJewlery); case LevelIndex.Market: return(levelMarket); case LevelIndex.Museum: return(levelMuseum); case LevelIndex.Slum: return(levelSlum); default: break; } return(null); }
public void SetLevel(int x, int y, LevelIndex level) { switch (level) { case LevelIndex.Brinstar: SetMapLocationArea(x, y, MapLevel.Brinstar); break; case LevelIndex.Norfair: SetMapLocationArea(x, y, MapLevel.Norfair); break; case LevelIndex.Tourian: SetMapLocationArea(x, y, MapLevel.Tourian); break; case LevelIndex.Kraid: SetMapLocationArea(x, y, MapLevel.Kraid); break; case LevelIndex.Ridley: SetMapLocationArea(x, y, MapLevel.Ridley); break; case LevelIndex.None: SetMapLocationArea(x, y, MapLevel.Blank); break; } }
/// <summary> /// Loads all currentLevelIndex-specific data for a specific currentLevelIndex in a given ROM image /// </summary> /// <param name="rom">The Rom object to load data from</param> /// <param name="currentLevelIndex">The currentLevelIndex to load</param> public Level(MetroidRom rom, LevelIndex level) { this.rom = rom; data = rom.data; this.index = level; Format = rom.Format.CreateLevelFormat(this); this.Bank = rom.Format.Banks[Format.LevelBankIndex]; Bytes = new ByteIndexer(this); PCpu = new PointerIndexer(this); PRom = new PRomIndexer(this); pointers_deprecated = new LevelPointers(rom, this); structures = new StructureCollection(this); screens = new ScreenCollection(this); patternGroups = new PatternGroupIndexTable(this); LoadPatterns(); LoadPalette(); combos = new ComboTable(rom, Format.ComboDataOffset); sprites = Graphic.LevelSprites.GetSprites(level); itemTable_DEPRECATED = new ItemLoader(this, rom); //structures = new StructureCollection(this); altMusic = new AlternateMusicRooms(rom, this); this.Items = new ItemCollection(this); Items.LoadItems(); TilePhysicsTableLocation = Format.GetTilePhysicsTableLocation(); }
/// <summary> /// /// </summary> /// <param name="level"></param> /// <param name="mapLocation"></param> /// <param name="currentSelection">Specifies currently selected item, so selection can be restored /// after reloading screen.</param> internal void LoadScreen(LevelIndex level, Point mapLocation, ItemScreenData currentRoom, ItemInstance currentSelection) { BeginUpdate(); this.selectedItem = currentSelection; this.currentRoom = currentRoom; // Check to see if screen is already loaded if (this.mapLocation != mapLocation) { this.mapLocation = mapLocation; lstItems.BeginUpdate(); lstItems.Items.Clear(); ItemSeeker items; ////if (rom.GetLevel(level).CheckForItemsAt(mapLocation, out items)) { LoadItemsForSelectedScreen(); ////} lstItems.EndUpdate(); } itemValueList.BeginUpdate(); ShowSelectedItem(); itemValueList.EndUpdate(); EndUpdate(); }
private void ReadStream(PhotonStream stream) { LevelIndex state = (LevelIndex)stream.ReceiveNext(); if (state != levelIndex) { if (thiefObject) { if (state == LevelIndex.None) { thiefObject.SetActive(false); // Set it in root node. thiefObject.transform.parent = null; } else { Level obj = m_WorldManager.GetLevel(state); if (obj) { thiefObject.SetActive(true); thiefObject.transform.parent = obj.transform; } } levelIndex = state; } } }
private TreeNode GetNode(LevelIndex levelIndex) { switch (levelIndex) { case LevelIndex.Brinstar: return(dataList.Nodes["Brinstar"]); case LevelIndex.Norfair: return(dataList.Nodes["Norfair"]); case LevelIndex.Tourian: return(dataList.Nodes["Tourian"]); case LevelIndex.Kraid: return(dataList.Nodes["Kraid"]); case LevelIndex.Ridley: return(dataList.Nodes["Ridley"]); case LevelIndex.None: return(DoorNode); } return(null); }
private void MoveSpritePatterns(LevelIndex level) { int patternGroupIndex = LevelSprGroups[(int)level]; var groupData = rom.PatternGroupOffsets[patternGroupIndex]; int dest = LevelSprOffsets[(int)level]; CopyPatternGroup(groupData, dest); }
//----------------------------------------------------------------------- public void DestroyLevelIndexes() { //for ( int i = 0; i < mLevelIndex.Count ; i++ ) //{ // OGRE_DELETE_T(mLevelIndex[i], IndexMap, MEMCATEGORY_GEOMETRY); //} LevelIndex.Clear(); }
/// <summary> /// Constructor. /// </summary> /// <param name="currentLevelIndex"></param> /// <param name="data"></param> /// <param name="offset"></param> public ItemRowEntry(LevelIndex level, MetroidRom rom, int offset, int index) { this.index = index; this.offset = offset; this.data = rom.data; this.level = level; this.rom = rom; }
void Start() { levelManager = GameObject.FindObjectOfType <LevelManager>(); levelIndex = GameObject.FindObjectOfType <LevelIndex>(); levels = GameObject.FindGameObjectsWithTag("LevelBtn"); findMax(); Debug.Log("no. of levels " + levels.Length); }
public void Enqueue(LevelIndex level, int layoutIndex, bool altPal) { if (level == LevelIndex.None || layoutIndex == 0xFF) { return; } queue.Enqueue(new LayoutIndex(level, layoutIndex, altPal)); }
/// <summary> /// Returns a Editroid.Level based on the specified value. /// </summary> /// <param name="currentLevelIndex">The currentLevelIndex to get</param> /// <returns>T Editroid.Level based on the specified value</returns> public Level GetLevel(LevelIndex level) { if (level == LevelIndex.None) { return(Brinstar); } return(levels[level]); }
private void WriteDefaultTilePhysics(MetroidRom r, LevelIndex level) { var tilePhysicsOffset = (int)r.Levels[level].TilePhysicsTableLocation; for (int i = 0; i < 256; i++) { r.data[tilePhysicsOffset + i] = (byte)i; } }
public void Redraw(LevelIndex level, int screenIndex) { screens.Rerender(level, screenIndex, true); if (FocusedEditor != null && (level == LevelIndex.None || (FocusedEditor.LevelIndex == level && (screenIndex == -1 || screenIndex == FocusedEditor.ScreenIndex)))) { UpdateStatus(); } //Invalidate(); }
private IEnumerator LoadLevelImmediateImpl(LevelIndex index, bool fade) { isLoadingLevel = true; List <AsyncOperation> operations = new List <AsyncOperation> { }; if (fade) { // fade out of current level sceneTransition.PlayImmediate("FadeOut"); while (sceneTransition.IsPlaying()) { yield return(null); } } // add unload (current level) operations foreach (var section in gameLevels[index].sections) { try { operations.Add(UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(section.fullPath)); } // ignore ArgumentException when unloading a level section that's not loaded catch (ArgumentException e) /* Scene to unload is invalid */ { continue; // #todo: make sure the exception is "Scene to unload is invalid" } } operations.Add(UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(gameLevels[currentGameLevelIndex].fullPath)); // wait for current level to unload foreach (var operation in operations) { while (!operation.isDone) { yield return(null); } } // load requested level UnityEngine.SceneManagement.SceneManager.LoadScene(gameLevels[index].fullPath, UnityEngine.SceneManagement.LoadSceneMode.Additive); if (fade) { // fade in to new level sceneTransition.PlayImmediate("FadeIn"); while (sceneTransition.IsPlaying()) { yield return(null); } } currentGameLevelIndex = index; isLoadingLevel = false; }
private void ApplyLevelSpritePatterns(ChrBankBuilder builder, LevelIndex levelIndex, bool justinBailey) { ApplyPatternsToBank(builder, ExpandoPatternOffsets.GlobalGameplaySprites); ApplyPatternsToBank(builder, ExpandoPatternOffsets.DigitSprites); if (justinBailey) { ApplyPatternsToBank(builder, ExpandoPatternOffsets.JustinBaileySprites); } ApplyPatternsToBank(builder, ExpandoPatternOffsets.GetSpriteEntry(levelIndex)); }
private void SerializeLevelChrAnimation(ref int frameIndex, LevelIndex index) { // LevelIndex.None = title screen ChrAnimationLevelData data = (index == LevelIndex.None) ? TitleChrAnimationTable : Levels[index].ChrAnimation; // Level's default animation will use next available frame entry ChrUsage.MMC3_SetBgLoopStart(index, (byte)frameIndex); // Write frame data to chr animation table ChrAnimation.SerializeChrAnimation(this, data, ref frameIndex); }
public void LoadLevelFromFile(string filePath, LevelType levelType) { if (this.listLevelIndex != null) { listLevelIndex.Clear(); } TextAsset textAsset = Resources.Load<TextAsset>(filePath); if(textAsset != null) { string[] temp = textAsset.text.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries); for(int i = 1; i < temp.Length; i++)//bo dong dau tien { string[] context = temp[i].Split(new char[] { ';' }, System.StringSplitOptions.RemoveEmptyEntries); LevelIndex levelIndex = new LevelIndex(context, levelType); listLevelIndex.Add(levelIndex); switch(levelType) { case LevelType.NONE: break; case LevelType.PLAYER: listPlayer.Add(levelIndex); break; case LevelType.ENEMY: listEnemy.Add(levelIndex); break; case LevelType.GUN: listGun.Add(levelIndex); break; } } } else { Debug.Log("chua load dc file"); } }