コード例 #1
0
 private void EditTT()
 {
     GUILayout.Label("寻找的文件夹路径");
     for (int i = 0; i < targetDirNames.Count; i++)
     {
         targetDirNames[i] = EditorGUILayout.TextField("", targetDirNames[i]);
     }
     if (GUILayout.Button("增加路径", GUILayout.Width(200)))
     {
         targetDirNames.Add("");
     }
     if (GUILayout.Button("点我:开始打开文件操作", GUILayout.Width(200)))
     {
         for (int i = 0; i < targetDirNames.Count; i++)
         {
             if (YangMenuHelper.IsDirectory(targetDirNames[i]))
             {
                 if (!targetDirNames[i].EndsWith("\\"))
                 {
                     targetDirNames[i] += "\\";
                 }
             }
             else
             {
                 targetDirNames.RemoveAt(i);
             }
         }
         YangMenuHelper.helperIns.WriteAllConfigLines("temp/openDir.txt", targetDirNames);
         InitFileDir();
         beginTT = true;
     }
 }
コード例 #2
0
    static void CopyP4Path()
    {
        var    assetGuids = Selection.assetGUIDs;
        string choosePath = "";

        foreach (var guid in assetGuids)
        {
            string path = AssetDatabase.GUIDToAssetPath(guid);
            choosePath += YangMenuHelper.helperIns.projAbsPath + path + "\n";
        }
        string[] dirs = choosePath.Split('/');
        choosePath = "/";
        bool isPath = false;

        for (int i = 0; i < dirs.Length; i++)
        {
            if (dirs[i].Equals("x5_mobile"))
            {
                isPath = true;
            }
            if (isPath)
            {
                choosePath += "/" + dirs[i];
            }
        }
        YangMenuHelper.ControlTextEditor(choosePath);
    }
コード例 #3
0
 public void OnStringChange(string value)
 {
     if (value != null)
     {
         lineValue = YangMenuHelper.ReplaceKVValue(lineValue, value);
     }
     WriteToConfig();
 }
コード例 #4
0
 public void OnInputChange()
 {
     //string nowValue = YangMenuHelper.GetXMLValue(lineValue);
     //int now = int.Parse(nowValue);
     //lineValue = YangMenuHelper.ReplaceXMLItemValue(lineValue, (now + addValue) + "");
     //WriteToConfig();
     lineValue = YangMenuHelper.ReplaceKVValue(lineValue, xmlValue);
     WriteToConfig();
 }
コード例 #5
0
    static void CopyPath()
    {
        var    assetGuids = Selection.assetGUIDs;
        string choosePath = "";

        foreach (var guid in assetGuids)
        {
            string path = AssetDatabase.GUIDToAssetPath(guid);
            choosePath += YangMenuHelper.helperIns.projAbsPath + path + "\n";
        }

        YangMenuHelper.ControlTextEditor(choosePath);
    }
コード例 #6
0
 public void OnBoolChange()
 {
     if (xmlValue.ToLower().Equals("true"))
     {
         xmlValue  = "false";
         lineValue = YangMenuHelper.ReplaceKVValue(lineValue, xmlValue);
     }
     else
     {
         xmlValue  = "true";
         lineValue = YangMenuHelper.ReplaceKVValue(lineValue, xmlValue);
     }
     WriteToConfig();
 }
コード例 #7
0
    private void InitFileDir()
    {
        dirfiles.Clear();
        for (int i = 0; i < targetDirNames.Count; i++)
        {
            if (YangMenuHelper.IsDirectory(targetDirNames[i]))
            {
                DirectoryInfo dir = new DirectoryInfo(targetDirNames[i]);

                FileSystemInfo[] files = dir.GetFileSystemInfos();
                dirfiles.AddRange(files);
            }
        }
    }
コード例 #8
0
    static void OpenAtlasDirs()
    {
        var assetGuids = Selection.assetGUIDs;

        foreach (var guid in assetGuids)
        {
            string path = AssetDatabase.GUIDToAssetPath(guid);
            if (path.Contains("/StaticResources/art/UIAtlas/NewUI"))
            {
                string filePath = YangMenuHelper.helperIns.projAbsPath + path;

                if (YangMenuHelper.IsDirectory(filePath))
                {
                    System.Diagnostics.Process.Start(filePath);
                }
                else
                {
                    filePath = YangMenuHelper.helperIns.GetDirectoryPath(filePath);
                }
                System.Diagnostics.Process.Start(filePath);
                string[] filess     = filePath.Split('/');
                bool     started    = false;
                string   targetName = "";
                for (int i = 0; i < filess.Length; i++)
                {
                    if (filess[i].Equals("NewUI"))
                    {
                        started = true;
                    }
                    else
                    {
                        if (started && filess[i] != "" && filess[i] != null)
                        {
                            targetName += filess[i] + "/";
                        }
                    }
                }
                string        target = YangMenuHelper.helperIns.projResourcePath + YangMenuHelper.helperIns.Get美术资源Path() + "UI/新界面程序用目录/";
                DirectoryInfo mydir  = new DirectoryInfo(target + targetName);
                if (mydir.Exists)
                {
                    target += targetName;
                }
                System.Diagnostics.Process.Start(target);
            }
            else
            {
            }
        }
    }
コード例 #9
0
 static void  择并复制路径()
 {
     //Selection.activeGameObject//选择的
     Transform[] ts = Selection.transforms;
     foreach (Transform t in ts)
     {
         UnityEngine.Object ossssA = PrefabUtility.GetPrefabParent(t.gameObject);
         EditorGUIUtility.PingObject(ossssA);
         if (null != ossssA)
         {
             EditorGUIUtility.PingObject(ossssA);
             string path = AssetDatabase.GetAssetPath(ossssA);
             YangMenuHelper.ControlTextEditor(YangMenuHelper.helperIns.projAbsPath + path);
             return;//这里找不到. 证明是运行期间.
         }
     }
     择并复制运行期间路径();
 }
