public override void OnDetached() { base.OnDetached(); var viewModel = Bot.GetViewModel(); viewModel.RemoveDocument(View); if (m_deletionDialog != null && m_deletionDialog.Visibility == Visibility.Visible) { View.Dispatcher.Invoke(new Action(m_deletionDialog.Close)); m_deletionDialog = null; } if (m_characterCreationDialog != null && m_characterCreationDialog.Visibility == Visibility.Visible) { View.Dispatcher.Invoke(new Action(m_characterCreationDialog.Close)); m_characterCreationDialog = null; } }
private void OnCreateCharacter(object parameter) { if (m_characterCreationDialog != null && m_characterCreationDialog.Visibility == Visibility.Visible) { m_characterCreationDialog.Close(); } m_characterCreationDialog = new CharacterCreationDialog(); if (m_characterCreationData != null) { m_characterCreationDialog.Data = m_characterCreationData; } else { m_characterCreationDialog.Data.EnabledBreeds = Bot.ClientInformations.AvailableBreeds; m_characterCreationData = m_characterCreationDialog.Data; } if (m_characterCreationDialog.ShowDialog() == true) { if (m_heads == null) { m_heads = ObjectDataManager.Instance.EnumerateObjects <Head>().ToArray(); } int[] colors = new int[5]; colors[0] = m_characterCreationData.Color1Used ? ColorToInt(m_characterCreationData.Color1) : -1; colors[1] = m_characterCreationData.Color2Used ? ColorToInt(m_characterCreationData.Color2) : -1; colors[2] = m_characterCreationData.Color3Used ? ColorToInt(m_characterCreationData.Color3) : -1; colors[3] = m_characterCreationData.Color4Used ? ColorToInt(m_characterCreationData.Color4) : -1; colors[4] = m_characterCreationData.Color5Used ? ColorToInt(m_characterCreationData.Color5) : -1; Bot.SendToServer(new CharacterCreationRequestMessage(m_characterCreationData.CharacterName, (sbyte)m_characterCreationData.Breed, m_characterCreationData.Sex == SexTypeEnum.SEX_FEMALE, colors, m_heads.First(x => x.breed == (uint)m_characterCreationData.Breed && x.gender == (int)m_characterCreationData.Sex).id)); } }