Ejemplo n.º 1
0
    /// <summary>
    /// Get all textures from a material
    /// </summary>
    /// <returns>The textures from material.</returns>
    /// <param name="mat">Mat.</param>
    public static bool getTexturesFromMaterial(Material mat, ref ArrayList propNames, ref ArrayList texNames, ref ArrayList texPaths)
    {
        bool ret = false;

        if (mat == null)
        {
            Debug.LogWarning("The mat is null");
            return(ret);
        }
        Shader shader   = mat.shader;
        string propName = "";

        for (int i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
        {
            if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv)
            {
                propName = ShaderUtil.GetPropertyName(shader, i);
                Texture texture = mat.GetTexture(propName);
                if (texture != null)
                {
                    ret = ECLEditorUtl.moveAsset4Upgrade(texture) || ret ? true : false;
                    propNames.Add(propName);
                    texNames.Add(ECLEditorUtl.getAssetName4Upgrade(texture));
                    texPaths.Add(ECLEditorUtl.getPathByObject(texture));
                }
            }
        }
        return(ret);
    }
Ejemplo n.º 2
0
    public static void doSaveAsset(GameObject go)
    {
        CLPanelBase panel = go.GetComponent <CLPanelBase>();

        if (panel == null)
        {
            return;
        }
        Debug.Log(panel.name);
        if (panel.isNeedResetAtlase)
        {
            CLUIUtl.resetAtlasAndFont(panel.transform, true);
            PrefabUtility.SavePrefabAsset(go);
        }
        string dir = Application.dataPath + "/" + ECLEditorUtl.getPathByObject(go);

        dir = Path.GetDirectoryName(dir);
        ECLCreatAssetBundle4Update.createAssets4Upgrade(dir, panel.gameObject, true);

        // 必须再取一次,好像执行了上面一句方法后,cell就会变成null
        panel = go.GetComponent <CLPanelBase>();
        if (panel != null && panel.isNeedResetAtlase)
        {
            CLUIUtl.resetAtlasAndFont(panel.transform, false);
            PrefabUtility.SavePrefabAsset(go);
        }
    }
Ejemplo n.º 3
0
    void uploadOss(string name = null)
    {
        if (string.IsNullOrEmpty(selectedServer.ossCmd))
        {
            Debug.LogError("请先设置同步脚本!");
            return;
        }
        if (string.IsNullOrEmpty(name))
        {
            name = selectedPackageName;
        }
        string localDir = getUpgradePackagePath(name);
        string shell    = Path.Combine(Application.dataPath, ECLEditorUtl.getPathByObject(selectedServer.ossShell));
        string arg1     = Path.GetDirectoryName(shell);
        string arg2     = localDir.ToString();
        string argss    = shell + " " + arg1 + " " + arg2;

//		Debug.LogError (argss);
        System.Diagnostics.Process process = System.Diagnostics.Process.Start("/bin/bash", argss);
        //重新定向标准输入,输入,错误输出
//		process.StartInfo.RedirectStandardInput = true;
//		process.StartInfo.RedirectStandardOutput = true;
//		process.StartInfo.RedirectStandardError = true;
//
//		string ret = process.StandardOutput.ReadToEnd ();
//		Debug.Log (ret);
        Debug.LogWarning("Finished===" + name);
    }
Ejemplo n.º 4
0
    static public void showDirList()
    {
        string ret = "";
        string dir = Application.dataPath + "/" + ECLProjectManager.FrameName;

        ECLEditorUtl.getDirList(dir, "", ref ret);
        Debug.Log(ret);
    }
Ejemplo n.º 5
0
    string getMatName(Material mat)
    {
        string materialPath = ECLEditorUtl.getPathByObject(mat);

        materialPath = materialPath.Replace(CLPathCfg.self.basePath + "/upgradeRes4Dev/other/Materials/", "");
        materialPath = materialPath.Replace(".mat", "");
        materialPath = materialPath.Replace("/", ".");
        return(materialPath);
    }
Ejemplo n.º 6
0
    public static void resetShardAssets(UnityEngine.Object obj)
    {
        CLSharedAssets sharedAsset = null;
        CLRoleAvata    avata       = null;

        if (obj != null && obj is GameObject)
        {
            // 没搞明白,执行到这里时,textureMgr已经为null了,因此再取一次
            sharedAsset = ((GameObject)obj).GetComponent <CLSharedAssets> ();
            avata       = ((GameObject)obj).GetComponent <CLRoleAvata> ();

            UIFont font = ((GameObject)obj).GetComponent <UIFont> ();
            if (font != null)
            {
                if (!string.IsNullOrEmpty(font.atlasName))
                {
                    font.atlas = CLUIInit.self.getAtlasByName(font.atlasName);
                    if (font.atlas)
                    {
                        font.material = font.atlas.spriteMaterial;
                    }
                }
            }
        }
        else if (obj != null && obj is Material)
        {
            CLMaterialPool.resetTexRef(ECLEditorUtl.getAssetName4Upgrade(obj), (Material)obj, null, null);
            sharedAsset = null;
        }
        else
        {
            sharedAsset = null;
        }

        bool isRefresh = false;

        if (avata != null)
        {
            avata.setDefaultMaterial();
            isRefresh = true;
        }
        if (sharedAsset != null)
        {
            sharedAsset.reset();
            sharedAsset.resetAssets();
            isRefresh = true;
        }
        if (isRefresh && obj is GameObject)
        {
            //string path = AssetDatabase.GetAssetPath (obj);
            //EditorUtility.SetDirty (obj);
            //AssetDatabase.WriteImportSettingsIfDirty (path);
            //AssetDatabase.ImportAsset (path);
            PrefabUtility.SavePrefabAsset(obj as GameObject);
        }
    }
Ejemplo n.º 7
0
        //		private int IndexOf (string[] array, string target)
        //		{
        //			int length = array.Length;
        //			for (var i = 0; i < length; i++) {
        //				if (array [i] == target)
        //					return i;
        //			}
        //			return 0;
        //		}


        public void DrawInspectorBase(Node node)
        {
            ECLEditorUtl.BeginContents();
            {
                EditorGUILayout.LabelField("State values");
                EditorGUILayout.TextField(new GUIContent("Conditon"), node.condition);
                EditorGUILayout.TextField(new GUIContent("Result1"), node.result1);
                EditorGUILayout.TextField(new GUIContent("Result2"), node.result2);
            }
            ECLEditorUtl.EndContents();
        }
