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); }
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); }
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;//这里找不到. 证明是运行期间. } } 择并复制运行期间路径(); }
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; } } }
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(); }
static void CopyAnimDir() { YangMenuHelper.ControlTextEditor(YangMenuHelper.helperIns.projAbsPath + "Assets/StaticResources/art/UIAnim"); }