1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System.Collections.Generic;
- using UnityEngine;
- using LitJson;
- using System.Collections;
- 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()
- {
- StartCoroutine(GetData());
- }
- // Update is called once per frame
- void Update()
- {
- }
- /// <summary>
- /// 获取工业步骤内容信息
- /// </summary>
- IEnumerator GetData()
- {
- while (m_GongYeData==null)
- {
- yield return null;
- StartCoroutine(LoadDll2.DownLoadAssets((AssetBundle ab) => {
- TextAsset obj = ab.LoadAsset<TextAsset>("gongyedata");
- m_GongYeData = JsonMapper.ToObject<GongYeData>(obj.text);
- }));
- }
- yield return null;
- 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;
- }
|