12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System.Collections.Generic;
- using UnityEngine;
- using LitJson;
- public class GongYeContral : MonoBehaviour
- {
- public TextAsset textobj;
- private GongYeData m_GongYeData;
- private List<FunctionValue> m_FunctionValues;
- public List<FunctionValue> 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()
- {
- }
- /// <summary>
- /// 获取工业步骤内容信息
- /// </summary>
- private void GetData()
- {
- while (true)
- {
- m_GongYeData = JsonMapper.ToObject<GongYeData>(textobj.text);
- if (m_GongYeData != null)
- {
- break;
- }
- }
- List<FunctionValue> fvList = new List<FunctionValue>();
- 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<FunctionValue> functionValues;
- public List<ContentInfo> contentInfos;
- }
|