コード例 #1
0
    protected readonly Stack<MapDataStore> recycledBlocks; // Object pool!

    protected BlockMesher() {
        // Make queues
        requestQueue = new Util.UniqueQueue<DFCoord, Request>();
        recycledBlocks = new Stack<MapDataStore>();
        resultQueue = new Queue<Result>();

        // Load meshes
        contentLoader = new ContentLoader();
        System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
        watch.Start();
        contentLoader.ParseContentIndexFile(Application.streamingAssetsPath + "/index.txt");
        contentLoader.FinalizeTextureAtlases();
        watch.Stop();
        Debug.Log("Took a total of " + watch.ElapsedMilliseconds + "ms to load all XML files.");

        // Load materials
        materials = new Dictionary<MatPairStruct, RemoteFortressReader.MaterialDefinition>();
        foreach (RemoteFortressReader.MaterialDefinition material in DFConnection.Instance.NetMaterialList.material_list)
        {
            materials[material.mat_pair] = material;
        }
        System.GC.Collect(); //force a garbage collect after initial load.
    }
コード例 #2
0
    protected readonly Stack <MapDataStore> recycledBlocks; // Object pool!

    protected BlockMesher()
    {
        // Make queues
        requestQueue   = new Util.UniqueQueue <DFCoord, Request>();
        recycledBlocks = new Stack <MapDataStore>();
        resultQueue    = new Queue <Result>();

        // Load meshes
        contentLoader = new ContentLoader();
        System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
        watch.Start();
        contentLoader.ParseContentIndexFile(Application.streamingAssetsPath + "/index.txt");
        contentLoader.FinalizeTextureAtlases();
        watch.Stop();
        Debug.Log("Took a total of " + watch.ElapsedMilliseconds + "ms to load all XML files.");

        // Load materials
        materials = new Dictionary <MatPairStruct, RemoteFortressReader.MaterialDefinition>();
        foreach (RemoteFortressReader.MaterialDefinition material in DFConnection.Instance.NetMaterialList.material_list)
        {
            materials[material.mat_pair] = material;
        }
    }