Пример #1
0
 public void OnEnabled()
 {
     System.IO.File.WriteAllText("mod.debug.log", ""); // restart log.
     InstallHarmony();
     LoadingWrapperPatch.OnPostLevelLoaded += SegmentEnd.InitSegmentEndArray;
     if (SceneManager.GetActiveScene().name.Equals("Game"))
     {
         SegmentEnd.InitSegmentEndArray();
     }
 }
        } // end method

        public static void OnUpdateSegment(ushort segmentId) {
            foreach (var startNode in new[] { false, true }) {
                int index = GetSegmentEndIndex(segmentId, startNode);
                if (!Extensions.netService.IsSegmentValid(segmentId)) {
                    SegmentEndArray[index] = null;
                } else {
                    Extensions.Assert(SegmentEndArray != null, "SegmentEndArray!=null");
                    ushort nodeId = startNode ? segmentId.ToSegment().m_startNode : segmentId.ToSegment().m_endNode;
                    if (SegmentEndArray[index] == null)
                        SegmentEndArray[index] = new SegmentEnd(segmentId, nodeId);
                    else
                        SegmentEndArray[index].Recalculate(segmentId, nodeId);
                }
            }
        }