zoukankan      html  css  js  c++  java
  • BaseEditor

    using UnityEngine;
    using System.Collections.Generic;
    using UnityEditor;
    using System.Text;
    using System.IO;
    using System;

    namespace Daemo
    {

    public class BaseEditor : Editor
    {

    /// <summary>
    /// 切割路径
    /// </summary>
    protected static string SplitPath(string path, string s)
    {
    string[] ss = path.Split('/');
    string result = "";
    bool flat = false;
    for (int i = 0; i < ss.Length; i++)
    {
    if (flat)
    {
    result = result + "/" + ss[i];
    }
    if (!flat && ss[i] == s)
    {
    flat = true;
    }
    }
    return result;
    }

    #region 遍历文件夹

    //遍历文件夹
    public static void HandlelDirections(string path, Action<string> action)
    {
    HandleLocalFiles(path, action);
    string[] childrenPaths = Directory.GetDirectories(path);
    foreach (string childPath in childrenPaths)
    {
    HandlelDirections(childPath, action);
    }
    }
    public static void HandleLocalFiles(string path, Action<string> action)
    {
    string[] files = Directory.GetFiles(path);
    for (int i = 0; i < files.Length; i++)
    {
    string file = files[i];
    file = file.Replace(@"",@"/");
    action(file);
    }
    }

    #endregion

    #region 遍历子节点

    public static void CycleChild(Transform t, Action<Transform> action)
    {
    action(t);
    for (int i = 0; i < t.childCount; i++)
    {

    if (t.childCount > 0)
    CycleChild(t.GetChild(i), action);
    }
    }

    #endregion

    }

    }

  • 相关阅读:
    AE开发 入门教程
    工作空间工厂 打开文件例子
    Delphi IDE使用的一些主要技巧
    动画演示 Delphi 2007 IDE 功能[2]
    Delphi的类与继承
    属性的自动完成
    DELPHI中函数、过程变量的声明与应用
    Delphi回车键切换焦点
    delphi 窗体的创建和释放
    delphi assigned函数的用法
  • 原文地址:https://www.cnblogs.com/rexzhao/p/7243168.html
Copyright © 2011-2022 走看看