Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sdk-public
unity_sdk_demo
Commits
5742e61f
Commit
5742e61f
authored
Nov 25, 2025
by
gaorui
Browse files
feat(config): 更新分享配置
parent
d56c702d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Assets/Plugins/Android/.DS_Store
View file @
5742e61f
No preview for this file type
Assets/Plugins/Android/launcherTemplate.gradle
View file @
5742e61f
...
@@ -3,7 +3,8 @@ apply plugin: 'com.android.application'
...
@@ -3,7 +3,8 @@ apply plugin: 'com.android.application'
dependencies
{
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
,
'*.aar'
])
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
,
'*.aar'
])
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'com.hoolai.access.open:hoolai-core:1.3.1.4_3-SNAPSHOT'
implementation
'com.hoolai.access.open:hoolai-core:1.3.1.4_5-SNAPSHOT'
// implementation 'com.hoolai.access.channel:hoolai:1.3.1.3_1-SNAPSHOT'
// implementation 'com.hoolai.access.channel:hoolai:1.3.1.3_1-SNAPSHOT'
...
...
Assets/Plugins/Android/libs/launcher-release.aar
View file @
5742e61f
No preview for this file type
Assets/Scenes/SampleScene.unity
View file @
5742e61f
...
@@ -4481,7 +4481,7 @@ MonoBehaviour:
...
@@ -4481,7 +4481,7 @@ MonoBehaviour:
m_OnCullStateChanged
:
m_OnCullStateChanged
:
m_PersistentCalls
:
m_PersistentCalls
:
m_Calls
:
[]
m_Calls
:
[]
m_text
:
QQ
Text
m_text
:
QQ
Link
m_isRightToLeft
:
0
m_isRightToLeft
:
0
m_fontAsset
:
{
fileID
:
11400000
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_fontAsset
:
{
fileID
:
11400000
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_sharedMaterial
:
{
fileID
:
2180264
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
m_sharedMaterial
:
{
fileID
:
2180264
,
guid
:
8f586378b4e144a9851e7b34d9b748ee
,
type
:
2
}
...
...
Assets/Scripts/demo/ui/GameSdkManager.cs
View file @
5742e61f
...
@@ -314,7 +314,7 @@ public class GameManager : MonoBehaviour
...
@@ -314,7 +314,7 @@ public class GameManager : MonoBehaviour
};
};
HoolaiSdkManager
.
ShareData
(
ShareType
.
WECHAT_TIMELINE
,
shareParams
);
HoolaiSdkManager
.
ShareData
(
Share
Platform
Type
.
WECHAT_TIMELINE
,
ShareType
.
TEXT
,
shareParams
);
}
}
public
void
OnWXShareImage
()
public
void
OnWXShareImage
()
...
@@ -343,7 +343,7 @@ public class GameManager : MonoBehaviour
...
@@ -343,7 +343,7 @@ public class GameManager : MonoBehaviour
};
};
HoolaiSdkManager
.
ShareData
(
ShareType
.
WECHAT_SESSION
,
shareParams
);
HoolaiSdkManager
.
ShareData
(
Share
Platform
Type
.
WECHAT_SESSION
,
ShareType
.
IMG
,
shareParams
);
}
}
else
else
{
{
...
@@ -365,7 +365,7 @@ public class GameManager : MonoBehaviour
...
@@ -365,7 +365,7 @@ public class GameManager : MonoBehaviour
};
};
HoolaiSdkManager
.
ShareData
(
ShareType
.
WECHAT_FAVORITE
,
shareParams
);
HoolaiSdkManager
.
ShareData
(
Share
Platform
Type
.
WECHAT_FAVORITE
,
ShareType
.
TEXT
,
shareParams
);
}
}
...
@@ -373,18 +373,18 @@ public class GameManager : MonoBehaviour
...
@@ -373,18 +373,18 @@ public class GameManager : MonoBehaviour
public
void
OnQQShareTEXT
()
public
void
OnQQShareTEXT
()
{
{
NativeLogger
.
I
(
"Game_Unity_Log"
,
"clicked OnQQShareImage QQ_
TEXT
"
);
NativeLogger
.
I
(
"Game_Unity_Log"
,
"clicked OnQQShareImage QQ_
LINK
"
);
ShareParams
shareParams
=
new
ShareParams
ShareParams
shareParams
=
new
ShareParams
{
{
title
=
"我是分享测试Title"
,
title
=
"我是分享测试Title"
,
content
=
"我是分享测试Content"
,
content
=
"我是分享测试Content"
,
//
picPath = "我是图片地址",
picPath
=
"我是图片地址"
,
shareUrl
=
"
我是分享的链接
"
shareUrl
=
"
https://img1.baidu.com/it/u=2172818577,3783888802&fm=253&app=138&f=JPEG
"
};
};
HoolaiSdkManager
.
ShareData
(
Share
Type
.
QQ_TEXT
,
shareParams
);
HoolaiSdkManager
.
ShareData
(
Share
PlatformType
.
QQ
,
ShareType
.
LINK
,
shareParams
);
}
}
...
@@ -396,8 +396,6 @@ public class GameManager : MonoBehaviour
...
@@ -396,8 +396,6 @@ public class GameManager : MonoBehaviour
}
}
private
void
ShareQQScreenshotCallback
(
string
imagePath
)
private
void
ShareQQScreenshotCallback
(
string
imagePath
)
{
{
if
(!
string
.
IsNullOrEmpty
(
imagePath
))
if
(!
string
.
IsNullOrEmpty
(
imagePath
))
...
@@ -414,31 +412,11 @@ public class GameManager : MonoBehaviour
...
@@ -414,31 +412,11 @@ public class GameManager : MonoBehaviour
};
};
HoolaiSdkManager
.
ShareData
(
ShareType
.
QQ_
IMG
,
shareParams
);
HoolaiSdkManager
.
ShareData
(
Share
PlatformType
.
QQ
,
Share
Type
.
IMG
,
shareParams
);
}
}
else
else
{
{
Debug
.
LogError
(
"截图失败,无法分享。"
);
Debug
.
LogError
(
"截图失败,无法分享。"
);
}
}
}
}
public
void
OnQQShareTextZone
()
{
NativeLogger
.
I
(
"Game_Unity_Log"
,
"clicked OnQQShareTextZone QQ_TEXT_AND_QQZONE"
);
}
public
void
OnQQShareImageZone
()
{
NativeLogger
.
I
(
"Game_Unity_Log"
,
"clicked OnQQShareImageZone QQ_IMG_AND_QQZONE"
);
}
public
void
OnNativeShareText
()
{
}
}
}
Assets/Scripts/sdk/channel/AndroidSdkInterface.cs
View file @
5742e61f
...
@@ -174,12 +174,12 @@ public class AndroidSdkInterface : MonoBehaviour
...
@@ -174,12 +174,12 @@ public class AndroidSdkInterface : MonoBehaviour
}
}
}
}
public
static
void
CallSdkShareData
(
int
type
,
string
jsonStr
)
public
static
void
CallSdkShareData
(
int
platformType
,
int
type
,
string
jsonStr
)
{
{
try
try
{
{
UnityMainThreadDispatcher
.
Instance
.
Enqueue
(()
=>
{
UnityMainThreadDispatcher
.
Instance
.
Enqueue
(()
=>
{
ServiceInstance
?.
Call
(
"shareData"
,
type
,
jsonStr
);
ServiceInstance
?.
Call
(
"shareData"
,
platformType
,
type
,
jsonStr
);
NativeLogger
.
I
(
"fastsdk_btn_unity"
,
"call SdkManager shareData"
);
NativeLogger
.
I
(
"fastsdk_btn_unity"
,
"call SdkManager shareData"
);
});
});
...
...
Assets/Scripts/sdk/channel/IosSdkInterface.cs
View file @
5742e61f
...
@@ -15,7 +15,7 @@ public class IosSdkInterface
...
@@ -15,7 +15,7 @@ public class IosSdkInterface
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_StartPay
(
string
jsonInfo
);
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_StartPay
(
string
jsonInfo
);
// 分享功能
// 分享功能
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_StartShare
(
int
shareType
,
string
jsonInfo
);
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_StartShare
(
int
platformType
,
int
shareType
,
string
jsonInfo
);
// 数据上报
// 数据上报
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_ReportUserInfoFull
(
int
eventType
,
string
jsonInfo
);
[
DllImport
(
"__Internal"
)]
private
static
extern
void
_ReportUserInfoFull
(
int
eventType
,
string
jsonInfo
);
...
@@ -50,9 +50,9 @@ public class IosSdkInterface
...
@@ -50,9 +50,9 @@ public class IosSdkInterface
_StartPay
(
json
);
_StartPay
(
json
);
}
}
public
static
void
StartShare
(
int
shareType
,
string
jsonstr
)
public
static
void
StartShare
(
int
platformType
,
int
shareType
,
string
jsonstr
)
{
{
_StartShare
(
shareType
,
jsonstr
);
_StartShare
(
platformType
,
shareType
,
jsonstr
);
}
}
public
static
void
ReportUserInfoFull
(
EventType
eventType
,
string
jsonStr
)
public
static
void
ReportUserInfoFull
(
EventType
eventType
,
string
jsonStr
)
...
...
Assets/Scripts/sdk/core/HoolaiSdkManager.cs
View file @
5742e61f
...
@@ -103,16 +103,17 @@ public static class HoolaiSdkManager
...
@@ -103,16 +103,17 @@ public static class HoolaiSdkManager
}
}
// ==================== 分享 ====================
// ==================== 分享 ====================
public
static
void
ShareData
(
ShareType
shareType
,
ShareParams
shareParams
)
public
static
void
ShareData
(
SharePlatformType
platformType
,
ShareType
shareType
,
ShareParams
shareParams
)
{
{
int
platform
=
(
int
)
platformType
;
int
type
=
(
int
)
shareType
;
int
type
=
(
int
)
shareType
;
string
jsonStr
=
JsonConvert
.
SerializeObject
(
shareParams
);
string
jsonStr
=
JsonConvert
.
SerializeObject
(
shareParams
);
#if UNITY_ANDROID && !UNITY_EDITOR
#if UNITY_ANDROID && !UNITY_EDITOR
AndroidSdkInterface
.
CallSdkShareData
(
type
,
jsonStr
);
AndroidSdkInterface
.
CallSdkShareData
(
platform
,
type
,
jsonStr
);
#elif UNITY_IOS && !UNITY_EDITOR
#elif UNITY_IOS && !UNITY_EDITOR
// iOS 分享参数解析(可根据需要扩展)
// iOS 分享参数解析(可根据需要扩展)
Debug
.
Log
(
"【UnifiedSdkManager】iOS 分享暂未实现完整解析"
);
Debug
.
Log
(
"【UnifiedSdkManager】iOS 分享暂未实现完整解析"
);
IosSdkInterface
.
StartShare
(
type
,
jsonStr
);
IosSdkInterface
.
StartShare
(
platform
,
type
,
jsonStr
);
#else
#else
Debug
.
Log
(
$"【UnifiedSdkManager】模拟调用:分享,平台=
{
shareType
}
"
);
Debug
.
Log
(
$"【UnifiedSdkManager】模拟调用:分享,平台=
{
shareType
}
"
);
#endif
#endif
...
...
Assets/Scripts/sdk/data/SharePlatformType.cs
0 → 100644
View file @
5742e61f
public
enum
SharePlatformType
{
WECHAT_SESSION
=
1
,
// 微信对话
WECHAT_TIMELINE
=
2
,
// 朋友圈
WECHAT_FAVORITE
=
3
,
//iOS 无此选项,待定接入
QQ
=
4
,
// QQ
FACEBOOK
=
5
,
//facebook
SYSTEM
=
6
,
//Native
}
\ No newline at end of file
Assets/Scripts/sdk/data/SharePlatformType.cs.meta
0 → 100644
View file @
5742e61f
fileFormatVersion: 2
guid: abbf896f63a34497e9e8a6a7eb83bb4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/sdk/data/ShareType.cs
View file @
5742e61f
//平台分享类型
public
enum
ShareType
public
enum
ShareType
{
{
// 微信平台
TEXT
=
1
,
// 文本
WECHAT_SESSION
=
0
,
// 微信对话
IMG
=
2
,
// 图片
WECHAT_TIMELINE
=
1
,
// 朋友圈
LINK
=
3
,
// 链接
WECHAT_FAVORITE
=
10
,
//iOS 无此选项,待定接入
VIDEO
=
4
,
// 视频
// QQ平台
QQ_TEXT
=
2
,
//分享文字
QQ_IMG
=
3
,
//分享图片
//DQD(31, "懂球帝"),
FACEBOOK_LINK
=
5
,
//facebook链接
FACEBOOK_IMG
=
6
,
//facebook图片
FACEBOOK_VIDEO
=
7
,
//facebook图片
SYSTEM_SHARE
=
8
,
//系统分享
}
}
\ No newline at end of file
Assets/Scripts/sdk/data/ShareType.cs.meta
0 → 100644
View file @
5742e61f
fileFormatVersion: 2
guid: 4f0c8fc361c1745dd98b822a0266ae4a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
UserSettings/Layouts/default-2022.dwlt
View file @
5742e61f
...
@@ -19,7 +19,7 @@ MonoBehaviour:
...
@@ -19,7 +19,7 @@ MonoBehaviour:
width
:
1920
width
:
1920
height
:
975
height
:
975
m_ShowMode
:
4
m_ShowMode
:
4
m_Title
:
Hierarchy
m_Title
:
Project
m_RootView
:
{
fileID
:
2
}
m_RootView
:
{
fileID
:
2
}
m_MinSize
:
{
x
:
875
,
y
:
300
}
m_MinSize
:
{
x
:
875
,
y
:
300
}
m_MaxSize
:
{
x
:
10000
,
y
:
10000
}
m_MaxSize
:
{
x
:
10000
,
y
:
10000
}
...
@@ -192,8 +192,8 @@ MonoBehaviour:
...
@@ -192,8 +192,8 @@ MonoBehaviour:
y
:
0
y
:
0
width
:
332
width
:
332
height
:
619.5
height
:
619.5
m_MinSize
:
{
x
:
20
0
,
y
:
2
00
}
m_MinSize
:
{
x
:
20
1
,
y
:
2
21
}
m_MaxSize
:
{
x
:
400
0
,
y
:
40
00
}
m_MaxSize
:
{
x
:
400
1
,
y
:
40
21
}
m_ActualView
:
{
fileID
:
13
}
m_ActualView
:
{
fileID
:
13
}
m_Panes
:
m_Panes
:
-
{
fileID
:
13
}
-
{
fileID
:
13
}
...
@@ -218,8 +218,8 @@ MonoBehaviour:
...
@@ -218,8 +218,8 @@ MonoBehaviour:
y
:
0
y
:
0
width
:
1015.5
width
:
1015.5
height
:
619.5
height
:
619.5
m_MinSize
:
{
x
:
20
0
,
y
:
2
00
}
m_MinSize
:
{
x
:
20
2
,
y
:
2
21
}
m_MaxSize
:
{
x
:
400
0
,
y
:
40
00
}
m_MaxSize
:
{
x
:
400
2
,
y
:
40
21
}
m_ActualView
:
{
fileID
:
14
}
m_ActualView
:
{
fileID
:
14
}
m_Panes
:
m_Panes
:
-
{
fileID
:
14
}
-
{
fileID
:
14
}
...
@@ -273,8 +273,8 @@ MonoBehaviour:
...
@@ -273,8 +273,8 @@ MonoBehaviour:
y
:
0
y
:
0
width
:
572.5
width
:
572.5
height
:
925
height
:
925
m_MinSize
:
{
x
:
27
5
,
y
:
50
}
m_MinSize
:
{
x
:
27
6
,
y
:
71
}
m_MaxSize
:
{
x
:
400
0
,
y
:
40
00
}
m_MaxSize
:
{
x
:
400
1
,
y
:
40
21
}
m_ActualView
:
{
fileID
:
18
}
m_ActualView
:
{
fileID
:
18
}
m_Panes
:
m_Panes
:
-
{
fileID
:
18
}
-
{
fileID
:
18
}
...
@@ -383,9 +383,9 @@ MonoBehaviour:
...
@@ -383,9 +383,9 @@ MonoBehaviour:
m_SceneHierarchy
:
m_SceneHierarchy
:
m_TreeViewState
:
m_TreeViewState
:
scrollPos
:
{
x
:
0
,
y
:
0
}
scrollPos
:
{
x
:
0
,
y
:
0
}
m_SelectedIDs
:
0aefffff
m_SelectedIDs
:
m_LastClickedID
:
-4342
m_LastClickedID
:
0
m_ExpandedIDs
:
0aefffff
24fbffff
m_ExpandedIDs
:
24fbffff
m_RenameOverlay
:
m_RenameOverlay
:
m_UserAcceptedRename
:
0
m_UserAcceptedRename
:
0
m_Name
:
m_Name
:
...
@@ -960,9 +960,9 @@ MonoBehaviour:
...
@@ -960,9 +960,9 @@ MonoBehaviour:
m_PlayAudio
:
0
m_PlayAudio
:
0
m_AudioPlay
:
0
m_AudioPlay
:
0
m_Position
:
m_Position
:
m_Target
:
{
x
:
3
93.59805
,
y
:
134.30
42
1
,
z
:
-1
4.739415
}
m_Target
:
{
x
:
3
08.34354
,
y
:
259.404
42
,
z
:
-1
8.393446
}
speed
:
2
speed
:
2
m_Value
:
{
x
:
3
93.59805
,
y
:
134.30
42
1
,
z
:
-1
4.739415
}
m_Value
:
{
x
:
3
08.34354
,
y
:
259.404
42
,
z
:
-1
8.393446
}
m_RenderMode
:
0
m_RenderMode
:
0
m_CameraMode
:
m_CameraMode
:
drawMode
:
0
drawMode
:
0
...
@@ -1012,9 +1012,9 @@ MonoBehaviour:
...
@@ -1012,9 +1012,9 @@ MonoBehaviour:
speed
:
2
speed
:
2
m_Value
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_Value
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_Size
:
m_Size
:
m_Target
:
426.48193
m_Target
:
791.88416
speed
:
2
speed
:
2
m_Value
:
426.48193
m_Value
:
791.88416
m_Ortho
:
m_Ortho
:
m_Target
:
1
m_Target
:
1
speed
:
2
speed
:
2
...
@@ -1084,7 +1084,7 @@ MonoBehaviour:
...
@@ -1084,7 +1084,7 @@ MonoBehaviour:
m_SkipHidden
:
0
m_SkipHidden
:
0
m_SearchArea
:
1
m_SearchArea
:
1
m_Folders
:
m_Folders
:
-
Assets
-
Assets
/Scripts/demo/ui
m_Globs
:
[]
m_Globs
:
[]
m_OriginalText
:
m_OriginalText
:
m_ImportLogFlags
:
0
m_ImportLogFlags
:
0
...
@@ -1092,16 +1092,16 @@ MonoBehaviour:
...
@@ -1092,16 +1092,16 @@ MonoBehaviour:
m_ViewMode
:
1
m_ViewMode
:
1
m_StartGridSize
:
64
m_StartGridSize
:
64
m_LastFolders
:
m_LastFolders
:
-
Assets
-
Assets
/Scripts/demo/ui
m_LastFoldersGridSize
:
-1
m_LastFoldersGridSize
:
-1
m_LastProjectPath
:
/Users/gr/Documents/unity-work/UnityDemo
m_LastProjectPath
:
/Users/gr/Documents/unity-work/UnityDemo
m_LockTracker
:
m_LockTracker
:
m_IsLocked
:
0
m_IsLocked
:
0
m_FolderTreeState
:
m_FolderTreeState
:
scrollPos
:
{
x
:
0
,
y
:
0
}
scrollPos
:
{
x
:
0
,
y
:
91.5
}
m_SelectedIDs
:
80
670000
m_SelectedIDs
:
9c
670000
m_LastClickedID
:
26
496
m_LastClickedID
:
26
524
m_ExpandedIDs
:
000000008067000082670000846700008667000088670000
90
670000
m_ExpandedIDs
:
000000008067000082670000846700008667000088670000
8a
670000
m_RenameOverlay
:
m_RenameOverlay
:
m_UserAcceptedRename
:
0
m_UserAcceptedRename
:
0
m_Name
:
m_Name
:
...
@@ -1129,7 +1129,7 @@ MonoBehaviour:
...
@@ -1129,7 +1129,7 @@ MonoBehaviour:
scrollPos
:
{
x
:
0
,
y
:
0
}
scrollPos
:
{
x
:
0
,
y
:
0
}
m_SelectedIDs
:
m_SelectedIDs
:
m_LastClickedID
:
0
m_LastClickedID
:
0
m_ExpandedIDs
:
000000008067000082670000846700008667000088670000
m_ExpandedIDs
:
000000008067000082670000846700008667000088670000
8a670000
m_RenameOverlay
:
m_RenameOverlay
:
m_UserAcceptedRename
:
0
m_UserAcceptedRename
:
0
m_Name
:
m_Name
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment