Exemplo n.º 1
0
        public static void make()
        {
            _uiElementDic.clear();
            _uiModelDic.clear();

            initElementNames();

            foreach (var v in _elementPrefabDic)
            {
                Transform tf = v.transform;

                UIObjectData element = new UIObjectData();
                element.name  = tf.gameObject.name;
                element.type  = UIElementType.Element;
                element.style = "";

                if (tf.gameObject.tag.Equals("G"))
                {
                    element.style = "G";
                }

                makeNode(element, tf);

                _uiElementDic.put(element.name, element);
            }

            //生成新预处理列表
            string[] files = FileUtils.getDeepFileList(ShineToolGlobal.uiModelsPath, "prefab");

            for (int i = 0; i < files.Length; i++)
            {
                string assetsPath = ToolFileUtils.getAssetsPath(files[i]);

                GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetsPath);

                Transform tf = prefab.transform;

                UIObjectData element = new UIObjectData();
                element.name  = tf.gameObject.name;
                element.type  = UIElementType.Model;
                element.style = "";

                if (tf.gameObject.tag.Equals("G"))
                {
                    element.style = "G";
                }

                makeNode(element, tf);

                _uiModelDic.put(element.name, element);
            }

            writeBytes();

            ToolFileUtils.executeServerTool("uiModel");

            Ctrl.print("OK");
        }
Exemplo n.º 2
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");
        }