// CSV読み込み、ジャグ配列作成(DateTimeも、intも文字列として読込)
    static string[][] ReadCsvToJaggedArray(string path)
    {
        // ファイル読み込み
        // 引数説明:第1引数→ファイル読込先, 第2引数→エンコード
        StreamReader sr = new StreamReader(path, Encoding.GetEncoding("Shift_JIS"));

        // https://qiita.com/Akematty/items/2fbb61b55132ced4a3be
        // ストリームリーダーをstringに変換
        string strStream = sr.ReadToEnd();

        // StringSplitOptionを設定(空行は格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        // 行に分ける
        string[] lines = strStream.Split(new char[] { '\n' }, option);

        // 宣言
        string[][] arr = new string[lines.GetLength(0)][];

        // 順次配列に追加
        int i = 0;

        foreach (string line in lines)
        {
            string[] splitedData = line.Split(',');
            arr[i] = new string[] { splitedData[0], splitedData[1] };
            i++;
        }

        // StreamReaderを閉じる
        sr.Close();

        return(arr);
    }
    /// <summary>通过文件生成事件</summary>
    private void    createEventsFromFile(TextAsset[] texts)
    {
        if (texts.Length > 0)
        {
            // 用于存储所有文件行数据的列表
            List <string> linesOfAllFiles = new List <string>();

            foreach (var text in texts)
            {
                // 用于删除空元素的选项
                System.StringSplitOptions option = System.StringSplitOptions.RemoveEmptyEntries;

                // 以换行符为标志切分为一行一行
                string[] lines = text.text.Split(new char[] { '\r', '\n' }, option);

                linesOfAllFiles.AddRange(lines);
            }

            // 转换并生成事件数组
            ScriptParser parser = new ScriptParser();

            m_events = parser.parseAndCreateEvents(linesOfAllFiles.ToArray());
            Debug.Log("Created " + m_events.Length.ToString() + " events.");
        }
        else
        {
            // 清空事件
            m_events = new Event[0];
        }

        // 事件创建完成
        m_hasCreatedEvents = true;
    }
Example #3
0
    /// <summary>ファイルからイベントを生成する.</summary>
    private void    createEventsFromFile(TextAsset[] texts)
    {
        if (texts.Length > 0)
        {
            // すべてのファイルの行データを保持するリスト.
            List <string> linesOfAllFiles = new List <string>();

            foreach (var text in texts)
            {
                // 空の要素を削除するためのオプション.
                System.StringSplitOptions option = System.StringSplitOptions.RemoveEmptyEntries;

                // 改行コードで1行ごとに切り出す.
                string[] lines = text.text.Split(new char[] { '\r', '\n' }, option);

                linesOfAllFiles.AddRange(lines);
            }

            // パースしてイベントの配列を作る.
            ScriptParser parser = new ScriptParser();

            m_events = parser.parseAndCreateEvents(linesOfAllFiles.ToArray());
            Debug.Log("Created " + m_events.Length.ToString() + " events.");
        }
        else
        {
            // イベントを空にしておく.
            m_events = new Event[0];
        }

        // イベント作成済み.
        m_hasCreatedEvents = true;
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        sr = new StreamReader(Application.dataPath + "/AnalysSpaceLine/" + name + ".csv");
        string strStream = sr.ReadToEnd();

        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;
        string [] lines   = strStream.Split(new char[] { '\r', '\n' }, option);
        char []   spliter = new char [1] {
            ','
        };
        float[] xdata = new float[lines.Length];
        float[] ydata = new float[lines.Length];
        for (int i = 0; i < lines.Length; i++)
        {
            string[] splitedData = lines [i].Split(spliter, option);
            xdata[i] = float.Parse(splitedData[0]);
            ydata[i] = float.Parse(splitedData[1]);
        }

        LineRenderer lineRenderer = this.GetComponent <LineRenderer>();

        lineRenderer.enabled = true;
        lineRenderer.SetVertexCount(xdata.Length);
        for (int i = 0; i < xdata.Length; i++)
        {
            Vector3 pos = new Vector3(xdata[i], ydata[i], (float)i * 0.5f);
            lineRenderer.SetPosition(i, pos);
        }
    }
