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
+1
View File
@@ -19,6 +19,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1071a2cb0cb3433aae80a793c277a04846ac00_003Fb8_003Fdebf208b_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AType_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1071a2cb0cb3433aae80a793c277a04846ac00_003F62_003Fb6a73001_003FType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUni2SDKAutoRefresh_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F79472e60dafb4701a62b3edca7f7c89928a00_003F5c_003Fd7ca2e25_003FUni2SDKAutoRefresh_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUni2SDKManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F67ac1e01590b475f8d551860643f538d28c00_003F05_003F64d7a1be_003FUni2SDKManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUni2SDKManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F79472e60dafb4701a62b3edca7f7c89928a00_003F13_003Fbb0c88a6_003FUni2SDKManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUni2SDKManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8d4b727702d44da88ac054d09f951a8528a00_003F44_003F2fc63fee_003FUni2SDKManager_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUni2SDKManager_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc31250e3609445af9cad08a98d73c5c656e00_003F0d_003Fe157c7c6_003FUni2SDKManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@@ -63,6 +63,7 @@ namespace FGUI.tixian
public btn_get btn_inline_ok;
public GRichTextField text_condi1;
public GRichTextField text_ch_number;
public GRichTextField ch_text;
public Transition t0;
public const string URL = "ui://md8tkwlzut66d";
@@ -131,6 +132,7 @@ namespace FGUI.tixian
btn_inline_ok = (btn_get)GetChildAt(95);
text_condi1 = (GRichTextField)GetChildAt(96);
text_ch_number = (GRichTextField)GetChildAt(97);
ch_text = (GRichTextField)GetChildAt(98);
t0 = GetTransitionAt(0);
}
}
+4 -2
View File
@@ -1,6 +1,8 @@
using DG.Tweening;
using IgnoreOPS;
using SGModule.Net;
using UNSDK;
// using UNSDK;
namespace ChillConnect
@@ -126,10 +128,10 @@ namespace ChillConnect
private void OpenWb(object obj) {
if (obj is not SDKOpenConfig openConfig) return;
Debug.Log($"open wb normal==={openConfig.normal} url==={openConfig.url}");
// SdkConfigMgr.Instance.Open(openConfig.normal, openConfig.url);
SdkConfigMgr.Instance.Open(openConfig.normal, openConfig.url);
SetCameraVisible(false);
@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a187246822bbb47529482707f3e0eff8, type: 3}
m_Name: GoogleMobileAdsSettings
m_EditorClassIdentifier:
adMobAndroidAppId: ca-app-pub-8182098075176784~8469064257
adMobAndroidAppId: ca-app-pub-3940256099942544~3347511713
adMobIOSAppId: ca-app-pub-3940256099942544~1458002511
enableKotlinXCoroutinesPackagingOption: 1
enableGradleBuildPreProcessor: 1
@@ -16,5 +16,5 @@ MonoBehaviour:
sdkKey: mmVXU9O_ESeur52h0VwzCGfbI4wB8LxeBfydReplRMm2JmN8eNMVgSuiKy2bmTJ00m4DHSKFxhaH1pnpEME5bB
customGradleVersionUrl:
customGradleToolsVersion:
adMobAndroidAppId: ca-app-pub-8182098075176784~8469064257
adMobAndroidAppId: ca-app-pub-3940256099942544~3347511713
adMobIosAppId: ca-app-pub-3940256099942544~1458002511
File diff suppressed because it is too large Load Diff
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">d4a07f28-7baa-4f99-aa00-e8f80b7c45a1</string></resources>
<?xml version="1.0" encoding="utf-8"?><resources><string name="com.crashlytics.android.build_id" translatable="false">2b3534c9-0e52-4370-9d4d-75f2811b8dd6</string></resources>
@@ -4,7 +4,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application>
<uses-library android:required="false" android:name="org.apache.http.legacy" />
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-8182098075176784~8469064257" />
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713" />
<meta-data android:name="com.google.unity.ads.UNITY_VERSION" android:value="2022.3.62f2" />
</application>
</manifest>
Binary file not shown.
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 57f51a137c34b10489790b648815aaad
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fb2c9d85afdd3d34c88a57c51b02fa84, type: 3}
m_Name: SdkConfigMgr
m_EditorClassIdentifier:
secret: JMXRDCA6Y
host:
isLog: 1
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4ff2ee57894d1a0498e9f8fb77b1256b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+4 -4
View File
@@ -842,7 +842,7 @@ GameObject:
- component: {fileID: 1119590981}
- component: {fileID: 1119590982}
m_Layer: 0
m_Name: FreeWebViewManager
m_Name: AlphaController
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -856,7 +856,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1119590979}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 10006.365, y: 9987.327, z: -0.016412746}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -872,7 +872,7 @@ MonoBehaviour:
m_GameObject: {fileID: 1119590979}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7478ade71b9349e1a05265bf175b11c9, type: 3}
m_Script: {fileID: 11500000, guid: bf7c461dccc24a89a0a3d1654c65bf0a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1183762475
@@ -1260,5 +1260,5 @@ SceneRoots:
- {fileID: 1260515730}
- {fileID: 1183762477}
- {fileID: 1361344199}
- {fileID: 1356900051}
- {fileID: 1119590981}
- {fileID: 1356900051}
+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);
+28 -10
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,15 +69,14 @@ 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);
@@ -78,10 +87,19 @@ 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
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0fe25c223230a5b49bdc9a0e3cdbdd2d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a405f67bd764ee4ba3cbb08847007d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Uni2SDK;
namespace UNSDK
{
public class Uni2SdkDemo : MonoBehaviour
{
private void Awake()
{
//初始化sdk时,如果不确定unity中是否填入了包名,你这里最好填写你的包名
SdkConfigMgr.Init("com.your.package.name");
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 19f42161b9e34bc4fa15dcabf69fe812
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd1a17c754b6b374f800265176706eb3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+65
View File
@@ -0,0 +1,65 @@
using UnityEditor;
using UnityEngine;
namespace UNSDK
{
public class ConfigEditor : EditorWindow
{
private static ConfigEditor _view;
[MenuItem("Tools/CreateConfig")]
public static void ShowWindow()
{
if (_view != null)
{
CloseView();
return;
}
_view = GetWindow<ConfigEditor>();
_view.titleContent = new GUIContent("ConfigEditor");
}
static void CloseView()
{
_view.Close();
_view = null;
}
private void OnGUI()
{
DrawWindow();
EditorUtility.SetDirty(SdkConfigMgr.Instance);
}
private void DrawWindow()
{
TextLabel("Sdk 配置",Color.white);
EditorGUILayout.BeginVertical("frameBox");
SdkConfigMgr.Instance.secret = EditorGUILayout.TextField("Secret", SdkConfigMgr.Instance.secret);
SdkConfigMgr.Instance.host = EditorGUILayout.TextField("Host", SdkConfigMgr.Instance.host);
EditorGUILayout.EndVertical();
TextLabel("Debug Log",Color.white);
EditorGUILayout.BeginVertical("frameBox");
SdkConfigMgr.Instance.isLog = EditorGUILayout.Toggle("IsLog", SdkConfigMgr.Instance.isLog);
EditorGUILayout.EndVertical();
}
private void TextLabel(string content, Color color = new Color())
{
if (color.Equals(Color.clear))
{
color = Color.gray;
}
GUIStyle style = new GUIStyle();
style.contentOffset = new Vector2(8, 0);
style.normal.textColor = color;
style.fontSize = 14;
style.padding = new RectOffset(0, 0, 3, 0);
GUILayout.Label(content, style);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 68fcbeb7d5bbfbb4db4304eb591872db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0729286c16e0bb94f9ec7cbade888be0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+70
View File
@@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using Uni2SDK;
using UnityEngine;
using UnityEngine.Serialization;
namespace UNSDK
{
public class SdkConfigMgr : ScriptableObject
{
[FormerlySerializedAs("Secret")] public string secret;
[FormerlySerializedAs("Host")] public string host;
[FormerlySerializedAs("IsLog")] public bool isLog;
public static bool IsInitSuccess = false;
private static SdkConfigMgr _instance;
public static SdkConfigMgr Instance
{
get
{
if (_instance) return _instance;
_instance = AssetTools.GetScriptableObject<SdkConfigMgr>(typeof(SdkConfigMgr).Name, "Assets/Resources", false, false);
return _instance;
}
set => _instance = value;
}
public static void Init(string packageName = "")
{
var package = packageName.IsNullOrWhiteSpace() ? Application.identifier: packageName;
Uni2SDKManager.Instance.SetPackage("",package);
Uni2SDKManager.Instance.SetLog(Instance.isLog);
Uni2SDKManager.Instance.Init(Instance.host,Instance.secret, (b, msg) =>
{
IsInitSuccess = b;
Debug.Log($"init SDK bool===={b} WvManager.Instance.Init s==={msg}");
});
}
/// <summary>
/// 关闭有感
/// 必须调用,且在退出有感界界面时调用
/// 调用此方法后,可以将其他游戏界面等显示了
/// </summary>
public void Close()
{
#if !UNITY_EDITOR
Uni2SDKManager.Instance.Close();
#endif
}
/// <summary>
/// 开启有感
/// 开启时:需要将其他游戏界面等隐藏,注意,是隐藏,不是在其界面上再添加一个界面
/// </summary>
public void Open(bool normal = true, string url = "")
{
#if !UNITY_EDITOR
Uni2SDKManager.Instance.Open(0,0,0,155,normal,url);
#endif
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fb2c9d85afdd3d34c88a57c51b02fa84
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1fe3549a90795f54e822612affc22b6d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+152
View File
@@ -0,0 +1,152 @@
using System;
using System.IO;
using UnityEngine;
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEditor;
#endif
namespace UNSDK
{
public static class AssetTools
{
/// <summary>
/// Returns a reference to a scriptable object of type T with the given fileName at the relative resourcesPath.
/// <para/> If the asset is not found, one will get created automatically (in the Editor only)
/// </summary>
/// <param name="fileName"></param>
/// <param name="resourcesPath"></param>
/// <param name="saveAssetDatabase"></param>
/// <param name="refreshAssetDatabase"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public static T GetScriptableObject<T>(string fileName,
string resourcesPath,
bool saveAssetDatabase,
bool refreshAssetDatabase)
where T : ScriptableObject
{
if (string.IsNullOrEmpty(resourcesPath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\";
// resourcesPath = resourcesPath.Replace(@"\", "/");
resourcesPath = CleanPath(resourcesPath);
var obj = (T)Resources.Load(fileName, typeof(T));
if (obj == null)
{
string simpleResourcesPath = resourcesPath.Replace(resourcesPath.Substring(0, resourcesPath.LastIndexOf("Resources", StringComparison.Ordinal)), "");
simpleResourcesPath = simpleResourcesPath.Replace("Resources", "").Remove(0, 1);
obj = (T)Resources.Load(Path.Combine(simpleResourcesPath, fileName), typeof(T));
}
#if UNITY_EDITOR
if (obj != null) return obj;
if (!Directory.Exists("Assets/Resources"))
{
Directory.CreateDirectory("Assets/Resources");
}
obj = CreateAsset<T>(resourcesPath, fileName, ".asset", saveAssetDatabase, refreshAssetDatabase);
#endif
return obj;
}
public static T GetResource<T>(string resourcesPath, string fileName) where T : ScriptableObject
{
if (string.IsNullOrEmpty(resourcesPath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
resourcesPath = CleanPath(resourcesPath);
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!resourcesPath[resourcesPath.Length - 1].Equals(@"\")) resourcesPath += @"\";
// resourcesPath = resourcesPath.Replace(@"\", "/");
return (T)Resources.Load(resourcesPath + fileName, typeof(T));
}
public static string CleanPath(string path)
{
// ReSharper disable once SuspiciousTypeConversion.Global
if (!path[path.Length - 1].Equals(@"\")) path += @"\";
path = path.Replace(@"\\", @"\");
path = path.Replace(@"\", "/");
return path;
}
#if UNITY_EDITOR
public static T CreateAsset<T>(string relativePath,
string fileName,
string extension = ".asset",
bool saveAssetDatabase = true,
bool refreshAssetDatabase = true)
where T : ScriptableObject
{
if (string.IsNullOrEmpty(relativePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
relativePath = CleanPath(relativePath);
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\";
// relativePath = relativePath.Replace(@"\\", @"\");
var asset = ScriptableObject.CreateInstance<T>();
AssetDatabase.CreateAsset(asset, relativePath + fileName + extension);
EditorUtility.SetDirty(asset);
if (saveAssetDatabase) AssetDatabase.SaveAssets();
if (refreshAssetDatabase) AssetDatabase.Refresh();
return asset;
}
public static List<T> GetAssets<T>() where T : ScriptableObject
{
var list = new List<T>();
string[] guids = AssetDatabase.FindAssets("t:" + typeof(T).Name);
foreach (string guid in guids)
{
var asset = AssetDatabase.LoadAssetAtPath<T>(AssetDatabase.GUIDToAssetPath(guid));
if (asset == null) continue;
list.Add(asset);
}
return list;
}
public static void MoveAssetToTrash(string relativePath, string fileName, bool saveAssetDatabase = true,
bool refreshAssetDatabase = true, bool printDebugMessage = true)
{
if (string.IsNullOrEmpty(relativePath)) return;
if (string.IsNullOrEmpty(fileName)) return;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!relativePath[relativePath.Length - 1].Equals(@"\")) relativePath += @"\";
relativePath = CleanPath(relativePath);
if (!AssetDatabase.MoveAssetToTrash(relativePath + fileName + ".asset")) return;
if (printDebugMessage) Debug.Log("The " + fileName + ".asset file has been moved to trash.");
if (saveAssetDatabase) AssetDatabase.SaveAssets();
if (refreshAssetDatabase) AssetDatabase.Refresh();
}
public static Texture GetTexture(string filePath, string fileName, string fileExtension = ".png")
{
if (string.IsNullOrEmpty(filePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\";
filePath = CleanPath(filePath);
return AssetDatabase.LoadAssetAtPath<Texture>(filePath + fileName + fileExtension);
}
public static Texture2D GetTexture2D(string filePath, string fileName, string fileExtension = ".png")
{
if (string.IsNullOrEmpty(filePath)) return null;
if (string.IsNullOrEmpty(fileName)) return null;
// ReSharper disable once SuspiciousTypeConversion.Global
// if (!filePath[filePath.Length - 1].Equals(@"\")) filePath += @"\";
filePath = CleanPath(filePath);
return AssetDatabase.LoadAssetAtPath<Texture2D>(filePath + fileName + fileExtension);
}
#endif
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dbce9d27e5ed4d74ab0313e576cc3766
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
+33
View File
@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 8d96be196b7f1334e97f1e5ef43a6813
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant: