Commit 508547c4 authored by SherryChaos's avatar SherryChaos

iOS support

parent d9a679a8
...@@ -29,7 +29,7 @@ namespace MDPro3 ...@@ -29,7 +29,7 @@ namespace MDPro3
{ {
Application.targetFrameRate = 0; Application.targetFrameRate = 0;
#if !UNITY_EDITOR && UNITY_ANDROID #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
Environment.CurrentDirectory = Application.persistentDataPath; Environment.CurrentDirectory = Application.persistentDataPath;
Directory.SetCurrentDirectory(Application.persistentDataPath); Directory.SetCurrentDirectory(Application.persistentDataPath);
if (VersionCheck()) if (VersionCheck())
......
...@@ -173,7 +173,7 @@ namespace MDPro3 ...@@ -173,7 +173,7 @@ namespace MDPro3
public static float GetUIScale(float maxUIScale = 1.5f) public static float GetUIScale(float maxUIScale = 1.5f)
{ {
var defau = 1000f; var defau = 1000f;
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
defau = 1500f; defau = 1500f;
#endif #endif
var scale = float.Parse(Get("UIScale", defau.ToString())) / 1000; var scale = float.Parse(Get("UIScale", defau.ToString())) / 1000;
......
...@@ -16,7 +16,7 @@ namespace MDPro3 ...@@ -16,7 +16,7 @@ namespace MDPro3
const string bgPath = Program.diyPath + "Background.png"; const string bgPath = Program.diyPath + "Background.png";
public static void ImportFiles() public static void ImportFiles()
{ {
#if UNITY_ANDROID && !UNITY_EDITOR #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
NativeFilePicker.PickMultipleFiles(MoveFilesToGame, null); NativeFilePicker.PickMultipleFiles(MoveFilesToGame, null);
#else #else
ChooseFiles(); ChooseFiles();
...@@ -25,7 +25,7 @@ namespace MDPro3 ...@@ -25,7 +25,7 @@ namespace MDPro3
public static void ImportBG() public static void ImportBG()
{ {
#if UNITY_ANDROID && !UNITY_EDITOR #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
NativeFilePicker.PickFile(MovePictureToGameBG, pictureFormat); NativeFilePicker.PickFile(MovePictureToGameBG, pictureFormat);
#else #else
ChooseBGPicture(); ChooseBGPicture();
...@@ -186,7 +186,7 @@ namespace MDPro3 ...@@ -186,7 +186,7 @@ namespace MDPro3
private static void Export(string[] filePaths, bool copy = true) private static void Export(string[] filePaths, bool copy = true)
{ {
#if UNITY_ANDROID && !UNITY_EDITOR #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
NativeFilePicker.ExportMultipleFiles(filePaths, ExportResult); NativeFilePicker.ExportMultipleFiles(filePaths, ExportResult);
if(!copy) if(!copy)
filesToDelete = filePaths.ToList(); filesToDelete = filePaths.ToList();
......
...@@ -2,6 +2,7 @@ using DG.Tweening; ...@@ -2,6 +2,7 @@ using DG.Tweening;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;
using UnityEngine.Networking; using UnityEngine.Networking;
...@@ -391,10 +392,10 @@ namespace MDPro3 ...@@ -391,10 +392,10 @@ namespace MDPro3
public static IEnumerator<AudioClip> LoadAudioFileAsync(string path, AudioType audioType) public static IEnumerator<AudioClip> LoadAudioFileAsync(string path, AudioType audioType)
{ {
string fullPath; string fullPath;
#if !UNITY_EDITOR && UNITY_ANDROID #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
fullPath = "file://" + Application.persistentDataPath + Program.slash + path; fullPath = "file://" + Application.persistentDataPath + Program.slash + path;
#else #else
fullPath = Environment.CurrentDirectory + Program.slash + path; fullPath = Path.Combine(Environment.CurrentDirectory, path);
#endif #endif
using var request = UnityWebRequestMultimedia.GetAudioClip(fullPath, audioType); using var request = UnityWebRequestMultimedia.GetAudioClip(fullPath, audioType);
......
...@@ -80,7 +80,7 @@ namespace MDPro3 ...@@ -80,7 +80,7 @@ namespace MDPro3
if (!File.Exists(path)) if (!File.Exists(path))
return null; return null;
string fullPath; string fullPath;
#if !UNITY_EDITOR && UNITY_ANDROID #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
fullPath = "file://" + Application.persistentDataPath + Program.slash + path; fullPath = "file://" + Application.persistentDataPath + Program.slash + path;
#else #else
fullPath = Environment.CurrentDirectory + Program.slash + path; fullPath = Environment.CurrentDirectory + Program.slash + path;
......
...@@ -69,7 +69,7 @@ namespace MDPro3.Servant ...@@ -69,7 +69,7 @@ namespace MDPro3.Servant
if (UserInput.MouseRightDown || UserInput.WasCancelPressed) if (UserInput.MouseRightDown || UserInput.WasCancelPressed)
OnReturn(); OnReturn();
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
if (UserInput.MouseLeftDown) if (UserInput.MouseLeftDown)
if(autoPlay != null) if(autoPlay != null)
OnReturn(); OnReturn();
......
...@@ -110,7 +110,7 @@ namespace MDPro3.Servant ...@@ -110,7 +110,7 @@ namespace MDPro3.Servant
AudioManager.SetSeVol(Config.GetFloat("SEVol", 0.7f)); AudioManager.SetSeVol(Config.GetFloat("SEVol", 0.7f));
AudioManager.SetVoiceVol(Config.GetFloat("VoiceVol", 0.7f)); AudioManager.SetVoiceVol(Config.GetFloat("VoiceVol", 0.7f));
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
if (Config.Have("Resolution")) if (Config.Have("Resolution"))
{ {
var resolution = Config.Get("Resolution", "1920 x 1080"); var resolution = Config.Get("Resolution", "1920 x 1080");
......
...@@ -898,7 +898,7 @@ namespace MDPro3.UI.ServantUI ...@@ -898,7 +898,7 @@ namespace MDPro3.UI.ServantUI
public static float GetScale() public static float GetScale()
{ {
var defau = 1f; var defau = 1f;
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
defau = 0.5f; defau = 0.5f;
#endif #endif
return Config.GetFloat("Scale", defau); return Config.GetFloat("Scale", defau);
......
...@@ -480,7 +480,7 @@ namespace MDPro3 ...@@ -480,7 +480,7 @@ namespace MDPro3
public void OnUp() public void OnUp()
{ {
bigShowing = true; bigShowing = true;
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
BigShowMobile(); BigShowMobile();
#else #else
BigShowDesktop(); BigShowDesktop();
......
...@@ -22,7 +22,7 @@ namespace MDPro3.Utility ...@@ -22,7 +22,7 @@ namespace MDPro3.Utility
private static readonly ConcurrentDictionary<int, SemaphoreSlim> cardLoadingLocks = new(); private static readonly ConcurrentDictionary<int, SemaphoreSlim> cardLoadingLocks = new();
private static readonly ConcurrentDictionary<int, SemaphoreSlim> cardNameLoadingLocks = new(); private static readonly ConcurrentDictionary<int, SemaphoreSlim> cardNameLoadingLocks = new();
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
private static readonly int maxArtLoads = 1; private static readonly int maxArtLoads = 1;
public static readonly int maxCardLoads = 1; public static readonly int maxCardLoads = 1;
#else #else
...@@ -438,7 +438,7 @@ namespace MDPro3.Utility ...@@ -438,7 +438,7 @@ namespace MDPro3.Utility
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
{ {
#if !UNITY_EDITOR && UNITY_ANDROID #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
path = Path.Combine("file://" + Application.persistentDataPath, path); path = Path.Combine("file://" + Application.persistentDataPath, path);
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
path = Path.Combine("file://" + Environment.CurrentDirectory, path); path = Path.Combine("file://" + Environment.CurrentDirectory, path);
......
...@@ -29,10 +29,7 @@ namespace MDPro3.Utility ...@@ -29,10 +29,7 @@ namespace MDPro3.Utility
public static bool OnMobile() public static bool OnMobile()
{ {
#if UNITY_ANDROID #if UNITY_ANDROID || UNITY_IOS
return true;
#endif
#if UNITY_IOS
return true; return true;
#endif #endif
if (SystemInfo.deviceName == "STEAMDECK") if (SystemInfo.deviceName == "STEAMDECK")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment