fix:1、H5方案改为我们自己的sdk,跳转电商也是。2、同步部分ios的优化

This commit is contained in:
2026-07-21 15:51:14 +08:00
parent ad3b1d24f2
commit 7a3c54c243
39 changed files with 68010 additions and 67313 deletions
+3 -3
View File
@@ -6,21 +6,21 @@ using SGModule.MarkdownKit;
using SGModule.Net;
using SGModule.NetKit;
using UnityEngine;
// using UNSDK;
using UNSDK;
public class ChillConnectRoot : MonoBehaviour
{
public void Awake()
{
#if UNITY_EDITOR || GAME_RELEASE || GAME_RELEASE1
#if UNITY_EDITOR || GAME_RELEASE
GameObject ingameDebugConsole = GameObject.Find("IngameDebugConsole");
if (ingameDebugConsole != null) ingameDebugConsole.SetActive(false);
#endif
// NetworkKit.Instance.InitData(ConfigManager.GameConfig.packageName, ConfigManager.GameConfig.isRelease);
// SdkConfigMgr.Init();
SdkConfigMgr.Init();
MaxADKit.Init();
+1 -1
View File
@@ -73,7 +73,7 @@ public static partial class DataMgr
public static DataStorage<int> ChLevel = BindDataStorage<int>(DataKeys.ch_level);
public static DataStorage<string> LevelData = new(DataKeys.LevelData, cloudSave: false);
public static DataStorage<int> AvailableDiceRolls = BindDataStorage<int>(DataKeys.AvailableDiceRolls);
public static DataStorage<int> ArrowResultLevel = BindDataStorage<int>(DataKeys.ArrowResultLevel,@default: 1);
public static DataStorage<int> ArrowResultLevel = BindDataStorage<int>(DataKeys.ArrowResultLevel,@default: 0);
public static DataStorage<int> ArrowDarkTheme = BindDataStorage<int>(DataKeys.ArrowDarkTheme,@default: 1);
public static DataStorage<int> ArrowTheme = BindDataStorage<int>(DataKeys.ArrowTheme,@default: 0);
public static DataStorage<int> ArrowChProgress = BindDataStorage<int>(DataKeys.ArrowChProgress,@default: 0);
+24 -27
View File
@@ -19,7 +19,7 @@ public class FreeWebViewManager : MonoBehaviour
private void Start()
{
initView();
// initView();
}
public void initView()
@@ -60,28 +60,28 @@ public class FreeWebViewManager : MonoBehaviour
{
// if (_webObj != null) return;
//
// // 创建WebView对象
// _webObj = new GameObject("WebViewObject1");
// _webView = _webObj.AddComponent<WebViewObject1>();
//
// // 关键:开启WKWebView,规避苹果审核拒绝
// _webView.Init(
// enableWKWebView: true,
// cb: OnWebMessage // JS调用Unity回调
// );
//
// float top_offset = 0;//fgui中的顶部信息的高度
// float buttom_offset = 155;
// if (Screen.safeArea.y != 0)
// {//刘海屏
// top_offset += Screen.safeArea.y;
// }
//
// // 铺满屏幕,适配刘海安全区
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// // 禁止下拉回弹(可选)
// _webView.SetScrollBounceEnabled(false);
//
// 创建WebView对象
_webObj = new GameObject("WebViewObject1");
_webView = _webObj.AddComponent<WebViewObject1>();
// 关键:开启WKWebView,规避苹果审核拒绝
_webView.Init(
enableWKWebView: true,
cb: OnWebMessage // JS调用Unity回调
);
float top_offset = 0;//fgui中的顶部信息的高度
float buttom_offset = 155;
if (Screen.safeArea.y != 0)
{//刘海屏
top_offset += Screen.safeArea.y;
}
// 铺满屏幕,适配刘海安全区
_webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
// 禁止下拉回弹(可选)
_webView.SetScrollBounceEnabled(false);
// 加载网页并显示
_webView.LoadURL(url);
_webView.SetVisibility(true);
@@ -105,10 +105,7 @@ public class FreeWebViewManager : MonoBehaviour
/// </summary>
public void CloseWeb()
{
if (_webObj != null)
{
_webView.SetVisibility(false);
}
OnDestroy();
}
private void OnDestroy()
@@ -644,18 +644,18 @@ namespace ChillConnect
{
ui.btn_wv.visible = false;
}
ui.btn_wv.visible = false;
//
// ui.btn_wv.SetClick(() =>
// {
// SDKOpenConfig openConfig = new SDKOpenConfig
// {
// normal = true,
// url = ""
// };
// CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
// });
//
ui.btn_wv.visible = true;
ui.btn_wv.SetClick(() =>
{
SDKOpenConfig openConfig = new SDKOpenConfig
{
normal = true,
url = ""
};
CtrlDispatcher.Instance.Dispatch(CtrlMsg.open_wb,openConfig);
});
ui.com_bottom.btn_skin.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.ArrowThemeUI_Open); });
ui.btn_petty.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.PettyAwardUI_Open); });
@@ -2182,7 +2182,7 @@ namespace ChillConnect
_heartCount = 3;
_collidedArrows.Clear();
_remainArrowCount = _levelConfig.arrows.Count;
DataMgr.ArrowResultLevel.Value = 1;
DataMgr.ArrowResultLevel.Value = 0;
InitView();
}
@@ -499,7 +499,7 @@ namespace ChillConnect
if ((float)DataMgr.Ticket.Value < vo.item_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo.item_need);
string str = string.Format(GameHelper.getDesByKey("makeup_2"), GameHelper.getChString(vo.item_need));
ui.com_ch.ch_text.text = str;
if ((float)DataMgr.Ticket.Value > vo.item_need)
{
@@ -557,12 +557,12 @@ namespace ChillConnect
var vo1 = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId + 1);
if (vo1 == null)
vo1 = vo;
string str1 = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
string str1 = string.Format(GameHelper.getDesByKey("makeup_2"), GameHelper.getChString(vo1.item_need));
ui.com_ch.ch_text.text = str1;
if ((float)(DataMgr.Ticket.Value - vo.item_need) < vo1.item_need)
{
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
string str = string.Format(GameHelper.getDesByKey("makeup_2"), GameHelper.getChString(vo.item_need));
ui.com_ch.ch_text.text = str;
ui.com_ch.progress.width = 656f * ((float)(DataMgr.Ticket.Value - vo.item_need) / vo1.item_need);
+29 -11
View File
@@ -6,6 +6,8 @@ using FGUI.ZM_H5_15;
using IgnoreOPS;
using SGModule.NetKit;
using UnityEngine;
using UNSDK;
// using UNSDK;
namespace ChillConnect
@@ -40,9 +42,17 @@ namespace ChillConnect
protected override void OnClose()
{
FreeWebViewManager.Instance.CloseWeb();
ctrl.CloseSettingAlpha();
// if (_config.normal)
// {
SdkConfigMgr.Instance.Close();
// }
// else
// {
// FreeWebViewManager.Instance.CloseWeb();
// }
// SdkConfigMgr.Instance.Close();
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
GameDispatcher.Instance.Dispatch(GameMsg.showBroadCast);
@@ -59,14 +69,13 @@ namespace ChillConnect
private SDKOpenConfig _config;
protected override void OnOpenBefore(object args)
{
if (args is not SDKOpenConfig openConfig) return;
// if (args is not SDKOpenConfig openConfig) return;
// _config = openConfig;
_config = openConfig;
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
// Debug.Log($"H5UI OpenBefore url: {_config.url} normal: {_config.normal}");
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
@@ -77,11 +86,20 @@ namespace ChillConnect
});
InitView();
DOVirtual.DelayedCall(0.35f, () =>
{
FreeWebViewManager.Instance.OpenWeb(_config.url);
});
// Debug.Log($"H5UI OpenWeb _config.normal=========: {_config.normal}");
// if (_config.normal)
// {
// SdkConfigMgr.Instance.Open();
// }
// else
// {
// DOVirtual.DelayedCall(0.35f, () =>
// {
// Debug.Log($"H5UI OpenWeb _config.url=========: {_config.url}");
// FreeWebViewManager.Instance.OpenWeb(_config.url);
// });
// }
}
protected override void OnOpen(object args)
+24
View File
@@ -1,6 +1,8 @@
using UnityEngine;
namespace ChillConnect
{
public class H5UICtrl : BaseUICtrl
@@ -11,9 +13,15 @@ namespace ChillConnect
private uint openUIMsg = UICtrlMsg.H5UI_Open;
private uint closeUIMsg = UICtrlMsg.H5UI_Close;
private AlphaController _alphaController;
#region
protected override void OnInit()
{
if (_alphaController == null)
{
_alphaController = GameObject.Find("AlphaController").GetComponent<AlphaController>();
}
//model = ModuleManager.Instance.GetModel(ModelConst.H5Model) as H5Model;
}
@@ -23,6 +31,8 @@ namespace ChillConnect
public override void OpenUI(object args = null)
{
OpenSettingAlpha();
if (ui == null)
{
ui = new H5UI(this);
@@ -75,5 +85,19 @@ namespace ChillConnect
}
#endregion
// 这个方法绑定到"打开面板"按钮
public void OpenSettingAlpha()
{
// 打开面板时,Unity 渲染层变为全透明
_alphaController?.SetPlayerAlpha(0.08f);
}
// 这个方法绑定到"关闭面板"按钮
public void CloseSettingAlpha()
{
// 关闭面板时,Unity 渲染层恢复不透明
_alphaController?.SetPlayerAlpha(1.0f);
}
}
}
@@ -46,6 +46,7 @@ namespace ChillConnect
}
private bool isOpenRecord = true;
protected override void OnClose()
{
@@ -62,7 +63,7 @@ namespace ChillConnect
gameDispatcher.Dispatch(GameMsg.MakeUpConfirmUIClosed);
if (UnityEngine.Random.Range(0, 100) < 50)
if (isOpenRecord && UnityEngine.Random.Range(0, 100) < 50)
{
if (UnityEngine.Random.Range(0, 50) < 25)
{
@@ -641,6 +642,10 @@ namespace ChillConnect
ui.text_ch_number.text = GameHelper.getChString(DataMgr.Ticket.Value);
var curValue = Math.Min(DataMgr.Ticket.Value, vo.item_need);
ui.pb_condi1.value = (double)curValue;
string str1 = string.Format(GameHelper.getDesByKey("makeup_2"), GameHelper.getChString(vo.item_need));
ui.ch_text.text = str1;
var textTitle = ui.pb_condi1.GetChild("title");
if (textTitle != null)
{
@@ -1060,6 +1065,7 @@ namespace ChillConnect
ui.btn_contact_us.SetClick(() =>
{
isOpenRecord = false;
// GameHelper.OpenEmail();
SDKOpenConfig openConfig = new SDKOpenConfig
{
+55
View File
@@ -0,0 +1,55 @@
using UnityEngine;
namespace ChillConnect
{
public class AlphaController : MonoBehaviour
{
private AndroidJavaObject currentActivity;
private bool isInitialized = false;
void Start()
{
// 只在 Android 平台初始化
if (Application.platform == RuntimePlatform.Android)
{
InitializeAndroidBridge();
}
}
private void InitializeAndroidBridge()
{
try
{
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
isInitialized = true;
Debug.Log("AlphaController: Android bridge initialized successfully");
}
}
catch (System.Exception e)
{
Debug.LogError("AlphaController: Failed to initialize Android bridge - " + e.Message);
isInitialized = false;
}
}
/// <summary>
/// 设置 Unity Player 透明度
/// </summary>
/// <param name="alpha">0.0 全透明, 1.0 不透明</param>
public void SetPlayerAlpha(float alpha)
{
if (!isInitialized)
{
Debug.LogWarning("AlphaController: Not initialized");
return;
}
// 限制透明度范围在 0-1 之间
alpha = Mathf.Clamp01(alpha);
currentActivity.Call("setPlayerAlpha", alpha);
Debug.Log($"AlphaController: Set alpha to {alpha}");
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bf7c461dccc24a89a0a3d1654c65bf0a
timeCreated: 1784614395