fix:1、添加h5 2、修复bug

This commit is contained in:
2026-06-24 17:59:07 +08:00
parent 7846543d1b
commit d2741d39be
40 changed files with 596 additions and 227 deletions
+1
View File
@@ -12,5 +12,6 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AShortcutExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F2348fb5ecc9e4e689f37f7d7fadaea9a27a00_003F77_003F364dbea6_003FShortcutExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASystem_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3ea01e77be99618395f448b16bd7cc2bd4248bd9e5d8474964b2d97f39c5d74_003FSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<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_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>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVector2_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003Fab_003F9e3ea355_003FVector2_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AWaitForSeconds_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FUsers_003F97354_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F37cc348edc804f4cb176b63962c716e7177200_003Fdd_003F64399fa4_003FWaitForSeconds_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
@@ -89,6 +89,8 @@ namespace IgnoreOPS
public int ProcessingTime;
public int[] WVOffset;
public string X_Redeemcode;
public CommonModel(string key) : base(key)
@@ -23,6 +23,7 @@ namespace FGUI.Arrow_game
public GButton btn_signin;
public com_finger com_finger;
public GProgressBar ch_progress;
public Transition t1;
public const string URL = "ui://sjl9teijrsd40";
public static com_arrow_game CreateInstance()
@@ -50,6 +51,7 @@ namespace FGUI.Arrow_game
btn_signin = (GButton)GetChildAt(16);
com_finger = (com_finger)GetChildAt(18);
ch_progress = (GProgressBar)GetChildAt(19);
t1 = GetTransitionAt(0);
}
}
}
@@ -7,8 +7,6 @@ namespace FGUI.Arrow_game
{
public partial class com_flicker : GComponent
{
public GGraph bg1;
public GGraph bg2;
public Transition t0;
public const string URL = "ui://sjl9teijrto31r";
@@ -21,8 +19,6 @@ namespace FGUI.Arrow_game
{
base.ConstructFromXML(xml);
bg1 = (GGraph)GetChildAt(0);
bg2 = (GGraph)GetChildAt(1);
t0 = GetTransitionAt(0);
}
}
@@ -12,6 +12,7 @@ namespace FGUI.ZM_Petty
public GTextField text_order;
public GTextField text_email;
public GTextField text_limit;
public GButton btn_redeem;
public const string URL = "ui://e9w4rbkqkbzob";
public static com_detail CreateInstance()
@@ -28,6 +29,7 @@ namespace FGUI.ZM_Petty
text_order = (GTextField)GetChildAt(4);
text_email = (GTextField)GetChildAt(5);
text_limit = (GTextField)GetChildAt(6);
btn_redeem = (GButton)GetChildAt(10);
}
}
}
+4 -2
View File
@@ -571,7 +571,7 @@ namespace ChillConnect
if (GameHelper.isRDExchangeMode()&&GameHelper.IsGiftSwitch())
{
string str = "<img src='ui://o9974uc5qbo98'/>";
return str + $" {ch:N0}";
return str + $"$ {ch:N0}";
}
else
{
@@ -1368,6 +1368,7 @@ namespace ChillConnect
if (SaveData.GetSaveObject().IsGetPettyReward) return;
SaveData.GetSaveObject().IsGetPettyReward = true;
SaveData.saveDataFunc();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PettyAwardUI_Open);
}
@@ -1682,7 +1683,8 @@ namespace ChillConnect
GUIUtility.systemCopyBuffer = text;
#elif UNITY_ANDROID
// CopyToClipboardAndroid(text);
GUIUtility.systemCopyBuffer = text;
#elif UNITY_IOS
BrigdeIOS.copyText(text);
#else
Binary file not shown.
@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 1486d6522f70f02429e1e7de6ce68bfd
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:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 846 KiB

After

Width:  |  Height:  |  Size: 846 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

