update: 更新 JsonBuilder 的数据源
# Conflicts: # Editor/GuruJsonBuilder/guru-project-settings.cfgdev
parent
31991a780b
commit
f85eb8d2bb
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f9c48f29655a4b8bb90520de5a7c2fa4
|
||||||
|
timeCreated: 1719552474
|
||||||
|
|
@ -13,30 +13,8 @@ namespace Guru.Editor
|
||||||
|
|
||||||
public class GuruServiceJsonBuilder: EditorWindow
|
public class GuruServiceJsonBuilder: EditorWindow
|
||||||
{
|
{
|
||||||
public enum GuruProjects
|
const string GuruProjectSettingsName = "guru-project-settings.cfg";
|
||||||
{
|
|
||||||
Default = 0,
|
|
||||||
BallSortPlus,
|
|
||||||
DOF,
|
|
||||||
D2,
|
|
||||||
DO,
|
|
||||||
TileConnect,
|
|
||||||
FindOut,
|
|
||||||
FindIt,
|
|
||||||
AP,
|
|
||||||
TileBurst,
|
|
||||||
Parking3D,
|
|
||||||
BallSort,
|
|
||||||
BallSort2,
|
|
||||||
WaterSort,
|
|
||||||
WaterSort2,
|
|
||||||
Arrow,
|
|
||||||
APFindDifference,
|
|
||||||
CookingBlitz,
|
|
||||||
WoodNuts,
|
|
||||||
MahjongSolitaire,
|
|
||||||
GoodsSort,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tool Version
|
// Tool Version
|
||||||
public const string Version = "0.2.0";
|
public const string Version = "0.2.0";
|
||||||
|
|
@ -57,35 +35,20 @@ namespace Guru.Editor
|
||||||
private static GuruServiceJsonBuilder _instance;
|
private static GuruServiceJsonBuilder _instance;
|
||||||
private List<string> _projectNames;
|
private List<string> _projectNames;
|
||||||
private int _selectedProjectIndex = 0;
|
private int _selectedProjectIndex = 0;
|
||||||
|
private static Dictionary<string, string> _publishLinks;
|
||||||
|
public static Dictionary<string, string> PublishLinks
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_publishLinks == null) _publishLinks = LoadProjectSettingsCfg();
|
||||||
|
return _publishLinks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Link & Keys
|
#region Link & Keys
|
||||||
|
|
||||||
private const string TSVLink = "https://docs.google.com/spreadsheets/d/e/{0}/pub?gid=0&single=true&output=tsv";
|
private const string TSVLink = "https://docs.google.com/spreadsheets/d/e/{0}/pub?gid=0&single=true&output=tsv";
|
||||||
private static readonly Dictionary<string, string> PublishLinks = new Dictionary<string, string>()
|
|
||||||
{
|
|
||||||
[GuruProjects.BallSortPlus.ToString()] = "2PACX-1vTa324nQIwNmXNtHC5sZZXYBdpUryKXdb8rFbTAwBa4KVlQ5ZXnErx2IvifkRxD8qKcNupfO1Kv5pJw",
|
|
||||||
[GuruProjects.DOF.ToString()] = "2PACX-1vSDpYZEUrCioCBRSkoZLra5nWk53Ks1f180TD1g2dnKcm-MZtAYvFSXDieAF4xromZCmxIoZuIfGyCJ",
|
|
||||||
[GuruProjects.D2.ToString()] = "2PACX-1vS1V35WTTPx2Jdeu6sVjPbaqFpjVwFu1Rn9tZkvxm8aEHbuRWibxt2pxPkLdDzwmCmrGBtU-PilABJm",
|
|
||||||
[GuruProjects.DO.ToString()] = "2PACX-1vT981NxQldx3qXELplYPoyFSfrMC3QvGciUwRu1sJmsHOu7dB3WSOPDGF4R55cXTq-Q5k_Dq4pmNpF2",
|
|
||||||
[GuruProjects.TileConnect.ToString()] = "2PACX-1vRfSd9UbrLilele8Fw1BafFjlvHG5EMnODfbppPiUaacr7wZ62IvgM65SYSjGEXJmU9g9AczollaFCf",
|
|
||||||
[GuruProjects.FindOut.ToString()] = "2PACX-1vQA3R66yWRHmUn6sneeIUU1qXEiaXv6h9QdzYzVRTEOg-yZf7WCJ6tuvXMWzwcOgGihiSnr9shMX__d",
|
|
||||||
[GuruProjects.FindIt.ToString()] = "2PACX-1vQs75JLsmTv1PESzOP6ANRqVk4zA3Y7PD5OV0yQbA5MM3wmp-hu4qE9gztZy7ETCP2nHJgDziwVpcFE",
|
|
||||||
[GuruProjects.AP.ToString()] = "2PACX-1vSvXTqbTcNCuHZYbKGA-fPKQj8XuixYUB9UXWqTQXz5QLXNurCtmBlziMbUxte_eqsGO0tB2GXe-sEC",
|
|
||||||
[GuruProjects.TileBurst.ToString()] = "2PACX-1vS5wvSZ5eSlK8TmYwVvgScJstaqN8cAB7Uxlq_nsbQwQ4VeD1BkhQuDbRdcO9ncuOCtoKjzSnviHVmc",
|
|
||||||
[GuruProjects.Parking3D.ToString()] = "2PACX-1vQY18hIrYjYNOqQNE12BcPtF4gtFMhBbfDrakBcIVQKoStmfPBY7C4O_Efj1Y8sNbytbKZr-0lPmBml",
|
|
||||||
[GuruProjects.BallSort.ToString()] = "2PACX-1vSPus7415l66-zScY1B1JOgLfSkm0yRPnRDG-BW0JgtnVZJziGDzvtBZr8D9oEZL2x478SdCS2yh0S_",
|
|
||||||
[GuruProjects.BallSort2.ToString()] = "2PACX-1vSZIZYbFuURK_ZMeMHV9ruL0SWBGMPA13er_J_DLRPVw5HBnU8_6c4mvek5UBFo1Ebbk63TMr-rsY6y",
|
|
||||||
[GuruProjects.WaterSort.ToString()] = "2PACX-1vTPxWbpP7KnT-e2xg9Uz-nukbLmqYc8SjwNL9MgycIhInNgmAjOmRnmyH6PWm3-hsEugKTJHKDcoKdI",
|
|
||||||
[GuruProjects.WaterSort2.ToString()] = "2PACX-1vQnZNtE7ZpT6eYagQDt686Be9Jr0tg22sRFg5cGiqFIsCVhWLu6jxDUg7qmyfIrX3iL5awat8FFnN7B",
|
|
||||||
[GuruProjects.Arrow.ToString()] = "2PACX-1vS5w8rNcJycK-VYgum7gkrLAx2Ln_7wykXLBX4EulI8XNGnlPsVlENQ8LupDdtiIu-JlngJaTw5dIzR",
|
|
||||||
[GuruProjects.APFindDifference.ToString()] = "2PACX-1vSmodKOvKjxmiNoYbrXFI6n1XC0aqvlnbYkEGyabLKqS6-C3Yi3nstmC89Hc31cdIzCk1FAl54beW2P",
|
|
||||||
[GuruProjects.CookingBlitz.ToString()] = "2PACX-1vShqtSSpwYQ8CvK-BVr-wQ5ygGeKKLdpaaWysSN_QumoDZYATemayAQIOdnFRzMP69nEwFYSx51oey8",
|
|
||||||
[GuruProjects.WoodNuts.ToString()] = "2PACX-1vQhtRg354eThBpWGCEk5f_2cLVbz1clQXv0n6w4Cyip0Knl6EQ4XwWMlcCec-legZdHU3E0-_cqKipc",
|
|
||||||
[GuruProjects.MahjongSolitaire.ToString()] = "2PACX-1vQpcaj8CpO__K1KGl-mg_940WOOIXBVzi0lmcjYTt1sqBI2PtK37s29McLTGU2I6N3fWM0ZepChedq7",
|
|
||||||
[GuruProjects.GoodsSort.ToString()] = "2PACX-1vQrg6Ss2bNYAI7A250t3_zp10UJtbbQXb8I4LtDJ2Q3uopUG_PUadoJy7T4w0jlf4xcTqot2NWsfp1m",
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -621,6 +584,53 @@ namespace Guru.Editor
|
||||||
_instance.Show();
|
_instance.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Settings
|
||||||
|
|
||||||
|
private static string GetRelativeDir()
|
||||||
|
{
|
||||||
|
var guids = AssetDatabase.FindAssets(nameof(GuruServiceJsonBuilder));
|
||||||
|
if (guids.Length > 0)
|
||||||
|
{
|
||||||
|
var path = AssetDatabase.GUIDToAssetPath(guids[0]);
|
||||||
|
var rpath = Directory.GetParent(path).FullName;
|
||||||
|
return rpath;
|
||||||
|
}
|
||||||
|
return Path.GetFullPath($"Assets/../Packages/Editor/GuruJsonBuilder");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Dictionary<string, string> LoadProjectSettingsCfg()
|
||||||
|
{
|
||||||
|
var cfgPath = $"{GetRelativeDir()}/{GuruProjectSettingsName}";
|
||||||
|
if (File.Exists(cfgPath))
|
||||||
|
{
|
||||||
|
var lines = File.ReadAllLines(cfgPath);
|
||||||
|
int len = lines?.Length ?? -1;
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> dict = new Dictionary<string, string>(lines.Length);
|
||||||
|
int i = 0;
|
||||||
|
string[] raw;
|
||||||
|
string line, key, value;
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
line = lines[i];
|
||||||
|
if(string.IsNullOrEmpty(line)) continue;
|
||||||
|
raw = lines[i].Split(',');
|
||||||
|
key = "";
|
||||||
|
value = "";
|
||||||
|
key = raw[0];
|
||||||
|
if(raw.Length > 0) value = raw[1];
|
||||||
|
dict[key] = value;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Window
|
#region Window
|
||||||
|
|
@ -631,7 +641,7 @@ namespace Guru.Editor
|
||||||
this.titleContent = new GUIContent("Json Builder");
|
this.titleContent = new GUIContent("Json Builder");
|
||||||
|
|
||||||
_projectNames = new List<string>(20);
|
_projectNames = new List<string>(20);
|
||||||
string[] names = Enum.GetNames(typeof(GuruProjects));
|
string[] names = PublishLinks.Keys.ToArray();
|
||||||
string name = "";
|
string name = "";
|
||||||
for(int i = 0; i < names.Length; i++)
|
for(int i = 0; i < names.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -648,7 +658,16 @@ namespace Guru.Editor
|
||||||
|
|
||||||
_selectedProjectIndex = 0;
|
_selectedProjectIndex = 0;
|
||||||
_state = STATE_IDLE;
|
_state = STATE_IDLE;
|
||||||
|
|
||||||
|
|
||||||
|
var json = LoadProjectSettingsCfg();
|
||||||
|
Debug.Log(json);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
|
|
@ -759,11 +778,6 @@ namespace Guru.Editor
|
||||||
#region Networking
|
#region Networking
|
||||||
|
|
||||||
|
|
||||||
private static string GetProjectTSVUrl(GuruProjects pid)
|
|
||||||
{
|
|
||||||
return GetProjectTSVUrl(pid.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetProjectTSVUrl(string pid)
|
private static string GetProjectTSVUrl(string pid)
|
||||||
{
|
{
|
||||||
if (PublishLinks.TryGetValue(pid, out var id))
|
if (PublishLinks.TryGetValue(pid, out var id))
|
||||||
|
|
@ -819,8 +833,7 @@ namespace Guru.Editor
|
||||||
private static void Test_FetchConfigFile()
|
private static void Test_FetchConfigFile()
|
||||||
{
|
{
|
||||||
|
|
||||||
var pid = GuruProjects.FindOut;
|
var pid = "FindOut";
|
||||||
|
|
||||||
var url = GetProjectTSVUrl(pid);
|
var url = GetProjectTSVUrl(pid);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88694fb6aaa64ea192e0bffb4cb5b744
|
||||||
|
timeCreated: 1719552889
|
||||||
Loading…
Reference in New Issue