public void SetEventData(CLCondition condition) { dataBase = new CLCondition(); Tool.CopyValue(dataBase, condition); IsCondition = true; Title.text = "编辑值-布尔"; string[] funstrs = Enum.GetNames(typeof(CLConditionType)); if (funstrs.Length != Function.options.Count + 1) { Function.options.Clear(); for (int i = 0; i < funstrs.Length - 1; i++) { if (funstrs[i] == "or" || funstrs[i] == "and" || funstrs[i] == "negate") { Function.options.Add(new Dropdown.OptionData("[布尔]" + funstrs[i])); } else { Function.options.Add(new Dropdown.OptionData("[实数]" + funstrs[i])); } if (funstrs[i] == condition.conditiontype.ToString()) { Function.value = i; } } Function.RefreshShownValue(); Function.onValueChanged.AddListener(res => { var condi = new CLCondition() { conditiontype = (CLConditionType)res }; SetEventData(condi); }); } Pm1.text = condition.condition1 == null ? "null" : condition.condition1.ToString(); FunTip.text = condition.conditiontype.ToString(); val.gameObject.SetActive(false); if (condition.conditiontype == CLConditionType.negate) { Pm2.gameObject.SetActive(false); } else { Pm2.gameObject.SetActive(true); Pm2.text = condition.condition2 == null ? "null" : condition.condition2.ToString(); } fun.Select(); }
public void SetEventData(CLValue value) { dataBase = new CLValue(); Tool.CopyValue(dataBase, value); IsCondition = false; Title.text = "编辑值-数据"; string objname = "物体"; string join = null; if (value.value == null) { var templist = new List <string>(); templist.Add(objname); templist.AddRange(value.parameterreflect); join = string.Join("的", templist.ToArray()); fun.Select(); Pm1.text = value.ToString(); } else { val.Select(); valinput.text = value.ToString(); } int index = 0; List <string> strnames = GetAllTypeValueNameForClobj(objname); if (strnames.Count != Function.options.Count) { Function.options.Clear(); for (int i = 0; i < strnames.Count; i++) { if (join == strnames[i]) { index = i; } Function.options.Add(new Dropdown.OptionData(strnames[i])); } Function.value = index; Function.RefreshShownValue(); Function.onValueChanged.AddListener(res => { var clval = new CLValue(); var str = Function.options[res].text; List <string> reflect = new List <string>(str.Split('的')); reflect.RemoveAt(0); clval.parameterreflect = reflect; clval.parameterindex = 0; clval.name = "触发物体0"; SetEventData(clval); }); } FunTip.gameObject.SetActive(false); Pm2.gameObject.SetActive(false); }