コード例 #1
0
    public void LoadJsonData()
    {
        string Jsonstring = "";

#if !UNITY_EDITOR
        Task.Run(async() =>
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************1");
            }, false);

            var file = await KnownFolders.DocumentsLibrary.GetFileAsync("City.txt");

            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************2");
            }, false);

            Jsonstring = await FileIO.ReadTextAsync(file);

            using (var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(Jsonstring)))
            {
                var serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(Prefecture));
                // クラスにデータを読み込む
                prefecture = serializer.ReadObject(stream) as Prefecture;
            }

            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************3");

                //prefecture = JsonUtility.FromJson<Prefecture>(Jsonstring);

                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************4");
                m_debugLogManager.DebugLogTextWrite("MyDebug:" + prefecture.Cities.Count);
                m_debugLogManager.DebugLogTextWrite("MyDebug:" + prefecture.Cities[0].Name);
                m_debugLogManager.DebugLogTextWrite(Jsonstring);
            }, false);
        });
#else
        var textAsset = Resources.Load("City") as TextAsset;
        Jsonstring = textAsset.text;
        using (var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(Jsonstring)))
        {
            var serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(Prefecture));
            // クラスにデータを読み込む
            prefecture = serializer.ReadObject(stream) as Prefecture;
        }
        //prefecture = JsonUtility.FromJson<Prefecture>(Jsonstring);

        m_debugLogManager.DebugLogTextWrite("MyDebug:" + prefecture.Cities.Count);
        m_debugLogManager.DebugLogTextWrite("MyDebug:" + prefecture.Cities[0].Name);
        m_debugLogManager.DebugLogTextWrite(Jsonstring);
#endif
    }
コード例 #2
0
    public void LoadManualJsonData()
    {
        string manualJson = "";

#if !UNITY_EDITOR
        Task.Run(async() =>
        {
            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************1");
            }, false);

            var file = await KnownFolders.DocumentsLibrary.GetFileAsync("Manual.txt");
            //var file = await KnownFolders.DocumentsLibrary.GetFileAsync("City.txt");

            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************2");
            }, false);

            manualJson = await FileIO.ReadTextAsync(file);

            manualList = JsonUtility.FromJson <ManualList>(manualJson);

            UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                m_debugLogManager.DebugLogTextWrite("MyDebug:*****************3");

                m_debugLogManager.DebugLogTextWrite("MyDebug:" + manualList.list[0].manual[0].operation.Count);
                m_debugLogManager.DebugLogTextWrite("MyDebug:" + manualList.list[0].manual[0].operation[0].kaiheiki);
                //m_debugLogManager.DebugLogTextWrite(manualJson);
            }, false);
        });
#else
        var textAsset = Resources.Load("Manual") as TextAsset;
        manualJson = textAsset.text;
        manualList = JsonUtility.FromJson <ManualList>(manualJson);

        m_debugLogManager.DebugLogTextWrite("MyDebug:" + manualList.list[0].manual[0].operation.Count);
        m_debugLogManager.DebugLogTextWrite("MyDebug:" + manualList.list[0].manual[0].operation[0].kaiheiki);
        //m_debugLogManager.DebugLogTextWrite(manualJson);
#endif
    }
コード例 #3
0
 public void OnSpeechKeywordRecognized(SpeechEventData eventData)
 {
     if (eventData.Command.Keyword == "よんさんのろくよんぶいじーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("43-64VG OK");
     }
     else if (eventData.Command.Keyword == "よんさんのろくよんびーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("43-64B OK");
     }
     else if (eventData.Command.Keyword == "よんさんのろくよんびーぴーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("43-64BP OK");
     }
     else if (eventData.Command.Keyword == "よんさんのななきゅーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("43-79 OK");
     }
     else if (eventData.Command.Keyword == "ろくまんのひゃくさんじゅうとりっぷろっくあかてーてーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("6-130 トリップロック赤T・T OK");
     }
     else if (eventData.Command.Keyword == "えむのさんびゃくとりっぷろっくあかてーてーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("M-300 トリップロック赤T・T OK");
     }
     else if (eventData.Command.Keyword == "はちあーるかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("8R OK");
     }
     else if (eventData.Command.Keyword == "さんごうはいへんいちじしーてぃーにじぷらぐかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("3号配変1次 CT2次プラグ OK");
     }
     else if (eventData.Command.Keyword == "さんごうはいへんにじしーてぃーにじぷらぐかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("3号配変2次 CT2次プラグ OK");
     }
     else if (eventData.Command.Keyword == "ろくまんろくせんぼるとぴーでぃーさんじてーてーかくにんよし")
     {
         m_debugLogManager.DebugLogTextWrite("66kV PD3次T・T OK");
     }
 }