private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { var temp = listBox1.SelectedItem as NPCMoveToCommand; numericUpDown1.Value = (decimal)(listBox1.SelectedItem as NPCMoveToCommand).speed; textBox1.Text = temp.commandName; richTextBox1.Text = temp.commandDescription; numericUpDown2.Value = temp.tickStart; numericUpDown3.Value = temp.tickStop; if (temp.GetType() == typeof(NPCMoveToCommand)) { tabControl1.SelectedIndex = 0; } else if (temp.GetType() == typeof(NPCChangeMap)) { var temp2 = listBox1.SelectedItem as NPCChangeMap; tabControl1.SelectedIndex = 1; listBox3.DataSource = null; listBox3.DataSource = BasicMap.allMapsGame(); if (BasicMap.allMapsGame().Find(m => m.identifier == temp2.MapToMoveToID) != null) { listBox3.SelectedIndex = BasicMap.allMapsGame().IndexOf(BasicMap.allMapsGame().Find(m => m.identifier == temp2.MapToMoveToID)); } else { temp2.MapToMoveToID = MapBuilder.loadedMap.identifier; listBox3.SelectedIndex = BasicMap.allMapsGame().IndexOf(BasicMap.allMapsGame().Find(m => m.identifier == temp2.MapToMoveToID)); } } } if (MapBuilder.controls.currentType == Scenes.Editor.MapEditorSub.MapEditorControls.controlType.TileSelect) { MapBuilder.controls.currentType = MapBuilder.controls.previousType; } }
public void DataBaseReload(GameContentDataBase gcdb) { try { //baseCharacter = gcdb.gameCharacters.Find(gc => gc.shapeID == baseCharacterSourceID).Clone(); baseCharacter = infoHolder.Reload(gcdb) as BaseCharacter; baseCharacter.fromMap = BasicMap.allMapsGame().Find(map => map.identifier == mapPlacedID); baseCharacter.currentMapToDisplayOn = BasicMap.allMapsGame().Find(map => map.identifier == mapActiveID); if (baseCharacter.spriteGameSize.Size == new Point(0)) { baseCharacter.spriteGameSize.Size = new Point(64); } foreach (var item in npcCommands) { item.script = gcdb.gameScripts.Find(s => s.identifier == item.scriptIdentifier); } // baseCharacter.changePosition(NPCArea[0].positionGrid * 64); } finally { } }
private void button6_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { var temp = listBox1.SelectedItem; if (temp.GetType() == typeof(NPCMoveToCommand)) { MapBuilder.controls.startTileSelect(AssignDestinationFromSelectedTile); } else if (temp.GetType() == typeof(NPCChangeMap)) { var temp2 = listBox1.SelectedItem as NPCChangeMap; if (temp2.MapToMoveToID == temp2.mapID) { MessageBox.Show("Please, first select a valid map to move to."); goto Skip; } MapBuilder.ReloadActiveMap(BasicMap.allMapsGame().Find(map => map.identifier == temp2.MapToMoveToID)); MapBuilder.controls.startTileSelect(AssignDestinationFromSelectedTile); Skip : { } } } }
public override void Execute() { base.Execute(); if (parentObject.baseCharacter.fromMap == null) { parentObject.baseCharacter.fromMap = BasicMap.allMapsGame().Find(m => m.identifier == parentObject.mapPlacedID); if (parentObject.mapPlacedID == 0) { parentObject.baseCharacter.fromMap = GameProcessor.parentMap; } } else { parentObject.baseCharacter.fromMap = GameProcessor.parentMap.subMaps.Find(m => m.identifier == mapID); } if (MapToMoveToID == 0) { parentObject.baseCharacter.currentMapToDisplayOn = parentObject.baseCharacter.fromMap; } else { parentObject.baseCharacter.currentMapToDisplayOn = GameProcessor.parentMap.subMaps.Find(m => m.identifier == MapToMoveToID); } bCompletedCommand = true; if (parentObject.baseCharacter.currentMapToDisplayOn == GameProcessor.loadedMap && parentObject.baseCharacter.currentMapToDisplayOn != parentObject.baseCharacter.fromMap) { MapObjectHelpClass.objectFromOutsideOnThisMap.Add(parentObject); } else if (parentObject.baseCharacter.currentMapToDisplayOn == parentObject.baseCharacter.fromMap) { MapObjectHelpClass.objectFromOutsideOnThisMap.Remove(parentObject); } }