代码合并
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5ae9284505c4b940b508a7f812159eb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUBezierMobile : ModuleViewInputUnit {
|
||||
private Vector3 mousePosition;
|
||||
private Vector3 originalPosition;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
private ModulePlateDesign PlateDesign => ModuleCore.I.PlateDesign;
|
||||
public VIUBezierMobile(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
PlateDesign.SelectBezierPoint(data.ScreenPosition);
|
||||
if (!PlateDesign.IsValidBezierPoint) { return; }
|
||||
mousePosition = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
originalPosition = PlateDesign.BezierPointPosition;
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
if (!PlateDesign.IsValidBezierPoint) { return; }
|
||||
Vector3 current = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
Vector3 offset = current - mousePosition;
|
||||
PlateDesign.ChangeBezierPoint(originalPosition + offset);
|
||||
}
|
||||
public override void ReleaseMouse(DataMouseInput data) {
|
||||
PlateDesign.ReleaseBezierPoint();
|
||||
}
|
||||
public override void ScrollWheel(DataMouseInput data) {
|
||||
PlateDesign.ReleaseBezierPoint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a819c02b79cf50242803b88efbb134c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUCameraMobile : ModuleViewInputUnit {
|
||||
private Vector3 mousePosition;
|
||||
private Vector3 originalPosition;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
public VIUCameraMobile(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
mousePosition = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
originalPosition = viewCamera.Position;
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
Vector3 current = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
Vector3 offset = current - mousePosition;
|
||||
viewCamera.Position = originalPosition + offset;
|
||||
}
|
||||
public override void ReleaseMouse(DataMouseInput data) {
|
||||
|
||||
}
|
||||
public override void ScrollWheel(DataMouseInput data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ba32fb2f11bf1948bdaae8823a824b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUCameraRotate : ModuleViewInputUnit {
|
||||
private float mouseRotate;
|
||||
private float originalRotate;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
public VIUCameraRotate(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
mouseRotate = viewCamera.ScreenToViewPosition(data.ScreenPosition).x;
|
||||
originalRotate = viewCamera.EulerAngles.y;
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
float current = viewCamera.ScreenToViewPosition(data.ScreenPosition).x;
|
||||
float offset = (current - mouseRotate) * 360;
|
||||
viewCamera.EulerAngles = new Vector3(0, originalRotate - offset, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 535c46cee34ae5e49802e537ad5a7a13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUCameraScale : ModuleViewInputUnit {
|
||||
public enum ScaleType { Scale, Orthographic }
|
||||
private readonly ScaleType scaleType;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
public VIUCameraScale(ModuleViewCamera viewCamera, ScaleType scaleType = ScaleType.Scale) {
|
||||
this.viewCamera = viewCamera;
|
||||
this.scaleType = scaleType;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
|
||||
}
|
||||
public override void ReleaseMouse(DataMouseInput data) {
|
||||
|
||||
}
|
||||
public override void ScrollWheel(DataMouseInput data) {
|
||||
if (scaleType == ScaleType.Scale) {
|
||||
float size = viewCamera.LocalScale.x + data.ScrollWheel;
|
||||
size = Mathf.Clamp(size, 0.5f, 4);
|
||||
Vector3 localScale = new Vector3(size, size, size);
|
||||
viewCamera.LocalScale = Vector3.Lerp(viewCamera.LocalScale, localScale, Time.deltaTime * 20);
|
||||
}
|
||||
if (scaleType == ScaleType.Orthographic) {
|
||||
float size = viewCamera.OrthographicSize + data.ScrollWheel;
|
||||
size = Mathf.Clamp(size, 0.1f, 4);
|
||||
viewCamera.OrthographicSize = Mathf.Lerp(viewCamera.OrthographicSize, size, Time.deltaTime * 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e00fcc9528ea97040bcdee04b0279778
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUDesignPointInsert : ModuleViewInputUnit {
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
private ModulePlateDesign PlateDesign => ModuleCore.I.PlateDesign;
|
||||
public VIUDesignPointInsert(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
PlateDesign.InsertDesignPoint(data.ScreenPosition);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b8b6a3b0a7e1e649bdcd0615dfa80ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUDesignPointMobile : ModuleViewInputUnit {
|
||||
private Vector3 mousePosition;
|
||||
private Vector3 originalPosition;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
private ModulePlateDesign PlateDesign => ModuleCore.I.PlateDesign;
|
||||
public VIUDesignPointMobile(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
PlateDesign.SelectDesignPoint(data.ScreenPosition);
|
||||
if (!PlateDesign.IsValidDesignPoint) { return; }
|
||||
mousePosition = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
originalPosition = PlateDesign.DesignPointPosition;
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
if (!PlateDesign.IsValidDesignPoint) { return; }
|
||||
Vector3 current = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
Vector3 offset = current - mousePosition;
|
||||
PlateDesign.ChangeDesignPoint(originalPosition + offset);
|
||||
}
|
||||
public override void ReleaseMouse(DataMouseInput data) {
|
||||
PlateDesign.ReleaseDesignPoint();
|
||||
}
|
||||
public override void ScrollWheel(DataMouseInput data) {
|
||||
PlateDesign.ReleaseDesignPoint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb31bfbd0ef82f24b823836852bd846c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUEdgePointAdd : ModuleViewInputUnit {
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
private ModulePlateDesign PlateDesign => ModuleCore.I.PlateDesign;
|
||||
public VIUEdgePointAdd(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
PlateDesign.InsertEdgePoint(data.ScreenPosition);
|
||||
}
|
||||
public override void MoveMouse(DataMouseInput data) {
|
||||
//Vector3 position = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
//Vector3 worldPosition = position + viewCamera.CameraWorldPosition;
|
||||
//worldPosition.z = 0;
|
||||
//Collider2D[] colliders = Physics2D.OverlapCircleAll(worldPosition, range, DefaultLayerMask);
|
||||
//if (colliders.Length == 0) { return; }
|
||||
//edgePoint = colliders[0].GetComponentInParent<PrefabEdgePoint>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c0e8f369912dbb4e9d906ca3d14a628
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class VIUEdgePointMobile : ModuleViewInputUnit {
|
||||
private Vector3 mousePosition;
|
||||
private Vector3 originalPosition;
|
||||
private readonly ModuleViewCamera viewCamera;
|
||||
private ModulePlateDesign PlateDesign => ModuleCore.I.PlateDesign;
|
||||
public VIUEdgePointMobile(ModuleViewCamera viewCamera) {
|
||||
this.viewCamera = viewCamera;
|
||||
}
|
||||
public override void DownMouse(DataMouseInput data) {
|
||||
PlateDesign.SelectEdgePoint(data.ScreenPosition);
|
||||
if (!PlateDesign.IsValidEdgePoint) { return; }
|
||||
mousePosition = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
originalPosition = PlateDesign.EdgePointPosition;
|
||||
}
|
||||
public override void DragMouse(DataMouseInput data) {
|
||||
if (!PlateDesign.IsValidEdgePoint) { return; }
|
||||
Vector3 current = viewCamera.ScreenToWorldPosition(data.ScreenPosition);
|
||||
Vector3 offset = current - mousePosition;
|
||||
PlateDesign.ChangeEdgePoint(originalPosition + offset);
|
||||
}
|
||||
public override void ReleaseMouse(DataMouseInput data) {
|
||||
PlateDesign.ReleaseEdgePoint();
|
||||
}
|
||||
public override void ScrollWheel(DataMouseInput data) {
|
||||
PlateDesign.ReleaseEdgePoint();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae2a8f6a151f160479bd605f2c407a8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class ModuleViewInputUnit {
|
||||
/// <summary> 核心模块 </summary>
|
||||
protected virtual ModuleCore ModuleCore => ModuleCore.I;
|
||||
/// <summary> 按下鼠标左键 </summary>
|
||||
public virtual void DownMouse(DataMouseInput data) { }
|
||||
/// <summary> 拖拽鼠标左键 </summary>
|
||||
public virtual void DragMouse(DataMouseInput data) { }
|
||||
/// <summary> 释放鼠标左键 </summary>
|
||||
public virtual void ReleaseMouse(DataMouseInput data) { }
|
||||
/// <summary> 移动鼠标 </summary>
|
||||
public virtual void MoveMouse(DataMouseInput data) { }
|
||||
/// <summary> 鼠标滚轮 </summary>
|
||||
public virtual void ScrollWheel(DataMouseInput data) { }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15cfd3c63263fc14fbb47c12c18447ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user