Exemple #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");
        }
Exemple #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");
        }
        protected override void populateMenu(GenericMenu menu, SerializedProperty property, SElementAttribute attribute)
        {
            string[] files = FileUtils.getDeepFileList(ToolFileUtils.getAssetsPath(ShineToolGlobal.uiElementsPath), "prefab");
            for (int i = 0; i < files.Length; i++)
            {
                GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(files[i]);

                string name = prefab.name;
                menu.AddItem(new GUIContent(name), name == property.stringValue, onSelectItem, name);
            }
        }
Exemple #4
0
        /** 读取bundle配置 */
        private void readResourceInfoConfig()
        {
            string[][] re = ToolFileUtils.readFileForExcelFirstSheet(ShineToolGlobal.resourceInfoPath);

            _defaultSaveType       = int.Parse(re[0][1]);
            _signedResourceSaveDic = new SMap <string, int>();

            for (int i = 2; i < re.Length; i++)
            {
                _signedResourceSaveDic.put(re[i][0], int.Parse(re[i][1]));
            }
        }
Exemple #5
0
        private static void initElementNames()
        {
            _elementDic       = new SMap <string, string>();
            _elementPrefabDic = new SMap <string, GameObject>();

            string[] files = FileUtils.getDeepFileList(ShineToolGlobal.uiElementsPath, "prefab");
            for (int i = 0; i < files.Length; i++)
            {
                string assetsPath = ToolFileUtils.getAssetsPath(files[i]);

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

                _elementDic.put(assetsPath, prefab.name);
                _elementPrefabDic.put(assetsPath, prefab);
            }
        }
Exemple #6
0
        static void addAllSceneToBuildSettings()
        {
            // string[] unityList=FileUtils.getDeepFileList(ShineToolGlobal.assetSourcePath + "/unity","unity");
            string[] sceneList = FileUtils.getDeepFileList(ShineToolGlobal.assetSourcePath + "/scene", "unity");

            EditorBuildSettingsScene[] newSettings = new EditorBuildSettingsScene[sceneList.Length + 2];

            int i = 0;

            newSettings[i++] = new EditorBuildSettingsScene(ShineGlobal.sourceHeadU + "unity/main.unity", true);
            newSettings[i++] = new EditorBuildSettingsScene(ShineGlobal.sourceHeadU + "unity/root.unity", true);

            foreach (string v in sceneList)
            {
                string sceneName = ToolFileUtils.getAssetsPath(v);
                newSettings[i++] = new EditorBuildSettingsScene(sceneName, true);
            }

            EditorBuildSettings.scenes = newSettings;
        }
Exemple #7
0
        private void readConfig()
        {
            // EditorUtility.DisplayProgressBar("请耐心等待","正在读取配置文件...",0.0f);

            long configTime = File.GetLastWriteTime(ShineToolGlobal.buildConfigPath).Ticks;

            if (_buildConfigs == null || _buildConfigFileTime != configTime)
            {
                _buildConfigFileTime = configTime;
                string[][] re = ToolFileUtils.readFileForExcelFirstSheet(ShineToolGlobal.buildConfigPath);

                _buildConfigs = new BuildConfig[re.Length - 1];

                for (int i = 1; i < re.Length; i++)
                {
                    BuildConfig config = new BuildConfig();
                    config.readConfig(re[i]);

                    _buildConfigs[i - 1] = config;
                }
            }

            EditorUtility.ClearProgressBar();
        }