Skip to content

Commit

Permalink
修改提示
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoye97 committed Nov 28, 2021
1 parent 5226ebf commit 6de2cb5
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions VRoidChinese/VRoidChinese.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public class VRoidChinese : BaseUnityPlugin
/// </summary>
public ConfigEntry<KeyCode> SwitchLangKey;

/// <summary>
/// 只提醒一次的提示
/// </summary>
public ConfigEntry<bool> ShowOnceTip;

/// <summary>
/// 是否有空值,有空值则需要Dump
/// </summary>
Expand Down Expand Up @@ -101,6 +106,7 @@ private void Start()
// 备份原文
Backup();
// 读取配置
ShowOnceTip = Config.Bind<bool>("config", "ShowOnceTip", false, "仅提示一次的消息");
OnStartDump = Config.Bind<bool>("config", "OnStartDump", false, "当启动时进行转储(原词条)");
OnHasNullValueDump = Config.Bind<bool>("config", "OnHasNullValueDump", false, "当缺失词条时进行转储(合并后词条)");
DevMode = Config.Bind<bool>("config", "DevMode", false, "汉化者开发模式");
Expand Down Expand Up @@ -149,14 +155,20 @@ private void Update()

private void OnGUI()
{
GUI.backgroundColor = Color.black;
if (ShowUpdateTip)
{
Rect rect = new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 400, 300);
rect = GUILayout.Window(1234, rect, TipWindowFunc, "出现异常", GUILayout.ExpandHeight(true));
rect = GUILayout.Window(1234, rect, ExceptionTipWindowFunc, "出现异常", GUILayout.ExpandHeight(true));
}
if (!ShowOnceTip.Value)
{
Rect rect = new Rect(Screen.width / 2 - 200, Screen.height / 2 - 150, 300, 200);
rect = GUILayout.Window(4321, rect, OnceTipWindowFunc, "免费声明", GUILayout.ExpandHeight(true));
}
}

public void TipWindowFunc(int id)
public void ExceptionTipWindowFunc(int id)
{
GUI.backgroundColor = Color.white;
GUI.contentColor = Color.black;
Expand All @@ -182,6 +194,20 @@ public void TipWindowFunc(int id)
}
}

/// <summary>
/// 仅出现一次的提示
/// </summary>
/// <param name="id"></param>
public void OnceTipWindowFunc(int id)
{
GUILayout.Label("软件和汉化插件均是完全免费的,汉化插件在GitHub开源,近期出现淘宝无良商家贩卖软件和汉化插件,请大家注意警惕,谨防受骗。");
GUILayout.FlexibleSpace();
if (GUILayout.Button("确定(不再提示此消息)"))
{
ShowOnceTip.Value = true;
}
}

/// <summary>
/// 备份原文
/// </summary>
Expand Down Expand Up @@ -410,7 +436,7 @@ public void FixString()
[HarmonyPrefix, HarmonyPatch(typeof(StandaloneWindowTitle), "Change")]
public static bool WindowTitlePatch(ref string newTitle)
{
newTitle += " 版本: 1.04 - 汉化版本: 1.6.3 - 作者: 宵夜97 - 汉化开源免费,谨防受骗";
newTitle += $" v{Application.version} 汉化作者: 宵夜97";
return true;
}

Expand Down

0 comments on commit 6de2cb5

Please sign in to comment.