Example #1
0
 public static void ClearCache()
 {
     PrefabsLoaded = false;
     NetInfoExt.NetInfoExtArray = null;
     MaterialUtils.Clear();
     TextureUtils.Clear();
 }
 public static void ClearCache()
 {
     Log.Info("PrefabUtils.ClearCache() called");
     PrefabsLoaded = false;
     NetInfoExt.NetInfoExtArray = null;
     MaterialUtils.Clear();
     TextureUtils.Clear();
 }
Example #3
0
        public static void CachePrefabs()
        {
            Log.Info("CachePrefabs() called ...");
            Log.Info("Assembly is " + typeof(PrefabUtils).Assembly);

            Extensions.Init();
            TMPEUTILS.Init();
            NS2Utils.Init();
#if !DEBUG
            if (!Extensions.IsActive)
            {
                Log.Info("skipped caching prefabs in asset editor/map/scenario/... release build");
                return;
            }
#endif
            NetInfoExt.InitNetInfoExtArray();
            TextureUtils.Init();
            MaterialUtils.Init();
            for (ushort segmentID = 0; segmentID < NetManager.MAX_SEGMENT_COUNT; ++segmentID)
            {
                foreach (bool bStartNode in new bool[] { false, true })
                {
                    if (TMPEUTILS.HasCrossingBan(segmentID, bStartNode))
                    {
                        NetSegment segment = segmentID.ToSegment();

                        if (!segment.Info)
                        {
                            continue;
                        }

                        ushort nodeID = bStartNode ? segment.m_startNode : segment.m_endNode;

                        foreach (var node in segment.Info.m_nodes)
                        {
                            if (node.m_directConnect)
                            {
                                continue;
                            }
                            var flags = nodeID.ToNode().m_flags;

                            //cache:
                            //Log.Info("Caching " + segment.Info.name);
                            if (nodeID.ToNode().m_flags.IsFlagSet(NetNode.Flags.Junction))
                            {
                                CalculateMaterialCommons.CalculateMaterial(node.m_nodeMaterial, nodeID, segmentID);
                            }
                        }
                    }
                }
            }
            PrefabsLoaded = true;
            Log.Info("all prefabs cached");
        }