public StartDialogueDialog(Form parentForm, Project project) { _parentForm = parentForm; _project = project; this.btnOk.Click += BtnOk_Click; InitializeComponent(); this.cmbDialogue.Items.Clear(); this.cmbDialogue.Items.Add("None"); foreach (var dialogueFile in project.DialogueFiles) { var item = new DarkComboItem(Path.GetFileNameWithoutExtension(dialogueFile.Name)) { Tag = dialogueFile }; this.cmbDialogue.Items.Add(item); } this.cmbDialogue.SelectedIndex = 0; }
public void Initalize() { _npc = _project.LoadNPC(this.ContentFile.FullName); if (_npc == null) { base.Close(); DarkMessageBox.ShowError("Error loading npc!", "Error!"); return; } this.txtName.Text = _npc.Name; this.txtStr.Text = _npc.Stats.Strength.ToString(); this.txtInt.Text = _npc.Stats.Intelligence.ToString(); this.txtDef.Text = _npc.Stats.Defense.ToString(); this.txtHealth.Text = _npc.Stats.Vitality.ToString(); this.txtDex.Text = _npc.Stats.Dexterity.ToString(); this.txtFrameWidth.Text = _npc.FrameSize.X.ToString(); this.txtFrameHeight.Text = _npc.FrameSize.Y.ToString(); this.txtColLeft.Text = _npc.CollisionBounds.X.ToString(); this.txtColTop.Text = _npc.CollisionBounds.Y.ToString(); this.txtColWidth.Text = _npc.CollisionBounds.Width.ToString(); this.txtColHeight.Text = _npc.CollisionBounds.Height.ToString(); this.txtMaxRoam.Text = _npc.MaxRoam.X.ToString(); this.txtSpeed.Text = _npc.Speed.ToString(); this.txtAggressiveRange.Text = _npc.AggresiveRange.ToString(); this.txtReachX.Text = _npc.Reach.X.ToString(); this.txtReachY.Text = _npc.Reach.Y.ToString(); this.cmbEquipSlot.DataSource = Enum.GetValues(typeof(EquipmentSlots)); this.cmbEquipSlot.SelectedItem = EquipmentSlots.MainArm; this.cmbDialogue.Items.Add("None"); foreach (var dialogue in _project.DialogueFiles) { var comboItem = new DarkComboItem(Path.GetFileNameWithoutExtension(dialogue.Name)) { Tag = dialogue }; this.cmbDialogue.Items.Add(comboItem); } if (!string.IsNullOrEmpty(_npc.Dialogue) && this.cmbDialogue.Items.Contains(_npc.Dialogue)) { this.cmbDialogue.SelectedItem = Path.GetFileNameWithoutExtension(_npc.Dialogue); _selectedDialogue = _project.LoadDialogue((((DarkComboItem)this.cmbDialogue.SelectedItem).Tag as FileInfo).FullName); _npc.Dialogue = _selectedDialogue.Name; this.cmbDialogueBranch.Items.Add("None"); foreach (var branch in _selectedDialogue.Branches) { this.cmbDialogueBranch.Items.Add(branch.Name); } if (this.cmbDialogueBranch.Items.Contains(_npc.DialogueBranch)) { this.cmbDialogueBranch.SelectedItem = _npc.DialogueBranch; } else { this.cmbDialogueBranch.SelectedItem = "None"; } this.cmbDialogueBranch.Enabled = true; this.cmbDialogueBranch.Enabled = true; } else { this.cmbDialogue.SelectedItem = "None"; this.cmbDialogueBranch.Enabled = false; } this.UpdateCustomVariablesView(); if (File.Exists(_project.ClientRootDirectory + "/" + _npc.TexturePath)) { this.picSpriteSheet.Load(_project.ClientRootDirectory + "/" + _npc.TexturePath); this.picCollisionPreview.Load(_project.ClientRootDirectory + "/" + _npc.TexturePath); if (_npc.FrameSize == Vector.Zero) { _npc.FrameSize = new Vector(this.picSpriteSheet.Image.Width, this.picSpriteSheet.Image.Height); } this.txtFrameWidth.Text = _npc.FrameSize.X.ToString(); this.txtFrameHeight.Text = _npc.FrameSize.Y.ToString(); } else if (!string.IsNullOrEmpty(_npc.TexturePath)) { DarkMessageBox.ShowError($"Cannot load sprite sheet image {_npc.TexturePath}, the file does not exist!", "Error!", DarkDialogButton.Ok); } _unsaved = true; }