You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
7.3 KiB
224 lines
7.3 KiB
#if UNITY_EDITOR
|
|
using IVDataFormat;
|
|
using System.IO;
|
|
using System.Numerics;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class CustomOptionWindow : EditorWindow
|
|
{
|
|
#region User
|
|
[MenuItem("Custom/User Settings", priority = 1)]
|
|
public static void OpenUserToken()
|
|
{
|
|
EditorWindow.GetWindow<CustomOptionWindow>("User Settings");
|
|
}
|
|
|
|
public const string KEY = "editortoken";
|
|
string userToken = null;
|
|
|
|
private void OnGUI()
|
|
{
|
|
if (string.IsNullOrEmpty(userToken))
|
|
{
|
|
userToken = PlayerPrefs.GetString(KEY, "input your token here");
|
|
}
|
|
GUILayout.Space(10f);
|
|
GUILayout.Label("User Token", EditorStyles.boldLabel);
|
|
GUIStyle areastyle = new GUIStyle(GUI.skin.textArea);
|
|
areastyle.wordWrap = true;
|
|
areastyle.fixedHeight = 300f;
|
|
userToken = EditorGUILayout.TextArea(userToken, areastyle);
|
|
GUILayout.Label("* Input your login token and save.");
|
|
GUILayout.Space(10f);
|
|
if (GUILayout.Button("Save"))
|
|
{
|
|
if (!string.IsNullOrEmpty(userToken) && !userToken.Equals("input your token here"))
|
|
{
|
|
PlayerPrefs.SetString(KEY, userToken);
|
|
PlayerPrefs.Save();
|
|
EditorUtility.DisplayDialog("Result", "User token saved.", "OK");
|
|
}
|
|
else
|
|
{
|
|
userToken = "input your token here";
|
|
EditorUtility.DisplayDialog("Error!", "Please input correct token.", "OK");
|
|
}
|
|
}
|
|
}
|
|
#endregion User
|
|
|
|
#region Remove Datas
|
|
[MenuItem("Custom/Remove Datas/Remove Play Data", priority = 11)]
|
|
public static void RemovePlayData()
|
|
{
|
|
string strpath = Application.persistentDataPath + "/" + Global.ES3_PlayDatas;
|
|
File.Delete(strpath);
|
|
EditorUtility.DisplayDialog("Remove Play Data", strpath + " Removed!", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Remove Datas/Remove Currency Data", priority = 12)]
|
|
public static void RemoveCurrencyData()
|
|
{
|
|
string strpath = Application.persistentDataPath + "/" + Global.ES3_PlayGoods;
|
|
File.Delete(strpath);
|
|
EditorUtility.DisplayDialog("Remove Currency Data", strpath + " Removed!", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Remove Datas/Remove Pass Data", priority = 13)]
|
|
public static void RemoveCPassData()
|
|
{
|
|
string strpath = Application.persistentDataPath + "/" + Global.ES3_Pass;
|
|
File.Delete(strpath);
|
|
EditorUtility.DisplayDialog("Remove Pass Data", strpath + " Removed!", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Remove Datas/Remove All Save Datas", priority = 14)]
|
|
public static void RemoveAllSaveDatas()
|
|
{
|
|
string[] strpaths = Directory.GetFiles(Application.persistentDataPath);
|
|
string postfix = ".es3";
|
|
for (int i = 0; i < strpaths.Length; i++)
|
|
{
|
|
if (strpaths[i].EndsWith(postfix))
|
|
File.Delete(strpaths[i]);
|
|
}
|
|
EditorUtility.DisplayDialog("Remove All Datas", "Remove all save datas complete!\n" + Application.persistentDataPath, "OK");
|
|
}
|
|
#endregion Remove Datas
|
|
|
|
#region Add Goods
|
|
[MenuItem("Custom/Add Goods/Add Gold", priority = 21)]
|
|
public static void AddGold()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gold += new BigInteger(100000L);
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gold", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Dia", priority = 22)]
|
|
public static void AddDia()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.diaFree += 50000;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Dia", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Point", priority = 23)]
|
|
public static void AddPoint()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.point += 100;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Point", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Awaken Stone", priority = 24)]
|
|
public static void AddAwakenStone()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gearAwakenStone += 500;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Awaken Stone", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Rein Stone", priority = 25)]
|
|
public static void AddReinStone()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gearReinStone += 10000000;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Rein Stone", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Gacha Ticket Weapon", priority = 26)]
|
|
public static void AddGachaWeapon()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gachaWeapon += 300;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gacha Ticket Weapon", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Gacha Ticket Armor", priority = 27)]
|
|
public static void AddGachaArmor()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gachaArmor += 300;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gacha Ticket Armor", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Gacha Ticket Acce", priority = 28)]
|
|
public static void AddGachaAcce()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gachaAcc += 300;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gacha Ticket Acce", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Gacha Ticket Treasure", priority = 29)]
|
|
public static void AddGachaTreasure()
|
|
{
|
|
cGoodsData data = cGoodsData.Load(1);
|
|
data.gachaTreasure += 300;
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gacha Ticket Treasure", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Gear Box", priority = 41)]
|
|
public static void AddGearBox()
|
|
{
|
|
cBoxData data = cBoxData.Load(1);
|
|
int iendcode = cGoods.CBoxGeneralStart + 28;
|
|
for (int key = cGoods.CBoxGeneralStart; key < iendcode; key++)
|
|
{
|
|
if (Random.Range(0, 2) > 0)
|
|
continue;
|
|
|
|
if (data.dicBoxCount.ContainsKey(key))
|
|
data.dicBoxCount[key] += 50;
|
|
else
|
|
data.dicBoxCount.Add(key, 50);
|
|
}
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Gear Box", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Pet Box", priority = 42)]
|
|
public static void AddPetBox()
|
|
{
|
|
cBoxData data = cBoxData.Load(1);
|
|
int iendcode = cGoods.CBoxPetStart + 28;
|
|
for (int key = cGoods.CBoxPetStart; key < iendcode; key++)
|
|
{
|
|
if (Random.Range(0, 2) > 0)
|
|
continue;
|
|
|
|
if (data.dicBoxCount.ContainsKey(key))
|
|
data.dicBoxCount[key] += 10;
|
|
else
|
|
data.dicBoxCount.Add(key, 10);
|
|
}
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Pet Box", "OK");
|
|
}
|
|
|
|
[MenuItem("Custom/Add Goods/Add Diary Box", priority = 43)]
|
|
public static void AddDiaryBox()
|
|
{
|
|
cBoxData data = cBoxData.Load(1);
|
|
int key = cGoods.CBoxDiary;
|
|
if (data.dicBoxCount.ContainsKey(key))
|
|
data.dicBoxCount[key] += 20;
|
|
else
|
|
data.dicBoxCount.Add(key, 20);
|
|
data.Save(1);
|
|
EditorUtility.DisplayDialog("Add Goods", "Add Diary Box", "OK");
|
|
}
|
|
#endregion Add Goods
|
|
}
|
|
#endif
|