public override void Awake() { base.Awake(); MMX.GameManager.MainMenu = this; gameObject.FindObject("包裹").GetComponent<ButtonController>().clickEvent = () => { var packageController = PackageMenuController.Create(); packageController.show(); }; gameObject.FindObject("强度").GetComponent<ButtonController>().clickEvent = () => { var controller = HumanStatusController.Create(); controller.show(); }; gameObject.FindObject("装备").GetComponent<ButtonController>().clickEvent = () => { var roleMenu = RoleMenuController.Create(); roleMenu.selectRoleCompletionAction = (humanInfo) => { var humanStatusController = HumanStatusController.Create(); humanStatusController.viewType = HumanStatusController.HumanStatusViewType.equipment; humanStatusController.currentHumanIndex = TeamQueue.shared.humans.IndexOf(humanInfo.gameObject); humanStatusController.show(); }; roleMenu.show(); }; gameObject.FindObject("乘降").GetComponent<ButtonController>().clickEvent = () => { StationMenuController stationMenu = StationMenuController.Create(); stationMenu.show(); }; inputs.UI.A.performed += ctx => { EventSystem.current.currentSelectedGameObject.GetComponent<ButtonController>().clickEvent?.Invoke(); }; inputs.UI.B.performed += ctx => hide(); }
private void Awake() { inputs = new InputControls(); inputs.Player.Move.performed += ctx => moveVect = ctx.ReadValue <Vector2>(); inputs.Player.Move.canceled += ctx => moveVect = Vector2.zero; inputs.Player.A.performed += ctx => { var hit = Physics2D.Raycast(gameObject.transform.position, GetComponent <Movement>().lookDirection, 1, 1 << 10 | 1 << 8); if (hit.collider == null) { return; } var sceneEventGraphs = hit.collider.gameObject.GetComponents <BaseSceneGraph>(); foreach (var eventGraph in sceneEventGraphs) { eventGraph.graph.trigger(TriggerType.KeyTrigger); } var eventActions = hit.collider.gameObject.GetComponents <EventAction>(); foreach (var action in eventActions) { if (action.startCondition == StartConditions.KeyTrigger) { action.execute(); break; } } }; inputs.Player.X.performed += ctx => MMX.GameManager.MainMenu.show(); inputs.Player.Y.performed += ctx => { StationMenuController stationMenu = StationMenuController.Create(); stationMenu.show(); }; }