コード例 #1
0
        public void UpdateDictionaries()
        {
            foreach (Monster mon in Monsters.Values)
            {
                foreach (HarvestingTableRow htRow in mon.HarvestingTable.Rows)
                {
                    if (!string.IsNullOrEmpty(htRow.ItemNameRef) &&
                        HarvestedItems.TryGetValue(htRow.ItemNameRef.ToLower(), out HarvestedItem hItem))
                    {
                        htRow.Item = hItem;
                    }
                }

                if (!string.IsNullOrEmpty(mon.CreatureTypeRef) &&
                    CreatureTypes.TryGetValue(mon.CreatureTypeRef.ToLower(), out CreatureType cType))
                {
                    mon.CreatureType = cType;
                }

                if (!string.IsNullOrEmpty(mon.TrinketTableType) &&
                    TrinketTables.TryGetValue(mon.TrinketTableType.ToLower(), out TrinketTable tTable))
                {
                    mon.TrinketTable = tTable;
                }
            }

            StorageStateChanged?.Invoke();
        }
コード例 #2
0
        public void LoadState(DnDToolsState initialState)
        {
            if (State == null)
            {
                State = initialState;
            }
            else
            {
                State.AppendState(initialState);
            }

            State.HarvestedItems.ForEach(hItem => HarvestedItems.TryAdd(hItem.Name.ToLower(), hItem));
            State.CreatureTypes.ForEach(cType => CreatureTypes.TryAdd(cType.ToString().ToLower(), cType));
            State.TrinketTables.ForEach(tTable => TrinketTables.TryAdd(tTable.TrinketTableType.ToLower(), tTable));
            State.Monsters.ForEach(mon => Monsters.TryAdd(mon.Name.ToLower(), mon));

            UpdateDictionaries();

            IsLoaded = true;

            StorageStateChanged?.Invoke();
        }