public void execute(EventAction eventAction) { var dialog = DialogController.shared; dialog.showText(eventAction.stringVar2, eventAction.stringVar1, () => { if (eventAction.childEventAction.Length > 0) { var boxController = SelectButtonBoxController.Create(); foreach (var item in eventAction.childEventAction) { boxController.addButton(item.eventName, () => { item.execute(); dialog.hide(); }); boxController.canCancel = !eventAction.boolVar1; } boxController.show(); } else { dialog.hide(); } }, eventAction.childEventAction.Length > 0); }
IEnumerator Waiting(EventAction eventAction) { yield return(new WaitForSeconds(eventAction.floatVar1)); if (eventAction.childEventAction.Length == 1) { eventAction.childEventAction[0].execute(); } else if (eventAction.childEventAction.Length > 1) { var boxController = SelectButtonBoxController.Create(); foreach (var item in eventAction.childEventAction) { boxController.addButton(item.eventName, () => { item.execute(); }); } boxController.show(); } }
public override void Awake() { base.Awake(); this.needsResetLastSelectedGameObject = false; inputs.UI.B.performed += ctx => hide(); inputs.UI.A.performed += ctx => { var currentSelectedObj = EventSystem.current.currentSelectedGameObject; if (currentSelectedObj == confirmButton) { confirm(); //确定 return; } if (currentSelectedObj == traction) { //牵引 return; } var index = roles.IndexOf(currentSelectedObj); if (index < 0) { return; } var boxController = SelectButtonBoxController.Create(); foreach (var vehicle in aroundVehicles) { boxController.addButton(vehicle.vehicleName, vehicle.gameObject.GetComponent <SpriteRenderer>().sprite, () => { setVehicles(index, vehicle); }); } boxController.addButton("不乘坐", null, () => { setVehicles(index, null); }); boxController.show(); }; }
public override bool trigger() { if (options.Count > 0) { DialogController.shared.showText(content, nick, () => { var boxController = SelectButtonBoxController.Create(); foreach (var item in options.Select((value, i) => (value, i))) { boxController.addButton(item.value, () => { var port = this.GetOutputPort("options " + item.i); if (port != null) { (port.Connection?.node as EventBaseNode)?.trigger(); } DialogController.shared.hide(); }); boxController.canCancel = this.canCancel; } boxController.show(); }, true);