webgl版初始化
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcbfe98d29b703044a524e421fcacc2a
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6116f350f3c2bca4dbb63afc5febe614
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23a5c2ef10b97d944a21755c6a5c520e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace SesothoLine
|
||||
{
|
||||
/// <summary>
|
||||
/// 线路绘制编辑器
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(SesothoPeManager))]
|
||||
public class SesothoPeManagerEditor : Editor
|
||||
{
|
||||
#region 委托事件
|
||||
|
||||
/// <summary>
|
||||
/// 当前主要的鼠标动作
|
||||
/// </summary>
|
||||
private event Action CurrenMouseAction;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 字段属性
|
||||
|
||||
/// <summary>
|
||||
/// 是编辑绘制模式
|
||||
/// </summary>
|
||||
public bool IsDebugDrawMode;
|
||||
|
||||
private Vector3 _currentPosition;
|
||||
|
||||
private bool OpKey_ForceStr;
|
||||
private bool OpKey_90Arc;
|
||||
private bool OpKey_180Arc;
|
||||
private bool OpKey_RevCisoid;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 生命周期
|
||||
|
||||
// private void OnEnable()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// private void OnDisable()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
private void OnSceneGUI()
|
||||
{
|
||||
if (!IsDebugDrawMode) return;
|
||||
|
||||
int controlID = GUIUtility.GetControlID(FocusType.Keyboard);
|
||||
if(GUIUtility.hotControl == 0)
|
||||
HandleUtility.AddDefaultControl(controlID);
|
||||
|
||||
OpKey_ForceStr = false;
|
||||
OpKey_90Arc = false;
|
||||
OpKey_180Arc = false;
|
||||
OpKey_RevCisoid = false;
|
||||
|
||||
if (Event.current.GetTypeForControl(controlID) == EventType.KeyDown)
|
||||
{
|
||||
switch (Event.current.keyCode)
|
||||
{
|
||||
case KeyCode.Escape:
|
||||
IsDebugDrawMode = false;
|
||||
break;
|
||||
case KeyCode.LeftControl:
|
||||
OpKey_ForceStr = true;
|
||||
break;
|
||||
case KeyCode.LeftAlt:
|
||||
OpKey_90Arc = true;
|
||||
break;
|
||||
case KeyCode.LeftShift:
|
||||
OpKey_180Arc = true;
|
||||
break;
|
||||
case KeyCode.R:
|
||||
OpKey_RevCisoid = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var mousePos = Event.current.mousePosition;
|
||||
if (Physics.Raycast(HandleUtility.GUIPointToWorldRay(mousePos), out var hit, float.MaxValue, 0xffff))
|
||||
{
|
||||
_currentPosition = hit.point;
|
||||
}
|
||||
|
||||
if (Event.current.type == EventType.MouseUp && GUIUtility.hotControl == 0)
|
||||
{
|
||||
if (Event.current.button == 0)
|
||||
{
|
||||
CurrenMouseAction?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (GUILayout.Button(IsDebugDrawMode ? "退出绘制模式" : "进入绘制模式"))
|
||||
IsDebugDrawMode = !IsDebugDrawMode;
|
||||
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 画线
|
||||
|
||||
private TerminalLine2T3 _line;
|
||||
private TerminalPoint _startPoint;
|
||||
private TerminalPoint _endPoint;
|
||||
|
||||
private void DarwLine()
|
||||
{
|
||||
_endPoint.transform.position = _currentPosition;
|
||||
|
||||
// _line.SetLineSegment(
|
||||
// _lastPointPosition, _currentPosition,
|
||||
// _lastPointNormal, _helperNormal
|
||||
// );
|
||||
|
||||
|
||||
if (OpKey_ForceStr)
|
||||
_line.DrawStraightLine();
|
||||
else
|
||||
{
|
||||
var angle = -1;
|
||||
if (OpKey_90Arc || OpKey_180Arc)
|
||||
{
|
||||
angle = 0;
|
||||
if (OpKey_90Arc)
|
||||
angle += 90;
|
||||
if (OpKey_180Arc)
|
||||
angle += 180;
|
||||
}
|
||||
_line.AutomaticDrawCircularLine(angle, OpKey_RevCisoid);
|
||||
}
|
||||
|
||||
// 计算完毕后执行渲染,这里调用有可能会带来空引用问题
|
||||
// 但在此之前的阶段已经对此进行过了处理所以没有关系,如果要照抄的话需要进行一些修改。
|
||||
_line.UpdateRender();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 557f21129700c2640b88cafb45f16ee1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Lrss3.SesothoLine.Editor",
|
||||
"rootNamespace": "SesothoLineEditor",
|
||||
"references": [
|
||||
"Lrss3.Deconstruction",
|
||||
"UnityEditor.UI"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2428b220c378e91419f25330ce465c75
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: faed1afa5c53aa24c95131dcabd45eb9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Deconstruction.Runtime.UI;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Deconstruction.Editor.UI
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(CircleSlider) , true)]
|
||||
public class CircleSliderEditor : SelectableEditor
|
||||
{
|
||||
private SerializedProperty m_Value;
|
||||
private SerializedProperty FillOrigin;
|
||||
private SerializedProperty m_MaxValue;
|
||||
private SerializedProperty m_MinValue;
|
||||
private SerializedProperty m_FillRect;
|
||||
private SerializedProperty m_HandleRect;
|
||||
private SerializedProperty m_FillOrigin;
|
||||
private SerializedProperty m_Radius;
|
||||
private SerializedProperty m_ClockWise;
|
||||
// private SerializedProperty m_MaxAngle;
|
||||
// private SerializedProperty m_MinAngle;
|
||||
private SerializedProperty m_WholeNumbers;
|
||||
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
m_FillRect = serializedObject.FindProperty("m_FillRect");
|
||||
m_HandleRect = serializedObject.FindProperty("m_HandleRect");
|
||||
m_MinValue = serializedObject.FindProperty("m_MinValue");
|
||||
m_MaxValue = serializedObject.FindProperty("m_MaxValue");
|
||||
m_Value = serializedObject.FindProperty("m_Value");
|
||||
m_FillOrigin = serializedObject.FindProperty("m_FillOrigin");
|
||||
m_Radius = serializedObject.FindProperty("m_Radius");
|
||||
m_ClockWise = serializedObject.FindProperty("m_ClockWise");
|
||||
m_WholeNumbers = serializedObject.FindProperty("m_WholeNumbers");
|
||||
// m_MaxAngle = serializedObject.FindProperty("m_MaxAngle");
|
||||
// m_MinAngle = serializedObject.FindProperty("m_MinAngle");
|
||||
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
|
||||
EditorGUILayout.PropertyField(m_FillRect);
|
||||
EditorGUILayout.PropertyField(m_HandleRect);
|
||||
|
||||
if (m_FillRect.objectReferenceValue != null )
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_MinValue);
|
||||
EditorGUILayout.PropertyField(m_MaxValue);
|
||||
EditorGUILayout.PropertyField(m_WholeNumbers);
|
||||
EditorGUILayout.Slider(m_Value, m_MinValue.floatValue, m_MaxValue.floatValue);
|
||||
EditorGUILayout.PropertyField(m_FillOrigin);
|
||||
EditorGUILayout.PropertyField(m_ClockWise);
|
||||
}
|
||||
|
||||
if (m_HandleRect.objectReferenceValue != null)
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_Radius);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1f1f581af3fd5f4f9bdeaedd7c27516
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,69 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65aae7f37e34be6409e0966d54c89b6d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6d9af83259f2a74bab221b541a1b2ed
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user