using CCS.App; using System.Collections.Generic; using UnityEngine; using LitJson; public class GongYeContral : MonoBehaviour { private GongYeData m_GongYeData; private List m_FunctionValues; public List FunctionValues { get { if (null == m_FunctionValues) { m_FunctionValues = m_GongYeData.functionValues; } return m_FunctionValues; } set { m_FunctionValues = value; } } void Start() { GetData(); } // Update is called once per frame void Update() { } /// /// 获取工业步骤内容信息 /// private void GetData() { while (true) { m_GongYeData = JsonMapper.ToObject(((Resources.Load("config/gongyedata")) as TextAsset).text); if (m_GongYeData != null) { break; } } List fvList = new List(); for (int i = 0; i < m_GongYeData.contentInfos.Count; i++) { FunctionValue fv = new FunctionValue(); fv.index = i; fv.isShow = fv.index == m_GongYeData.defaultValue ? true : false; fv.value = 0; fvList.Add(fv); } m_GongYeData.functionValues = fvList; } } public class GongYeData { public uint moduleID; public uint functionID; public int defaultValue;// 默认值 public int isShowState; public List functionValues; public List contentInfos; }