12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using Newtonsoft.Json;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.UI;
- using XRTool.Util;
- using UnityEngine.UI;
- public class TestDataReader : MonoBehaviour
- {
- // Start is called before the first frame update
- void Start()
- {
- if (DataConfMgr<ServerConfig>.Instance.TableHelper == null)
- {
- DataConfMgr<ServerConfig>.Instance.OpenData(Application.streamingAssetsPath);
- }
- if (!DataConfMgr<ServerConfig>.Instance.TableHelper.isInit)
- {
- DataConfMgr<ServerConfig>.Instance.TableHelper.readConfComplete += OnReadConfComplete;
- DataConfMgr<ServerConfig>.Instance.OpenTable("serverName");
- }
- else
- {
- OnReadConfComplete();
- }
- }
- private void OnReadConfComplete()
- {
- var list = DataConfMgr<ServerConfig>.Instance.TableHelper.DataList;
- if (list != null)
- {
- string msg = "";
- for (int i = 0; i < list.Count; i++)
- {
- msg += (JsonConvert.SerializeObject(list[i])) + "\n\n";
- }
- GetComponent<Text>().text = msg;
- }
- }
- }
|