You've already forked CC-Framework.Commercialization
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| abc996cdc9 |
@@ -6,9 +6,10 @@ namespace Runtime.ADAggregator
|
|||||||
{
|
{
|
||||||
public class ADManager : MonoBehaviour
|
public class ADManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
private static ADManager _instance;
|
private static ADManager _instance;
|
||||||
private static bool mIsCreate = false;
|
private static bool mIsCreate = false;
|
||||||
|
private static bool mIsGMModel = false;
|
||||||
|
|
||||||
public static ADManager Instance
|
public static ADManager Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -21,7 +22,7 @@ namespace Runtime.ADAggregator
|
|||||||
Destroy(objs[i]);
|
Destroy(objs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_instance = new GameObject().AddComponent<ADManager>();
|
_instance = new GameObject().AddComponent<ADManager>();
|
||||||
_instance.name = "[GameUpdater] <color=yellow>NoInit<color>";
|
_instance.name = "[GameUpdater] <color=yellow>NoInit<color>";
|
||||||
DontDestroyOnLoad(_instance);
|
DontDestroyOnLoad(_instance);
|
||||||
_instance.InitTimeSystem();
|
_instance.InitTimeSystem();
|
||||||
@@ -34,7 +35,7 @@ namespace Runtime.ADAggregator
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
public AndroidJavaObject activityContext { get; private set; }
|
public AndroidJavaObject activityContext { get; private set; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -55,8 +56,9 @@ namespace Runtime.ADAggregator
|
|||||||
#pragma warning disable CS0414
|
#pragma warning disable CS0414
|
||||||
private bool _isInit = false;
|
private bool _isInit = false;
|
||||||
#pragma warning restore CS0414
|
#pragma warning restore CS0414
|
||||||
|
|
||||||
public void Init(Action onCallback , string userId, ADConfig adConfig , IAdController controller , params object[] args)
|
public void Init(Action onCallback, string userId, ADConfig adConfig, IAdController controller,
|
||||||
|
params object[] args)
|
||||||
{
|
{
|
||||||
_isInit = true;
|
_isInit = true;
|
||||||
_instance.name = "[GameUpdater] <color=green>Init<color>";
|
_instance.name = "[GameUpdater] <color=green>Init<color>";
|
||||||
@@ -70,20 +72,31 @@ namespace Runtime.ADAggregator
|
|||||||
_adConfig = adConfig;
|
_adConfig = adConfig;
|
||||||
onCallback?.Invoke();
|
onCallback?.Invoke();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试模式,此模式下,不会播放、加载任何广告,但是会模拟广告播放成功,正式版本不能调用此方法
|
||||||
|
/// </summary>
|
||||||
|
public void SetTestModel()
|
||||||
|
{
|
||||||
|
mIsGMModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsRealy(AD_Type adType)
|
public bool IsRealy(AD_Type adType)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
if (!_isInit || mIsGMModel)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#pragma warning disable CS0162
|
#pragma warning disable CS0162
|
||||||
if (AD_Dicts.ContainsKey(adType) == false)
|
if (AD_Dicts.ContainsKey(adType) == false)
|
||||||
{
|
{
|
||||||
AD_Dicts[adType] = PlayerCreate(adType);
|
AD_Dicts[adType] = PlayerCreate(adType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AD_Dicts[adType].IsReadly();
|
return AD_Dicts[adType].IsReadly();
|
||||||
#pragma warning restore CS0162
|
#pragma warning restore CS0162
|
||||||
}
|
}
|
||||||
@@ -93,6 +106,10 @@ namespace Runtime.ADAggregator
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
if (!_isInit || mIsGMModel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Debug.LogError("准备加载广告" + adType);
|
// Debug.LogError("准备加载广告" + adType);
|
||||||
#pragma warning disable CS0162
|
#pragma warning disable CS0162
|
||||||
if (!IsRealy(adType))
|
if (!IsRealy(adType))
|
||||||
@@ -118,7 +135,16 @@ namespace Runtime.ADAggregator
|
|||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
public void AsyncPlayAD(AD_Type adType, string adScene, Action<bool> callback)
|
public void AsyncPlayAD(AD_Type adType, string adScene, Action<bool> callback)
|
||||||
{
|
{
|
||||||
_adController.EventLog("adScene" , adScene);
|
#if UNITY_EDITOR
|
||||||
|
callback?.Invoke(true);
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
if (!_isInit || mIsGMModel)
|
||||||
|
{
|
||||||
|
callback?.Invoke(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_adController.EventLog("adScene", adScene);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_curAsyncPlayer?.Kill();
|
_curAsyncPlayer?.Kill();
|
||||||
@@ -126,13 +152,14 @@ namespace Runtime.ADAggregator
|
|||||||
{
|
{
|
||||||
AD_Dicts[adType] = PlayerCreate(adType);
|
AD_Dicts[adType] = PlayerCreate(adType);
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = AD_Dicts[adType];
|
var player = AD_Dicts[adType];
|
||||||
_curAsyncPlayer = new AsyncAdPlayer(player, callback);
|
_curAsyncPlayer = new AsyncAdPlayer(player, callback);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogError(e);
|
Debug.LogError(e);
|
||||||
_adController.EventLog("error" , "showAdError" , e.Message);
|
_adController.EventLog("error", "showAdError", e.Message);
|
||||||
callback?.Invoke(false);
|
callback?.Invoke(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,6 +169,10 @@ namespace Runtime.ADAggregator
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return null;
|
return null;
|
||||||
#endif
|
#endif
|
||||||
|
if (!_isInit || mIsGMModel)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
#pragma warning disable CS0162
|
#pragma warning disable CS0162
|
||||||
return _adController.CreateAdPlayer(type);
|
return _adController.CreateAdPlayer(type);
|
||||||
#pragma warning restore CS0162
|
#pragma warning restore CS0162
|
||||||
@@ -152,6 +183,10 @@ namespace Runtime.ADAggregator
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
if (!_isInit || mIsGMModel)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
#pragma warning disable CS0162
|
#pragma warning disable CS0162
|
||||||
if (adType != AD_Type.AwardVideo)
|
if (adType != AD_Type.AwardVideo)
|
||||||
{
|
{
|
||||||
@@ -169,11 +204,11 @@ namespace Runtime.ADAggregator
|
|||||||
private List<Action> _updateList;
|
private List<Action> _updateList;
|
||||||
private const int DefaultLength = 1024;
|
private const int DefaultLength = 1024;
|
||||||
private List<AdTimeHandler> _timeHandlers;
|
private List<AdTimeHandler> _timeHandlers;
|
||||||
|
|
||||||
private void InitTimeSystem()
|
private void InitTimeSystem()
|
||||||
{
|
{
|
||||||
this._updateList = new List<Action>(DefaultLength);
|
this._updateList = new List<Action>(DefaultLength);
|
||||||
this._timeHandlers = new List<AdTimeHandler>();
|
this._timeHandlers = new List<AdTimeHandler>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _InvokeUpdate(List<Action> list)
|
private void _InvokeUpdate(List<Action> list)
|
||||||
@@ -192,7 +227,7 @@ namespace Runtime.ADAggregator
|
|||||||
list[i].Invoke();
|
list[i].Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = this._timeHandlers.Count - 1; i >= 0; i--)
|
for (int i = this._timeHandlers.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var timeHandler = this._timeHandlers[i];
|
var timeHandler = this._timeHandlers[i];
|
||||||
@@ -207,8 +242,8 @@ namespace Runtime.ADAggregator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update() => this._InvokeUpdate(this._updateList);
|
private void Update() => this._InvokeUpdate(this._updateList);
|
||||||
|
|
||||||
public AdTimeHandler CreateTimer(float delay, Action callback, Action<float> update = null)
|
public AdTimeHandler CreateTimer(float delay, Action callback, Action<float> update = null)
|
||||||
{
|
{
|
||||||
if (delay <= 0)
|
if (delay <= 0)
|
||||||
@@ -249,7 +284,7 @@ namespace Runtime.ADAggregator
|
|||||||
{
|
{
|
||||||
this._updateList.Remove(updater);
|
this._updateList.Remove(updater);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void CloseMask()
|
public void CloseMask()
|
||||||
@@ -261,6 +296,5 @@ namespace Runtime.ADAggregator
|
|||||||
{
|
{
|
||||||
_adController.SetMask(true);
|
_adController.SetMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,209 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!29 &1
|
|
||||||
OcclusionCullingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_OcclusionBakeSettings:
|
|
||||||
smallestOccluder: 5
|
|
||||||
smallestHole: 0.25
|
|
||||||
backfaceThreshold: 100
|
|
||||||
m_SceneGUID: 00000000000000000000000000000000
|
|
||||||
m_OcclusionCullingData: {fileID: 0}
|
|
||||||
--- !u!104 &2
|
|
||||||
RenderSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 9
|
|
||||||
m_Fog: 0
|
|
||||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
|
||||||
m_FogMode: 3
|
|
||||||
m_FogDensity: 0.01
|
|
||||||
m_LinearFogStart: 0
|
|
||||||
m_LinearFogEnd: 300
|
|
||||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
|
||||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
|
||||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
|
||||||
m_AmbientIntensity: 1
|
|
||||||
m_AmbientMode: 3
|
|
||||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
|
||||||
m_SkyboxMaterial: {fileID: 0}
|
|
||||||
m_HaloStrength: 0.5
|
|
||||||
m_FlareStrength: 1
|
|
||||||
m_FlareFadeSpeed: 3
|
|
||||||
m_HaloTexture: {fileID: 0}
|
|
||||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_DefaultReflectionMode: 0
|
|
||||||
m_DefaultReflectionResolution: 128
|
|
||||||
m_ReflectionBounces: 1
|
|
||||||
m_ReflectionIntensity: 1
|
|
||||||
m_CustomReflection: {fileID: 0}
|
|
||||||
m_Sun: {fileID: 0}
|
|
||||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
|
||||||
--- !u!157 &3
|
|
||||||
LightmapSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 12
|
|
||||||
m_GIWorkflowMode: 1
|
|
||||||
m_GISettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
|
||||||
m_EnableBakedLightmaps: 0
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_LightmapEditorSettings:
|
|
||||||
serializedVersion: 12
|
|
||||||
m_Resolution: 2
|
|
||||||
m_BakeResolution: 40
|
|
||||||
m_AtlasSize: 1024
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 1
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAmbientOcclusion: 0
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_TextureCompression: 1
|
|
||||||
m_FinalGather: 0
|
|
||||||
m_FinalGatherFiltering: 1
|
|
||||||
m_FinalGatherRayCount: 256
|
|
||||||
m_ReflectionCompression: 2
|
|
||||||
m_MixedBakeMode: 2
|
|
||||||
m_BakeBackend: 0
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 500
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVREnvironmentSampleCount: 500
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_PVRFilteringMode: 2
|
|
||||||
m_PVRDenoiserTypeDirect: 0
|
|
||||||
m_PVRDenoiserTypeIndirect: 0
|
|
||||||
m_PVRDenoiserTypeAO: 0
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVREnvironmentMIS: 0
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 5
|
|
||||||
m_PVRFilteringGaussRadiusAO: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_LightingDataAsset: {fileID: 0}
|
|
||||||
m_LightingSettings: {fileID: 0}
|
|
||||||
--- !u!196 &4
|
|
||||||
NavMeshSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_BuildSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
agentTypeID: 0
|
|
||||||
agentRadius: 0.5
|
|
||||||
agentHeight: 2
|
|
||||||
agentSlope: 45
|
|
||||||
agentClimb: 0.4
|
|
||||||
ledgeDropHeight: 0
|
|
||||||
maxJumpAcrossDistance: 0
|
|
||||||
minRegionArea: 2
|
|
||||||
manualCellSize: 0
|
|
||||||
cellSize: 0.16666667
|
|
||||||
manualTileSize: 0
|
|
||||||
tileSize: 256
|
|
||||||
accuratePlacement: 0
|
|
||||||
maxJobWorkers: 0
|
|
||||||
preserveTilesOutsideBounds: 0
|
|
||||||
debug:
|
|
||||||
m_Flags: 0
|
|
||||||
m_NavMeshData: {fileID: 0}
|
|
||||||
--- !u!1 &519420028
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 519420032}
|
|
||||||
- component: {fileID: 519420031}
|
|
||||||
- component: {fileID: 519420029}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Main Camera
|
|
||||||
m_TagString: MainCamera
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!81 &519420029
|
|
||||||
AudioListener:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 519420028}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &519420031
|
|
||||||
Camera:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 519420028}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ClearFlags: 2
|
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
|
||||||
m_projectionMatrixMode: 1
|
|
||||||
m_GateFitMode: 2
|
|
||||||
m_FOVAxisMode: 0
|
|
||||||
m_SensorSize: {x: 36, y: 24}
|
|
||||||
m_LensShift: {x: 0, y: 0}
|
|
||||||
m_FocalLength: 50
|
|
||||||
m_NormalizedViewPortRect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: 1
|
|
||||||
height: 1
|
|
||||||
near clip plane: 0.3
|
|
||||||
far clip plane: 1000
|
|
||||||
field of view: 60
|
|
||||||
orthographic: 1
|
|
||||||
orthographic size: 5
|
|
||||||
m_Depth: -1
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingPath: -1
|
|
||||||
m_TargetTexture: {fileID: 0}
|
|
||||||
m_TargetDisplay: 0
|
|
||||||
m_TargetEye: 0
|
|
||||||
m_HDR: 1
|
|
||||||
m_AllowMSAA: 0
|
|
||||||
m_AllowDynamicResolution: 0
|
|
||||||
m_ForceIntoRT: 0
|
|
||||||
m_OcclusionCulling: 0
|
|
||||||
m_StereoConvergence: 10
|
|
||||||
m_StereoSeparation: 0.022
|
|
||||||
--- !u!4 &519420032
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 519420028}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 2cda990e2423bbf4892e6590ba056729
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "com.foldcc.cc-framework.commercialization",
|
"name": "com.foldcc.cc-framework.commercialization",
|
||||||
"displayName": "CC-Framework.commercialization",
|
"displayName": "CC-Framework.commercialization",
|
||||||
"description": "商业化sdk通用组件,包含广告、内购、用户统计、归因统计等",
|
"description": "商业化sdk通用组件,包含广告、内购、用户统计、归因统计等",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"unity": "2021.1",
|
"unity": "2021.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user