Ejemplo n.º 8
0
    public static void cleanShardAssets(UnityEngine.Object obj)
    {
        CLSharedAssets sharedAsset = null;
        CLRoleAvata    avata       = null;

        if (obj is GameObject)
        {
            sharedAsset = ((GameObject)obj).GetComponent <CLSharedAssets> ();
            avata       = ((GameObject)obj).GetComponent <CLRoleAvata> ();
            if (AssetDatabase.GetAssetPath(obj).Contains("/other/model/"))
            {
                ECLEditorUtl.cleanModleMaterials(AssetDatabase.GetAssetPath(obj));
            }
            UIFont font = ((GameObject)obj).GetComponent <UIFont> ();
            if (font != null)
            {
                string spName = font.spriteName;
                font.atlas      = null;
                font.material   = null;
                font.spriteName = spName;
            }
        }
        else if (obj is Material)
        {
            CLMaterialPool.cleanTexRef(ECLEditorUtl.getAssetName4Upgrade(obj), (Material)obj);
            sharedAsset = null;
        }
        else
        {
            sharedAsset = null;
        }
        bool isRefresh = false;

        if (avata != null)
        {
            avata.cleanMaterial();
            isRefresh = true;
        }
        if (sharedAsset != null)
        {
            sharedAsset.cleanRefAssets();
            isRefresh = true;
        }
        if (isRefresh && obj is GameObject)
        {
            //			AssetDatabase.Refresh ();
            //string path = AssetDatabase.GetAssetPath (obj);
            //EditorUtility.SetDirty (obj);
            //AssetDatabase.WriteImportSettingsIfDirty (path);
            //AssetDatabase.ImportAsset (path);
            PrefabUtility.SavePrefabAsset(obj as GameObject);
        }
    }
