public JsonPlayerLoader(Uri uri)
 {
     JsonMapper jsonMapper = new JsonMapper();
     jsonMapper.RegisterImporter<JsonReader, KeyControl>(deserializeKeyControl);
     Stream jsonStream = Application.GetContentStream(uri).Stream;
     string jsonStr = new StreamReader(jsonStream, Encoding.UTF8).ReadToEnd();
     this.dummyPlayer = jsonMapper.ToObject<DummyPlayer>(jsonStr);
 }
Beispiel #2
0
    internal void ReceiveMessage(string channel, string json)
    {
        try
        {
            Chat.Message message = JsonMapper.ToObject <Chat.Message>(json);
            message.Text = SwearWords.Filter(message.Text, true);

            ForwardMessage(channel, channel, message);
            ForwardMessage(CHANNEL_ALL, channel, message);
        }
        catch
        {
            if (Debug.isDebugBuild == true)
            {
                Debug.LogWarning("Chat.ReceiveMessage() :: json of invalid format received!");
                Debug.LogWarning("  channel = " + channel);
                Debug.LogWarning("  json = " + json);
            }
        }
    }
 public JsonKeyControlLoader(JsonReader reader)
 {
     dummyKeyControl = new DummyKeyControl();
     JsonMapper jsonMapper = new JsonMapper();
     while (reader.Read())
     {
         if (reader.Token == JsonToken.ObjectEnd)
         {
             break;
         }
         if (reader.Token == JsonToken.PropertyName)
         {
             switch (reader.Value as string)
             {
                 case "walkKeyBinding":
                     dummyKeyControl.walkKeyBinding = jsonMapper.ToObject<Dictionary<string, string>>(reader);
                     break;
                 case "layBombKey":
                     dummyKeyControl.layBombKey = jsonMapper.ToObject<string>(reader);
                     break;
             }
         }
     }
 }
 public TileMap parse()
 {
     JsonMapper jsonMapper = new JsonMapper();
     Stream jsonStream = Application.GetContentStream(uri).Stream;
     string jsonStr = new StreamReader(jsonStream, Encoding.UTF8).ReadToEnd();
     return jsonMapper.ToObject<TileMap>(jsonStr);
 }
Beispiel #5
0
    public void outNotes(){
        Debug.Log("Start outnotes");
        nowBGMName = AudioManager.Instance.getNowBGMName();
        JsonMapper JsonMapper = new JsonMapper();
        path = Application.persistentDataPath + "/Notes/" ;
		Debug.Log ("save path: "+path);
        // フォルダーがない場合は作成する
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        //Notesのデータ
        jsontext = JsonMapper.ToJson(notes);
        File.WriteAllText(path + nowBGMName + ".json", jsontext);
        //Notesのjsonのデータ
        outjson = new OutJson();
        outjson.set(nowBGMName,notes.Count);
        jsontext = JsonMapper.ToJson(outjson);
        File.WriteAllText(path + "Data-" +nowBGMName + ".json", jsontext);
        notes.Clear();
        Debug.Log("Done outnotes");
    }
Beispiel #6
0
    public List<newNote> getNotesJson(string MusicName){
        JsonMapper JsonMapper = new JsonMapper();
        path = Application.persistentDataPath + "/Notes/" ;
        outjson = new OutJson();
        fi = new FileInfo(path +MusicName + ".json");
        try {
			using (StreamReader sr = new StreamReader(fi.OpenRead(), Encoding.UTF8)){
				jsontext = sr.ReadToEnd();
			}
		} catch (Exception e){
			Debug.Log("NotFound Notes-Json File");
            Debug.Log("Error:"+e);
		}
        notes = JsonMapper.ToObject<List<newNote>>(jsontext);
        return notes; 
    }