Example #1
0
        public static List <IdentificationTool.AssetSegment> m_pendingSegments; // Segments pending to be saved

        public static void ProcessNewPaths(List <ushort> segments, BuildingInfo info)
        {
            try
            {
#if DEBUG
                Debug.Log("Loading TMPE settings...");
#endif
                TmpeAssetData data = AssetDataManager.Instance.AssetsWithData[IdentificationTool.GetNameWithoutPrefix(info.name)];

                Debug.Log("Hoooray! Tmpe settings loaded");

                Configuration config = SerializableDataExtension.DeserializeData(data.TmpeConfiguration, out bool error);
                if (error)
                {
                    throw new Exception("Tmpe: Failed to deserialize data");
                }

                /* We identify the old ids with the new ids */
                IdentificationTool.CreateDictionaries(segments, data.Segments, out Dictionary <ushort, ushort> segmentPairs,
                                                      out Dictionary <ushort, ushort> nodePairs, out Dictionary <uint, uint> lanePairs);
                IdentificationTool.TranslateGameConfiguration(config, segmentPairs, nodePairs, lanePairs);

                /*SerializableDataExtension.LoadDataState(config, out bool error2);
                 * if (error2)
                 *  throw new Exception("Tmpe: error when applying loaded data");*/

                /* Apply settings after some time elapses (hack) */
                ProvisionalDataLoader.StartTimer(config);
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.Log(ex);
#endif
            }
        }