Example #5
0
        public static System.String[] SplitTSS(
            System.String target,
            System.String[] separator, System.StringSplitOptions options)
        {
            Exception e = new Exception();

            throw e;
        }
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);

        System.StringSplitOptions o = (System.StringSplitOptions)arg0;
        ToLua.Push(L, o);
        return(1);
    }
Example #7
0
    //Hip:0 LeftFoot:1 LeftHand:2 Head:3 RightHand:4 RightFoot:5 Body:6

    public ActPosition3(string pass)
    {
        string filename = System.IO.Path.GetFileNameWithoutExtension(pass);

        name  = filename.Substring(0, filename.Length - 2);
        frame = int.Parse(filename.Substring(filename.Length - 2));

        StreamReader sr        = new StreamReader(pass);
        string       strStream = sr.ReadToEnd();

        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;
        string [] lines   = strStream.Split(new char[] { '\r', '\n' }, option);
        char []   spliter = new char [1] {
            ','
        };
        for (int i = 0; i < lines.Length; i++)
        {
            string[] splitedData = lines [i].Split(spliter, option);

            switch (splitedData[0])
            {
            case "Head":
                position7[3, 0] = float.Parse(splitedData[1]);
                position7[3, 1] = float.Parse(splitedData[2]);
                break;

            case "Hip":
                position7[0, 0] = float.Parse(splitedData[1]);
                position7[0, 1] = float.Parse(splitedData[2]);
                break;

            case "LeftHand":
                position7[2, 0] = float.Parse(splitedData[1]);
                position7[2, 1] = float.Parse(splitedData[2]);
                break;

            case "RightHand":
                position7[4, 0] = float.Parse(splitedData[1]);
                position7[4, 1] = float.Parse(splitedData[2]);
                break;

            case "LeftFoot":
                position7[1, 0] = float.Parse(splitedData[1]);
                position7[1, 1] = float.Parse(splitedData[2]);
                break;

            case "RightFoot":
                position7[5, 0] = float.Parse(splitedData[1]);
                position7[5, 1] = float.Parse(splitedData[2]);
                break;

            case "Body":
                position7[6, 0] = float.Parse(splitedData[1]);
                position7[6, 1] = float.Parse(splitedData[2]);
                break;
            }
        }
    }
Example #8
0
    // Use this for initialization
    void Start()
    {
        int   pointer = 0;
        float minX, maxX, minY, maxY;

        for (float z = -1; z <= 9; z = z + 0.2f)//x座標
        {
            pointer++;
            minX = 0;
            maxX = 0;
            minY = 0;
            maxY = 0;
            for (float y = 0; y <= 2; y = y + 0.2f)      //y座標
            {
                for (float x = -1; x <= 1; x = x + 0.2f) //z座標
                {
                    Vector3 namepos = new Vector3(x, y, z);
                    sr = new StreamReader(Application.dataPath + "/AnalysSpaceResultSLIDE/" + namepos.ToString() + ".csv");
                    string strStream = sr.ReadToEnd();
                    System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;
                    string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);
                    if (lines.Length > 0)
                    {
                        if (minX >= x)
                        {
                            minX = x;
                        }
                        if (minY >= y)
                        {
                            minY = y;
                        }
                        if (maxX <= x)
                        {
                            maxX = x;
                        }
                        if (maxY <= y)
                        {
                            maxY = y;
                        }
                    }
                }
            }
            minXlist[pointer] = minX;
            maxXlist[pointer] = maxX;
            minYlist[pointer] = minY;
            maxYlist[pointer] = maxY;
        }

        for (int i = 1; i < minXlist.Length; i++)
        {
            if (minXlist[i] - minXlist[i - 1] > 0.6 || minXlist[i] - minXlist[i - 1] < -0.6)
            {
                minXlist[i - 1] = minXlist[i];
            }
        }
    }
Example #9
0
    // CSVデータを文字列型2次元配列に変換する
    // ファイルパス,変換される配列の値(参照渡し)
    public Dictionary <string, CharaData> readCSVData(string charaName)
    {
        TextAsset csv;
        string    stagePath = "CharaData/" + charaName + "_SkillPerformance";

        csv = Resources.Load(stagePath) as TextAsset;

        StringReader reader    = new StringReader(csv.text);
        string       strStream = reader.ReadToEnd();

        // StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        // 行に分ける
        string[] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        // カンマ分けの準備(区分けする文字を設定する)
        char[] spliter = new char[1] {
            ','
        };

        // 行数設定
        int h = lines.Length;
        // 列数設定
        int w = lines[0].Split(spliter, option).Length;

        // 返り値の2次元配列の要素数を設定
        Dictionary <string, CharaData> cdata = new Dictionary <string, CharaData>();

        // 行データを切り分けて,構造体配列へ変換する
        for (int i = 1; i < h; i++)
        {
            string[] splitedData = lines[i].Split(spliter, option);

            CharaData cd = new CharaData();
            cd.skill       = splitedData[0];
            cd.damage      = int.Parse(splitedData[1]);
            cd.attri       = splitedData[2];
            cd.startCorrec = float.Parse(splitedData[3]);
            cd.conboCorrec = float.Parse(splitedData[4]);
            cd.attackLevel = int.Parse(splitedData[5]);
            cd.startUp     = int.Parse(splitedData[6]);
            cd.active      = int.Parse(splitedData[7]);
            cd.recovery    = int.Parse(splitedData[8]);
            cd.blockStun   = int.Parse(splitedData[10]);
            cd.hitStun     = int.Parse(splitedData[11]);
            cd.guardDamage = int.Parse(splitedData[12]);

            cdata.Add(cd.skill, cd);

            skillName.Add(cd.skill);
        }

        return(cdata);
    }
Example #10
0
    private void LoadMap_FromTextFile(string filename)
    {
        string   txtMapData = "";
        FileInfo fi         = new FileInfo(Application.dataPath + "/StreamingAssets/" + "/MapData/" + filename);

        try
        {
            // 一行毎読み込み
            using (StreamReader sr = new StreamReader(fi.OpenRead(), Encoding.UTF8))
            {
                txtMapData = sr.ReadToEnd();
            }
        }
        catch (Exception e)
        {
            Debug.LogWarning(e.Message);
        }

        if (txtMapData.Length != 0)
        {
            // 空の要素を削除するためのオプション.
            System.StringSplitOptions option = System.StringSplitOptions.RemoveEmptyEntries;

            // 改行コードで1行ごとに切り出す..
            string[] lines = txtMapData.Split(new char[] { '\r', '\n' }, option);

            // 一行目はマップの大きさ.
            // "," で1区間ごとに切り出す.
            string[] sizewh = lines[0].Split(new char[] { ',' }, option);
            this.MapSize_X = int.Parse(sizewh[0]);
            this.MapSize_Y = int.Parse(sizewh[1]);

            string[] mapdata = new string[this.MapSize_Y * this.MapSize_X];

            for (int y = 0; y < this.MapSize_Y; ++y)
            {
                // "," で1区間ごとに切り出す.
                string[] data = lines[1 + y].Split(new char[] { ',' }, option);   //一行目はマップの大きさなので2行目から

                for (int x = 0; x < this.MapSize_X; ++x)
                {
                    mapdata[y * MapSize_X + x] = data[x];
                }
            }

            // ゲームで使う配列に丸ごとコピー
            this.mapData = mapdata;
        }
        else
        {
            //テキストが空だった
            Debug.LogWarning("txtMapData is null");
        }
    }
Example #11
0
    // CSVデータを文字列型2次元配列に変換する
    // ファイルパス,変換される配列の値(参照渡し)
    public static NumYArray readCSVData(string path)
    {
        TextAsset csv;

        csv = Resources.Load(path) as TextAsset;

        StringReader reader    = new StringReader(csv.text);
        string       strStream = reader.ReadToEnd();

        // StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        // 行に分ける
        string[] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        // カンマ分けの準備(区分けする文字を設定する)
        char[] spliter = new char[1] {
            ','
        };

        // 行数設定
        int h = lines.Length;
        // 列数設定
        int w = lines[1].Split(spliter, option).Length;

        // 返り値の2次元配列の要素数を設定
        List <List <float> > sdata = new List <List <float> >();

        // 配列の要素確保
        for (int i = 0; i < h - 1; i++)
        {
            sdata.Add(new List <float>());
            for (int j = 0; j < w; j++)
            {
                sdata[i].Add(0);
            }
        }

        // 行データを切り分けて,2次元配列へ変換する
        for (int i = 1; i < h; i++)
        {
            string[] splitedData = lines[i].Split(spliter, option);

            for (int j = 0; j < w; j++)
            {
                sdata[i - 1][j] = float.Parse(splitedData[j]);
            }
        }

        NumYArray returnArray = new NumYArray(sdata);

        return(returnArray);
    }
