public void Confirm() { if (!IsCondition) { if (select == val) { var value = new CLValue() { value = valinput.text }; dataBase = value; } else { var value = dataBase as CLValue; value.value = null; dataBase = value; } } if (ConfirmEvent != null) { ConfirmEvent(dataBase); } Destroy(this.gameObject); }
private void PmsClick(CLValue value) { List <DialogBoxDataBase> datas = new List <DialogBoxDataBase>(); int count = 3; for (int i = 0; i < count; i++) { datas.Add(new DialogStrData("触发物体" + i)); } for (int i = 0; i < Clobjs.Count; i++) { datas.Add(new DialogStrData("场景物体" + i + Clobjs[i].Name)); } int defaultval = datas.FindIndex(s => s.GetDialogBoxShowString() == value.name); DialogBoxManager.dialogBoxManager.ListSelect("选择", "物体", defaultval, datas, confirm => { if (confirm < count) { value.parameterindex = confirm; } else { value.parameterindex = -1; value.id = Clobjs[confirm - count].Id; } value.name = datas[confirm].GetDialogBoxShowString(); SetEventData(value); }); }
public void EditCLValueData(ResourceLoad resourceLoad, CLValue clvalue, UnityAction <object> confirm, UnityAction cancel = null) { var databox = Instantiate(EventDataEditorDialogBoxTemplate, transform).GetComponent <EventDataDialogBox>(); databox.resourceLoad = resourceLoad; databox.SetEventData(clvalue); databox.ConfirmEvent = confirm; databox.CancelEvent = cancel; databox.gameObject.SetActive(true); }
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); }
private void PmsClick(CLCondition condition, bool isleft) { CLCondition con = isleft ? condition.condition1 : condition.condition2; if (con == null) { con = new CLCondition(); } if (condition.conditiontype == CLConditionType.negate || condition.conditiontype == CLConditionType.and || condition.conditiontype == CLConditionType.or) { DialogBoxManager.dialogBoxManager.EditConditionData(resourceLoad, con, confirm => { if (isleft) { condition.condition1 = confirm as CLCondition; } else { condition.condition2 = confirm as CLCondition; } SetEventData(condition); }); } else { con.conditiontype = CLConditionType.val; CLValue value = con.value; if (value == null) { value = new CLValue() { parameterindex = 0, name = "触发物体0" } } ; DialogBoxManager.dialogBoxManager.EditCLValueData(resourceLoad, value, s => { con.value = s as CLValue; if (isleft) { condition.condition1 = con; } else { condition.condition2 = con; } SetEventData(condition); }); } }
void Start() { Remark.onValueChanged.AddListener(s => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Remark = s; }); EventType.onValueChanged.AddListener(s => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].EventType = (CLEventType)s; }); Condition.GetComponent <Button>().onClick.AddListener(() => { CLCondition con = resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Condition; if (con == null) { con = new CLCondition(); } DialogBoxManager.dialogBoxManager.EditConditionData(resourceLoad, con, confirm => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Condition = confirm as CLCondition; LoadEventInfo(resourceLoad.EventInfos[classify_event.Key][classify_event.Value]); }); }); Action.onValueChanged.AddListener(s => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Action.type = (CLActionType)s; }); Pm1.GetComponent <Button>().onClick.AddListener(() => { CLValue value = resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Action.values[0]; if (value == null) { value = new CLValue(); } DialogBoxManager.dialogBoxManager.EditCLValueData(resourceLoad, value, confirm => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Action.values[0] = confirm as CLValue; LoadEventInfo(resourceLoad.EventInfos[classify_event.Key][classify_event.Value]); }); }); Pm2.GetComponent <Button>().onClick.AddListener(() => { CLValue value = resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Action.values[1]; if (value == null) { value = new CLValue(); } DialogBoxManager.dialogBoxManager.EditCLValueData(resourceLoad, value, confirm => { resourceLoad.EventInfos[classify_event.Key][classify_event.Value].Action.values[1] = confirm as CLValue; LoadEventInfo(resourceLoad.EventInfos[classify_event.Key][classify_event.Value]); }); }); }
private object AnalysisValue(CLValue value, params object[] objs) { if (value.value != null) { return(value.value); } object obj; if (value.parameterindex >= 0) { obj = objs[value.parameterindex]; } else { obj = Clobjs.Find(s => s.Id == value.id); } Type type = obj.GetType(); foreach (var t in value.parameterreflect) { var field = type.GetField(t); if (field != null) { obj = field.GetValue(obj); type = obj.GetType(); continue; } var proper = type.GetProperty(t); if (proper != null) { obj = proper.GetValue(obj, new object[0]); type = obj.GetType(); continue; } Debug.Log("发生空指针异常"); return(false); } return(obj); }