public EncounterBuilder(Module m, ParentForm p) { InitializeComponent(); mod = m; prntForm = p; createTileImageButtons(); surface = new Bitmap(mSizeW, mSizeH); panelView.BackgroundImage = surface; device = Graphics.FromImage(surface); g_walkPass = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\walk_pass.png"); g_walkBlock = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\walk_block.png"); g_LoSBlock = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\los_block.png"); if (prntForm.encountersList.Count < 1) { Encounter newEnc = new Encounter(); newEnc.SetAllToGrass(); prntForm.encountersList.Add(newEnc); } refreshMap(); refreshListBoxEncounters(); refreshListBoxCreatures(); refreshCmbItems(); refreshLbxItems(); refreshGoldDrop(); }
private void btnAddEncounter_Click_1(object sender, EventArgs e) { Encounter newEncounter = new Encounter(); newEncounter.encounterName = "new encounter"; newEncounter.SetAllToGrass(); //newEncounter.passRefs(prntForm.game, prntForm); prntForm.encountersList.Add(newEncounter); refreshListBoxEncounters(); // should I create a new file at this point? }
private void btnDuplicate_Click(object sender, EventArgs e) { if ((lbxEncounters.Items.Count > 0) && (lbxEncounters.SelectedIndex >= 0)) { try { Encounter newEncounter = new Encounter(); newEncounter = prntForm.encountersList[prntForm._selectedLbxEncounterIndex].DeepCopy(); newEncounter.encounterName = prntForm.encountersList[prntForm._selectedLbxEncounterIndex].encounterName + "-Copy"; //newEncounter.passRefs(prntForm.game, prntForm); prntForm.encountersList.Add(newEncounter); refreshListBoxEncounters(); } catch { } } }
public EncounterEditor(Module m, ParentForm p) { InitializeComponent(); mod = m; prntForm = p; thisEnc = prntForm.encountersList[prntForm._selectedLbxEncounterIndex]; createTileImageButtons(); surface = new Bitmap(mSizeW, mSizeH); panelView.BackgroundImage = surface; device = Graphics.FromImage(surface); try { g_walkPass = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\walk_pass.png"); g_walkBlock = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\walk_block.png"); g_LoSBlock = new Bitmap(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\graphics\\los_block.png"); } catch (Exception ex) { MessageBox.Show("failed to load walkPass and walkBlock bitmaps: " + ex.ToString()); } refreshCmbItems(); refreshLbxItems(); refreshGoldDrop(); }
public Encounter DeepCopy() { Encounter copy = new Encounter(); copy = (Encounter)this.MemberwiseClone(); copy.encounterTiles = new List <TileEnc>(); foreach (TileEnc s in this.encounterTiles) { TileEnc newTileEnc = new TileEnc(); newTileEnc.Layer1Filename = s.Layer1Filename; newTileEnc.Layer2Filename = s.Layer2Filename; newTileEnc.Layer3Filename = s.Layer3Filename; newTileEnc.LoSBlocked = s.LoSBlocked; newTileEnc.Walkable = s.Walkable; copy.encounterTiles.Add(newTileEnc); } copy.encounterCreatureRefsList = new List <CreatureRefs>(); foreach (CreatureRefs s in this.encounterCreatureRefsList) { CreatureRefs newCrtRef = new CreatureRefs(); newCrtRef.creatureResRef = s.creatureResRef; newCrtRef.creatureTag = s.creatureTag; newCrtRef.creatureStartLocationX = s.creatureStartLocationX; newCrtRef.creatureStartLocationY = s.creatureStartLocationY; copy.encounterCreatureRefsList.Add(newCrtRef); } copy.encounterCreatureList = new List <string>(); foreach (string s in this.encounterCreatureList) { copy.encounterCreatureList.Add(s); } copy.Triggers = new List <Trigger>(); foreach (Trigger t in this.Triggers) { copy.Triggers.Add(t); } copy.propsList = new List <Prop>(); foreach (Prop p in this.propsList) { copy.propsList.Add(p); } copy.encounterInventoryRefsList = new List <ItemRefs>(); foreach (ItemRefs s in this.encounterInventoryRefsList) { ItemRefs newItRef = new ItemRefs(); newItRef = s.DeepCopy(); copy.encounterInventoryRefsList.Add(newItRef); } copy.encounterPcStartLocations = new List <Coordinate>(); foreach (Coordinate s in this.encounterPcStartLocations) { Coordinate newCoor = new Coordinate(); newCoor.X = s.X; newCoor.Y = s.Y; copy.encounterPcStartLocations.Add(newCoor); } return(copy); }
/*private void openLevel(string g_dir, string g_fil, string g_filNoEx) { this.Cursor = Cursors.WaitCursor; try { area = area.loadAreaFile(g_dir + "\\" + g_fil + ".lvl"); if (area == null) { MessageBox.Show("returned a null area"); } loadAreaObjectBitmapLists(); } catch (Exception ex) { MessageBox.Show("failed to open file: " + ex.ToString()); } refreshLeftPanelInfo(); panelView.Width = area.MapSizeX * sqr; panelView.Height = area.MapSizeY * sqr; panelView.BackgroundImage = (Image)surface; device = Graphics.FromImage(surface); if (surface == null) { MessageBox.Show("returned a null Map bitmap"); return; } refreshMap(true); this.Cursor = Cursors.Arrow; }*/ private void createNewArea(int width, int height) { //create tilemap thisEnc = null; thisEnc = new Encounter(); thisEnc.MapSizeX = width; thisEnc.MapSizeY = height; for (int index = 0; index < (width * height); index++) { TileEnc newTile = new TileEnc(); newTile.Walkable = true; newTile.LoSBlocked = false; thisEnc.encounterTiles.Add(newTile); } refreshLeftPanelInfo(); panelView.Width = thisEnc.MapSizeX * sqr; panelView.Height = thisEnc.MapSizeY * sqr; panelView.BackgroundImage = (Image)surface; device = Graphics.FromImage(surface); if (surface == null) { MessageBox.Show("returned a null Map bitmap"); return; } refreshMap(true); }
public Encounter DeepCopy() { Encounter copy = new Encounter(); copy = (Encounter)this.MemberwiseClone(); copy.encounterTiles = new List<TileEnc>(); foreach (TileEnc s in this.encounterTiles) { TileEnc newTileEnc = new TileEnc(); newTileEnc.Layer1Filename = s.Layer1Filename; newTileEnc.Layer2Filename = s.Layer2Filename; newTileEnc.LoSBlocked = s.LoSBlocked; newTileEnc.Walkable = s.Walkable; copy.encounterTiles.Add(newTileEnc); } copy.encounterCreatureRefsList = new List<CreatureRefs>(); foreach (CreatureRefs s in this.encounterCreatureRefsList) { CreatureRefs newCrtRef = new CreatureRefs(); newCrtRef.creatureResRef = s.creatureResRef; newCrtRef.creatureTag = s.creatureTag; newCrtRef.creatureStartLocationX = s.creatureStartLocationX; newCrtRef.creatureStartLocationY = s.creatureStartLocationY; copy.encounterCreatureRefsList.Add(newCrtRef); } copy.encounterCreatureList = new List<string>(); foreach (string s in this.encounterCreatureList) { copy.encounterCreatureList.Add(s); } copy.encounterInventoryRefsList = new List<ItemRefs>(); foreach (ItemRefs s in this.encounterInventoryRefsList) { ItemRefs newItRef = new ItemRefs(); newItRef = s.DeepCopy(); copy.encounterInventoryRefsList.Add(newItRef); } copy.encounterPcStartLocations = new List<Coordinate>(); foreach (Coordinate s in this.encounterPcStartLocations) { Coordinate newCoor = new Coordinate(); newCoor.X = s.X; newCoor.Y = s.Y; copy.encounterPcStartLocations.Add(newCoor); } return copy; }