Example #12
0
    private int width  = 0;   //列数

#if OLD_VER
// CSVデータ読み込み関数(旧バージョン)
// 引数:データパス
    private int[, ] readCSVData(string path)
    {
        // 返り値の2次元配列
        int[,] readToIntData;

        // ストリームリーダーsrに読み込む
        // ※Application.dataPathはプロジェクトデータのAssetフォルダまでのアクセスパスのこと,
        StreamReader sr = new StreamReader(Application.dataPath + path);
        // ストリームリーダーをstringに変換
        string strStream = sr.ReadToEnd();

        // StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        // 行に分ける
        string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        // カンマ分けの準備(区分けする文字を設定する)
        char [] spliter = new char[1] {
            ','
        };

        // 行数設定
        int heightLength = lines.Length;
        // 列数設定
        int widthLength = lines[0].Split(spliter, option).Length;

        // 返り値の2次元配列の要素数を設定
        readToIntData = new int[heightLength, widthLength];

        // カンマ分けをしてデータを完全分割
        for (int i = 0; i < heightLength; i++)
        {
            for (int j = 0; j < widthLength; j++)
            {
                //カンマ分け
                string [] readStrData = lines[i].Split(spliter, option);
                //型変換
                readToIntData[i, j] = int.Parse(readStrData[j]);
            }
        }

        // 確認表示用の変数(行数、列数)を格納する
        this.height = heightLength; //行数
        this.width  = widthLength;  //列数

        // 返り値
        return(readToIntData);
    }
Example #13
0
    private int width  = 0;   //列数

    //CSVデータ読み込み関数
    //引数:データパス
    private string[,] readCSVData(string path)
    {
        //返り値の2次元配列
        string[,] readToIntData;

        TextAsset csvFile;

        csvFile = Resources.Load(path, typeof(TextAsset)) as TextAsset;

        //StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //行に分ける
        string[] lines = csvFile.text.Split(new char[] { '\r', '\n' }, option);

        //カンマ分けの準備(区分けする文字を設定する)
        char[] spliter = new char[1] {
            ','
        };

        //行数設定
        int heightLength = lines.Length;
        //列数設定
        int widthLength = lines[0].Split(spliter, option).Length;

        //返り値の2次元配列の要素数を設定
        readToIntData = new string[heightLength, widthLength];

        //カンマ分けをしてデータを完全分割
        for (int i = 0; i < heightLength; i++)
        {
            for (int j = 0; j < widthLength; j++)
            {
                //カンマ分け
                string[] readStrData = lines[i].Split(spliter, option);
                //型変換
                //                readToIntData[i, j] = int.Parse(readStrData[j]);
                //Debug.Log(i + "-" + j+":" + readStrData[j]);
                readToIntData[i, j] = readStrData[j];
            }
        }

        //確認表示用の変数(行数、列数)を格納する
        this.height = heightLength;   //行数
        this.width  = widthLength;    //列数

        //返り値
        return(readToIntData);
    }
Example #14
0
    private int randomSecretThema; //秘密のテーマのランダム変数

    private string[,] readCSVData(string path)
    {
        randomThema       = UnityEngine.Random.Range(0, height); //共通のテーマ
        randomSecretThema = UnityEngine.Random.Range(1, width);  //秘密のテーマ
        //返り値の2次元配列
        string[,] readToIntData;

        var sr = Resources.Load("Csv/Thema");
        //ストリームリーダーをstringに変換
        string strStream = sr.ToString();

        //StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //行に分ける
        string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        //カンマ分けの準備(区分けする文字を設定する)
        char [] spliter = new char[1] {
            ','
        };

        //行数設定
        int heightLength = lines.Length;
        //列数設定
        int widthLength = lines[0].Split(spliter, option).Length;

        //返り値の2次元配列の要素数を設定
        readToIntData = new string[heightLength, widthLength];

        //カンマ分けをしてデータを完全分割
        for (int i = 0; i < heightLength; i++)
        {
            for (int j = 0; j < widthLength; j++)
            {
                //カンマ分け
                string [] readStrData = lines[i].Split(spliter, option);
                //型変換
                readToIntData[i, j] = readStrData[j];
            }
        }

        //確認表示用の変数(行数、列数)を格納する
        this.height = heightLength; //行数
        this.width  = widthLength;  //列数

        //返り値
        return(readToIntData);
    }
Example #15
0
        public static System.String[] SplitMSS(
            System.String target,
            System.String[] separator, System.StringSplitOptions options)
        {
            object result;

            if (TestSpecificStubsUtil.RunTestSpecificStub(System.Reflection.MethodBase.GetCurrentMethod(), new object[] { target, separator, options }, out result))
            {
                return((System.String[])result);
            }
            else
            {
                return(target.Split(separator, options));
            }
        }
    //第一引数…読み込むCSVデータファイルのパス 
    public static string[] ReadCsvData(string path_)
    {
        //ファイル読み込み
        StreamReader sr = new StreamReader(path_);
        //stringに変換
        string strStream = sr.ReadToEnd();

        //カンマとカンマの間に何もなかったら格納しないことにする設定
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //行に分ける
        string[] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        return(lines);
    }
Example #17
0
    public string[] EpisodeStageNum(string lines_, char[] spliter_, int trialNumber_)
    {
        //カンマとカンマの間に何もなかったら格納しないことにする設定
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //リターン値。カンマ分けしたデータを一行分格納する。
        string[] CommaSeparationData = new string[trialNumber_];
        for (int i = 0; i < trialNumber_; i++)
        {
            //1行にあるCsvDataの要素数分準備する
            string[] readStrData = new string[trialNumber_];
            //CsvDataを引数の文字で区切って1つずつ格納
            readStrData = lines_.Split(spliter_, option);
            //readStrDataをリターン値に格納
            CommaSeparationData[i] = readStrData[i];
        }
        return(CommaSeparationData);
    }
Example #18
0
    private int m_width  = 0;   //列数
    //***************************************************************************
    /// <summary> 指定されたファイルを読み込む</summary>
    /// <param name="filePath">ファイル名</param>
    /// <returns>ファイルの内容(2次元配列)</returns>
    //***************************************************************************
    public byte[,] Read(string filePath)
    {
        //返り値の2次元配列
        byte[,] LoadCSVData;

        //読み込み
        //Application.dataPathはプロジェクトデータのAssetフォルダまでのパス
        StreamReader streamReader = new StreamReader(Application.dataPath + "/" + filePath);
        //stringに変換
        string strStream = streamReader.ReadToEnd();

        //StringSplitOptionを設定
        //カンマとカンマの間に何もないときは格納しない
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        string[] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        //区分けする文字の設定
        char[] spliter = new char[1] {
            ','
        };

        //行数設定
        m_height = lines.Length;
        //列数設定
        m_width = lines[0].Split(spliter, option).Length;

        //返り値の2次元配列の要素数を設定
        LoadCSVData = new byte[m_height, m_width];
        //カンマ分
        for (int i = 0; i < m_height; i++)
        {
            for (int j = 0; j < m_width; j++)
            {
                //カンマ分け
                string[] loadData = lines[i].Split(spliter, option);
                //型変換
                LoadCSVData[i, j] = byte.Parse(loadData[j]);
            }
        }
        //返り値
        return(LoadCSVData);
    }
Example #19
0
    private int width  = 0;   //列数



    // CSVデータを文字列型2次元配列に変換する
    //                      ファイルパス,変換される配列の値(参照渡し)
    private void readCSVData(string path, ref string[,] sdata)
    {
        // ストリームリーダーsrに読み込む
        StreamReader sr = new StreamReader(path);
        // ストリームリーダーをstringに変換
        string strStream = sr.ReadToEnd();

        // StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        // 行に分ける
        string[] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        // カンマ分けの準備(区分けする文字を設定する)
        char[] spliter = new char[1] {
            ','
        };

        // 行数設定
        int h = lines.Length;
        // 列数設定
        int w = lines[0].Split(spliter, option).Length;

        // 返り値の2次元配列の要素数を設定
        sdata = new string[h, w];

        // 行データを切り分けて,2次元配列へ変換する
        for (int i = 0; i < h; i++)
        {
            string[] splitedData = lines[i].Split(spliter, option);

            for (int j = 0; j < w; j++)
            {
                sdata[i, j] = splitedData[j];
            }
        }

        // 確認表示用の変数(行数、列数)を格納する
        this.height = h;   //行数
        this.width  = w;   //列数
    }
