Skip to content

Commit

Permalink
Fullscreen+0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yojohanshinwataikei committed Oct 1, 2020
1 parent 9e876be commit 2b4048d
Show file tree
Hide file tree
Showing 5 changed files with 496 additions and 48 deletions.
29 changes: 22 additions & 7 deletions Assets/Editor/ArcadeBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,39 @@

public class ArcadeBuild
{
[MenuItem("Arcade/Test build")]
public static void TestBuild()
{
UnityEngine.Debug.Log(BuildPipeline.BuildPlayer(
new BuildPlayerOptions()
{
locationPathName = "Build/x64/Arcade-plus.exe",
scenes = new string[] { "Assets/_Scenes/ArcEditor.unity" },
target = BuildTarget.StandaloneWindows64,
options = BuildOptions.None,
}).summary.result.ToString());
}
[MenuItem("Arcade/UpdateBuildTime")]
public static void UpdateBuildTime(){
public static void UpdateBuildTime()
{
DateTime buildTime = DateTime.Now;
//Note: seems pwd is project folder, however this is not documented
File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "Assets/Misc/BuildTimestamp.txt"), $"{buildTime.Ticks}");
AssetDatabase.Refresh();
}
}
[MenuItem("Arcade/Build")]
public static void Build(){
public static void Build()
{
BuildArcade(false);
}
[MenuItem("Arcade/Build and zip")]
public static void BuildAndZip(){
public static void BuildAndZip()
{
BuildArcade(true);
}
public static void BuildArcade(bool createZipPackage)
{
UpdateBuildTime();
UpdateBuildTime();
FileUtil.DeleteFileOrDirectory("Build");
UnityEngine.Debug.Log(BuildPipeline.BuildPlayer(
new BuildPlayerOptions()
Expand Down Expand Up @@ -58,8 +73,8 @@ public static void BuildArcade(bool createZipPackage)
options = BuildOptions.None,
}).summary.result.ToString());
// TODO: Find a way to use the System.IO.Compression.ZipFile without breaking things
FileUtil.CopyFileOrDirectory("Skin","Build/x64/Skin");
FileUtil.CopyFileOrDirectory("Background","Build/x64/Background");
FileUtil.CopyFileOrDirectory("Skin", "Build/x64/Skin");
FileUtil.CopyFileOrDirectory("Background", "Build/x64/Background");
}
}

2 changes: 1 addition & 1 deletion Assets/Misc/BuildTimestamp.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
637371615015466783
637371716767105336
3 changes: 2 additions & 1 deletion Assets/Misc/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
- 你现在可以在选中单个 Arctap 时通过左上角编辑菜单选中其所在的 Arc
- 音符流速显示的数值改为与游戏内相同的 1.0 - 6.5
- 细分了网格线的颜色
- 增加了屏幕分辨率的可选项
- 增加了全屏设置
- 增加了目标帧率设置
- 增加了屏幕分辨率的可选项
- 针对 Arcaea 3.0 的界面进行了排版调整
- 保存谱面时未识别的 scenecontrol 语句现在会保持原样输出
- 保存谱面时未识别的元信息数据现在会保持原样输出
Expand Down
26 changes: 22 additions & 4 deletions Assets/Scripts/Compose/ArcadeComposeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ArcadePreference
public int AgreedUserAgreementVersion;
public long ReadWhatsNewVersion;
public string ScreenResolution = "1280x720";
public bool Fullscreen = false;
public int TargetFrameRate = -1;
public int Velocity = 30;
public uint UndoBufferSize = 200;
Expand Down Expand Up @@ -106,6 +107,7 @@ public long BuildTimestamp
public Text Version;

public Dropdown ResolutionDropdown;
public Toggle FullscreenToggle;
public Dropdown TargetFramerateDropdown;
public InputField UndoBufferSizeInput;

Expand All @@ -126,8 +128,15 @@ private void Start()
ArcGameplayManager.Instance.OnMusicFinished.AddListener(Pause);
ResolutionDropdown.onValueChanged.AddListener((int value) =>
{
SetResolution(ResolutionDropdown.options[value].text);
ArcadePreference.ScreenResolution = ResolutionDropdown.options[value].text;
SetResolution(ArcadePreference.ScreenResolution,ArcadePreference.Fullscreen);
SavePreferences();
});
FullscreenToggle.onValueChanged.AddListener((bool value) =>
{
ArcadePreference.Fullscreen = value;
ResolutionDropdown.interactable = !value;
SetResolution(ArcadePreference.ScreenResolution,ArcadePreference.Fullscreen);
SavePreferences();
});
TargetFramerateDropdown.onValueChanged.AddListener((int value) =>
Expand Down Expand Up @@ -208,13 +217,19 @@ private void OnLog(string condition, string stackTrace, LogType type)
}
}

public void SetResolution(string resolution)
public void SetResolution(string resolution, bool fullscreen)
{
if (fullscreen)
{
Debug.Log($"[fullscreen]{Screen.currentResolution.width}x{Screen.currentResolution.height}");
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, FullScreenMode.FullScreenWindow);
return;
}
// here we do not check format of string
string[] dimensions = resolution.Split('x');
int width = int.Parse(dimensions[0]);
int height = int.Parse(dimensions[1]);
Screen.SetResolution(width, height, false);
Screen.SetResolution(width, height, FullScreenMode.Windowed);
}
public void SetTargetFramerate(int fps)
{
Expand Down Expand Up @@ -352,7 +367,10 @@ public void LoadPreferences()
{
ArcadePreference.ScreenResolution = ResolutionDropdown.options[ResolutionDropdown.value].text;
}
SetResolution(ArcadePreference.ScreenResolution);
ResolutionDropdown.interactable = !ArcadePreference.Fullscreen;
FullscreenToggle.SetIsOnWithoutNotify(ArcadePreference.Fullscreen);
Screen.fullScreen = ArcadePreference.Fullscreen;
SetResolution(ArcadePreference.ScreenResolution, ArcadePreference.Fullscreen);
bool targetFramerateHit = false;
for (int i = 0; i < TargetFramerateDropdown.options.Count; i++)
{
Expand Down
Loading

0 comments on commit 2b4048d

Please sign in to comment.