Tz2/Assets/Zion/Scripts/SetValue.cs

95 lines
2.7 KiB
C#

using DefaultNamespace;
using MotionFramework;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SetValue : MonoBehaviour
{
public List<TextMeshProUGUI> Textpro = new List<TextMeshProUGUI>();
public List<Text> Text_1 = new List<Text>();
public List<InputField> Inputs = new List<InputField>();
public List<TMP_InputField> Inputs_ = new List<TMP_InputField>();
void Start()
{
if (Textpro.Count > 0)
{
for (int i = 0; i < Textpro.Count; i++)
{
Textpro[i].text = GetTask(Textpro[i].name);
}
}
if (Text_1.Count > 0)
{
for (int i = 0; i < Text_1.Count; i++)
{
Text_1[i].text = GetTask(Text_1[i].name);
}
}
if (Inputs.Count > 0)
{
for (int i = 0; i < Inputs.Count; i++)
{
Inputs[i].text = GetTask(Inputs[i].name);
}
}
if (Inputs_.Count > 0)
{
for (int i = 0; i < Inputs_.Count; i++)
{
Inputs_[i].text = GetTask(Inputs_[i].name);
}
}
}
public string GetTask(string Textname)
{
if (Textname.Contains("数量"))
{
return GameManager.Instance.marteialnumber.ToString();
}
if (Textname.Contains("描述") && !Textname.Contains("拆退(描述)"))
{
return MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述");
}
if (Textname.Contains("拆退(描述)"))
{
return MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("物料描述") + "\t" + GameManager.Instance.marteialnumber + GameManager.Instance.unit;
}
if (Textname.Contains("单位"))
{
return GameManager.Instance.unit;
}
if (Textname.Contains("工厂"))
{
return MotionEngine.GetModule<GlobalDataStorage>().GetTaskBookValueByMapping("工厂代码");
}
if (Textname.Contains("供应商"))
{
return ModerController.Instance.checkGoods[0].Manufacturer.text;
}
if (Textname.Contains("电压等级"))
{
if (ModerController.Instance.checkGoods[0].name.ToLower().Contains("10kv"))
{
return "10KV";
}
if (ModerController.Instance.checkGoods[0].name.ToLower().Contains("1kv"))
{
return "1KV";
}
else
{
return "";
}
}
return "";
}
}