Example #1
0
    void milkcocoaEventHandler(MilkcocoaEvent e)
    {
        AudioSource audioSource = gameObject.GetComponent <AudioSource>();

        audioSource.clip = Audio;
        audioSource.PlayOneShot(Audio);
    }
Example #2
0
 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;
     }
 }
Example #3
0
    // メソッド
    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;
        }
    }