提交项目
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ea7ef46cf2ade545b68fd32b9c4b8b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "SDKConfig",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b6da46957b38914aa097a61bd86a16d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,234 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RGKT2NIYSDK
|
||||
{
|
||||
[System.Serializable]
|
||||
public class SDKConfig : ScriptableObject
|
||||
{
|
||||
|
||||
public string appsFlyerDevKey;
|
||||
|
||||
public string appsFlyerIosAppleAppId;
|
||||
|
||||
public string appKey;
|
||||
|
||||
public string appSecret;
|
||||
|
||||
public string logReportUrl;
|
||||
|
||||
public string maxAppKey;
|
||||
|
||||
public string splashUnitId;
|
||||
|
||||
public string bannerUnitId;
|
||||
|
||||
public string interUnitId;
|
||||
|
||||
public string videoUnitId;
|
||||
|
||||
public string kwaiAppId;
|
||||
|
||||
public List<string> kwaiVideoUnitId = new();
|
||||
|
||||
public List<string> kwaiInterUnitId = new();
|
||||
|
||||
public string bigoAppId;
|
||||
|
||||
public List<string> bigoVideoUnitId = new();
|
||||
|
||||
public List<string> bigoInterUnitId = new();
|
||||
|
||||
public string bigoSplashUnitId;
|
||||
|
||||
public string toponAppId;
|
||||
|
||||
public string toponAppkey;
|
||||
|
||||
public string toponVideoUnitId;
|
||||
|
||||
public string toponInterUnitId;
|
||||
|
||||
public string admobAppId;
|
||||
|
||||
public string admobVideoUnitId;
|
||||
|
||||
public string admobInterUnitId;
|
||||
|
||||
public string admobSplashUnitId;
|
||||
|
||||
public bool isDebug = false;
|
||||
|
||||
public bool isPrintLog = false;
|
||||
|
||||
public bool isUseAdmobSplash = false;
|
||||
|
||||
private static SDKConfig _instance;
|
||||
|
||||
public static SDKConfig Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance != null) return _instance;
|
||||
_instance = AssetUtils.GetScriptableObject<SDKConfig>(typeof(SDKConfig).Name, "Assets/Resources", false, false);
|
||||
return _instance;
|
||||
}
|
||||
set
|
||||
{
|
||||
_instance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static string AppsFlyerDevKey
|
||||
{
|
||||
get { return Instance.appsFlyerDevKey; }
|
||||
}
|
||||
|
||||
public static string AppsFlyerIosAppleAppId
|
||||
{
|
||||
get { return Instance.appsFlyerIosAppleAppId; }
|
||||
}
|
||||
|
||||
public static string AppKey
|
||||
{
|
||||
get { return Instance.appKey; }
|
||||
}
|
||||
|
||||
public static string AppSecret
|
||||
{
|
||||
get { return Instance.appSecret; }
|
||||
}
|
||||
|
||||
public static string LogReportUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Instance.logReportUrl.StartsWith("http"))
|
||||
{
|
||||
return "https://" + Instance.logReportUrl.Replace(" ", ""); ;
|
||||
}
|
||||
return Instance.logReportUrl.Replace(" ", ""); ;
|
||||
}
|
||||
}
|
||||
|
||||
public static string MaxAppKey
|
||||
{
|
||||
get { return Instance.maxAppKey; }
|
||||
}
|
||||
|
||||
public static string SplashUnitID
|
||||
{
|
||||
get { return Instance.splashUnitId; }
|
||||
}
|
||||
|
||||
public static string BannerUnitId
|
||||
{
|
||||
get { return Instance.bannerUnitId; }
|
||||
}
|
||||
|
||||
public static string InterUnitId
|
||||
{
|
||||
get { return Instance.interUnitId; }
|
||||
}
|
||||
|
||||
public static string VideoUnitId
|
||||
{
|
||||
get { return Instance.videoUnitId; }
|
||||
}
|
||||
|
||||
public static string KwaiAppId
|
||||
{
|
||||
get => Instance.kwaiAppId;
|
||||
set => Instance.kwaiAppId = value;
|
||||
}
|
||||
|
||||
public static List<string> KwaiVideoUnitId
|
||||
{
|
||||
get => Instance.kwaiVideoUnitId;
|
||||
set => Instance.kwaiVideoUnitId = value;
|
||||
}
|
||||
|
||||
public static List<string> KwaiInterUnitId
|
||||
{
|
||||
get => Instance.kwaiInterUnitId;
|
||||
set => Instance.kwaiInterUnitId = value;
|
||||
}
|
||||
|
||||
public static string BigoAppId
|
||||
{
|
||||
get => Instance.bigoAppId;
|
||||
set => Instance.bigoAppId = value;
|
||||
}
|
||||
|
||||
public static List<string> BigoVideoUnitId
|
||||
{
|
||||
get => Instance.bigoVideoUnitId;
|
||||
set => Instance.bigoVideoUnitId = value;
|
||||
}
|
||||
|
||||
public static List<string> BigoInterUnitId
|
||||
{
|
||||
get => Instance.bigoInterUnitId;
|
||||
set => Instance.bigoInterUnitId = value;
|
||||
}
|
||||
|
||||
public static string BigoSplashUnitId
|
||||
{
|
||||
get => Instance.bigoSplashUnitId;
|
||||
set => Instance.bigoSplashUnitId = value;
|
||||
}
|
||||
|
||||
public static string ToponAppId
|
||||
{
|
||||
get { return Instance.toponAppId; }
|
||||
}
|
||||
|
||||
public static string ToponAppkey
|
||||
{
|
||||
get { return Instance.toponAppkey; }
|
||||
}
|
||||
|
||||
public static string ToponVideoUnitId
|
||||
{
|
||||
get { return Instance.toponVideoUnitId; }
|
||||
}
|
||||
|
||||
public static string ToponInterUnitId
|
||||
{
|
||||
get { return Instance.toponInterUnitId; }
|
||||
}
|
||||
|
||||
public static string AdmobAppId
|
||||
{
|
||||
get => Instance.admobAppId;
|
||||
set => Instance.admobAppId = value;
|
||||
}
|
||||
|
||||
public static string AdmobVideoUnitId
|
||||
{
|
||||
get => Instance.admobVideoUnitId;
|
||||
set => Instance.admobVideoUnitId = value;
|
||||
}
|
||||
|
||||
public static string AdmobSplashUnitId
|
||||
{
|
||||
get => Instance.admobSplashUnitId;
|
||||
set => Instance.admobSplashUnitId = value;
|
||||
}
|
||||
|
||||
public static string AdmobInterUnitId
|
||||
{
|
||||
get => Instance.admobInterUnitId;
|
||||
set => Instance.admobInterUnitId = value;
|
||||
}
|
||||
|
||||
public static bool IsDebug => Instance.isDebug;
|
||||
|
||||
public static bool IsPrintLog => Instance.isPrintLog;
|
||||
|
||||
public static bool IsUseAdmobSplash => Instance.isUseAdmobSplash;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e4857e9d117e764490d38ceb6820095
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0d9293c0ca40cd41ba02042aeb78b89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,152 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace RGKT2NIYSDK
|
||||
{
|
||||
public static class AssetUtils
|
||||
{
|
||||
/// <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: a6cff4f16b2f10d499cfd019dc05cf9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user