Ejemplo n.º 1
0
 void Load()
 {
     using (Stream file = File.OpenRead(Application.dataPath + "/1.txt"))
     {
         helloworld hellow = helloworld.Parser.ParseFrom(file);
         print(hellow.Id + "    " + hellow.Str + "%%%%%%%%%%" + hellow.Opt);
     }
 }
Ejemplo n.º 2
0
    void Save()
    {
        helloworld h1 = new helloworld();

        h1.Id  = 100;
        h1.Str = "kl";
        h1.Opt = 10000;
        using (Stream output = File.OpenWrite(Application.dataPath + "/1.txt"))
        {
            //CodedOutputStream st = new CodedOutputStream(output);
            h1.WriteTo(output);
        }
    }
Ejemplo n.º 3
0
 private void OnGUI()
 {
     if (GUILayout.Button("", GUILayout.Width(100), GUILayout.Height(50)))
     {
         helloworld h1 = new helloworld();
         h1.Id  = 100;
         h1.Str = "kl";
         h1.Opt = 10000;
         byte[] databytes = h1.ToByteArray();
         File.WriteAllBytes(Application.dataPath + "/1.md", databytes);
     }
     if (GUILayout.Button("", GUILayout.Width(100), GUILayout.Height(50)))
     {
         //byte[] byts = File.ReadAllBytes(Application.dataPath + "/1.md");
         //Serializer.Deserialize<helloworld>(byts);
         //Load();
         Fun_1();
     }
     if (GUILayout.Button("", GUILayout.Width(100), GUILayout.Height(50)))
     {
         Fun_2();
     }
 }