Exemplo n.º 1
0
        private void ExposeFactionData()
        {
            if (Scribe.mode == LoadSaveMode.Saving)
            {
                int currentFactionId = Faction.OfPlayer.loadID;
                Scribe_Custom.LookValue(currentFactionId, "currentFactionId");

                var data = new Dictionary <int, FactionMapData>(factionData);
                data.Remove(currentFactionId);
                Scribe_Custom.LookValueDeep(ref data, "factionMapData", map);
            }
            else
            {
                // The faction whose data is currently set
                Scribe_Values.Look(ref currentFactionId, "currentFactionId");

                Scribe_Custom.LookValueDeep(ref factionData, "factionMapData", map);
                if (factionData == null)
                {
                    factionData = new Dictionary <int, FactionMapData>();
                }
            }

            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                factionData[currentFactionId] = FactionMapData.NewFromMap(map, currentFactionId);
            }
        }
Exemplo n.º 2
0
 private void ExposeCustomFactionData()
 {
     Scribe_Custom.LookValueDeep(ref customFactionData, "customFactionMapData", map);
     customFactionData ??= new Dictionary <int, CustomFactionMapData>();
 }