/// <summary>
/// 停止Unity
/// </summary>
[DllImport ("__Internal")]
private static extern void StopUnity ();
// 关闭unity界面
public void CloseUnity ()
{
#if UNITY_ANDROID
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
jo.Call("StopUnity");
#elif UNITY_IPHONE || UNITY_IOS
StopUnity();
#endif
}
extern "C" {
void StopUnity () {
UnityAppController *unityDe = (UnityAppController *)[UIApplication sharedApplication].delegate;
if (unityDe.window.windowLevel == UIWindowLevelNormal){
unityDe.window.windowLevel = UIWindowLevelNormal - 1;
}
[unityDe.appWindow makeKeyAndVisible];
}
}
// 点击按钮切换到Unity界面~
- (void)didClickButton {
UnityAppController *unityDe = (UnityAppController *)[UIApplication sharedApplication].delegate;
if(unityDe.window.windowLevel == UIWindowLevelNormal - 1) {
unityDe.window.windowLevel = UIWindowLevelNormal;
}
UnitySendMessage("NativeManager", "NStartUnity", "1");
[unityDe.window makeKeyAndVisible];
}
using UnityEngine;
using System.Collections;
using Vuforia;
using CFramework;
/// <summary>
/// 此脚本只处理交互,不做功能性的方法处理~
/// </summary>
public class YXUnityAPI : MonoBehaviour
{
#region 新的API接口
/// <summary>
/// 打开Unity,展现第几个场景
/// </summary>
/// <param name="num">打开场景编号</param>
public void NStartUnity (string scenseNum)
{
int num = int.Parse (scenseNum);
switch (num) {
case 1:
UnityEngine.SceneManagement.SceneManager.LoadScene ("YXMJ");
break;
case 2:
UnityEngine.SceneManagement.SceneManager.LoadScene ("GRYO");
break;
default:
break;
}
YXUnityAPIHandler.Instance ().StartUnity (num);
}
#endregion
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有