Skip to content

Commit

Permalink
起動時にエラー表示になる問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsnmeajp committed Aug 28, 2022
1 parent 20bb319 commit cc45f5c
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions EVMC4U/Editor/Tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ static void InitializeOnLoad()
[MenuItem("EVMC4U/Oepn Tutorial")]
public static void Open()
{
//一度開いたのを覚えておく
EditorUserSettings.SetConfigValue("Opened", "1");

//ウィンドウサイズを固定
var window = GetWindow<Tutorial>();
window.maxSize = new Vector2(window_w, window_h - 6);
Expand All @@ -126,6 +123,12 @@ public static void Open()
anim.target = 0.001f;
anim.valueChanged = null;

if (Resources.Load<TextAsset>("tutorial/define") == null)
{
//読み込み準備ができていない
return;
}

//ページを初期位置に設定
page = "start";
if (EditorUserSettings.GetConfigValue("Language") == "ja")
Expand All @@ -144,28 +147,32 @@ public static void Open()
try
{
jsonError = "";
tutorialJson = JsonUtility.FromJson<TutorialJson>(Resources.Load<TextAsset>("tutorial/define").text);
var r = Resources.Load<TextAsset>("tutorial/define");
tutorialJson = JsonUtility.FromJson<TutorialJson>(r.text);
if (tutorialJson.debug)
{
Debug.Log(tutorialJson);
}

//各ページのデータを読み込む
foreach (var p in tutorialJson.pages)
{
tutorialPages.Add(p.name, p);
if (tutorialJson.debug)
{
Debug.Log(p);
}
}

//一度開いたのを覚えておく
EditorUserSettings.SetConfigValue("Opened", "1");
}
catch (ArgumentException e) {
Debug.LogError(e);
//Debug.LogError(e);
jsonError = e.ToString();
tutorialJson = null;
}

//各ページのデータを読み込む
foreach (var p in tutorialJson.pages)
{
tutorialPages.Add(p.name, p);
if (tutorialJson.debug)
{
Debug.Log(p);
}
}

//バージョンチェック(失敗したら失敗ページに飛ばす)
if (check)
{
Expand Down

0 comments on commit cc45f5c

Please sign in to comment.