コード例 #1
0
        public void UpdatePerks()
        {
            if (null == PerkGroups)
            {
                PerkGroups = new List <PerkGroupVM>();
            }
            var perksArray = PerksArray;

            foreach (var xmlGroup in XmlData.Current.PerkGroups)
            {
                var perkVMs = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVM(this, perksArray, x)).ToArray();
                foreach (var perkVM in perkVMs)
                {
                    int indx = Game.AllPerks.FindIndex(f => f.Name == perkVM.Name);
                    if (-1 == indx)
                    {
                        Game.AllPerks.Add(perkVM);
                    }
                }

                var groupVM = new PerkGroupVM(this, xmlGroup.Name, perkVMs);
                int idx     = PerkGroups.FindIndex(f => f.Name == groupVM.Name);
                if (-1 == idx)
                {
                    PerkGroups.Add(groupVM);
                }
            }
        }
コード例 #2
0
        public GameVM(AmfFile file, GameVM previousVM)
            : base(file)
        {
            SetCharacterOptions();
            setCharacter("PC");

            _flags = new GeneralObjectVM(GetObj("flags"));

            // Perks
            var charPerks = Character.GetObj("perks");

            if (null == charPerks)
            {
                charPerks = new Model.AmfObject(AmfTypes.Array);
            }
            var xmlPerks         = XmlData.Current.PerkGroups.SelectMany(x => x.Perks).ToArray();
            var unknownPerkGroup = XmlData.Current.PerkGroups.Last();

            ImportMissingNamedVectors(charPerks, xmlPerks, "storageName", x => x.GetString("tooltip"), unknownPerkGroup.Perks);

            PerkGroups = new List <PerkGroupVM>();
            foreach (var xmlGroup in XmlData.Current.PerkGroups)
            {
                var perksVM = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVectorVM(this, charPerks, x)).ToArray();
                _allPerks.AddRange(perksVM);

                var groupVM = new PerkGroupVM(this, xmlGroup.Name, perksVM);
                PerkGroups.Add(groupVM);
            }
            ;
        }
コード例 #3
0
ファイル: GameVM.cs プロジェクト: zeek20freak/TiTsEd
        private void setCharacter(string name)
        {
            var tmpChar = GetObj("characters");

            tmpChar        = tmpChar.GetObj(name);
            Character      = new CharacterVM(this, tmpChar);
            _characterName = name;
            if (name == "PC")
            {
                IsPC = true;
            }
            else
            {
                IsPC = false;
            }

            if (null == Character.KeyItems && (null != _allKeyItems))
            {
                Character.KeyItems = new UpdatableCollection <KeyItemVM>(_allKeyItems.Where(x => x.Match(KeyItemSearchText)));
            }

            if (null == Character.PerkGroups && (null != _allPerks))
            {
                Character.PerkGroups = new List <PerkGroupVM>();
                var charPerks = Character.PerksArray;
                foreach (var xmlGroup in XmlData.Current.PerkGroups)
                {
                    var perksVM = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVM(this, charPerks, x)).ToArray();
                    var groupVM = new PerkGroupVM(this, xmlGroup.Name, perksVM);
                    Character.PerkGroups.Add(groupVM);
                }
            }

            if (null == Character.StatusEffects && (null != _allStatuses))
            {
                Character.StatusEffects = new UpdatableCollection <StatusEffectVM>(_allStatuses.Where(x => x.Match(RawDataSearchText)));
            }
        }
コード例 #4
0
ファイル: GameVM.cs プロジェクト: zeek20freak/TiTsEd
        public GameVM(AmfFile file, GameVM previousVM)
            : base(file)
        {
            SetCharacterOptions();
            setCharacter("PC");

            var flagsObject = FlagsObject;

            _flags = new GeneralObjectVM(flagsObject);
            if (null != previousVM)
            {
                _perkSearchText    = previousVM._perkSearchText;
                _keyItemSearchText = previousVM._keyItemSearchText;
                _rawDataSearchText = previousVM._rawDataSearchText;
            }

            // Perks
            var charPerks        = Character.PerksArray;
            var xmlPerks         = XmlData.Current.PerkGroups.SelectMany(x => x.Perks).ToArray();
            var unknownPerkGroup = XmlData.Current.PerkGroups.Last();

            ImportMissingNamedVectors(charPerks, xmlPerks, "storageName", x => x.GetString("tooltip"), unknownPerkGroup.Perks);

            Character.PerkGroups = new List <PerkGroupVM>();
            foreach (var xmlGroup in XmlData.Current.PerkGroups)
            {
                var perksVM = xmlGroup.Perks.OrderBy(x => x.Name).Select(x => new PerkVM(this, charPerks, x)).ToArray();
                _allPerks.AddRange(perksVM);

                var groupVM = new PerkGroupVM(this, xmlGroup.Name, perksVM);
                Character.PerkGroups.Add(groupVM);
            }
            //Character.Perks = new UpdatableCollection<PerkVM>(_allPerks.Where(x => x.Match(PerkSearchText)));

            // KeyItems
            var keyItems = Character.KeyItemsArray;
            var xmlKeys  = XmlData.Current.KeyItems;

            ImportMissingNamedVectors(keyItems, xmlKeys, "storageName", x => x.GetString("tooltip"));
            _allKeyItems       = XmlData.Current.KeyItems.OrderBy(x => x.Name).Select(x => new KeyItemVM(this, keyItems, x)).ToArray();
            Character.KeyItems = new UpdatableCollection <KeyItemVM>(_allKeyItems.Where(x => x.Match(KeyItemSearchText)));

            // Statuses
            var statuses    = Character.StatusEffectsArray;
            var xmlStatuses = XmlData.Current.Statuses;

            ImportMissingNamedVectors(statuses, xmlStatuses, "storageName", x => x.GetString("tooltip"));
            _allStatuses            = XmlData.Current.Statuses.OrderBy(x => x.Name).Select(x => new StatusEffectVM(this, statuses, x)).ToArray();
            Character.StatusEffects = new UpdatableCollection <StatusEffectVM>(_allStatuses.Where(x => x.Match(RawDataSearchText)));

            // Flags
            foreach (var xmlFlag in XmlData.Current.Flags)
            {
                if (!_allFlags.ContainsKey(xmlFlag.Name))
                {
                    _allFlags[xmlFlag.Name] = new FlagVM(this, ref flagsObject, xmlFlag);
                }
            }
            foreach (var flag in flagsObject)
            {
                string flagName = flag.ToString();
                if (!_allFlags.ContainsKey(flagName))
                {
                    XmlEnum data = new XmlEnum();
                    data.Name           = flagName;
                    _allFlags[flagName] = new FlagVM(this, ref flagsObject, data);
                }
            }
            Flags = new UpdatableCollection <FlagVM>(_allFlags.Values.ToList().Where(x => x.Match(RawDataSearchText)));
        }