using asap.core; using GameCore; using UnityEngine; using Cinemachine; using PinballUncountable; using UniRx; public class PinballUncountableAct : AGameAct { [SerializeField] private Canvas worldSpaceUI; [SerializeField] private CinemachineVirtualCamera cam; [SerializeField] private PinballUncountablePlaySystem replaySystem; [SerializeField] private PinballUncountableSceneCanvasView sceneCanvasView; [SerializeField] private PinballUncountableDome dome; private async void Awake() { var manager = GContext.container.Resolve(); manager.EventAggregator.GetEvent().Subscribe(OnClickButton).AddTo(this); GContext.container.Resolve().Reset(); worldSpaceUI.worldCamera = Camera.main; var go = await UIManager.Instance.ShowUINotLoading(UITypes.PinballUncountablePanel); var panel = go.GetComponent(); panel.TryStartGuide(new EventInitGuide { TargetNode = sceneCanvasView.TargetNode }); manager.EventAggregator.GetEvent().Subscribe(OnBlockKick).AddTo(this); } #if UNITY_EDITOR // [SerializeField] private ushort id; // [SerializeField] private int testNum; // private void Update() // { // if (Input.GetKeyDown(KeyCode.N)) // { // ShiftCamera(); // } // if (Input.GetKeyDown(KeyCode.P)) // { // replaySystem.PlayId(id); // } // if (Input.GetKeyDown(KeyCode.T)) // { // var idx = GContext.container.Resolve().TableContext.GetEquivelantIndexFromScore(testNum); // Debug.Log($"[PinballUncountable] test reward idx: {idx}]"); // } // } #endif public void ShiftCamera(EventShiftCamera evt = null) { // Debug.Log("Cam Shift"); cam.m_Lens.Orthographic = false; if (Camera.main == null) return; if (Camera.main.TryGetComponent(out var brain)) brain.ManualUpdate(); } [SerializeField] private bool blockKick = false; private void OnBlockKick(EventBlockKick e) { blockKick = e.Block; } private void OnClickButton(EventOnClickSceneButton e) { var manager = GContext.container.Resolve(); var ids = manager.TableContext.GetTrajectoryArrayFromEntranceIndex(e.EntranceIdx, e.Multiplier); dome.Kick(blockKick); replaySystem.Play(ids); } protected override void OnDestroy() { } private void OnDisable() { ShiftCamera(); } }