コード例 #10
0
 private CONFIG_TYPE GetType(string value)
 {
     value = value.ToLower();
     if (value.Equals("true") || value.Equals("false"))
     {
         return(CONFIG_TYPE.BOOL);
     }
     else if (YangMenuHelper.IsInt(value))
     {
         return(CONFIG_TYPE.INT);
     }
     else if (YangMenuHelper.IsInput(value))
     {
         return(CONFIG_TYPE.INPUT);
     }
     else
     {
         return(CONFIG_TYPE.STRING);
     }
 }
コード例 #11
0
 static void  择并复制运行期间路径()
 {
     Transform[] ts = Selection.transforms;
     foreach (Transform t in ts)
     {
         string   name     = t.name;
         string[] allGuids = AssetDatabase.FindAssets(name, new string[] { "Assets" });
         string   nearPath = String2NearPath(name, allGuids);
         if (nearPath != "")
         {
             //找到了
             UnityEngine.Object o = AssetDatabase.LoadAssetAtPath(nearPath, typeof(UnityEngine.Object));
             if (null != o)
             {
                 EditorGUIUtility.PingObject(o);
             }
             YangMenuHelper.ControlTextEditor(YangMenuHelper.helperIns.projAbsPath + nearPath);
             break;
         }
     }
 }
コード例 #12
0
    private void ShowLoginOpenId()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("登录的token:" + UnityEngine.PlayerPrefs.GetString(VersionModule.LAST_SEL_TOKEN));
        if (GUILayout.Button("复制token", GUILayout.Width(70)))
        {
            YangMenuHelper.ControlTextEditor(UnityEngine.PlayerPrefs.GetString(VersionModule.LAST_SEL_TOKEN));
        }
        if (!string.IsNullOrEmpty(YangMenuHelper.helperIns.LockToken))
        {
            lockId    = YangMenuHelper.helperIns.LockToken;
            GUI.color = Color.green;
            if (GUILayout.Button("token已锁定,锁定的token:", GUILayout.Width(200)))
            {
                YangMenuHelper.helperIns.LockToken = "";
                YangMenuHelper.helperIns.WriteConfigLine(0, YangMenuHelper.LOCK_TOKEN, YangMenuHelper.helperIns.LockToken);
            }
            GUI.color = Color.white;
        }
        else
        {
            GUI.color = Color.gray;
            if (GUILayout.Button("token未锁定,点击将token锁定至:", GUILayout.Width(200)))
            {
                YangMenuHelper.helperIns.LockToken = lockId;
                YangMenuHelper.helperIns.WriteConfigLine(0, YangMenuHelper.LOCK_TOKEN, YangMenuHelper.helperIns.LockToken);
            }
            GUI.color = Color.white;
        }
        lockId = EditorGUILayout.TextField("", lockId);
        if (!string.IsNullOrEmpty(lockId) && !string.IsNullOrEmpty(YangMenuHelper.helperIns.LockToken) && !lockId.Equals(YangMenuHelper.helperIns.LockToken))
        {
            YangMenuHelper.helperIns.LockToken = "";//改变字符串初始化
            YangMenuHelper.helperIns.WriteConfigLine(0, YangMenuHelper.LOCK_TOKEN, YangMenuHelper.helperIns.LockToken);
        }
        //Debug.Log("lockId:" + lockId);

        GUILayout.EndHorizontal();
    }
コード例 #13
0
    public void Init(ReadConfigDelegate delegate_, ReadConfigDelegate editConfigReader, string clientConfigPath, string editorPath)
    {
        configDic.Clear();
        List <string> showConfigLine = new List <string>();

        editConfigReader(BasePath + "filter.txt", delegate(int currentLine, string line)
        {
            if (!YangMenuHelper.digOutAnnotation(line))
            {
                showConfigLine.Add(line);
            }
            return(true);
        });

        List <LineConfigInfo> configLines = new List <LineConfigInfo>();
        bool startTag = false;

        delegate_(clientConfigPath, delegate(int currentLine, string line)
        {
            line = line.Trim();
            //if (!startTag)
            //{
            //    if (line.Contains("<ClientConfig>"))
            //    {
            //        startTag = true;
            //    }
            //}
            //else
            //{
            //    if (line.Contains("</ClientConfig>"))
            //    {
            //        return false;//末尾了
            //    }

            //    if (startTag)
            //    {
            if (!YangMenuHelper.digOutAnnotation(line))
            {
                for (int i = 0; i < showConfigLine.Count; i++)
                {
                    if (line.Contains(showConfigLine[i] + "="))
                    {
                        LineConfigInfo lci = new LineConfigInfo();
                        lci.myType         = GetType(YangMenuHelper.GetKVValue(line));
                        if (lci.myType == CONFIG_TYPE.STRING)
                        {
                            ReadStringConfigValue(editConfigReader, BasePath + "_" + YangMenuHelper.GetKVKey(line) + ".txt", lci);
                        }
                        else if (lci.myType == CONFIG_TYPE.INPUT || lci.myType == CONFIG_TYPE.INT)
                        {
                        }

                        lci.lineValue = line;
                        lci.xmlValue  = YangMenuHelper.GetKVValue(line);
                        lci.lineIndex = currentLine;
                        configDic.Add(currentLine, lci);
                        break;
                    }
                }
            }
            //    }
            //}
            return(true);
        });
    }
コード例 #14
0
 static void CopyAnimDir()
 {
     YangMenuHelper.ControlTextEditor(YangMenuHelper.helperIns.projAbsPath + "Assets/StaticResources/art/UIAnim");
 }