Skip to content

Commit

Permalink
Merge pull request #56 from kirurobo/dev_mac
Browse files Browse the repository at this point in the history
v0.9.1
  • Loading branch information
kirurobo authored May 3, 2023
2 parents 3bc2a41 + d66863c commit 6ce6dd9
Show file tree
Hide file tree
Showing 25 changed files with 3,514 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- v*

env:
MAIN_BRANCH: master
MAIN_BRANCH: main
UPM_BRANCH: upm
PKG_ROOT_DIR: UniWinC/Assets/Kirurobo/UniWindowController
SAMPLES_DIR: Samples
Expand Down
5 changes: 5 additions & 0 deletions UniWinC/Assets/Kirurobo/UniWindowController/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ How to write the changelog.
https://keepachangelog.com/ja/1.0.0/
--->

## [v0.9.1] - 2023-05-03
### Fixed
- Position of file type selection box on macOS
- GetClientSize() on macOS

## [v0.9.0] - 2023-04-22
### Changed
- The development environment has been updated to Unity 2020.3.43
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,31 @@ static void PerformBuild()
{
// コマンドライン引数の最後が出力パスだとする
//string outputPath = System.Environment.GetCommandLineArgs().Last();

// var buildPlayerOptions = new BuildPlayerOptions();
// buildPlayerOptions.scenes = sceneList.ToArray();
// buildPlayerOptions.locationPathName = outputPath;
// buildPlayerOptions.target = BuildTarget.StandaloneOSX;
// buildPlayerOptions.options = BuildOptions.None;

// 事前にエディタから設定したビルド設定を利用する

// 事前にエディタから設定したビルド設定を利用
var scenes = EditorBuildSettings.scenes;
var buildTarget = EditorUserBuildSettings.activeBuildTarget;
var locationPath = EditorUserBuildSettings.GetBuildLocation(buildTarget);

// ビルド対象は環境に合わせて上書き
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
buildTarget = BuildTarget.StandaloneOSX;
locationPath = "Builds/macOS/" + Application.productName;
#elif UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
buildTarget = BuildTarget.StandaloneWindows64;
locationPath = "Builds/Win64/" + Application.productName;
#endif

var buildPlayerOptions = new BuildPlayerOptions
{
scenes = EditorBuildSettingsScene.GetActiveSceneList(EditorBuildSettings.scenes),
locationPathName = EditorUserBuildSettings.GetBuildLocation(buildTarget),
scenes = EditorBuildSettingsScene.GetActiveSceneList(scenes),
locationPathName = locationPath,
target = buildTarget,
options = BuildOptions.None
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.0</string>
<string>0.9.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;

namespace Kirurobo
{
public class SampleManager : MonoBehaviour
{
static readonly string[] _scenes =
{
"SampleMenu",
"SimpleSample",
"UiSample",
"FullScreenSample",
"FileDialogSample"
};

private static SampleManager _instance;
public static SampleManager Instance => _instance ?? (_instance = GameObject.FindObjectOfType<SampleManager>() ?? new SampleManager());

public Canvas canvas;

private void Awake()
{
// シングルトンとする。既にインスタンスがあれば自分を破棄
Expand All @@ -34,44 +28,46 @@ private void Awake()
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}

/// <summary>
/// シーンロード時にメインカメラを記憶
/// </summary>
/// <param name="arg0"></param>
/// <param name="arg1"></param>
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
{
UniWindowController.current.SetCamera(Camera.main);
}

// Start is called before the first frame update
void Start()
{
}

// Update is called once per frame
void Update()
/// <summary>
/// 指定の名前のシーンを開く
/// </summary>
/// <param name="name">シーン名</param>
public void LoadScene(string name)
{
if (name == "SimpleSample")
{
// SimpleSample の場合はスクリプトでの制御がないため、ここで透明化
UniWindowController.current.isTransparent = true;
}
else if (name == "FullScreenSample")
{
// FullScreenSample の場合は強制的に最大化
UniWindowController.current.shouldFitMonitor = true;
}

SceneManager.LoadScene(name);
}

private void OnGUI()
{
float y = 0;

for (int index = 0; index < _scenes.Length; index++)
{
if (GUI.Button(new Rect(0, y, 160, 36), _scenes[index]))
{
if (index == 1)
{
// SimpleSample の場合はスクリプトでの制御がないため、ここで透明化
UniWindowController.current.isTransparent = true;
} else if (index == 3)
{
// FullScreenSample の場合は強制的に最大化
UniWindowController.current.shouldFitMonitor = true;
}

SceneManager.LoadScene(_scenes[index]);
}
y += 40;
}
/// <summary>
/// 終了
/// </summary>
public void Quit()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
}
Loading

0 comments on commit 6ce6dd9

Please sign in to comment.