Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a0fd194e
由
cgx
编写于
2022-05-20 17:17:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
解决Unity在静音模式下无法播放bug
1 个父辈
28bd1061
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
17 行增加
和
18 行删除
DreamSleep/DreamSleep/Class/Start/Root/AppDelegate.h
DreamSleep/DreamSleep/Class/Start/Root/AppDelegate.m
DreamSleep/TapiOS/Classes/UnityAppController.h
DreamSleep/TapiOS/Classes/UnityAppController.mm
DreamSleep/DreamSleep/Class/Start/Root/AppDelegate.h
查看文件 @
a0fd194
...
...
@@ -14,6 +14,7 @@
#pragma mark - Unity
@property
(
nonatomic
,
strong
)
NSDictionary
*
appLaunchOpts
;
@property
(
nonatomic
,
strong
)
UnityFramework
*
ufw
;
/// 显示unity
-
(
void
)
showUnityView
;
@end
...
...
DreamSleep/DreamSleep/Class/Start/Root/AppDelegate.m
查看文件 @
a0fd194
...
...
@@ -64,7 +64,7 @@
[[
IQKeyboardManager
sharedManager
]
setEnable
:
YES
];
[[
IQKeyboardManager
sharedManager
]
setEnableAutoToolbar
:
YES
];
[[
IQKeyboardManager
sharedManager
]
setShouldResignOnTouchOutside
:
YES
];
return
YES
;
}
...
...
@@ -162,13 +162,10 @@
UnityFramework
*
UnityFrameworkLoad
(
void
)
{
NSString
*
bundlePath
=
[[[
NSBundle
mainBundle
]
bundlePath
]
stringByAppendingString
:
@"/Frameworks/UnityFramework.framework"
];
NSBundle
*
bundle
=
[
NSBundle
bundleWithPath
:
bundlePath
];
if
([
bundle
isLoaded
]
==
false
)
[
bundle
load
];
if
([
bundle
isLoaded
]
==
false
)
{
[
bundle
load
];
}
UnityFramework
*
ufw
=
[
bundle
.
principalClass
getInstance
];
if
(
!
[
ufw
appController
])
{
[
ufw
setExecuteHeader
:
&
_mh_execute_header
];
}
UnityFramework
*
ufw
=
[
bundle
.
principalClass
getInstance
];
if
(
!
[
ufw
appController
])
{
[
ufw
setExecuteHeader
:
&
_mh_execute_header
];
}
return
ufw
;
}
...
...
@@ -180,17 +177,16 @@ extern int gArgc;
extern
char
**
gArgv
;
-
(
void
)
initUnity
{
if
([
self
unityIsInitialized
])
{
[
DSProgressHUD
showDetailInfo
:
@"Unload Unity first"
];
// unity如果初始化了,首先需要卸载unity
if
([
self
unityIsInitialized
])
{
[
DSProgressHUD
showDetailInfo
:
@"Unity already initialized,please unload unity first"
];
return
;
}
[
self
setUfw
:
UnityFrameworkLoad
()];
[
self
setUfw
:
UnityFrameworkLoad
()];
[[
self
ufw
]
setDataBundleId
:
"com.unity3d.framework"
];
[[
self
ufw
]
registerFrameworkListener
:
self
];
[[
self
ufw
]
runEmbeddedWithArgc
:
gArgc
argv
:
gArgv
appLaunchOpts
:
self
.
appLaunchOpts
];
[[[
self
ufw
]
appController
]
rootView
];
}
-
(
void
)
showUnityView
{
...
...
@@ -201,15 +197,16 @@ extern char** gArgv;
#pragma mark - UnityFrameworkListener
-
(
void
)
unityDidUnload
:
(
NSNotification
*
)
notification
{
DSLog
(
@"unityDidUnload
ed called
"
);
DSLog
(
@"unityDidUnload"
);
[
self
.
window
makeKeyAndVisible
];
[[
self
ufw
]
unregisterFrameworkListener
:
self
];
[
self
setUfw
:
nil
];
[
self
.
window
makeKeyAndVisible
];
}
-
(
void
)
unityDidQuit
:
(
NSNotification
*
)
notification
{
DSLog
(
@"========== %s ============"
,
__func__
);
}
-
(
void
)
applicationWillResignActive
:
(
UIApplication
*
)
application
{
[[[
self
ufw
]
appController
]
applicationWillResignActive
:
application
];
}
-
(
void
)
applicationDidEnterBackground
:
(
UIApplication
*
)
application
{
[[[
self
ufw
]
appController
]
applicationDidEnterBackground
:
application
];
}
-
(
void
)
applicationWillEnterForeground
:
(
UIApplication
*
)
application
{
[[[
self
ufw
]
appController
]
applicationWillEnterForeground
:
application
];
}
-
(
void
)
applicationDidBecomeActive
:
(
UIApplication
*
)
application
{
[[[
self
ufw
]
appController
]
applicationDidBecomeActive
:
application
];
}
-
(
void
)
applicationWillTerminate
:
(
UIApplication
*
)
application
{
[[[
self
ufw
]
appController
]
applicationWillTerminate
:
application
];
}
@end
DreamSleep/TapiOS/Classes/UnityAppController.h
查看文件 @
a0fd194
...
...
@@ -36,6 +36,7 @@ __attribute__ ((visibility("default")))
id
<
RenderPluginDelegate
>
_renderDelegate
;
}
@property
(
strong
,
nonatomic
)
UIViewController
*
vc
;
// override it to add your render plugin delegate
-
(
void
)
shouldAttachRenderDelegate
;
...
...
DreamSleep/TapiOS/Classes/UnityAppController.mm
查看文件 @
a0fd194
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论