Commit e414651d authored by mercury233's avatar mercury233

add no access hint

parent ab5f0191
......@@ -145,6 +145,14 @@ public static class Config
{
all += translations[i].original + "->" + translations[i].translated + "\r\n";
}
try
{
File.WriteAllText(path, all);
}
catch (Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
}
}
......@@ -65,8 +65,15 @@ public static class InterString
return return_value.Replace("@n", "\r\n").Replace("@ui", "");
}
else if (original != "")
{
try
{
File.AppendAllText(path, original + "->" + original + "\r\n");
}
catch
{
Program.noAccess = true;
}
translations.Add(original, original);
return original.Replace("@n", "\r\n").Replace("@ui", "");
}
......
......@@ -86,17 +86,23 @@ public class Menu : WindowServantSP
}
}
bool outed = false;
bool msgUpdateShowed = false;
bool msgPermissionShowed = false;
public override void preFrameFunction()
{
base.preFrameFunction();
if (upurl != "" && outed == false)
Menu.checkCommend();
if (Program.noAccess && !msgPermissionShowed)
{
msgPermissionShowed = true;
Program.PrintToChat(InterString.Get("[b][FF0000]NO ACCESS!! NO ACCESS!! NO ACCESS!![-][/b]") + "\n" + InterString.Get("访问程序目录出错,保存卡组等功能无法使用。@n请将 YGOPro2 安装到其他文件夹,或以管理员身份运行。"));
}
else if (upurl != "" && !msgUpdateShowed)
{
outed = true;
msgUpdateShowed = true;
RMSshow_yesOrNo("update", InterString.Get("[b]发现更新![/b]") + "\n" + uptxt + "\n" + InterString.Get("是否打开下载页面?"),
new messageSystemValue { value = "1", hint = "yes" }, new messageSystemValue { value = "0", hint = "no" });
}
Menu.checkCommend();
}
void onClickExit()
......@@ -182,6 +188,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
string all = "";
......@@ -232,6 +239,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
try
......@@ -246,6 +254,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
}
......
......@@ -292,11 +292,21 @@ public class Program : MonoBehaviour
Config.initialize("config/config.conf");
if (!Directory.Exists("expansions"))
{
try
{
Directory.CreateDirectory("expansions");
}
catch
{
}
}
var fileInfos = new FileInfo[0];
var fileInfos = (new DirectoryInfo("expansions")).GetFiles();
if (Directory.Exists("expansions"))
{
fileInfos = (new DirectoryInfo("expansions")).GetFiles();
foreach (FileInfo file in fileInfos)
{
if (file.Name.ToLower().EndsWith(".ypk"))
......@@ -312,6 +322,7 @@ public class Program : MonoBehaviour
YGOSharp.CardsManager.initialize("expansions/" + file.Name);
}
}
}
if (Directory.Exists("cdb"))
{
......@@ -1025,6 +1036,8 @@ public class Program : MonoBehaviour
public static float fieldSize = 1;
public static bool longField = false;
public static bool noAccess = false;
void OnApplicationQuit()
{
TcpHelper.SaveRecord();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment