备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(CubeScript))]
|
||||
public class CubeControllerEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
CubeScript cube = (CubeScript)target;
|
||||
if (GUILayout.Button("Apply Id"))
|
||||
{
|
||||
cube.ApplyId();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb7c3ac829784c849aaf9f0e05eb96a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
public class AngleSelectorAttribute : PropertyAttribute { }
|
||||
|
||||
|
||||
[CustomPropertyDrawer(typeof(AngleSelectorAttribute))]
|
||||
public class CubeInspectorAngle : PropertyDrawer
|
||||
{
|
||||
private readonly int[] angles = { 0, 90, 180, 270 };
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (property.propertyType == SerializedPropertyType.Integer)
|
||||
{
|
||||
int currentAngle = property.intValue;
|
||||
int selectedIndex = Mathf.Max(0, System.Array.IndexOf(angles, currentAngle));
|
||||
selectedIndex = EditorGUI.Popup(position, label.text, selectedIndex, angles.Select(a => a.ToString()).ToArray());
|
||||
property.intValue = angles[selectedIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(position, label.text, "Use [AngleSelector] with int.");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1063df1950c112f459d37016df41eb6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using Script.EditorScript;
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
using UnityEngine;
|
||||
[ExecuteInEditMode]
|
||||
public class ExtendedEditorWindow : EditorWindow
|
||||
{
|
||||
[MenuItem("Window/Tool UI")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
GetWindow<ExtendedEditorWindow>("Tool UI");
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
GUILayout.Label("This is an extended editor window", EditorStyles.boldLabel);
|
||||
|
||||
if (GUILayout.Button("生成棋盘模板"))
|
||||
{
|
||||
GameObject back = GameObject.Find("Board");
|
||||
BackBroadEditor board = back.GetComponent<BackBroadEditor>();
|
||||
board.GenerateBoard();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("生成箱子"))
|
||||
{
|
||||
GameObject back = GameObject.Find("Box");
|
||||
BoxBroadEditor board = back.GetComponent<BoxBroadEditor>();
|
||||
board.GenerateBoard();
|
||||
}
|
||||
|
||||
//if (GUILayout.Button("生成模板数据"))
|
||||
//{
|
||||
// GameObject tempObj = GameObject.Find("RandomPropsTemp");
|
||||
// RandomPropsTemp temp = tempObj.GetComponent<RandomPropsTemp>();
|
||||
// temp.GenerateTempData();
|
||||
//}
|
||||
|
||||
if (GUILayout.Button("导出数据"))
|
||||
{
|
||||
GameObject tempObj = GameObject.Find("RandomPropsTemp");
|
||||
RandomPropsTemp temp = tempObj.GetComponent<RandomPropsTemp>();
|
||||
temp.GenerateTempData();
|
||||
Debug.LogError("模板生成结束");
|
||||
|
||||
GameObject init = GameObject.Find("Init");
|
||||
ClampEditorController board = init.GetComponent<ClampEditorController>();
|
||||
board.ExportData();
|
||||
|
||||
Debug.LogError("导出数据结束");
|
||||
}
|
||||
if (GUILayout.Button("检查数据"))
|
||||
{
|
||||
GameObject init = GameObject.Find("Init");
|
||||
ClampEditorController board = init.GetComponent<ClampEditorController>();
|
||||
board.CheckData();
|
||||
|
||||
Debug.LogError("检查数据结束");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 282a66c987406da48aeb6b92c5e54c9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.EditorScript
|
||||
{
|
||||
[System.Serializable]
|
||||
[ExecuteInEditMode]
|
||||
public class InspectorEntry
|
||||
{
|
||||
public int PropId;
|
||||
public CubeConfigData resource;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61c9e2eb44f6466895e1a3f9cca3c185
|
||||
timeCreated: 1724641684
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
#if UNITY_EDITOR
|
||||
namespace Script.EditorScript
|
||||
{
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(InspectorEntry))]
|
||||
[ExecuteInEditMode]
|
||||
public class InspectorEntryDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// 计算各个字段的位置
|
||||
Rect idRect = new Rect(position.x, position.y, position.width / 2, position.height);
|
||||
Rect resourceRect = new Rect(position.x + position.width / 2 + 5, position.y, position.width / 2 - 5, position.height);
|
||||
|
||||
// 绘制字段
|
||||
EditorGUI.PropertyField(idRect, property.FindPropertyRelative("PropId"), GUIContent.none);
|
||||
EditorGUI.PropertyField(resourceRect, property.FindPropertyRelative("resource"), GUIContent.none);
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd2c0d2b9fe94df186b140844660eee8
|
||||
timeCreated: 1724641613
|
||||
@@ -0,0 +1,20 @@
|
||||
#if UNITY_EDITOR
|
||||
using Script.EditorScript;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(RandomPropsTemp))]
|
||||
public class InspectorEntryEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
RandomPropsTemp Temp = (RandomPropsTemp)target;
|
||||
if (GUILayout.Button("Apply Id"))
|
||||
{
|
||||
Temp.ApplyId();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 663bdd53aa80b964594e9a24f43d87f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user