private async Task BuildIndexAsync(bool skipItemTypesReload = false) { SetStatusbarText("Loading characters and items..."); IndexSummary result; var newIndex = new Index(); result = await newIndex.BuildAsync(GrimDawnDirectory, GrimDawnSavesDirectory, _loadedSettings.KeepExtractedDBFiles, false, (msg) => SetStatusbarText(msg)).ConfigureAwait(false); _index = newIndex; if (!skipItemTypesReload) { Dispatcher.Invoke((Action)(() => { var itemQualities = new ObservableCollection <MultiselectComboItem>(); itemQualities.AddRange(result.ItemRarities.Select(x => new MultiselectComboItem() { Selected = (x != "Common" && x != "Rare" && x != "Magical"), Value = x, DisplayText = x })); ItemQualities = itemQualities; ItemTypes.Clear(); ItemTypes.AddRange(result.ItemTypes.Select(x => new MultiselectComboItem() { Selected = true, Value = x, DisplayText = ItemHelper.GetItemTypeDisplayName(x) })); AllCharacters.Clear(); AllCharacters.Add("(select character)"); AllCharacters.AddRange(result.Characters); })); } }
private void CreateCharacterJson() { string[] pics = Directory.GetFiles(WorkDirEtcPic); int count = pics.Length; ObservableCollection <Character> c = new ObservableCollection <Character>(); foreach (string pic in pics) { string nameWithScore = Path.GetFileName(pic); nameWithScore = nameWithScore.Replace(".png", ""); Character character = new Character(nameWithScore); try { AllCharacters.Add(character); } catch // catch fires when the program starts { c.Add(character); AllCharacters = c; } count--; } new CharacterJson(WorkDirEtc, AllCharacters); }
void Awake() { if (AllCharacters == null) { AllCharacters = new List <Character>(); } AllCharacters.Add(this); GetAnimation(); GetMotionMachine(); GetMotionCommander(); GetMotionCrossfader(); OnChAwake(); }
private void LoadCharacters() { foreach (Character c in CharacterJson.GetCharactersFromJson()) { try { AllCharacters.Add(c); } catch // catch fires when the program starts { ObservableCollection <Character> characters = new ObservableCollection <Character>(); characters.Add(c); AllCharacters = characters; } } }