Exemplo n.º 1
0
    public static void Save(appParam param)
    {
        string json = JsonUtility.ToJson(param);

        BinaryFormatter bf = new BinaryFormatter();
        print("save:::" + Application.persistentDataPath + "/" + param.designName + ".json");

        FileStream file = File.Open (Application.persistentDataPath + "/" + param.designName + ".json",FileMode.OpenOrCreate);
        bf.Serialize(file, json);
        file.Close();
        /*if (File.Exists( Application.persistentDataPath + "/" + param.designName + ".json")) {
            FileStream file = File.Create (Application.persistentDataPath + "/" + param.designName + ".json");
            bf.Serialize(file, json);
            file.Close();
        } else {
            FileStream overFile = File.Open(Application.persistentDataPath + "/" + param.designName + ".json",FileMode.);
            bf.Serialize (overFile, json);
            overFile.Close();
        }*/
    }
Exemplo n.º 2
0
    public void SaveInit()
    {
        _appParam = new appParam(_patternParam.Count);
        print(_patternParam.Count);

        BGColor bgColor = FindObjectOfType<BGColor> ();
        _appParam.BackGroundRGB = new Vector3 (bgColor.Bgred,bgColor.Bggreen,bgColor.Bgblue);
        _appParam.designName = "nonameDesign";

        try{
        PartsColor part = FindObjectOfType<PartsColor> ();
        _appParam.PartsRGB = new Vector3(part.Red,part.Green,part.Blue);

        }catch(Exception e){
            print(e.Message);
            _appParam.PartsRGB = Vector3.zero;
        }
        int i = 0;
        foreach(patternParam pp in _patternParam)
        {
            _appParam.link[i++] = pp.PatternInfo();
        }
    }