Commit 508547c4 authored by SherryChaos's avatar SherryChaos

iOS support

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