Ejemplo n.º 9
0
    void init()
    {
        if (!isFinishInit || asset == null)
        {
            isFinishInit = true;

            if (!string.IsNullOrEmpty(instance.soundFileName) && CLPathCfg.self != null)
            {
                string tmpPath = CLPathCfg.self.basePath + "/upgradeRes4Dev/other/sound/" + instance.soundFileName;
                asset = ECLEditorUtl.getObjectByPath(tmpPath);
            }
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Gets the material reference.
    /// </summary>
    /// <returns><c>true</c>, 说明有新资源移动到开发目录 <c>false</c> otherwise.</returns>
    /// <param name="sharedAsset">Shared asset.</param>
    /// <param name="tr">Tr.</param>
    public static bool getMaterialRef(CLSharedAssets sharedAsset, Transform tr)
    {
        bool ret  = false;
        bool ret1 = false;
        bool ret2 = false;
        bool ret3 = false;

        Renderer[] rds = tr.GetComponents <Renderer> ();
        Renderer   rd  = null;

        for (int r = 0; r < rds.Length; r++)
        {
            rd = rds [r];
            if (rd == null)
            {
                continue;
            }
            if (rd.sharedMaterials != null && rd.sharedMaterials.Length > 0)
            {
                for (int i = 0; i < rd.sharedMaterials.Length; i++)
                {
                    if (rd.sharedMaterials [i] == null)
                    {
                        continue;
                    }
                    Coolape.CLSharedAssets.CLMaterialInfor clMat = new Coolape.CLSharedAssets.CLMaterialInfor();
                    clMat.render = rd;
                    clMat.index  = i;
                    ret1         = ECLEditorUtl.moveAsset4Upgrade(rd.sharedMaterials [i]) || ret1 ? true : false;
                    string materialName = ECLEditorUtl.getAssetName4Upgrade(rd.sharedMaterials [i]);
                    clMat.materialName = materialName;
                    sharedAsset.materials.Add(clMat);

                    // save to cfg file
                    ArrayList propNames = new ArrayList();
                    ArrayList texNames  = new ArrayList();
                    ArrayList texPaths  = new ArrayList();
                    ret2 = ECLEditorUtl.getTexturesFromMaterial(rd.sharedMaterials [i], ref propNames, ref texNames, ref texPaths) || ret2 ? true : false;
                    saveMaterialTexCfg(materialName, propNames, texNames, texPaths);
                }
            }
        }

        for (int i = 0; i < tr.childCount; i++)
        {
            ret3 = getMaterialRef(sharedAsset, tr.GetChild(i)) || ret3 ? true : false;
        }
        return(ret1 || ret2 || ret3);
    }
Ejemplo n.º 11
0
    public Object getMaterial(string path)
    {
        if (MaterialMap [path] == null)
        {
            string matPath = PStr.b().a(CLPathCfg.self.basePath).a("/")
                             .a("upgradeRes4Dev").a("/other/Materials/").a(path.Replace(".", "/")).a(".mat").e();
//			Debug.Log (matPath);
            Object obj = ECLEditorUtl.getObjectByPath(matPath);
            MaterialMap [path] = obj;
            return(obj);
        }
        else
        {
            return((Object)(MaterialMap [path]));
        }
    }
Ejemplo n.º 12
0
    static public void setModeProp()
    {
        Object[] objs = Selection.objects;
        if (objs == null || objs.Length == 0)
        {
            return;
        }
        ModelImporter mi   = null;
        string        path = "";

        for (int j = 0; j < objs.Length; j++)
        {
            path = AssetDatabase.GetAssetPath(objs [j]);
//			mi = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath (objs[j])) as ModelImporter;
            ECLEditorUtl.setModelProp(path, false, ModelImporterNormals.None, ModelImporterTangents.None);
        }
    }
Ejemplo n.º 13
0
    void refreshContent()
    {
        editKey = "";
        languageList.Clear();
        dictOrgs.Clear();
        dict.Clear();
        string dir = Application.dataPath + "/" + CLPathCfg.self.localizationPath;

        dir = dir.Replace("/upgradeRes/", "/upgradeRes4Dev/");
        string[] files = Directory.GetFiles(dir);
        byte[]   buff  = null;
        Dictionary <string, string> tempDic = null;

        for (int i = 0; i < files.Length; i++)
        {
            if (ECLEditorUtl.isIgnoreFile(files [i]))
            {
                continue;
            }
            buff = File.ReadAllBytes(files [i]);
            languageList.Add(Path.GetFileNameWithoutExtension(files [i]));
            ByteReader reader = new ByteReader(buff);
            tempDic = reader.ReadDictionary();
            foreach (KeyValuePair <string, string> cell in tempDic)
            {
                if (dictOrgs.ContainsKey(cell.Key.ToString()))
                {
                    ArrayList list = dictOrgs [cell.Key.ToString()];
                    if (list == null)
                    {
                        list = new ArrayList();
                    }
                    list.Add(cell.Value);
                    dictOrgs [cell.Key.ToString()] = list;
                }
                else
                {
                    ArrayList list = new ArrayList();
                    list.Add(cell.Value);
                    dictOrgs [cell.Key.ToString()] = list;
                }
            }
        }
        dict = dictOrgs;
    }
Ejemplo n.º 14
0
        public void DrawInspector(Root node)
        {
            EditorGUILayout.LabelField(new GUIContent("Root"), TitleStyle);
            EditorGUILayout.Space();

            node.begainIndex = EditorGUILayout.IntField(new GUIContent("Begain Index"), node.begainIndex);

            node.monoScript = (MonoScript)EditorGUILayout.ObjectField("Root Script", node.monoScript, typeof(MonoScript), false);
            if (node.monoScript != null)
            {
                if (!node.monoScript.GetClass().IsSubclassOf(typeof(ActionBase)))
                {
                    EditorGUILayout.HelpBox(string.Format("{0} is not a subclass of Hivemind.ActionBase", node.monoScript.GetClass().ToString()), MessageType.Warning);
                    //					action.monoScript = null;
                }
                else
                {
                }
            }
            if (node.attr != null)
            {
                ECLEditorUtl.BeginContents();
                {
                    EditorGUILayout.LabelField("Event Content");
                    node.attr.DrawInspector(node);
                }
                ECLEditorUtl.EndContents();
            }
            EditorGUILayout.Space();

            if (GUILayout.Button("Refresh Nodes Index"))
            {
                node.index    = 0;
                node.maxIndex = 0;
                foreach (Node n in node.behaviorTree.nodes)
                {
                    if (n != node)
                    {
                        node.maxIndex++;
                        n.index = node.begainIndex + node.maxIndex;
                    }
                }
            }
        }
Ejemplo n.º 15
0
    public Mesh getMesh(string path, string meshName)
    {
        if (MeshMap [path] == null)
        {
            string matPath = PStr.b().a(CLPathCfg.self.basePath).a("/")
                             .a("upgradeRes4Dev").a("/other/model/").a(path.Replace(".", "/")).a(".FBX").e();
            Debug.Log(matPath);
            MeshMap [path] = ECLEditorUtl.getObjectByPath(matPath);
        }


        GameObject mi = MeshMap [path] as GameObject;

        if (mi != null)
        {
            MeshFilter[] mfs = mi.GetComponentsInChildren <MeshFilter>();
            if (mfs != null && mfs.Length > 0)
            {
                for (int i = 0; i < mfs.Length; i++)
                {
                    if (mfs [i].sharedMesh.name == meshName)
                    {
                        return(mfs[i].sharedMesh);
                    }
                }
            }
            else
            {
                SkinnedMeshRenderer[] smrs = mi.GetComponentsInChildren <SkinnedMeshRenderer>();
                if (smrs != null)
                {
                    for (int i = 0; i < smrs.Length; i++)
                    {
                        if (smrs [i].sharedMesh.name == meshName)
                        {
                            return(smrs[i].sharedMesh);
                        }
                    }
                }
            }
        }
        return(null);
    }
Ejemplo n.º 16
0
    public static void doCleanModelMaterials(string matPath)
    {
        checkModleSetting(matPath);
        ModelImporter mi = ModelImporter.GetAtPath(matPath) as ModelImporter;

        if (mi != null)
        {
            cleanModleMaterials(mi);
            AssetDatabase.ImportAsset(matPath);
        }

        GameObject go = ECLEditorUtl.getObjectByPath(matPath) as GameObject;

        if (go != null)
        {
            MeshRenderer mf = go.GetComponentInChildren <MeshRenderer> ();
            if (mf != null)
            {
                mf.sharedMaterial = null;
                Material[] mats = mf.sharedMaterials;
                for (int i = 0; i < mats.Length; i++)
                {
                    mats [i] = null;
                }
                mf.sharedMaterials = mats;
            }
            SkinnedMeshRenderer smr = go.GetComponentInChildren <SkinnedMeshRenderer> ();
            if (smr != null)
            {
                smr.sharedMaterial = null;
                Material[] mats = smr.sharedMaterials;
                for (int i = 0; i < mats.Length; i++)
                {
                    mats [i] = null;
                }
                smr.sharedMaterials = mats;
            }
            EditorUtility.SetDirty(go);
            AssetDatabase.WriteImportSettingsIfDirty(matPath);
            AssetDatabase.Refresh();
        }
    }
Ejemplo n.º 17
0
 void OnGUI()
 {
     if (GUILayout.Button("Gen C#"))
     {
         Debug.Log(getCode());
     }
     if (GUILayout.Button("Gen Lua"))
     {
         Debug.Log(getCodeLua());
     }
     GUILayout.Space(5);
     ECLEditorUtl.BeginContents();
     {
         EditorGUILayout.BeginHorizontal();
         {
             curve = EditorGUILayout.CurveField("Curve", curve, GUILayout.Height(200));
         }
         EditorGUILayout.EndHorizontal();
     }
     ECLEditorUtl.EndContents();
 }
Ejemplo n.º 18
0
    void uploadOss(string name = null)
    {
        if (string.IsNullOrEmpty(selectedServer.ossCmd))
        {
            Debug.LogError("请先设置同步脚本!");
            return;
        }
        if (string.IsNullOrEmpty(name))
        {
            name = selectedPackageName;
        }
        string localDir = getUpgradePackagePath(name);
        string shell    = Path.Combine(Application.dataPath, ECLEditorUtl.getPathByObject(selectedServer.ossShell));
        string arg1     = Path.GetDirectoryName(shell);
        string arg2     = localDir.ToString();

//		Debug.LogError (argss);
//		System.Diagnostics.Process process = System.Diagnostics.Process.Start ("/bin/bash", argss);
        //重新定向标准输入,输入,错误输出
//		process.StartInfo.RedirectStandardInput = true;
//		process.StartInfo.RedirectStandardOutput = true;
//		process.StartInfo.RedirectStandardError = true;
//
//		string ret = process.StandardOutput.ReadToEnd ();
//		Debug.Log (ret);

//		Debug.LogError (shell + " " + arg1 + " " + arg2);
        if ("MacOSX".Equals(SystemInfo.operatingSystemFamily.ToString()))
        {
            string argss = Path.Combine(Path.GetDirectoryName(shell), Path.GetFileNameWithoutExtension(shell)) + ".sh" + " " + arg1 + " " + arg2;
//			Debug.LogError (argss);
            System.Diagnostics.Process process = System.Diagnostics.Process.Start("/bin/bash", argss);
        }
        else
        {
            string batFile = Path.Combine(Path.GetDirectoryName(shell), Path.GetFileNameWithoutExtension(shell)) + ".bat";
            System.Diagnostics.Process.Start(batFile, arg1 + " " + arg2);
        }
        Debug.LogWarning("Finished===" + name);
    }
Ejemplo n.º 19
0
        public void DrawInspector(NodeAction node)
        {
            EditorGUILayout.LabelField(new GUIContent("Action"), TitleStyle);

            EditorGUILayout.Space();
            node.desc         = EditorGUILayout.TextField(new GUIContent("Desc"), node.desc);
            node.canMultTimes = EditorGUILayout.Toggle("Run MultTimes", node.canMultTimes);

            // MonoScript selection field
            NodeAction action = (NodeAction)serializedObject.targetObject;

            action.monoScript = (MonoScript)EditorGUILayout.ObjectField("Action Script", action.monoScript, typeof(MonoScript), false);
            if (action.monoScript != null)
            {
                if (!action.monoScript.GetClass().IsSubclassOf(typeof(ActionBase)))
                {
                    EditorGUILayout.HelpBox(string.Format("{0} is not a subclass of Hivemind.ActionBase", action.monoScript.GetClass().ToString()), MessageType.Warning);
//					action.monoScript = null;
                }
                else
                {
                }
            }
            if (action.action != null)
            {
                ECLEditorUtl.BeginContents();
                {
                    EditorGUILayout.LabelField("Event Content");
                    action.action.DrawInspector(node);
                }
                ECLEditorUtl.EndContents();
            }
            EditorGUILayout.Space();

            DrawInspectorBase(node);

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 20
0
    public void drawLuaInfor()
    {
        instance = target as CLBaseLua;
        ECLEditorUtl.BeginContents();
        {
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Lua Text", GUILayout.Width(100));
                luaAsset = EditorGUILayout.ObjectField(luaAsset, typeof(UnityEngine.Object), GUILayout.Width(125));
            }
            GUILayout.EndHorizontal();
            string luaPath = AssetDatabase.GetAssetPath(luaAsset);
            //              if(!string.IsNullOrEmpty(luaPath)) {
            instance.luaPath = Utl.filterPath(luaPath);
            //              }
            EditorUtility.SetDirty(instance);

            GUI.contentColor = Color.yellow;
            EditorGUILayout.LabelField("注意:绑定的lua要求返回luatable");
            GUI.contentColor = Color.white;
        }
        ECLEditorUtl.EndContents();
    }
Ejemplo n.º 21
0
    public override void OnInspectorGUI()
    {
        instance = target as CLUIPlaySound;
        DrawDefaultInspector();

        if (instance != null)
        {
            init();
            NGUIEditorTools.BeginContents();
            {
                GUILayout.BeginHorizontal(); {
                    EditorGUILayout.LabelField("AudioClip", GUILayout.Width(100));
                    asset = EditorGUILayout.ObjectField(asset, typeof(UnityEngine.Object), GUILayout.Width(125));
                }
                GUILayout.EndHorizontal();
                string soundPath = ECLEditorUtl.getPathByObject(asset);
                instance.soundFileName = Path.GetFileName(soundPath);
                instance.soundName     = Path.GetFileNameWithoutExtension(soundPath);
                EditorUtility.SetDirty(instance);
            }
            NGUIEditorTools.EndContents();
        }
    }
Ejemplo n.º 22
0
    public Avatar getAvatar(string path)
    {
        if (MeshMap [path] == null)
        {
            string matPath = PStr.b().a(CLPathCfg.self.basePath).a("/")
                             .a("upgradeRes4Dev").a("/other/model/").a(path.Replace(".", "/")).a(".FBX").e();
            Debug.Log(matPath);
            MeshMap [path] = ECLEditorUtl.getObjectByPath(matPath);
        }
        GameObject mi = MeshMap [path] as GameObject;

        Animator animator = mi.GetComponent <Animator>();

        if (animator == null)
        {
            animator = mi.GetComponentInChildren <Animator>();
        }
        if (animator != null)
        {
            return(animator.avatar);
        }
        return(null);
    }
Ejemplo n.º 23
0
    public override void OnInspectorGUI()
    {
        instance = target as CLSeeker;
        //DrawDefaultInspector();
        ECLEditorUtl.BeginContents();
        {
            EditorGUILayout.HelpBox(
                "配合A星使用的seeker。\n" +
                "主要方法:\n" +
                "  .init();//初始化回调:寻路完成的回调,移动过程中的回调,到达目的地的回调\n" +
                "  .seek();//寻路,完成后会调用在init里设置的回调函数,第一个参数是路径,第二个参数为能否到达目的地\n" +
                "  .seekTarget();//寻路,会定时重新寻目标对象的路径\n" +
                "  .cancelSeekTarget();//取消对目标对象的定时寻路\n" +
                "  .startMove();//开始移动,只能通过此方法,不能直接改变canMove变量\n" +
                "  .stopMove();//停止移动\n"
                , MessageType.None, true);
        }
        ECLEditorUtl.EndContents();

        ECLEditorUtl.BeginContents();
        {
            GUI.color = Color.yellow;
            GUILayout.Label("*鼠标悬停在字段上有解释");
            GUI.color = Color.white;

            GUIContent uicontnt = null;
            uicontnt = new GUIContent("AStar Instance", "A星寻路实例,如果不设值,在运行时自动使用CLAStarPathSearch.current");
            instance.mAStarPathSearch = (CLAStarPathSearch)EditorGUILayout.ObjectField(uicontnt, instance.mAStarPathSearch, typeof(CLAStarPathSearch));
            uicontnt                      = new GUIContent("Target", "目标对象");
            instance.target               = (Transform)EditorGUILayout.ObjectField(uicontnt, instance.target, typeof(Transform));
            uicontnt                      = new GUIContent("Move Speed", "移动速度");
            instance.speed                = EditorGUILayout.FloatField(uicontnt, instance.speed);
            uicontnt                      = new GUIContent("Turning Speed", "转动速度,【注意】当为负数时表示立即转到目标方向,大于0时则会慢慢转向目标方向");
            instance.turningSpeed         = EditorGUILayout.FloatField(uicontnt, instance.turningSpeed);
            uicontnt                      = new GUIContent("EndReached Distance", "离目标到一定距离后结束移动");
            instance.endReachedDistance   = EditorGUILayout.FloatField(uicontnt, instance.endReachedDistance);
            uicontnt                      = new GUIContent("Auto Move After Seek", "当寻路完成后就移动过去");
            instance.autoMoveOnFinishSeek = EditorGUILayout.Toggle(uicontnt, instance.autoMoveOnFinishSeek);
            uicontnt                      = new GUIContent("Moving By", "能哪种update移动");
            instance.movingBy             = (CLSeeker.MovingBy)EditorGUILayout.EnumPopup(uicontnt, instance.movingBy);
            uicontnt                      = new GUIContent("Moving Unscaled Time", "移动时忽略时间的缩放");
            instance.unscaledTime         = EditorGUILayout.Toggle(uicontnt, instance.unscaledTime);
            uicontnt                      = new GUIContent("Debug Show Path", "显示路径");
            instance.showPath             = EditorGUILayout.Toggle(uicontnt, instance.showPath);
        }
        ECLEditorUtl.EndContents();

        ECLEditorUtl.BeginContents();
        {
            if (GUILayout.Button("Search"))
            {
                instance.seek(instance.target.position);
            }

            if (GUILayout.Button("SearchTarget"))
            {
                instance.seekTarget(instance.target);
            }
            if (GUILayout.Button("Cancel SearchTarget"))
            {
                instance.cancelSeekTarget();
            }

            if (GUILayout.Button("Begain Move"))
            {
                instance.startMove();
            }

            if (GUILayout.Button("Stop Move"))
            {
                instance.stopMove();
            }
        }
        ECLEditorUtl.EndContents();
    }
Ejemplo n.º 24
0
    void OnGUI()
    {
        if (!ECLProjectSetting.isProjectExit(ECLProjectManager.self))
        {
            GUIStyle style = new GUIStyle();
            style.fontSize         = 20;
            style.normal.textColor = Color.yellow;
            GUILayout.Label("The scene is not ready, create it now?", style);
            if (GUILayout.Button("Show Project Manager"))
            {
                EditorWindow.GetWindow <ECLProjectManager> (false, "CoolapeProject", true);
            }
            Close();
            return;
        }

        if (ECLProjectManager.data.hotUpgradeServers.Count > 0)
        {
            ECLEditorUtl.BeginContents();
            {
                List <string> toolbarNames = new List <string> ();
                for (int i = 0; i < ECLProjectManager.data.hotUpgradeServers.Count; i++)
                {
                    HotUpgradeServerInfor dd = ECLProjectManager.data.hotUpgradeServers [i] as HotUpgradeServerInfor;
                    toolbarNames.Add(dd.name);
                }
                selectedServerIndex = GUILayout.Toolbar(selectedServerIndex, toolbarNames.ToArray());
                HotUpgradeServerInfor hsi = ECLProjectManager.data.hotUpgradeServers [selectedServerIndex] as HotUpgradeServerInfor;
                selectedServer = hsi;
//						ECLProjectSetting.cellServerInor (hsi, false);
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Key:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.key);
                }
                GUILayout.EndHorizontal();
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Hot Upgrade Base Url:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.hotUpgradeBaseUrl);
                }
                GUILayout.EndHorizontal();
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Host 4 Upload Upgrade Package:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.host4UploadUpgradePackage);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Port 4 Upload Upgrade Package:", ECLEditorUtl.width200);
                    EditorGUILayout.IntField(selectedServer.port4UploadUpgradePackage);
                }
                GUILayout.EndHorizontal();
            }
            ECLEditorUtl.EndContents();
        }

        if (selectedServer == null)
        {
            GUILayout.Label("Please select a server!");
            return;
        }

        EditorGUILayout.BeginHorizontal();
        {
            GUI.color = Color.green;
            if (GUILayout.Button("Refresh", GUILayout.Height(40f)))
            {
                setData();
            }
            GUI.color = Color.white;
            if (!isSelectMod)
            {
                if (GUILayout.Button("Save", GUILayout.Height(40f)))
                {
                    if (mList == null || mList.Count == 0)
                    {
                        Debug.LogWarning("Nothing need to save!");
                        return;
                    }
                    string str = JSON.JsonEncode(mList);
                    File.WriteAllText(Application.dataPath + "/" + cfgPath, str);
                }
            }
        }
        EditorGUILayout.EndHorizontal();

        ECLEditorUtl.BeginContents();
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Package Name", GUILayout.Width(160));
                EditorGUILayout.LabelField("MD5", GUILayout.Width(250));
                EditorGUILayout.LabelField("Exist?", GUILayout.Width(40));
                EditorGUILayout.LabelField("Upload?", GUILayout.Width(60));
                EditorGUILayout.LabelField("...", GUILayout.Width(60));
                EditorGUILayout.LabelField("Notes");
            }
            EditorGUILayout.EndHorizontal();
            if (mList == null)
            {
                return;
            }
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 75));
            {
                for (int i = mList.Count - 1; i >= 0; i--)
                {
                    item = ListEx.getMap(mList, i);

                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.TextField(MapEx.getString(item, "name"), GUILayout.Width(160));
                        EditorGUILayout.TextField(MapEx.getString(item, "md5"), GUILayout.Width(250));

                        if (!MapEx.getBool(item, "exist"))
                        {
                            GUI.color = Color.red;
                        }
                        EditorGUILayout.TextField(MapEx.getBool(item, "exist") ? "Yes" : "No", GUILayout.Width(40));
                        GUI.color = Color.white;
                        if (!isUploaded(item))
                        {
                            GUI.color = Color.red;
                        }
                        EditorGUILayout.TextField(isUploaded(item) ? "Yes" : "No", GUILayout.Width(60));
                        GUI.color = Color.white;
                        if (MapEx.getBool(item, "exist"))
                        {
                            GUI.enabled = true;
                        }
                        else
                        {
                            GUI.enabled = false;
                        }
                        GUI.color = Color.yellow;
                        if (isSelectMod)
                        {
                            if (GUILayout.Button("select", GUILayout.Width(60f)))
                            {
                                Close();
                                Utl.doCallback(onSelectedCallback, item, selectedCallbackParams);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("upload", GUILayout.Width(60f)))
                            {
                                if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel"))
                                {
                                    selectedPackageName = MapEx.getString(item, "name");
                                    uploadUpgradePackage(MapEx.getString(item, "name"));
                                }
                            }
                            if (GUILayout.Button("同步OSS", GUILayout.Width(60f)))
                            {
                                if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel"))
                                {
                                    uploadOss(MapEx.getString(item, "name"));
                                }
                            }
                        }

                        GUI.color       = Color.white;
                        GUI.enabled     = true;
                        item ["remark"] = EditorGUILayout.TextArea(MapEx.getString(item, "remark"));

                        GUILayout.Space(5);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndScrollView();
        }
        ECLEditorUtl.EndContents();
    }
