123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System.Collections.Generic;
- using UnityEngine;
- using LitJson;
- public class GongYeContral : MonoBehaviour
- {
- 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>(((Resources.Load("config/gongyedata")) as TextAsset).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;
- }
|