@@ -1,153 +0,0 @@
fileFormatVersion: 2
guid: cb0f933baada5401db98634511b3e9d7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
-42
View File
@@ -1,42 +0,0 @@
%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: 6e4857e9d117e764490d38ceb6820095, type: 3}
m_Name: SDKConfig
m_EditorClassIdentifier:
appsFlyerDevKey: dkUcozfCwjViZVVr9osrpk
appsFlyerIosAppleAppId: 6773180091
appKey: 585B452ED1E2497A92116D226D2E26E2
appSecret: 465985F9E6504364BEE7677BAEBD16B0
logReportUrl: xyz.captainsroll.com
maxAppKey: mmVXU9O_ESeur52h0VwzCGfbI4wB8LxeBfydReplRMm2JmN8eNMVgSuiKy2bmTJ00m4DHSKFxhaH1pnpEME5bB
splashUnitId:
bannerUnitId:
interUnitId: bb957e86a7b5ae7c
videoUnitId: 100870cb72cf50ca
kwaiAppId:
kwaiVideoUnitId: []
kwaiInterUnitId: []
bigoAppId:
bigoVideoUnitId: []
bigoInterUnitId: []
bigoSplashUnitId:
toponAppId:
toponAppkey:
toponVideoUnitId:
toponInterUnitId:
admobAppId:
admobVideoUnitId:
admobInterUnitId:
admobSplashUnitId:
isDebug: 0
isPrintLog: 0
isUseAdmobSplash: 0
+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: KFG8KMWDJ
host:
isLog: 1
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fe518f3825efad24eb1701a01c8c1b7c
guid: 44d97a630bac8f44abf06383a16d4bb5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
@@ -221,9 +221,12 @@ namespace ChillConnect
public override void OnUpdate()
{
// Update 里判断改为:
// 禁用输入时,直接跳过拖拽
if (_inputDisableCount > 0)
{
// Debug.Log($"输入已禁用,直接跳过拖拽");
return;
}
// 初始化未完成,直接跳过拖拽
if (!_initComplete)
@@ -360,6 +363,8 @@ namespace ChillConnect
_remainArrowCount = _levelConfig.arrows.Count;
InitView();
((com_money)ui.com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
}
protected override void OnOpen(object args)
@@ -727,12 +732,15 @@ namespace ChillConnect
/// </summary>
private void TriggerBlockFlash()
{
ui.t1.Play();
// 先终止正在播放的动画,避免叠加错乱
ui.com_ficker.visible = true;
ui.com_ficker.t0.Play(() =>
{
ui.com_ficker.visible = false;
});
}
#endregion
@@ -53,6 +53,8 @@ namespace ChillConnect
protected override void OnClose()
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
// GameHelper.SetCloseResult(false);
closeCallback?.Invoke();
// if (IsLevelSuccess && !GameHelper.is_first_login)
@@ -69,6 +71,7 @@ namespace ChillConnect
private SuccessData successData_;
protected override void OnOpenBefore(object args)
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
if (Screen.safeArea.y != 0)
{//刘海屏
ui.btn_gold.y += 68;
@@ -76,7 +79,7 @@ namespace ChillConnect
var anim_paly = FXManager.Instance.SetFx<SkeletonAnimation>(ui.btn_gold.GetChild("gold_anim") as GGraph, Fx_Type.fx_coin, ref closeCallback);
anim_paly.state.SetAnimation(0, "animation", true);
(ui.top_money as com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
((com_money)ui.top_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
if (GameHelper.IsGiftSwitch())
ui.switchgift.selectedIndex = 1;
@@ -91,6 +91,7 @@ namespace ChillConnect
makeupTaskData = args as MakeupTaskData;
ch_index = makeupTaskData.tableId - 1;
ui.btn_earn.title = GameHelper.getDesByKey("ch_out_1");
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
@@ -26,8 +26,8 @@ namespace ChillConnect
uiInfo.packageName = "ZM_Petty";
uiInfo.assetName = "com_petty_award";
uiInfo.layerType = UILayerType.Popup;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
@@ -39,6 +39,8 @@ namespace ChillConnect
protected override void OnClose()
{
SaveData.saveDataFunc();
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
closeCallback?.Invoke();
@@ -87,7 +89,7 @@ namespace ChillConnect
private void InitView()
{
_mLastState = SaveData.GetSaveObject().PettyState;
Debug.Log($"PettyState============: {SaveData.GetSaveObject().PettyState}");
// Debug.Log($"PettyState============: {SaveData.GetSaveObject().PettyState}");
var num = GameHelper.GetCommonModel().SmallReward;
ui.com_get_panel.text_reward.text = $"{GameHelper.Get102Str(num)} USD";
@@ -292,12 +294,46 @@ namespace ChillConnect
if (pettyDataLimit != 0)
{
ui.com_detail.text_limit.SetVar("day", pettyDataLimit.ToString()).FlushVars();
}else
}
else
{
var day = GameHelper.GetCommonModel().ProcessingTime;
ui.com_detail.text_limit.SetVar("day", day.ToString()).FlushVars();
SaveData.GetSaveObject().PettyDataLimit = day;
}
if (!IsPettyDataExpired())
{
ui.com_detail.btn_redeem.visible = true;
ui.com_detail.btn_redeem.SetClick(() =>
{
Debug.Log($"click redeem code view----------------------");
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RedeemCodeUI_Open);
CtrlCloseUI();
});
}
}
public bool IsPettyDataExpired()
{
// 1. 获取保存的过期天数限制
var pettyDataLimit = SaveData.GetSaveObject().PettyDataLimit;
// 2. 获取当前日期(去掉时分秒,只保留日期部分,避免当天误判)
DateTime currentDate = DateTime.Now.Date;
// 3. 获取数据保存时的日期
DateTime saveDate = DateTime.ParseExact(SaveData.GetSaveObject().PettyDateTime, "yyyy.MM.dd", System.Globalization.CultureInfo.InvariantCulture);
// 4. 计算时间差
TimeSpan timeSpan = currentDate - saveDate;
// 5. 判断是否超出限制天数
bool isExpired = timeSpan.TotalDays >= pettyDataLimit;
return isExpired;
}
}
}
@@ -1,10 +1,6 @@
using System.Collections;
using System.Globalization;
using DG.Tweening;
using FairyGUI;
using FGUI.Loading_25;
using FGUI.tixian;
using UnityEngine;
using IgnoreOPS;
namespace ChillConnect
{
@@ -25,9 +21,9 @@ namespace ChillConnect
uiInfo.packageName = "tixian";
uiInfo.assetName = "com_redeem_code";
uiInfo.layerType = UILayerType.Loading;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
uiInfo.isNeedOpenAnim = true;
uiInfo.isNeedCloseAnim = true;
uiInfo.isNeedUIMask = true;
}
#region
@@ -49,7 +45,8 @@ namespace ChillConnect
protected override void OnOpenBefore(object args)
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
ui.btn_close1.SetClick(CtrlCloseUI);
InitView();
}
protected override void OnOpen(object args)
@@ -58,6 +55,30 @@ namespace ChillConnect
#endregion
private void InitView()
{
ui.lab_mn2.text = GameHelper.Get101Str(0);
ui.lab_ticket.text = GameHelper.GetPriceInt(SaveData.GetSaveObject().PettyAmount);
var strings = ConfigSystem.GetConfig<CommonModel>().X_Redeemcode;
ui.lab_code.text = strings;
ui.btn_copy.SetClick(() =>
{
GameHelper.CopyText(ui.lab_code.text);
});
ui.btn_contact_us.SetClick(() =>
{
});
ui.btn_close1.SetClick(CtrlCloseUI);
}
#region
protected override void AddListener()
@@ -9,9 +9,9 @@ namespace ChillConnect
private uint closeUIMsg = UICtrlMsg.RedeemCodeUI_Close;
#region
protected override void OnInit()
{
//model = ModuleManager.Instance.GetModel(ModelConst.PettyAwardModel) as PettyAwardModel;
}
protected override void OnDispose()
@@ -29,21 +29,19 @@ namespace ChillConnect
public override void CloseUI(object args = null)
{
if (ui is { isClose: false })
if (ui != null && !ui.isClose)
{
ui.Close();
}
ui = null;
}
#endregion
#region
public override uint GetOpenUIMsg(string uiName)
{
return openUIMsg;
}
public override uint GetCloseUIMsg(string uiName)
{
return closeUIMsg;
@@ -51,14 +49,23 @@ namespace ChillConnect
protected override void AddListener()
{
AppDispatcher.Instance.AddListener(AppMsg.UI_DisplayLoadingUI, OpenUI);
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
}
protected override void RemoveListener()
{
AppDispatcher.Instance.RemoveListener(AppMsg.UI_DisplayLoadingUI, OpenUI);
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
}
protected override void AddServerListener()
{
}
protected override void RemoveServerListener()
{
}
#endregion
}
}
@@ -38,7 +38,7 @@ namespace ChillConnect
protected override void OnClose()
{
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, false);
GameDispatcher.Instance.Dispatch(GameMsg.StopArrowTouch, true);
//open_sign();
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4ebe9c47f185b4746a79a6a509c59f5e
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 = "com.wackyllamagame.chaos";//StringExtensions.IsNullOrWhiteSpace(packageName) ? 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()
{
#if !UNITY_EDITOR
Uni2SDKManager.Instance.Open(0,164,0,0);
#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: