Exemplo n.º 1
0
        private static void callNative(NavMeshConfig config, SceneRecastData data, int currentMapID)
        {
            BytesWriteStream stream = new BytesWriteStream();

            stream.setUseBitBoolean(false);

            config.write(stream);

            string cStr   = ShineToolGlobal.mapInfoPath + "/navConfig.bin";
            string dStr   = SceneEditorWindow.getMapFilePathFront(currentMapID) + "_navData.bin";
            string objStr = SceneEditorWindow.getMapFilePathFront(currentMapID) + "_navData.obj";

            FileUtils.writeFileForBytesWriteStream(cStr, stream);

            stream.clear();
            data.write(stream);
            FileUtils.writeFileForBytesWriteStream(dStr, stream);

            if (_needObjFile)
            {
                StringBuilder sb = new StringBuilder();

                foreach (Vector3 vec in data.vertices)
                {
                    sb.Append('v');
                    sb.Append(' ');
                    sb.Append(vec.x);
                    sb.Append(' ');
                    sb.Append(vec.y);
                    sb.Append(' ');
                    sb.Append(vec.z);
                    sb.Append('\n');
                }

                int[] navIndices = data.triangles.getValues();
                int   len        = data.triangles.size() / 3;

                for (int i = 0; i < len; i++)
                {
                    sb.Append('f');
                    sb.Append(' ');
                    sb.Append(navIndices[i * 3] + 1);
                    sb.Append(' ');
                    sb.Append(navIndices[i * 3 + 1] + 1);
                    sb.Append(' ');
                    sb.Append(navIndices[i * 3 + 2] + 1);
                    sb.Append('\n');
                }

                FileUtils.writeFileForUTF(objStr, sb.ToString());
            }

            Ctrl.print("callJar");
            ToolFileUtils.executeServerTool("exportNav", currentMapID.ToString());
            Ctrl.print("OK");
        }