750 lines
28 KiB
C#
750 lines
28 KiB
C#
using System.Text;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace BFEditor
|
|
{
|
|
public class TutorialConfigWindow : EditorWindow
|
|
{
|
|
#if UNITY_EDITOR && UNITY_STANDALONE
|
|
int selectIndex = -1;//当前选中的引导Index
|
|
const float WidthOfLeftPanel = 850;
|
|
const float WidthOfMiddlePanel = 350;
|
|
const float WidthOfRightPanel = 300;
|
|
Vector2 leftScrollPos;
|
|
Vector2 middleScrollPos;
|
|
Vector2 rightScrollPos;
|
|
|
|
const int DEFAULT_MASK_COLOR = 156;//默认遮罩颜色
|
|
void Awake()
|
|
{
|
|
TutorialConfigBridge.Instance.LoadTutorialExcel();
|
|
}
|
|
|
|
void OnGUI()
|
|
{
|
|
DrawOverviewArea();
|
|
DrawDetailArea();
|
|
DrawHelpArea();
|
|
}
|
|
|
|
void DrawOverviewArea()
|
|
{
|
|
GUILayout.BeginArea(new Rect(0, 0, WidthOfLeftPanel, position.height));
|
|
leftScrollPos = EditorGUILayout.BeginScrollView(leftScrollPos);
|
|
for (int i = TutorialConfigBridge.EXTRA_ROW_NUM; i < TutorialConfigBridge.Instance.GetRowNum(); i++)
|
|
{
|
|
GUILayout.BeginHorizontal();
|
|
EditorGUILayout.LabelField(string.Format("ID:{0}", TutorialConfigBridge.Instance.GetID(i)), GUILayout.Width(80));
|
|
EditorGUILayout.LabelField(string.Format("类型:{0}", TutorialConfigBridge.Instance.GetGuideTypeStr(i)), GUILayout.Width(200));
|
|
EditorGUILayout.LabelField(string.Format("说明:{0}", TutorialConfigBridge.Instance.GetGuideDescribeStr(i)), GUILayout.Width(300));
|
|
if (GUILayout.Button("查看", GUILayout.Width(50)))
|
|
{
|
|
selectIndex = i;
|
|
}
|
|
if (GUILayout.Button("上方插入", GUILayout.Width(60)))
|
|
{
|
|
TutorialConfigBridge.Instance.InsertRow(i);
|
|
Repaint();
|
|
}
|
|
if (GUILayout.Button("下方插入", GUILayout.Width(60)))
|
|
{
|
|
TutorialConfigBridge.Instance.InsertRow(i + 1);
|
|
Repaint();
|
|
}
|
|
if (GUILayout.Button("删除", GUILayout.Width(50)))
|
|
{
|
|
TutorialConfigBridge.Instance.DeleteRow(i);
|
|
Repaint();
|
|
}
|
|
GUILayout.EndHorizontal();
|
|
}
|
|
EditorGUILayout.EndScrollView();
|
|
GUILayout.EndArea();
|
|
}
|
|
|
|
void DrawDetailArea()
|
|
{
|
|
GUILayout.BeginArea(new Rect(WidthOfLeftPanel + 20, 0, WidthOfMiddlePanel, position.height));
|
|
middleScrollPos = EditorGUILayout.BeginScrollView(middleScrollPos);
|
|
if (TutorialConfigBridge.EXTRA_ROW_NUM <= selectIndex && selectIndex < TutorialConfigBridge.Instance.GetRowNum())
|
|
{
|
|
var id = TutorialConfigBridge.Instance.GetID(selectIndex);
|
|
var idType = TutorialIdType.NONE; // 引导大类型
|
|
if (!string.IsNullOrEmpty(id))
|
|
{
|
|
idType = (TutorialIdType)(int.Parse(id) / 10000);
|
|
}
|
|
|
|
//版本
|
|
if (idType == TutorialIdType.VERSION)
|
|
{
|
|
DrawID();
|
|
}
|
|
//其他(强引导1,功能开启2,功能指引4,跳转8)
|
|
else
|
|
{
|
|
DrawID();
|
|
DrawNext();
|
|
DrawType();
|
|
DrawGuideTypeStr();
|
|
DrawDescribeStr();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
DrawImportantAndSteps();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
DrawTarget();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
DrawStage();
|
|
DrawCondition();
|
|
DrawNextCondition();
|
|
DrawAction();
|
|
DrawParams();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
DrawHandPos();
|
|
DrawBoxPos();
|
|
DrawArrow();
|
|
DrawBoxHead();
|
|
DrawBoxHeadAct();
|
|
DrawBoxHeadFlip();
|
|
DrawBoxHeadPosition();
|
|
DrawAnimationPos();
|
|
DrawBoxHeadScale();
|
|
DrawHighlight();
|
|
DrawRadius();
|
|
DrawMaskColor();
|
|
|
|
EditorGUILayout.Space();
|
|
|
|
DrawVoice();
|
|
}
|
|
}
|
|
EditorGUILayout.EndScrollView();
|
|
GUILayout.EndArea();
|
|
}
|
|
|
|
void DrawHelpArea()
|
|
{
|
|
GUILayout.BeginArea(new Rect(WidthOfLeftPanel + WidthOfMiddlePanel + 40, 0, WidthOfRightPanel, position.height));
|
|
rightScrollPos = EditorGUILayout.BeginScrollView(rightScrollPos);
|
|
|
|
DrawGuideTypeHelp();
|
|
DrawImportantTypeHelp();
|
|
DrawConditionTypeHelp();
|
|
DrawActionTypeHelp();
|
|
|
|
EditorGUILayout.EndScrollView();
|
|
GUILayout.EndArea();
|
|
}
|
|
|
|
//详细绘制 *******************************************************************************************
|
|
|
|
void DrawID()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("ID(int):", TutorialConfigBridge.Instance.GetID(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
TutorialConfigBridge.Instance.SetID(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("ID需要为5位整数");
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawNext()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("NextID(int):", TutorialConfigBridge.Instance.GetNextID(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
TutorialConfigBridge.Instance.SetNextID(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("NextID需要为5位整数");
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawType()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curType = TutorialConfigBridge.Instance.GetType(selectIndex);
|
|
var curTypeEnum = TutorialType.NONE;
|
|
if (!string.IsNullOrEmpty(curType))
|
|
{
|
|
curTypeEnum = (TutorialType)int.Parse(curType);
|
|
}
|
|
var newType = (TutorialType)EditorGUILayout.EnumPopup("引导类型:", curTypeEnum);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = ((int)newType).ToString();
|
|
TutorialConfigBridge.Instance.SetType(selectIndex, value);
|
|
//自动配置TypeStr
|
|
TutorialConfigBridge.Instance.SetGuideTypeStr(selectIndex, TutorialConfigBridge.Instance.GetDefaultGuideTypeStr(newType));
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawGuideTypeStr()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("类型说明(string):", TutorialConfigBridge.Instance.GetGuideTypeStr(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetGuideTypeStr(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawDescribeStr()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("引导说明(string):", TutorialConfigBridge.Instance.GetGuideDescribeStr(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetGuideDescribeStr(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
|
|
void DrawStage()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("触发关卡(int):", TutorialConfigBridge.Instance.GetStage(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
TutorialConfigBridge.Instance.SetStage(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Stage需要为整数");
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawImportantAndSteps()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("关键节点类型(string):", TutorialConfigBridge.Instance.GetImportant(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetImportant(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
//Steps
|
|
if (!string.IsNullOrEmpty(value))
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value2 = EditorGUILayout.TextField("中断时重启步骤([int]):", TutorialConfigBridge.Instance.GetSteps(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetSteps(selectIndex, value2);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
else
|
|
{
|
|
var value2 = TutorialConfigBridge.Instance.GetSteps(selectIndex);
|
|
if (!string.IsNullOrEmpty(value2))
|
|
{
|
|
//清空steps
|
|
TutorialConfigBridge.Instance.SetSteps(selectIndex, string.Empty);
|
|
UpdateExcel();
|
|
}
|
|
}
|
|
}
|
|
void DrawTarget()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("UI目标(string):", TutorialConfigBridge.Instance.GetTarget(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetTarget(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawCondition()
|
|
{
|
|
//type
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curCondition = TutorialConfigBridge.Instance.GetCondition(selectIndex);
|
|
var curConditionTypeEnum = TutorialConditionType.NONE;
|
|
var curConditionValue = 0;
|
|
if (!string.IsNullOrEmpty(curCondition))
|
|
{
|
|
Vector2Int formatCurCondition = SplitStringToVector2Int(curCondition);
|
|
curConditionTypeEnum = (TutorialConditionType)formatCurCondition.x;
|
|
curConditionValue = formatCurCondition.y;
|
|
}
|
|
var newConditionType = (TutorialConditionType)EditorGUILayout.EnumPopup("触发条件类型:", curConditionTypeEnum);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
//如果设置为None 则清空数据
|
|
if (newConditionType == TutorialConditionType.NONE)
|
|
{
|
|
TutorialConfigBridge.Instance.SetCondition(selectIndex, string.Empty);
|
|
UpdateExcel();
|
|
}
|
|
//正常更新type
|
|
else
|
|
{
|
|
var newValue = Vector2IntToString(new Vector2Int((int)newConditionType, curConditionValue));
|
|
TutorialConfigBridge.Instance.SetCondition(selectIndex, newValue);
|
|
UpdateExcel();
|
|
}
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
//value
|
|
if (curConditionTypeEnum != TutorialConditionType.NONE)
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("触发条件参数(int):", curConditionValue.ToString());
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
var newValue2 = Vector2IntToString(new Vector2Int((int)newConditionType, parseInt));
|
|
TutorialConfigBridge.Instance.SetCondition(selectIndex, newValue2);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("触发条件参数需要为整数");
|
|
}
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
}
|
|
void DrawNextCondition()
|
|
{
|
|
//type
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curCondition = TutorialConfigBridge.Instance.GetNextCondition(selectIndex);
|
|
var curConditionTypeEnum = TutorialConditionType.NONE;
|
|
var curConditionValue = 0;
|
|
if (!string.IsNullOrEmpty(curCondition))
|
|
{
|
|
Vector2Int formatCurCondition = SplitStringToVector2Int(curCondition);
|
|
curConditionTypeEnum = (TutorialConditionType)formatCurCondition.x;
|
|
curConditionValue = formatCurCondition.y;
|
|
}
|
|
var newConditionType = (TutorialConditionType)EditorGUILayout.EnumPopup("结束条件类型:", curConditionTypeEnum);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
//如果设置为None 则清空数据
|
|
if (newConditionType == TutorialConditionType.NONE)
|
|
{
|
|
TutorialConfigBridge.Instance.SetNextCondition(selectIndex, string.Empty);
|
|
UpdateExcel();
|
|
}
|
|
//正常更新type
|
|
else
|
|
{
|
|
var newValue = Vector2IntToString(new Vector2Int((int)newConditionType, curConditionValue));
|
|
TutorialConfigBridge.Instance.SetNextCondition(selectIndex, newValue);
|
|
UpdateExcel();
|
|
}
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
//value
|
|
if (curConditionTypeEnum != TutorialConditionType.NONE)
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("结束条件参数(int):", curConditionValue.ToString());
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
var newValue2 = Vector2IntToString(new Vector2Int((int)newConditionType, parseInt));
|
|
TutorialConfigBridge.Instance.SetNextCondition(selectIndex, newValue2);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("结束条件参数需要为整数");
|
|
}
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
}
|
|
void DrawAction()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curType = TutorialConfigBridge.Instance.GetAction(selectIndex);
|
|
var curTypeEnum = TutorialActionType.NONE;
|
|
if (!string.IsNullOrEmpty(curType))
|
|
{
|
|
curTypeEnum = (TutorialActionType)int.Parse(curType);
|
|
}
|
|
var newType = (TutorialActionType)EditorGUILayout.EnumPopup("特殊行为:", curTypeEnum);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = ((int)newType).ToString();
|
|
TutorialConfigBridge.Instance.SetAction(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawParams()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("特殊参数([int]):", TutorialConfigBridge.Instance.GetActionParams(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetActionParams(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
//表现相关
|
|
void DrawHandPos()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetHandPos(selectIndex);
|
|
Vector2Int formatCurValue = SplitStringToVector2Int(curValue);
|
|
var newValue = EditorGUILayout.Vector2IntField("手指偏移:", formatCurValue);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = Vector2IntToString(newValue);
|
|
TutorialConfigBridge.Instance.SetHandPos(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxPos()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetBoxPos(selectIndex);
|
|
Vector2Int formatCurValue = SplitStringToVector2Int(curValue);
|
|
var newValue = EditorGUILayout.Vector2IntField("文本框偏移:", formatCurValue);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = Vector2IntToString(newValue);
|
|
TutorialConfigBridge.Instance.SetBoxPos(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawArrow()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetArrow(selectIndex);
|
|
var toggleValue = EditorGUILayout.Toggle("文本框箭头:", curValue == "1");
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = toggleValue ? "1" : string.Empty;
|
|
TutorialConfigBridge.Instance.SetArrow(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxHead()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("引导员形象(string):", TutorialConfigBridge.Instance.GetBoxHead(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetBoxHead(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxHeadAct()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetBoxHeadAct(selectIndex);
|
|
var toggleValue = EditorGUILayout.Toggle("引导员show动作(仅对话类):", curValue == "1");
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = toggleValue ? "1" : string.Empty;
|
|
TutorialConfigBridge.Instance.SetBoxHeadAct(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxHeadFlip()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetBoxHeadFlip(selectIndex);
|
|
var toggleValue = EditorGUILayout.Toggle("引导员翻转:", curValue == "1");
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = toggleValue ? "1" : string.Empty;
|
|
TutorialConfigBridge.Instance.SetBoxHeadFlip(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxHeadPosition()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetBoxHeadPosition(selectIndex);
|
|
var toggleValue = EditorGUILayout.Toggle("引导员是否在左边(剧情专用):", curValue == "1");
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = toggleValue ? "1" : string.Empty;
|
|
TutorialConfigBridge.Instance.SetBoxHeadPosition(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawAnimationPos()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetAnimationPosition(selectIndex);
|
|
Vector2Int formatCurValue = SplitStringToVector2Int(curValue);
|
|
var newValue = EditorGUILayout.Vector2IntField("引导员偏移:", formatCurValue);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = Vector2IntToString(newValue);
|
|
TutorialConfigBridge.Instance.SetAnimationPosition(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawBoxHeadScale()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("引导员缩放(1000标准值)(int):", TutorialConfigBridge.Instance.GetBoxHeadScale(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
TutorialConfigBridge.Instance.SetBoxHeadScale(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("BoxHeadScale需要为整数");
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawHighlight()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetHighlight(selectIndex);
|
|
var toggleValue = EditorGUILayout.Toggle("高亮形状(默认圆,勾上为方形):", curValue == "1");
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = toggleValue ? "1" : string.Empty;
|
|
TutorialConfigBridge.Instance.SetHighlight(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawRadius()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("高亮半径(默认100)(int):", TutorialConfigBridge.Instance.GetRadius(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
int parseInt = 0;
|
|
if (int.TryParse(value, out parseInt))
|
|
{
|
|
TutorialConfigBridge.Instance.SetRadius(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Radius需要为整数");
|
|
}
|
|
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawMaskColor()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var curValue = TutorialConfigBridge.Instance.GetMaskColor(selectIndex);
|
|
var curSliderValue = DEFAULT_MASK_COLOR;
|
|
if (!string.IsNullOrEmpty(curValue))
|
|
{
|
|
curSliderValue = int.Parse(curValue);
|
|
}
|
|
var sliderValue = EditorGUILayout.IntSlider("遮罩颜色值(剧情类无效):", curSliderValue, 0, 255);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
var value = sliderValue.ToString();
|
|
TutorialConfigBridge.Instance.SetMaskColor(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
void DrawVoice()
|
|
{
|
|
EditorGUILayout.BeginHorizontal();
|
|
EditorGUI.BeginChangeCheck();
|
|
var value = EditorGUILayout.TextField("语音(string):", TutorialConfigBridge.Instance.GetVoice(selectIndex));
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
TutorialConfigBridge.Instance.SetVoice(selectIndex, value);
|
|
UpdateExcel();
|
|
}
|
|
EditorGUILayout.EndHorizontal();
|
|
}
|
|
|
|
//帮助绘制 *******************************************************************************************
|
|
|
|
void DrawGuideTypeHelp()
|
|
{
|
|
//TODO
|
|
}
|
|
|
|
void DrawImportantTypeHelp()
|
|
{
|
|
//TODO
|
|
}
|
|
|
|
void DrawConditionTypeHelp()
|
|
{
|
|
//TODO
|
|
}
|
|
|
|
void DrawActionTypeHelp()
|
|
{
|
|
//TODO
|
|
}
|
|
|
|
//通用接口 *******************************************************************************************
|
|
|
|
/// <summary>
|
|
/// 将[a,b,c...,x]格式的string类型转为int[]类型
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
int[] SplitStringToIntArray(string value)
|
|
{
|
|
int[] array = null;
|
|
if (value.StartsWith("[") && value.EndsWith("]"))
|
|
{
|
|
var valueStrs = value.Split(',', '[', ']');
|
|
array = new int[valueStrs.Length];
|
|
for (int i = 0; i < array.Length - 2; i++)
|
|
{
|
|
array[i] = int.Parse(valueStrs[i + 1]);
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
string IntArrayToString(int[] array)
|
|
{
|
|
string stringValue = string.Empty;
|
|
if (array != null && array.Length > 0)
|
|
{
|
|
stringValue = "[";
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
stringValue = stringValue + array[i];
|
|
if (i < array.Length - 1)
|
|
{
|
|
stringValue = stringValue + ",";
|
|
}
|
|
}
|
|
stringValue = stringValue + "]";
|
|
}
|
|
return stringValue;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 将[a,b]格式的string类型转为Vector2Int类型
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
Vector2Int SplitStringToVector2Int(string value)
|
|
{
|
|
Vector2Int array = new Vector2Int();
|
|
if (value.StartsWith("[") && value.EndsWith("]"))
|
|
{
|
|
var valueStrs = value.Split(',', '[', ']');
|
|
if (valueStrs.Length == 4)
|
|
{
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
array[i] = int.Parse(valueStrs[i + 1]);
|
|
}
|
|
}
|
|
}
|
|
return array;
|
|
}
|
|
|
|
string Vector2IntToString(Vector2Int value)
|
|
{
|
|
string stringValue = string.Empty;
|
|
stringValue = string.Format("[{0},{1}]", value.x, value.y);
|
|
return stringValue;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新Excel
|
|
/// </summary>
|
|
void UpdateExcel()
|
|
{
|
|
TutorialConfigBridge.Instance.SaveExcel();
|
|
}
|
|
#endif
|
|
}
|
|
} |