Ejemplo n.º 1
0
        private void SelectEnemySoldierCharacter()
        {
            ModuleLogger.Log("SelectPlayerCharacter");
            var p = new CharacterSelectionParams {
                characters    = this._allCharacters,
                selectedIndex = this._allCharacters.IndexOf(this.EnemySoldierCharacter),
                setCharacter  = (c => EnemySoldierCharacter = c),
            };

            TaleWorlds.Engine.Screens.ScreenManager.PushScreen(new CharacterSelectionScreen(p));
        }
        public CharacterSelectionVM(CharacterSelectionParams p)
            : base()
        {
            ModuleLogger.Log("begin character selection vm construction");
            this._params       = p;
            this.allCharacters = new SortedDictionary <string, SortedDictionary <string, List <CharacterInfo> > >();
            foreach (var c1 in p.characters)
            {
                if (!this.allCharacters.ContainsKey(c1.culture))
                {
                    this.allCharacters.Add(c1.culture, new SortedDictionary <string, List <CharacterInfo> >());
                }
                var cultureDict = this.allCharacters[c1.culture];
                if (!cultureDict.ContainsKey(c1.defaultGroup))
                {
                    cultureDict.Add(c1.defaultGroup, new List <CharacterInfo>());
                }
                cultureDict[c1.defaultGroup].Add(c1);
            }
            var c = p.characters[p.selectedIndex];

            Cultures = new MBBindingList <NameVM>();
            foreach (var culture in this.allCharacters.Keys)
            {
                Cultures.Add(new NameVM {
                    Name = culture
                });
            }
            Groups = new MBBindingList <NameVM>();
            foreach (var group in this.allCharacters[c.culture].Keys)
            {
                Groups.Add(new NameVM {
                    Name = group
                });
            }
            Characters = new MBBindingList <CharacterVM>();
            foreach (var character in this.allCharacters[c.culture][c.defaultGroup])
            {
                Characters.Add(new CharacterVM(character));
            }
            SelectedCultureIndex   = Cultures.FindIndex(n => n.Name == c.culture);
            SelectedGroupIndex     = Groups.FindIndex(n => n.Name == c.defaultGroup);
            SelectedCharacterIndex = Characters.FindIndex(n => n.character == c);
            ModuleLogger.Log("end character selection vm construction");
        }
Ejemplo n.º 3
0
 public CharacterSelectionScreen(CharacterSelectionParams p)
     : base()
 {
     this._params = p;
 }