コード例 #1
0
        private void resizeMapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MapResizeWindow window = new MapResizeWindow(ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height);

            if (window.ShowDialog() == DialogResult.OK)
            {
                DiagManager.Instance.LoadMsg = "Resizing Map...";
                DevForm.EnterLoadPhase(GameBase.LoadPhase.Content);

                //TODO: move this into map class
                Grid.LocAction changeOp = (Loc effectLoc) => { ZoneManager.Instance.CurrentMap.Tiles[effectLoc.X][effectLoc.Y].Effect.UpdateTileLoc(effectLoc); };
                Grid.LocAction newOp    = (Loc effectLoc) => { ZoneManager.Instance.CurrentMap.Tiles[effectLoc.X][effectLoc.Y] = new Tile(0, effectLoc); };

                Loc diff = Grid.ResizeJustified <Tile>(ref ZoneManager.Instance.CurrentMap.Tiles, window.MapWidth, window.MapHeight, window.ResizeDir.Reverse(), changeOp, newOp);

                foreach (Character character in ZoneManager.Instance.CurrentMap.IterateCharacters())
                {
                    Loc newLoc = character.CharLoc + diff;
                    if (newLoc.X < 0)
                    {
                        newLoc.X = 0;
                    }
                    else if (newLoc.X >= window.MapWidth)
                    {
                        newLoc.X = window.MapWidth - 1;
                    }
                    if (newLoc.Y < 0)
                    {
                        newLoc.Y = 0;
                    }
                    else if (newLoc.Y >= window.MapHeight)
                    {
                        newLoc.Y = window.MapHeight - 1;
                    }

                    character.CharLoc = newLoc;
                    character.UpdateFrame();
                    ZoneManager.Instance.CurrentMap.UpdateExploration(character);
                }

                DevForm.EnterLoadPhase(GameBase.LoadPhase.Ready);
            }
        }
コード例 #2
0
        private IEnumerator <YieldInstruction> DoLoad(string mapName)
        {
            //take all the necessary steps before and after moving to the map

            DiagManager.Instance.LoadMsg = "Loading Map...";
            DevForm.EnterLoadPhase(GameBase.LoadPhase.Content);

            GameManager.Instance.ForceReady();

            ZoneManager.Instance.CurrentZone.DevLoadMap(mapName);


            ZoneManager.Instance.CurrentMap.EnterMap(DataManager.Instance.Save.ActiveTeam, ZoneManager.Instance.CurrentMap.EntryPoints[0]);

            DungeonScene.Instance.ResetFloor();


            RefreshTitle();
            LoadMapProperties();
            SetupLayerVisibility();
            DevForm.EnterLoadPhase(GameBase.LoadPhase.Ready);

            yield break;
        }