You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using AX.MessageSystem; |
|
using AX.InputSystem; |
|
|
|
[RequireComponent(typeof(CameraManager))] |
|
public class CameraHorizontalTransaction : MonoBehaviour { |
|
|
|
private CameraManager cameraManager; |
|
// Use this for initialization |
|
void Start () { |
|
cameraManager = GetComponent<CameraManager>(); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update () { |
|
|
|
} |
|
|
|
void OnEnable() |
|
{ |
|
MessageDispatcher.AddListener("CAMERA_DRAG_ENTER_COMMAND", CameraDragEnterExecute); |
|
MessageDispatcher.AddListener("CAMERA_DRAGING_COMMAND", CameraDragingExecute); |
|
MessageDispatcher.AddListener("CAMERA_DRAG_EXIT_COMMAND", CameraDragExitExecute); |
|
} |
|
|
|
void OnDisable() |
|
{ |
|
MessageDispatcher.RemoveListener("CAMERA_DRAG_ENTER_COMMAND", CameraDragEnterExecute); |
|
MessageDispatcher.RemoveListener("CAMERA_DRAGING_COMMAND", CameraDragingExecute); |
|
MessageDispatcher.RemoveListener("CAMERA_DRAG_EXIT_COMMAND", CameraDragExitExecute); |
|
} |
|
|
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("CAMERA_DRAG_ENTER_COMMAND", CameraDragEnterExecute); |
|
MessageDispatcher.RemoveListener("CAMERA_DRAGING_COMMAND", CameraDragingExecute); |
|
MessageDispatcher.RemoveListener("CAMERA_DRAG_EXIT_COMMAND", CameraDragExitExecute); |
|
} |
|
|
|
private void CameraDragEnterExecute(IMessage obj) |
|
{ |
|
var data = (CameraCmdArgs)obj.Data; |
|
cameraManager.UpdateDragEnterData(data.mousePosition,data.dragStart); |
|
} |
|
|
|
private void CameraDragingExecute(IMessage obj) |
|
{ |
|
var data = (CameraCmdArgs)obj.Data; |
|
cameraManager.UpdateDragingData(data.mousePosition,data.dragStart); |
|
} |
|
|
|
private void CameraDragExitExecute(IMessage obj) |
|
{ |
|
var data = (CameraCmdArgs)obj.Data; |
|
cameraManager.UpdateDragExitData(data.mousePosition,data.dragStart); |
|
} |
|
}
|
|
|