Example #20
0
    private string[] MyCsvRead(string path_)
    {
        //ファイル読み込み
        //StreamReader sr = new StreamReader(path_);
        WWW www = new WWW(path_);

        while (!www.isDone)
        {
            //ファイル読み込み終わるまで空回し。
        }

        //stringに変換
        string strStream = www.text;

        //カンマとカンマの間に何もなかったら格納しないことにする設定
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //行に分ける
        string[] lines = strStream.Split(new string[] { "@last" }, option);
        return(lines);
    }
Example #21
0
        static StackObject *Split_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.StringSplitOptions options = (System.StringSplitOptions) typeof(System.StringSplitOptions).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.String[] separator = (System.String[]) typeof(System.String[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.String instance_of_this_method;
            instance_of_this_method = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Split(separator, options);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #22
0
    //private bool hitflag;
    // Use this for initialization
    void Start()
    {
        this.GetComponent <Renderer>().material = nohitMaterial;
        delta_time = 0;
        mode       = 1;
        pointer    = 0;
        pos        = transform.position;
        sr         = new StreamReader(Application.dataPath + "/AnalysSpaceHip/" + transform.position.ToString() + ".csv");
        string strStream = sr.ReadToEnd();

        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;
        string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);
        if (lines.Length > 0)
        {
            timedata = float.Parse(lines[0]);
        }
        else
        {
            timedata = 100f;
        }
    }
Example #23
0
    // Update is called once per frame
    void Update()
    {
        delta_time += (int)(Time.deltaTime * 1000f);

        if (delta_time > timedata[timedata.Length - 1])
        {
            delta_time = 0;
            pointer    = 0;
        }

        if (delta_time > timedata[pointer] || delta_time == 0)
        {
            foreach (Transform n in gameObject.transform)
            {
                GameObject.Destroy(n.gameObject);
            }
            pointer++;
            sr = new StreamReader(filelist[pointer]);
            string strStream = sr.ReadToEnd();
            System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;
            string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);
            positions = new Vector3[lines.Length];
            char [] spliter = new char [1] {
                ','
            };

            for (int i = 0; i < lines.Length; i++)
            {
                string[] splitedData = lines [i].Substring(1, lines[i].Length - 2).Split(spliter, option);
                positions[i] = new Vector3(float.Parse(splitedData[0]), float.Parse(splitedData[1]), float.Parse(splitedData[2]));
            }
            foreach (Vector3 v in positions)
            {
                GameObject obj = Instantiate(sphere, v, transform.rotation);
                obj.transform.SetParent(transform);
            }
        }
    }
Example #24
0
    Graph ReadGraph(string path)
    {
        //ストリームリーダーsrに読み込む
        //※Application.dataPathはプロジェクトデータのAssetフォルダまでのアクセスパスのこと,
        Graph g = new Graph();

        TextAsset    csv = Resources.Load("data/" + path) as TextAsset;
        StringReader sr  = new StringReader(csv.text);
        //StreamReader sr = new StreamReader(Application.dataPath +path);
        //ストリームリーダーをstringに変換
        string strStream = sr.ReadToEnd();

        //StringSplitOptionを設定(要はカンマとカンマに何もなかったら格納しないことにする)
        System.StringSplitOptions option = StringSplitOptions.RemoveEmptyEntries;

        //行に分ける
        string [] lines = strStream.Split(new char[] { '\r', '\n' }, option);

        //カンマ分けの準備(区分けする文字を設定する)
        char [] spliter = new char[1] {
            '\t'
        };

        //行数設定
        int heightLength = lines.Length;

        //カンマ分けをしてデータを完全分割
        for (int i = 0; i < heightLength; i++)
        {
            string [] readData = lines[i].Split(spliter, option);
            int       id1      = int.Parse(readData[0]);
            int       id2      = int.Parse(readData[1]);
            g.AddEdge(id1, id2);
        }
        return(g);
    }