コード例 #1
0
ファイル: ReadFile.cs プロジェクト: hungpro2341999/BrickDom
    public void LoadGame()
    {
        string       json = JsonDataGame.text;
        SavaDataGame a    = JsonUtility.FromJson <SavaDataGame>(json);

        //InforShapeSplit.InforShape = ListToDirectoryShape(a.shape);


        //InforShapeSplit.List_Point = ListToDataGamePositon(a.Postion);

        InforShapeSplit.ArrayDataGameShape = a.shape.ToArray();
        InforShapeSplit.ArrayPositonShape  = a.Postion.ToArray();

        //   StartCoroutine(Start_1(a.shape, a.Postion));
        //
        //Debug.Log("FILE : " + InforShapeSplit.InforShape.Count);
        //Debug.Log("FILE : " + InforShapeSplit.List_Point.Count);
        InforShapeSplit.Filter();
        CompleteCode = true;
        Debug.Log("Loading");
    }
コード例 #2
0
ファイル: ReadFile.cs プロジェクト: hungpro2341999/BrickDom
    public IEnumerator LoadFile()
    {
        string       s         = textAssetData.text;
        StringReader strReader = new StringReader(s);

        while (true)
        {
            string line = strReader.ReadLine();
            if (line != null)
            {
                if (!line.StartsWith("TypeShape") && line != "")
                {
                    Format(line);
                }

                yield return(new WaitForSeconds(0));
            }
            else
            {
                break;
            }
        }
        ListKey lKey = new ListKey();

        lKey.Key = InforShapeSplit.ListKey;

        //  SavingDataWithJson.SaveData<ListKey>(lKey, "Key.fun");

        string jsonKey = JsonUtility.ToJson(lKey);

        WriteStringKey(jsonKey);

        //    Debug.Log("Key khoi tao : " +SavingDataWithJson.LoadData<ListKey>("Key.fun").Key.Count);
        Dictionary <string, List <int[, ]> > SInforShape = InforShapeSplit.InforShape;
        Dictionary <string, List <Vector2> > SListShape  = InforShapeSplit.List_Point;

        List <DataGameShape>   DataShape        = DirctortToList(SInforShape, InforShapeSplit.ListKey);
        List <DataGamePositon> DataShapePositon = DirctortToListPositopn(SListShape, InforShapeSplit.ListKey);

        SavaDataGame save = new SavaDataGame(DataShape, DataShapePositon);



        string json = JsonUtility.ToJson(save);

        Debug.Log(json);
        SaveJson(json);


        // SavingDataWithJson.SaveData(save,"Dataa.fun");


        //  InforShapeSplit.Filter();

        Debug.Log("Get Data");

        CompleteCode = true;


        //Debug.Log("Get Data" + a.shape.Count);

        //for(int i = 0; i < a.shape.Count; i++)
        //{

        //        Debug.Log((a.shape[i].key)+"  "+ a.shape[i].GetListMatrix().Count);



        //}
        //Debug.Log("Get Data" + a.shape.Count);
    }