Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ヘルプのボタンを押したときに公式HPに遷移するように変更 #159

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 11 additions & 34 deletions Assets/uDesktopMascot/Scripts/Menu/MenuPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,49 +202,26 @@ private async UniTask LoadBackgroundImageAsync(string relativePath, Cancellation
}

/// <summary>
/// ヘルプページ(README.txt)を環境に応じて開く
/// 公式のHPのクリエイター向けページを開く
/// </summary>
private void OpenHelp()
{
string path;

#if UNITY_EDITOR
// Unity Editorでは、Assetsフォルダ内のパスを使用
path = Path.Combine(Application.dataPath, "uDesktopMascot/Document/README.txt");
#else
// ビルド後のアプリケーションでは、ビルドフォルダのルートへのパスを取得
string rootPath = Application.platform switch
{
// macOSの場合、Application.dataPath は AppName.app/Contents なので2つ上の親ディレクトリを取得
RuntimePlatform.OSXPlayer => Directory.GetParent(Application.dataPath).Parent.FullName,
_ => Directory.GetParent(Application.dataPath).FullName
};
path = Path.Combine(rootPath, "README.txt");
#endif

// パスをログに出力
Log.Info($"Attempting to open file at path: {path}");

if (File.Exists(path))
// 開きたいURLを指定
string url = "https://midralab.github.io/uDesktopMascot-web/docs/category/%E3%83%81%E3%83%A5%E3%83%BC%E3%83%88%E3%83%AA%E3%82%A2%E3%83%AB";

try
{
try
{
// ファイルURLを作成
string url = $"file:///{path.Replace("\\", "/")}";
// ファイルを開く
Application.OpenURL(url);
}
catch (Exception e)
{
Log.Error($"README.txtを開くことができませんでした:\n{e}");
}
Log.Info($"Attempting to open URL: {url}");
// URLを開く
Application.OpenURL(url);
}
else
catch (Exception e)
{
Log.Error($"README.txtが次のパスに見つかりませんでした: {path}");
Log.Error($"指定されたURLを開くことができませんでした:\n{e}");
}
}


/// <summary>
/// WebUIを開く
/// </summary>
Expand Down
Loading