Ejemplo n.º 25
0
    static void doCreate(string path, Hashtable lastOtherVer, Hashtable lastPriorityVer, Hashtable lastCfgdataVer, ref Hashtable outMap)
    {
        string[] fileEntries = Directory.GetFiles(path);
        string   extension   = "";
        string   filePath    = "";
        string   md5Str      = "";

        foreach (string fileName in fileEntries)
        {
            extension = Path.GetExtension(fileName);
            if (ECLEditorUtl.isIgnoreFile(fileName))
            {
                continue;
            }
            filePath = filter(fileName);
            filePath = filePath.Replace("\\", "/");
            filePath = filePath.Replace("/upgradeRes4Publish/", "/upgradeRes/");

            if (ECLProjectManager.isModified(fileName))
            {
                md5Str = Utl.MD5Encrypt(File.ReadAllBytes(fileName));
            }
            else
            {
                md5Str = MapEx.getString(lastOtherVer, filePath);
                if (string.IsNullOrEmpty(md5Str))
                {
                    md5Str = MapEx.getString(lastPriorityVer, filePath);
                }
                else if (string.IsNullOrEmpty(md5Str))
                {
                    md5Str = MapEx.getString(lastCfgdataVer, filePath);
                }
            }
            outMap [filePath] = md5Str;
        }

        string[] dirEntries = Directory.GetDirectories(path);
        foreach (string dir in dirEntries)
        {
            //跳过不同平台的资源
                        #if UNITY_ANDROID
            if (Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("Standalone") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_IOS
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("Standalone") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_STANDALONE_WIN
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_STANDALONE_OSX
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("Standalone"))
            {
                continue;
            }
#endif
            doCreate(dir, lastOtherVer, lastPriorityVer, lastCfgdataVer, ref outMap);
        }
    }
Ejemplo n.º 26
0
    public override void OnInspectorGUI()
    {
        avata = (CLRoleAvata)target;
        ECLEditorUtl.BeginContents();
        {
            if (isAddBones || isShowBones)
            {
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField("Bone Name", GUILayout.Width(100));
                    EditorGUILayout.LabelField("Bone Transform", GUILayout.Width(150));
                }
                GUILayout.EndHorizontal();
            }

            if (isShowBones)
            {
                for (int i = 0; i < avata.bonesNames.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.TextField(avata.bonesNames [i], GUILayout.Width(100));
                        EditorGUILayout.ObjectField(avata.bonesList [i], typeof(Transform), GUILayout.Width(150));
                        if (GUILayout.Button("-"))
                        {
                            if (EditorUtility.DisplayDialog("Confirm", "确定要删除?", "Okay", "Cancel"))
                            {
                                avata.bonesNames.RemoveAt(i);
                                avata.bonesList.RemoveAt(i);
                                EditorUtility.SetDirty(avata);
                                break;
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }

            if (isAddBones)
            {
                GUILayout.BeginHorizontal();
                {
                    addBoneName = EditorGUILayout.TextField(addBoneName, GUILayout.Width(100));
                    addBone     = (Transform)(EditorGUILayout.ObjectField(addBone, typeof(Transform), GUILayout.Width(150)));
                    if (GUILayout.Button("+"))
                    {
                        if (string.IsNullOrEmpty(addBoneName))
                        {
                            EditorUtility.DisplayDialog("Confirm", "Bone Name can not null?", "Okay");
                            return;
                        }
                        if (avata.bonesMap.ContainsKey(addBoneName))
                        {
                            EditorUtility.DisplayDialog("Confirm", "Bone Name allready exsit, please check then name Uniqueness?", "Okay");
                            return;
                        }
                        if (addBone == null)
                        {
                            EditorUtility.DisplayDialog("Confirm", "Bone can not null?", "Okay");
                            return;
                        }
                        avata.bonesNames.Add(addBoneName);
                        avata.bonesList.Add(addBone);
                        avata.bonesMap [addBoneName] = addBone;
                        EditorUtility.SetDirty(avata);
                        addBone     = null;
                        addBoneName = "";
                    }
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button(isShowBones ? "Hide Bones" : "Show Bones"))
                {
                    isShowBones = !isShowBones;
                }
                if (GUILayout.Button("Add Bones"))
                {
                    isAddBones = true;
                }
            }
            GUILayout.EndHorizontal();
        }
        ECLEditorUtl.EndContents();

        ECLEditorUtl.BeginContents();
        {
            if (avata.bodyPartNames != null)
            {
                for (int i = 0; i < avata.bodyPartNames.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        if (selectedPartindex == i)
                        {
                            GUI.color = Color.yellow;
                        }
                        if (GUILayout.Button(avata.bodyPartNames [i]))
                        {
                            selectedPartindex = i;
                            isShowNewBodyPart = false;
                        }
                        GUI.color = Color.white;
                        if (GUILayout.Button("-", GUILayout.Width(30)))
                        {
                            if (EditorUtility.DisplayDialog("Confirm", "确定要删除?", "Okay", "Cancel"))
                            {
                                avata.bodyPartNames.RemoveAt(i);
                                break;
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                    if (selectedPartindex == i)
                    {
                        avata.bodyParts [i] = showOnePart(avata.bodyParts [i], false);
                    }
                }
            }
            if (isShowNewBodyPart)
            {
                newBodyPart = newBodyPart == null ? new CLBodyPart() : newBodyPart;
                newBodyPart = showOnePart(newBodyPart, true);
                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Clean"))
                    {
                        newBodyPart.cellNames.Clear();
//                        newBodyPart.materials.Clear ();
                        newBodyPart.materialNames.Clear();
                        newBodyPart.partObjs.Clear();
                        newBodyPart.animatorControllers.Clear();
                        cellName   = "";
                        onePartObj = null;
                    }
                    if (GUILayout.Button("Save Body Part"))
                    {
                        doAddBodyPart();
                    }
                }
                GUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Add Body Part"))
            {
                selectedPartindex = -1;
                newBodyPart       = new CLBodyPart();
                isShowNewBodyPart = true;
            }
        }
        ECLEditorUtl.EndContents();
        testPartName = EditorGUILayout.TextField("Part Name", testPartName);
        testCellName = EditorGUILayout.TextField("Cell Name", testCellName);
        if (GUILayout.Button("test"))
        {
            avata.setMapindex();
            avata.switch2xx(testPartName, testCellName);
        }

        if (GUILayout.Button("clean Material"))
        {
            avata.cleanMaterial();
        }
        if (GUILayout.Button("set Default Material"))
        {
            avata.setDefaultMaterial();
        }
    }
Ejemplo n.º 27
0
    void  initData(string path, int tabs)
    {
        //跳过不同平台的资源
#if UNITY_ANDROID
        if (Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX"))
        {
            return;
        }
#elif UNITY_IOS
        if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX"))
        {
            return;
        }
#elif UNITY_STANDALONE_WIN
        if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("StandaloneOSX"))
        {
            return;
        }
#elif UNITY_STANDALONE_OSX
        if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone"))
        {
            return;
        }
#elif UNITY_WEBGL
        if (Path.GetFileName(path).Equals("Android") || Path.GetFileName(path).Equals("IOS") || Path.GetFileName(path).Equals("Standalone") || Path.GetFileName(path).Equals("StandaloneOSX"))
        {
            return;
        }
#endif

        ECLResInfor ri = new ECLResInfor();
        path            = path.Replace("\\", "/");
        ri.path         = path;
        ri.name         = Path.GetFileName(path);
        ri.isDir        = true;
        ri.selected     = true;
        ri.tabs         = tabs;
        ri.relativePath = ri.path.Replace(Application.dataPath + "/", "");
        ri.publishPath  = Utl.filterPath(ri.relativePath);
        ri.ver          = "";
        datas.Add(ri);

        string[] fileEntries = Directory.GetFiles(path);         //因为Application.dataPath得到的是型如 "工程名称/Assets"
        int      count       = fileEntries.Length;
        string   fileName    = "";
        string   extension   = "";
        for (int i = 0; i < count; i++)
        {
            fileName  = fileEntries [i];
            extension = Path.GetExtension(fileName);
            if (ECLEditorUtl.isIgnoreFile(fileName))
            {
                continue;
            }
            totalFiles++;
            ri              = new ECLResInfor();
            fileName        = fileName.Replace("\\", "/");
            ri.path         = fileName;
            ri.name         = Path.GetFileName(fileName);
            ri.isDir        = false;
            ri.selected     = true;
            ri.tabs         = tabs + 1;
            ri.relativePath = ri.path.Replace(Application.dataPath + "/", "");
            ri.publishPath  = Utl.filterPath(ri.relativePath);
            ri.ver          = Utl.MD5Encrypt(File.ReadAllBytes(fileName));     //MapEx.getString (resLastUpgradeVer, ri.publishPath);
            datas.Add(ri);
            selectedDatas.Add(ri);
        }

        string[] dirEntries = Directory.GetDirectories(path);
        count = dirEntries.Length;
        string dir = "";
        for (int i = 0; i < count; i++)
        {
            initData(dirEntries [i], tabs + 1);
        }
    }
Ejemplo n.º 28
0
    void showCellSprite(Hashtable m)
    {
        Hashtable d   = MapEx.getMap(m, "data");
        Texture   tex = ECLEditorUtl.getObjectByPath(MapEx.getString(d, "path")) as Texture;

        if (tex == null)
        {
            return;
        }
//		NGUIEditorTools.DrawTiledTexture (rect, NGUIEditorTools.backdropTexture);
        Rect uv = new Rect(MapEx.getInt(d, "x"), MapEx.getInt(d, "y"), MapEx.getInt(d, "width"), MapEx.getInt(d, "height"));

        uv = NGUIMath.ConvertToTexCoords(uv, tex.width, tex.height);

        float scaleX = rect.width / uv.width;
        float scaleY = rect.height / uv.height;

        // Stretch the sprite so that it will appear proper
        float aspect   = (scaleY / scaleX) / ((float)tex.height / tex.width);
        Rect  clipRect = rect;

        if (aspect != 1f)
        {
            if (aspect < 1f)
            {
                // The sprite is taller than it is wider
                float padding = cellSize * (1f - aspect) * 0.5f;
                clipRect.xMin += padding;
                clipRect.xMax -= padding;
            }
            else
            {
                // The sprite is wider than it is taller
                float padding = cellSize * (1f - 1f / aspect) * 0.5f;
                clipRect.yMin += padding;
                clipRect.yMax -= padding;
            }
        }

        if (GUI.Button(rect, ""))
        {
            mSelectedSprite   = MapEx.getString(d, "name");
            isShowParckerView = false;
            currSelectSprite  = m;
        }
        GUI.DrawTextureWithTexCoords(clipRect, tex, uv);

        // Draw the selection
        if (mSelectedSprite == MapEx.getString(d, "name"))
        {
            NGUIEditorTools.DrawOutline(rect, new Color(0.4f, 1f, 0f, 1f));
        }

        GUI.backgroundColor = new Color(1f, 1f, 1f, 0.5f);
        GUI.contentColor    = new Color(1f, 1f, 1f, 0.7f);
        GUI.Label(new Rect(rect.x, rect.y + rect.height, rect.width, 32f), MapEx.getString(d, "name"), "ProgressBarBack");
        GUI.contentColor    = Color.white;
        GUI.backgroundColor = Color.white;
        GUILayout.Space(cellSize + 30);                 //这句主要目的是为了可以滑动
        rect.y += (cellSize + 30);
    }
Ejemplo n.º 29
0
    public override void OnInspectorGUI()
    {
        instance = target as CLSeekerByRay;
        //DrawDefaultInspector();
        ECLEditorUtl.BeginContents();
        {
            EditorGUILayout.HelpBox(
                "通过射线寻路\n" +
                "【注意注意注意】\n" +
                "  1.不需要A星;\n" +
                "  2.只能处理简单的寻路,最好是每个目标点都是可到达的;\n" +
                "  3.如果某个点不能到达,则肯定会寻设置的最大的寻路次数;\n" +
                "主要方法:\n" +
                "  .init();//初始化回调:寻路完成的回调,移动过程中的回调,到达目的地的回调\n" +
                "  .seek();//寻路,完成后会调用在init里设置的回调函数,第一个参数是路径,第二个参数为能否到达目的地\n" +
                "  .seekTarget();//寻路,会定时重新寻目标对象的路径\n" +
                "  .cancelSeekTarget();//取消对目标对象的定时寻路\n" +
                "  .startMove();//开始移动,只能通过此方法,不能直接改变canMove变量\n" +
                "  .stopMove();//停止移动\n"
                , MessageType.None, true);
        }
        ECLEditorUtl.EndContents();

        ECLEditorUtl.BeginContents();
        {
            GUI.color = Color.yellow;
            GUILayout.Label("*鼠标悬停在字段上有解释");
            GUI.color = Color.white;

            GUIContent uicontnt = null;

            ECLEditorUtl.BeginContents();
            {
                uicontnt = new GUIContent("Obstruct Mask", "障碍物的layer");
                instance.obstructMask = ECLEditorUtl.drawMaskField(uicontnt, instance.obstructMask);
                uicontnt                = new GUIContent("Ray Distance", "每次寻路发射的射线长度用于检测障碍物");
                instance.rayDistance    = EditorGUILayout.FloatField(uicontnt, instance.rayDistance);
                uicontnt                = new GUIContent("Ray Height", "每次寻路发射的射线高度用于检测障碍物");
                instance.rayHeight      = EditorGUILayout.FloatField(uicontnt, instance.rayHeight);
                uicontnt                = new GUIContent("Ray Dirs", "4方向、8方向、16方向发射线寻路");
                instance.rayDirs        = (CLSeekerByRay.SearchDirs)EditorGUILayout.EnumPopup(uicontnt, instance.rayDirs);
                uicontnt                = new GUIContent("Max Search Times", "最大寻路次数,防止死循环");
                instance.maxSearchTimes = EditorGUILayout.IntField(uicontnt, instance.maxSearchTimes);
            }
            ECLEditorUtl.EndContents();

            uicontnt                      = new GUIContent("Target", "目标对象");
            instance.target               = (Transform)EditorGUILayout.ObjectField(uicontnt, instance.target, typeof(Transform));
            uicontnt                      = new GUIContent("Move Speed", "移动速度");
            instance.speed                = EditorGUILayout.FloatField(uicontnt, instance.speed);
            uicontnt                      = new GUIContent("Turning Speed", "转动速度,【注意】当为负数时表示立即转到目标方向,大于0时则会慢慢转向目标方向");
            instance.turningSpeed         = EditorGUILayout.FloatField(uicontnt, instance.turningSpeed);
            uicontnt                      = new GUIContent("EndReached Distance", "离目标到一定距离后结束移动");
            instance.endReachedDistance   = EditorGUILayout.FloatField(uicontnt, instance.endReachedDistance);
            uicontnt                      = new GUIContent("Auto Move After Seek", "当寻路完成后就移动过去");
            instance.autoMoveOnFinishSeek = EditorGUILayout.Toggle(uicontnt, instance.autoMoveOnFinishSeek);
            uicontnt                      = new GUIContent("Moving By", "能哪种update移动");
            instance.movingBy             = (CLSeeker.MovingBy)EditorGUILayout.EnumPopup(uicontnt, instance.movingBy);
            uicontnt                      = new GUIContent("Moving Unscaled Time", "移动时忽略时间的缩放");
            instance.unscaledTime         = EditorGUILayout.Toggle(uicontnt, instance.unscaledTime);
            ECLEditorUtl.BeginContents();
            {
                uicontnt = new GUIContent("Soften Path", "柔化路径");
                instance.isSoftenPath = EditorGUILayout.Toggle(uicontnt, instance.isSoftenPath);
                if (instance.isSoftenPath)
                {
                    uicontnt = new GUIContent("Soften Type", "柔化路径的方式,line:直接把路径分段的接点处分成两个点进行柔;sler:在路径分段的接点处加入曲面插值");
                    instance.softenPathType = (CLAIPathUtl.SoftenPathType)EditorGUILayout.EnumPopup(uicontnt, instance.softenPathType);
                    if (instance.softenPathType == CLAIPathUtl.SoftenPathType.Slerp)
                    {
                        uicontnt = new GUIContent("Soften Slerp Factor", "曲面插值的个数,【注意】不能太大");
                        instance.softenFactor = EditorGUILayout.IntField(uicontnt, instance.softenFactor);
                    }
                }
            }
            ECLEditorUtl.EndContents();

            uicontnt          = new GUIContent("Debug Show Path", "显示路径");
            instance.showPath = EditorGUILayout.Toggle(uicontnt, instance.showPath);
        }
        ECLEditorUtl.EndContents();

        ECLEditorUtl.BeginContents();
        {
            if (GUILayout.Button("Search"))
            {
                instance.seek(instance.target.position);
            }

            if (GUILayout.Button("SearchTarget"))
            {
                instance.seekTarget(instance.target);
            }
            if (GUILayout.Button("Cancel SearchTarget"))
            {
                instance.cancelSeekTarget();
            }

            if (GUILayout.Button("Begain Move"))
            {
                instance.startMove();
            }

            if (GUILayout.Button("Stop Move"))
            {
                instance.stopMove();
            }
        }
        ECLEditorUtl.EndContents();
    }
Ejemplo n.º 30
0
    void showSpriteInfor()
    {
        if (currSelectSprite == null)
        {
            return;
        }
        Hashtable d             = MapEx.getMap(currSelectSprite, "data");
        int       times         = MapEx.getInt(currSelectSprite, "times");
        string    name          = MapEx.getString(d, "name");
        string    path          = MapEx.getString(d, "path");
        int       x             = MapEx.getInt(d, "x");
        int       y             = MapEx.getInt(d, "y");
        int       width         = MapEx.getInt(d, "width");
        int       height        = MapEx.getInt(d, "height");
        int       borderLeft    = MapEx.getInt(d, "borderLeft");
        int       borderRight   = MapEx.getInt(d, "borderRight");
        int       borderTop     = MapEx.getInt(d, "borderTop");
        int       borderBottom  = MapEx.getInt(d, "borderBottom");
        int       paddingLeft   = MapEx.getInt(d, "paddingLeft");
        int       paddingRight  = MapEx.getInt(d, "paddingRight");
        int       paddingTop    = MapEx.getInt(d, "paddingTop");
        int       paddingBottom = MapEx.getInt(d, "paddingBottom");
        Hashtable atlas         = MapEx.getMap(currSelectSprite, "atlas");
        string    atlasStr      = "";

        foreach (DictionaryEntry item in atlas)
        {
            atlasStr = PStr.b().a(atlasStr).a(",").a(item.Key.ToString()).e();
        }
        Texture tex = ECLEditorUtl.getObjectByPath(path) as Texture;
        Rect    r   = Rect.zero;

        if (tex != null)
        {
            float h    = 0;
            float w    = position.width - 160;
            float rate = w / tex.width;
            if (rate < 1)
            {
                h = tex.height * rate;
            }
            else
            {
                h = tex.height;
            }
            h = h > 200 ? h : 200;
            r = new Rect(0, 0, NumEx.getIntPart(w), NumEx.getIntPart(h));
            GUI.DrawTexture(r, tex, ScaleMode.ScaleToFit);
            GUILayout.Space(r.height + r.y);                    //这句主要目的是为了可以滑动
        }
        else
        {
            r = new Rect(0, 0, position.width - 160, 100);
            GUILayout.Space(r.height + r.y);                    //这句主要目的是为了可以滑动
        }

        GUILayout.Space(10);
        ECLEditorUtl.BeginContents();
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.TextField("name", name);
                EditorGUILayout.IntField("times", times);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("x", x);
                EditorGUILayout.IntField("y", y);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("width", width);
                EditorGUILayout.IntField("height", height);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("borderLeft", borderLeft);
                EditorGUILayout.IntField("borderRight", borderRight);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("borderTop", borderTop);
                EditorGUILayout.IntField("borderBottom", borderBottom);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("paddingLeft", paddingLeft);
                EditorGUILayout.IntField("paddingRight", paddingRight);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.IntField("paddingTop", paddingTop);
                EditorGUILayout.IntField("paddingBottom", paddingBottom);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.TextField("path", path);
            EditorGUILayout.TextField("Atlas", atlasStr);
        }
        ECLEditorUtl.EndContents();
    }