地图编辑器第一版
This commit is contained in:
parent
a13ae659ab
commit
a79d051903
8
Assets/Editor/BFOthersTools/BoardEditorTools.meta
Normal file
8
Assets/Editor/BFOthersTools/BoardEditorTools.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0db9ae993e0bba941a6bfe7227aff6bd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,538 @@
|
|||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using System.IO;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace BFEditor
|
||||||
|
{
|
||||||
|
public class BoardEditorWindow : EditorWindow {
|
||||||
|
|
||||||
|
// private static void ShowWindow() {
|
||||||
|
// var window = GetWindow<BoardEditorWindow>();
|
||||||
|
// window.titleContent = new GUIContent("BoardWindow");
|
||||||
|
// window.Show();
|
||||||
|
// }
|
||||||
|
const string BOARD_EXCEL_KEY = "bf_board_excel_key";
|
||||||
|
const string BOARD_GRID_TYPE_KEY = "bf_board_grid_type_key";
|
||||||
|
const int gridCount = 49;
|
||||||
|
string battleImgDirectory = "Assets/arts/textures/ui/battle/";
|
||||||
|
string boardFilepath;
|
||||||
|
string boardGridTypePath;
|
||||||
|
string boardFiledName = "board";
|
||||||
|
string randomTypeStr = "";
|
||||||
|
int curIndex = 1;
|
||||||
|
Dictionary<int, Dictionary<string, string>> boardGridTypeDict = new Dictionary<int, Dictionary<string, string>>();
|
||||||
|
Dictionary<int, JArray> boardDict = new Dictionary<int, JArray>();
|
||||||
|
Dictionary<int, JArray> outPutBoardDict = new Dictionary<int, JArray>();
|
||||||
|
Dictionary<string, Texture> imgDict = new Dictionary<string, Texture>();
|
||||||
|
bool loadExcelOver = false;
|
||||||
|
Dictionary<int, string> elementTypeImgDict = new Dictionary<int, string>(){
|
||||||
|
[1] = "red_1",
|
||||||
|
[2] = "yellow_1",
|
||||||
|
[3] = "green_1",
|
||||||
|
[4] = "blue_1",
|
||||||
|
[5] = "purple_1"
|
||||||
|
};
|
||||||
|
Texture boardImg;
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
loadExcelOver = false;
|
||||||
|
boardFilepath = GetBoardExcelPath();
|
||||||
|
if (boardFilepath.Equals(""))
|
||||||
|
{
|
||||||
|
boardFilepath = "选择配置表路径";
|
||||||
|
}
|
||||||
|
|
||||||
|
boardGridTypePath = GetBoardGridTypePath();
|
||||||
|
if (boardGridTypePath.Equals(""))
|
||||||
|
{
|
||||||
|
boardGridTypePath = "选择grid_type配置表路径";
|
||||||
|
}
|
||||||
|
string[] paths = Directory.GetFiles(battleImgDirectory);
|
||||||
|
foreach(var path in paths)
|
||||||
|
{
|
||||||
|
if(!path.EndsWith(".meta"))
|
||||||
|
{
|
||||||
|
string formatPath = Path.GetFileNameWithoutExtension(path);
|
||||||
|
imgDict[formatPath] = AssetDatabase.LoadAssetAtPath<Texture>(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boardImg = AssetDatabase.LoadAssetAtPath<Texture>("Assets/arts/textures/background/battle_common/chessboard_1.png");
|
||||||
|
}
|
||||||
|
string GetBoardExcelPath()
|
||||||
|
{
|
||||||
|
return PlayerPrefs.GetString(BOARD_EXCEL_KEY, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBoardExcelPath(string path)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(BOARD_EXCEL_KEY, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetBoardGridTypePath()
|
||||||
|
{
|
||||||
|
return PlayerPrefs.GetString(BOARD_GRID_TYPE_KEY, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBoardGridTypePath(string path)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(BOARD_GRID_TYPE_KEY, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
BoardEditorWindow()
|
||||||
|
{
|
||||||
|
this.titleContent = new GUIContent("棋盘编辑器");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGUI() {
|
||||||
|
DrawBaseInfo();
|
||||||
|
DragBoard();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawBaseInfo()
|
||||||
|
{
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("grid_type 路径", GUILayout.Width(100));
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUILayout.TextField(boardGridTypePath, GUILayout.Width(300));
|
||||||
|
if (GUILayout.Button("选择", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
string openPath = EditorUtility.OpenFilePanel("选择配置表", GetBoardGridTypePath(), "");
|
||||||
|
if (openPath.CompareTo("") != 0)
|
||||||
|
{
|
||||||
|
boardGridTypePath = openPath;
|
||||||
|
SetBoardGridTypePath(openPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("配置表路径", GUILayout.Width(100));
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUILayout.TextField(boardFilepath, GUILayout.Width(300));
|
||||||
|
if (GUILayout.Button("选择", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
string openPath = EditorUtility.OpenFilePanel("选择配置表", GetBoardExcelPath(), "");
|
||||||
|
if (openPath.CompareTo("") != 0)
|
||||||
|
{
|
||||||
|
boardFilepath = openPath;
|
||||||
|
SetBoardExcelPath(openPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.Space(10);
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("字段名称", GUILayout.Width(100));
|
||||||
|
GUILayout.Space(10);
|
||||||
|
boardFiledName = GUILayout.TextField(boardFiledName, GUILayout.Width(200));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.Space(10);
|
||||||
|
if (GUILayout.Button("加载棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
LoadBoardExcel();
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
if (!IsInNewBoard())
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("上一张", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
showSwitchBoardSaveDialog(Math.Max(curIndex - 1, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal(GUILayout.Width(80));
|
||||||
|
GUIStyle style = new GUIStyle(GUI.skin.label);
|
||||||
|
style.alignment = TextAnchor.MiddleCenter;
|
||||||
|
GUILayout.Label("当前编号id = ", style);
|
||||||
|
showSwitchBoardSaveDialog(int.Parse(GUILayout.TextField(curIndex.ToString(), GUILayout.Width(40))));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
if (!IsInNewBoard())
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("下一张", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
showSwitchBoardSaveDialog(Math.Min(curIndex + 1, boardDict.Count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("复制当前棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
if (!boardDict.ContainsKey(curIndex))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JArray jo = boardDict[curIndex];
|
||||||
|
GUIUtility.systemCopyBuffer = JsonConvert.SerializeObject(jo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUILayout.Button("粘贴棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
JArray jo = (JArray)JsonConvert.DeserializeObject(GUIUtility.systemCopyBuffer);
|
||||||
|
if (jo == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boardDict[curIndex] = jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsInNewBoard())
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("新建棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
curIndex = outPutBoardDict.Count + 1;
|
||||||
|
boardDict[curIndex] = new JArray();
|
||||||
|
for (int i = 0; i < gridCount; i++)
|
||||||
|
{
|
||||||
|
JArray unit = (JArray)JsonConvert.DeserializeObject("[0, 0]");
|
||||||
|
boardDict[curIndex].Add(unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("退出新建棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
boardDict.Remove(curIndex);
|
||||||
|
curIndex = outPutBoardDict.Count;
|
||||||
|
}
|
||||||
|
if (GUILayout.Button("保存当前棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
SaveBoard(curIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
|
GUILayout.BeginArea(new Rect(730, 500, 500, 100));
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
GUILayout.Label("随机类型和数量[类型,数量] 空格 [类型,数量]");
|
||||||
|
randomTypeStr = GUILayout.TextField(randomTypeStr, GUILayout.Width(500));
|
||||||
|
if(GUILayout.Button("生成随机棋盘", GUILayout.Width(80)))
|
||||||
|
{
|
||||||
|
string[] units = randomTypeStr.Split('[');
|
||||||
|
Dictionary<int, int> dict = new Dictionary<int, int>();
|
||||||
|
for (int i = 0; i < units.Length; i++)
|
||||||
|
{
|
||||||
|
string formatStr = units[i].Replace("[", "").Replace("]", "").Replace(" ", "");
|
||||||
|
string[] unitList = formatStr.Split(',');
|
||||||
|
if (unitList.Length >= 2)
|
||||||
|
{
|
||||||
|
dict[int.Parse(unitList[0])] = int.Parse(unitList[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<int> list = new List<int>();
|
||||||
|
for (int i = 0; i < gridCount; i++)
|
||||||
|
{
|
||||||
|
list.Add(i);
|
||||||
|
}
|
||||||
|
Debug.Log(JsonConvert.SerializeObject(dict));
|
||||||
|
JArray ja = new JArray();
|
||||||
|
for (int i = 0; i < gridCount; i++)
|
||||||
|
{
|
||||||
|
JArray unit = (JArray)JsonConvert.DeserializeObject("[0, 0]");
|
||||||
|
ja.Add(unit);
|
||||||
|
}
|
||||||
|
foreach (int gridType in dict.Keys)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < dict[gridType]; i++)
|
||||||
|
{
|
||||||
|
int index = UnityEngine.Random.Range(0, list.Count);
|
||||||
|
ja[list[index]][0] = gridType;
|
||||||
|
list.RemoveAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boardDict[curIndex] = ja;
|
||||||
|
}
|
||||||
|
GUILayout.EndArea();
|
||||||
|
if(GUI.Button(new Rect(1050, 10, 100, 30), "导出到Excel"))
|
||||||
|
{
|
||||||
|
if (CheckBoardChanged(curIndex))
|
||||||
|
{
|
||||||
|
switch (EditorUtility.DisplayDialogComplex("提示", "当前棋盘已经改变,是否保存", "确定", "放弃", "再次确认"))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
SaveBoard(curIndex);
|
||||||
|
SaveBoardExcel();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AbortBoard(curIndex);
|
||||||
|
SaveBoardExcel();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SaveBoardExcel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadBoardExcel()
|
||||||
|
{
|
||||||
|
var desktopDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
|
||||||
|
var tempPath = System.IO.Path.Combine(desktopDir, "BoardEditorTemp.txt");
|
||||||
|
|
||||||
|
string relitivePath = Application.dataPath;
|
||||||
|
relitivePath = relitivePath.Remove(relitivePath.Length - 6, 6);
|
||||||
|
string pythonToolPath = relitivePath + "Tools/tranexcel_new";
|
||||||
|
|
||||||
|
// 读取grid_type配置表
|
||||||
|
BFEditorUtils.RunCommond("python", "load_board.py " + tempPath + " " + boardGridTypePath, pythonToolPath);
|
||||||
|
string boardGridTypeJson = File.ReadAllText(tempPath);
|
||||||
|
JObject jsonObj = (JObject)JsonConvert.DeserializeObject(boardGridTypeJson);
|
||||||
|
foreach (var item in jsonObj)
|
||||||
|
{
|
||||||
|
int key = int.Parse(item.Key);
|
||||||
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||||
|
foreach (var item2 in (JObject)item.Value)
|
||||||
|
{
|
||||||
|
dict[item2.Key] = item2.Value.ToString();
|
||||||
|
}
|
||||||
|
boardGridTypeDict[key] = dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取boardFile配置表
|
||||||
|
BFEditorUtils.RunCommond("python", "load_board.py " + tempPath + " " + boardFilepath, pythonToolPath);
|
||||||
|
string boardFileJson = File.ReadAllText(tempPath);
|
||||||
|
|
||||||
|
jsonObj = (JObject)JsonConvert.DeserializeObject(boardFileJson);
|
||||||
|
foreach (var item in jsonObj){
|
||||||
|
if (item.Value[boardFiledName] != null)
|
||||||
|
{
|
||||||
|
int key = int.Parse(item.Key);
|
||||||
|
boardDict[key] = copyBoard((JArray)item.Value[boardFiledName]);
|
||||||
|
outPutBoardDict[key] = copyBoard((JArray)item.Value[boardFiledName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadExcelOver = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveBoardExcel()
|
||||||
|
{
|
||||||
|
var desktopDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
|
||||||
|
var tempPath = System.IO.Path.Combine(desktopDir, "BoardEditorTemp.txt");
|
||||||
|
Dictionary<int, Dictionary<string, JArray>> output = new Dictionary<int, Dictionary<string, JArray>>();
|
||||||
|
foreach(int key in outPutBoardDict.Keys)
|
||||||
|
{
|
||||||
|
output[key] = new Dictionary<string, JArray>();
|
||||||
|
output[key][boardFiledName] = copyBoard(outPutBoardDict[key]);
|
||||||
|
}
|
||||||
|
string relitivePath = Application.dataPath;
|
||||||
|
relitivePath = relitivePath.Remove(relitivePath.Length - 6, 6);
|
||||||
|
string pythonToolPath = relitivePath + "Tools/tranexcel_new";
|
||||||
|
File.WriteAllText(tempPath, JsonConvert.SerializeObject(output));
|
||||||
|
BFEditorUtils.RunCommond("python", "save_board.py " + tempPath + " " + boardFilepath, pythonToolPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DragBoard()
|
||||||
|
{
|
||||||
|
Texture img;
|
||||||
|
GUI.DrawTexture(new Rect(0, 150, 702, 702), boardImg);
|
||||||
|
if(!loadExcelOver)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int startOffset = 22;
|
||||||
|
int textureWidth = 94;
|
||||||
|
if (!boardDict.ContainsKey(curIndex))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUILayout.BeginArea(new Rect(0, 150, 702, 702));
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
JArray jo = boardDict[curIndex];
|
||||||
|
int posIndex = 0;
|
||||||
|
for (int row = 1; row <= 7; row++) {
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
for (int col = 1; col <= 7; col++) {
|
||||||
|
JArray gridInfo = (JArray)jo[posIndex];
|
||||||
|
if(gridInfo.Count < 2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int gridType = (int)gridInfo[0];
|
||||||
|
int gridElementType = (int)gridInfo[1];
|
||||||
|
if(!boardGridTypeDict.ContainsKey(gridType))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制元素
|
||||||
|
if (elementTypeImgDict.ContainsKey(gridElementType))
|
||||||
|
{
|
||||||
|
img = imgDict[elementTypeImgDict[gridElementType]];
|
||||||
|
GUI.DrawTexture(new Rect(startOffset + (col - 1) * textureWidth, startOffset + (row - 1) * textureWidth, textureWidth, textureWidth), img);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绘制类型
|
||||||
|
if(boardGridTypeDict[gridType].ContainsKey("icon"))
|
||||||
|
{
|
||||||
|
string icon = boardGridTypeDict[gridType]["icon"];
|
||||||
|
if (imgDict.ContainsKey(icon))
|
||||||
|
{
|
||||||
|
img = imgDict[icon];
|
||||||
|
GUI.DrawTexture(new Rect(startOffset + (col - 1) * textureWidth, startOffset + (row - 1) * textureWidth, textureWidth, textureWidth), img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
posIndex++;
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
|
||||||
|
GUILayout.BeginArea(new Rect(730, 150, 510, 550));
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("棋盘配置信息", GUILayout.Width(100), GUILayout.Height(30));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
posIndex = 0;
|
||||||
|
for (int row = 1; row <= 7; row++) {
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
for (int col = 1; col <= 7; col++) {
|
||||||
|
JArray gridInfo = (JArray)jo[posIndex];
|
||||||
|
if(gridInfo.Count < 2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
gridInfo[0] = int.Parse(GUILayout.TextField(gridInfo[0].ToString(), GUILayout.Width(25)));
|
||||||
|
gridInfo[1] = int.Parse(GUILayout.TextField(gridInfo[1].ToString(), GUILayout.Width(25)));
|
||||||
|
GUILayout.Space(10);
|
||||||
|
posIndex++;
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
GUILayout.Space(10);
|
||||||
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckBoardChanged(int index)
|
||||||
|
{
|
||||||
|
if(boardDict.ContainsKey(index) && outPutBoardDict.ContainsKey(index))
|
||||||
|
{
|
||||||
|
if(outPutBoardDict[index].Count != boardDict[index].Count)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < boardDict[index].Count; i++)
|
||||||
|
{
|
||||||
|
JArray tArray = (JArray)boardDict[index][i];
|
||||||
|
JArray tArray2 = (JArray)outPutBoardDict[index][i];
|
||||||
|
if (tArray.Count != tArray2.Count)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int j = 0; j < tArray.Count; j++)
|
||||||
|
{
|
||||||
|
if (tArray[j].ToString() != tArray2[j].ToString())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveBoard(int index)
|
||||||
|
{
|
||||||
|
if(!boardDict.ContainsKey(index))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
outPutBoardDict[index] = copyBoard(boardDict[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbortBoard(int index)
|
||||||
|
{
|
||||||
|
if(!outPutBoardDict.ContainsKey(index))
|
||||||
|
{
|
||||||
|
boardDict.Remove(index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boardDict[index] = copyBoard(outPutBoardDict[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showSwitchBoardSaveDialog(int targetIndex)
|
||||||
|
{
|
||||||
|
if (IsInNewBoard())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetIndex == curIndex)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckBoardChanged(curIndex))
|
||||||
|
{
|
||||||
|
switch (EditorUtility.DisplayDialogComplex("提示", "当前棋盘已经改变,是否保存", "确定", "放弃", "再次确认"))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
SaveBoard(curIndex);
|
||||||
|
curIndex = targetIndex;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
AbortBoard(curIndex);
|
||||||
|
curIndex = targetIndex;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curIndex = targetIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JArray copyBoard(JArray targetArray)
|
||||||
|
{
|
||||||
|
JArray resultArray = new JArray();
|
||||||
|
for (int i = 0; i < targetArray.Count; i++)
|
||||||
|
{
|
||||||
|
JArray unit = new JArray();
|
||||||
|
resultArray.Add(unit);
|
||||||
|
JArray temp = (JArray)targetArray[i];
|
||||||
|
for (int j = 0; j < temp.Count; j++)
|
||||||
|
{
|
||||||
|
unit.Add(int.Parse(temp[j].ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsInNewBoard()
|
||||||
|
{
|
||||||
|
if(!boardDict.ContainsKey(curIndex) && !outPutBoardDict.ContainsKey(curIndex))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !outPutBoardDict.ContainsKey(curIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 339fc40f64b402d4bb60e77d94902487
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -100,5 +100,12 @@ namespace BFEditor
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MenuItem("其他工具/棋盘编辑器", false, 9)]
|
||||||
|
public static void CreateBoardEditorWindow()
|
||||||
|
{
|
||||||
|
var window = (BoardEditorWindow)EditorWindow.GetWindowWithRect(typeof(BoardEditorWindow), new Rect(Screen.width / 2, Screen.height / 2, 1200, 850), true);
|
||||||
|
window.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
377
Assets/scenes/board_edit_scene.unity
Normal file
377
Assets/scenes/board_edit_scene.unity
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 0
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 12
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 1
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_LightingSettings: {fileID: 0}
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
maxJobWorkers: 0
|
||||||
|
preserveTilesOutsideBounds: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1001 &255378347
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 581222997}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_Pivot.x
|
||||||
|
value: 0.5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_Pivot.y
|
||||||
|
value: 0.5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4165930251451731960, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8889665677046596496, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: battle_ui
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 1f0a4fee1adac4647bb28d0ae5db612f, type: 3}
|
||||||
|
--- !u!1001 &581222996
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 379821213967434738, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1255030095349129672, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: ui_root
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
--- !u!224 &581222997 stripped
|
||||||
|
RectTransform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2290935117655172272, guid: ac54530c57342254290353ac147bd91d, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 581222996}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &1478717503
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1478717505}
|
||||||
|
- component: {fileID: 1478717504}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Directional Light
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!108 &1478717504
|
||||||
|
Light:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1478717503}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 10
|
||||||
|
m_Type: 1
|
||||||
|
m_Shape: 0
|
||||||
|
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||||
|
m_Intensity: 1
|
||||||
|
m_Range: 10
|
||||||
|
m_SpotAngle: 30
|
||||||
|
m_InnerSpotAngle: 21.80208
|
||||||
|
m_CookieSize: 10
|
||||||
|
m_Shadows:
|
||||||
|
m_Type: 2
|
||||||
|
m_Resolution: -1
|
||||||
|
m_CustomResolution: -1
|
||||||
|
m_Strength: 1
|
||||||
|
m_Bias: 0.05
|
||||||
|
m_NormalBias: 0.4
|
||||||
|
m_NearPlane: 0.2
|
||||||
|
m_CullingMatrixOverride:
|
||||||
|
e00: 1
|
||||||
|
e01: 0
|
||||||
|
e02: 0
|
||||||
|
e03: 0
|
||||||
|
e10: 0
|
||||||
|
e11: 1
|
||||||
|
e12: 0
|
||||||
|
e13: 0
|
||||||
|
e20: 0
|
||||||
|
e21: 0
|
||||||
|
e22: 1
|
||||||
|
e23: 0
|
||||||
|
e30: 0
|
||||||
|
e31: 0
|
||||||
|
e32: 0
|
||||||
|
e33: 1
|
||||||
|
m_UseCullingMatrixOverride: 0
|
||||||
|
m_Cookie: {fileID: 0}
|
||||||
|
m_DrawHalo: 0
|
||||||
|
m_Flare: {fileID: 0}
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_Lightmapping: 4
|
||||||
|
m_LightShadowCasterMode: 0
|
||||||
|
m_AreaSize: {x: 1, y: 1}
|
||||||
|
m_BounceIntensity: 1
|
||||||
|
m_ColorTemperature: 6570
|
||||||
|
m_UseColorTemperature: 0
|
||||||
|
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_UseBoundingSphereOverride: 0
|
||||||
|
m_UseViewFrustumForShadowCasterCull: 1
|
||||||
|
m_ShadowRadius: 0
|
||||||
|
m_ShadowAngle: 0
|
||||||
|
--- !u!4 &1478717505
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1478717503}
|
||||||
|
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||||
|
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||||
7
Assets/scenes/board_edit_scene.unity.meta
Normal file
7
Assets/scenes/board_edit_scene.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 57e2e18001c74264c99e83e575cf13c7
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
37
Tools/tranexcel_new/load_board.py
Normal file
37
Tools/tranexcel_new/load_board.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import excute
|
||||||
|
import json
|
||||||
|
import type_deal
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
|
||||||
|
current_file_path = os.path.split(os.path.realpath(__file__))[0]
|
||||||
|
site_packages_path = os.path.abspath(os.path.join(current_file_path, "../site-packages"))
|
||||||
|
sys.path.append(site_packages_path)
|
||||||
|
reload(sys)
|
||||||
|
|
||||||
|
from openpyxl import load_workbook
|
||||||
|
if __name__ == "__main__" :
|
||||||
|
av = sys.argv
|
||||||
|
tempPath = av[1]
|
||||||
|
xlsname = av[2]
|
||||||
|
wb = load_workbook(xlsname)
|
||||||
|
data = {}
|
||||||
|
for sheet in wb:
|
||||||
|
maxRow = sheet.max_row
|
||||||
|
maxColumn = sheet.max_column
|
||||||
|
for row in range(5, maxRow + 1):
|
||||||
|
data[sheet.cell(row, 1).value] = {}
|
||||||
|
t = data[sheet.cell(row, 1).value]
|
||||||
|
for column in range(2, maxColumn + 1):
|
||||||
|
key = sheet.cell(2, column).value
|
||||||
|
# print(type_deal.get_type_from_square(sheet.cell(4, column).value))
|
||||||
|
if key == "default" and sheet.cell(row, column).value != None:
|
||||||
|
v = str(sheet.cell(row, column).value)
|
||||||
|
t[sheet.cell(3, column).value] = type_deal.to_data(v)
|
||||||
|
|
||||||
|
break
|
||||||
|
wb.close()
|
||||||
|
open(tempPath, 'w').write(json.dumps(data))
|
||||||
45
Tools/tranexcel_new/save_board.py
Normal file
45
Tools/tranexcel_new/save_board.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import excute
|
||||||
|
import json
|
||||||
|
import type_deal
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
|
||||||
|
current_file_path = os.path.split(os.path.realpath(__file__))[0]
|
||||||
|
site_packages_path = os.path.abspath(os.path.join(current_file_path, "../site-packages"))
|
||||||
|
sys.path.append(site_packages_path)
|
||||||
|
reload(sys)
|
||||||
|
|
||||||
|
from openpyxl import load_workbook
|
||||||
|
if __name__ == "__main__" :
|
||||||
|
av = sys.argv
|
||||||
|
jsonStr = open(av[1], 'r').read()
|
||||||
|
boardDict = json.loads(jsonStr)
|
||||||
|
filedName = None
|
||||||
|
count = 1
|
||||||
|
for key in boardDict:
|
||||||
|
for value in boardDict[key]:
|
||||||
|
filedName = value
|
||||||
|
break
|
||||||
|
count += 1
|
||||||
|
xlsname = av[2]
|
||||||
|
wb = load_workbook(xlsname)
|
||||||
|
data = {}
|
||||||
|
for sheet in wb:
|
||||||
|
maxRow = sheet.max_row
|
||||||
|
maxColumn = sheet.max_column
|
||||||
|
column = 2
|
||||||
|
for col in range(2, maxColumn + 1):
|
||||||
|
if sheet.cell(3, col).value == filedName:
|
||||||
|
column = col
|
||||||
|
for id in range(1, count):
|
||||||
|
index = int(id)
|
||||||
|
row = index + 4
|
||||||
|
sheet.cell(row, 1).value = index
|
||||||
|
sheet.cell(row, column).value = str(boardDict[str(index)][filedName])
|
||||||
|
break
|
||||||
|
wb.save(xlsname)
|
||||||
|
wb.close()
|
||||||
|
print("导出成功!")
|
||||||
Loading…
x
Reference in New Issue
Block a user