void milkcocoaEventHandler(MilkcocoaEvent e) { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.clip = Audio; audioSource.PlayOneShot(Audio); }
public void milkcocoaEventHandler(MilkcocoaEvent e) { // e.data は JSONObjectです if (e.data.GetField("params").HasField("chat")) { string message = e.data.GetField("params").GetField("chat").GetField("message").str; string username = e.data.GetField("params").GetField("chat").GetField("name").str; contentTextArea = Uri.UnescapeDataString(username) + " : " + Uri.UnescapeDataString(message) + "\n" + contentTextArea; } }
// メソッド public void milkcocoaEventHandler(MilkcocoaEvent e) { // Debug.Log("receivedJSON"); if (e.data.GetField("params").HasField("chat")) { // Debug.Log("proper syntax"); //受け取ったJSONファイルを読み込む string speakerName = e.data.GetField("params").GetField("chat").GetField("speakerName").str; string message = e.data.GetField("params").GetField("chat").GetField("message").str; // Debug.Log(string.Format("{0} : {1}", speakerName, message)); this.history = history + Uri.UnescapeDataString(speakerName) + " : " + Uri.UnescapeDataString(message) + System.Environment.NewLine; } }