手机端问题修改
1. tap跳转功能实现 2. 跳字优化
This commit is contained in:
@@ -44,6 +44,8 @@ namespace AibisDream
|
||||
_currentTalkSceneSo.Register(item => _data.curSceneSoName = item.name);
|
||||
// 加载SO
|
||||
Addressables.LoadAssetsAsync<TalkSceneSO>("SceneSO", null).Completed += LoadTalkSo;
|
||||
// 初始化TapTap
|
||||
TapTapCenter.Instance.Init();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if (runMode == RunMode.SingleScene)
|
||||
@@ -78,7 +80,7 @@ namespace AibisDream
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to load textures.");
|
||||
Debug.LogError("Failed to load talkso.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using AibisDream.Kit;
|
||||
using TapSDK.Core;
|
||||
using TapSDK.Rep;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class TapTapCenter : Singleton<TapTapCenter>
|
||||
{
|
||||
private bool _isInitialized = false;
|
||||
|
||||
[SerializeField] private TapTapConfig _tapTapConfig;
|
||||
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
base.OnSingletonInit();
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
try
|
||||
{
|
||||
if (_tapTapConfig == null)
|
||||
{
|
||||
Debug.LogError("TapTapConfig为空,请先配置TapTapConfig");
|
||||
return;
|
||||
}
|
||||
|
||||
// 核心配置
|
||||
TapTapSdkOptions coreOptions = new TapTapSdkOptions
|
||||
{
|
||||
// 客户端 ID,开发者后台获取
|
||||
clientId = _tapTapConfig.clientId,
|
||||
// 客户端令牌,开发者后台获取
|
||||
clientToken = _tapTapConfig.clientToken,
|
||||
// 地区,CN 为国内,Overseas 为海外
|
||||
region = _tapTapConfig.region,
|
||||
// 语言,默认为 Auto,默认情况下,国内为 zh_Hans,海外为 en
|
||||
preferredLanguage = TapTapLanguageType.Auto,
|
||||
// 是否开启日志,Release 版本请设置为 false
|
||||
enableLog = _tapTapConfig.enableLog
|
||||
};
|
||||
|
||||
|
||||
// TapSDK 初始化
|
||||
ActionKit.Sequence()
|
||||
.Task(async () => TapTapSDK.Init(coreOptions))
|
||||
.Callback(() => _isInitialized = true)
|
||||
.Callback(() => Debug.Log("TapTap SDK初始化成功"))
|
||||
.Start(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"TapTap SDK初始化失败: {e}");
|
||||
}
|
||||
#else
|
||||
Debug.Log("TapTap登录仅在移动平台可用");
|
||||
_isInitialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开Tap指定链接
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
public void OpenTapUrl(Action<int, string> callback)
|
||||
{
|
||||
if (!_isInitialized)
|
||||
{
|
||||
Debug.LogError("TapTap SDK未初始化");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"打开TapTap链接: {_tapTapConfig.tapUrl}");
|
||||
TapTapRep.Open(_tapTapConfig.tapUrl, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb63fcec6dba72e4f94d8c36776bff51
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TapSDK.Core;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
[CreateAssetMenu(fileName = "TapTapConfig", menuName = "Config/TapTapConfig")]
|
||||
public class TapTapConfig : ScriptableObject
|
||||
{
|
||||
public string clientId;
|
||||
public string clientToken;
|
||||
public TapTapRegionType region;
|
||||
public TapTapLanguageType preferredLanguage;
|
||||
public bool enableLog;
|
||||
|
||||
public string tapUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6707ed120e994c44f8e4d90efba9f25a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user