From efd711913049cdc753ca176f32620201e56de9a9 Mon Sep 17 00:00:00 2001 From: AlianBlank Date: Fri, 21 Jul 2023 14:30:09 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=87=8D=E6=9E=84]=201.=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AE=8F=E5=AE=9A=E4=B9=89=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 36 ------------------ LICENSE => LICENSE.md | 0 LICENSE.md.meta | 7 ++++ Plugins.meta | 5 +-- README.md.meta | 7 ++++ BlankGetChannel.meta => Runtime.meta | 5 +-- Runtime/BlankGetChannel.Runtime.asmdef | 13 +++++++ Runtime/BlankGetChannel.Runtime.asmdef.meta | 7 ++++ .../BlankGetChannel.cs | 29 +++++++------- .../BlankGetChannel.cs.meta | 0 .../com.alianhome.getchannel.zip | Bin .../com.alianhome.getchannel.zip.meta | 0 Runtime/link.xml | 4 ++ Runtime/link.xml.meta | 3 ++ Sample.meta | 8 ++++ Sample/BlankGetChannel.Sample.asmdef | 15 ++++++++ Sample/BlankGetChannel.Sample.asmdef.meta | 3 ++ .../BlankGetChannelExample.cs | 0 .../BlankGetChannelExample.cs.meta | 0 .../BlankGetChannelExample.unity | 0 .../BlankGetChannelExample.unity.meta | 0 package.json | 24 ++++++++++++ package.json.meta | 7 ++++ 23 files changed, 118 insertions(+), 55 deletions(-) delete mode 100644 .gitignore rename LICENSE => LICENSE.md (100%) create mode 100644 LICENSE.md.meta create mode 100644 README.md.meta rename BlankGetChannel.meta => Runtime.meta (58%) create mode 100644 Runtime/BlankGetChannel.Runtime.asmdef create mode 100644 Runtime/BlankGetChannel.Runtime.asmdef.meta rename BlankGetChannel.cs => Runtime/BlankGetChannel.cs (50%) rename BlankGetChannel.cs.meta => Runtime/BlankGetChannel.cs.meta (100%) rename com.alianhome.getchannel.zip => Runtime/com.alianhome.getchannel.zip (100%) rename com.alianhome.getchannel.zip.meta => Runtime/com.alianhome.getchannel.zip.meta (100%) create mode 100644 Runtime/link.xml create mode 100644 Runtime/link.xml.meta create mode 100644 Sample.meta create mode 100644 Sample/BlankGetChannel.Sample.asmdef create mode 100644 Sample/BlankGetChannel.Sample.asmdef.meta rename BlankGetChannelExample.cs => Sample/BlankGetChannelExample.cs (100%) rename BlankGetChannelExample.cs.meta => Sample/BlankGetChannelExample.cs.meta (100%) rename BlankGetChannelExample.unity => Sample/BlankGetChannelExample.unity (100%) rename BlankGetChannelExample.unity.meta => Sample/BlankGetChannelExample.unity.meta (100%) create mode 100644 package.json create mode 100644 package.json.meta diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0210746..0000000 --- a/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -[Ll]ibrary/ -[Tt]emp/ -[Oo]bj/ -[Bb]uild/ -[Bb]uilds/ -Assets/AssetStoreTools* - -# Visual Studio cache directory -.vs/ - -# Autogenerated VS/MD/Consulo solution and project files -ExportedObj/ -.consulo/ -*.csproj -*.unityproj -*.sln -*.suo -*.tmp -*.user -*.userprefs -*.pidb -*.booproj -*.svd -*.pdb -*.opendb - -# Unity3D generated meta files -*.pidb.meta -*.pdb.meta - -# Unity3D Generated File On Crash Reports -sysinfo.txt - -# Builds -*.apk -*.unitypackage diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 0000000..b3633ca --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 915a088a7e3ef3047b737576b9ea411f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins.meta b/Plugins.meta index aa30ded..9e472a0 100644 --- a/Plugins.meta +++ b/Plugins.meta @@ -1,9 +1,8 @@ fileFormatVersion: 2 -guid: 59b6e2e182b4ac5449e397258f408195 +guid: cfc3bc3f319d3bf42a29ef332d74f4b9 folderAsset: yes -timeCreated: 1545036572 -licenseType: Pro DefaultImporter: + externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..76920e8 --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 47f0ac7ae1f54f5429d7472b625417e6 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlankGetChannel.meta b/Runtime.meta similarity index 58% rename from BlankGetChannel.meta rename to Runtime.meta index 9ffdf5f..2360666 100644 --- a/BlankGetChannel.meta +++ b/Runtime.meta @@ -1,9 +1,8 @@ fileFormatVersion: 2 -guid: 163bf537443e56741afcc0861c1fc272 +guid: bffbde9db16714943a876e6c69b2ef61 folderAsset: yes -timeCreated: 1550302738 -licenseType: Pro DefaultImporter: + externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/Runtime/BlankGetChannel.Runtime.asmdef b/Runtime/BlankGetChannel.Runtime.asmdef new file mode 100644 index 0000000..de97bd2 --- /dev/null +++ b/Runtime/BlankGetChannel.Runtime.asmdef @@ -0,0 +1,13 @@ +{ + "name": "BlankGetChannel.Runtime", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Runtime/BlankGetChannel.Runtime.asmdef.meta b/Runtime/BlankGetChannel.Runtime.asmdef.meta new file mode 100644 index 0000000..2b8e2a5 --- /dev/null +++ b/Runtime/BlankGetChannel.Runtime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dbfb386c6bafe2c4e8d9aa40f0a6383e +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/BlankGetChannel.cs b/Runtime/BlankGetChannel.cs similarity index 50% rename from BlankGetChannel.cs rename to Runtime/BlankGetChannel.cs index 44b33d2..0215d45 100644 --- a/BlankGetChannel.cs +++ b/Runtime/BlankGetChannel.cs @@ -1,16 +1,14 @@ #if UNITY_IOS using System.Runtime.InteropServices; #endif -using System; using System.IO; -using LuaInterface; using UnityEngine; /// /// 获取渠道名称 /// Android: /// 需要在主启动的Activity 中添加 -/// +/// /// /// iOS : /// 需要在Info.plist中添加 @@ -20,9 +18,7 @@ /// public sealed class BlankGetChannel { - #if UNITY_IOS - [DllImport("__Internal")] private static extern string getChannelName(string channelKey); @@ -30,21 +26,28 @@ public sealed class BlankGetChannel /// /// 获取渠道值 /// - public static string GetChannelName(string channelKey) + public static string GetChannelName(string channelKey = "channel") { string channelName = "unknown"; #if UNITY_STANDALONE || UNITY_EDITOR - string channel = File.ReadAllText(Application.streamingAssetsPath + "/channel.txt"); - if (!string.IsNullOrEmpty(channel)) + string path = Application.streamingAssetsPath + "/channel.txt"; + if (File.Exists(path)) { - channelName = channel; + string channel = File.ReadAllText(Application.streamingAssetsPath + "/channel.txt"); + if (!string.IsNullOrEmpty(channel)) + { + channelName = channel; + } } + #elif UNITY_ANDROID - AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.alianhome.getchannel.MainActivity"); - channelName = androidJavaClass.CallStatic("GetChannel", channelKey); + using (AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.alianhome.getchannel.MainActivity")) + { + channelName = androidJavaClass.CallStatic("GetChannel", channelKey); + } #elif UNITY_IOS - channelName= getChannelName(channelKey); + channelName = getChannelName(channelKey); #endif return channelName; } -} +} \ No newline at end of file diff --git a/BlankGetChannel.cs.meta b/Runtime/BlankGetChannel.cs.meta similarity index 100% rename from BlankGetChannel.cs.meta rename to Runtime/BlankGetChannel.cs.meta diff --git a/com.alianhome.getchannel.zip b/Runtime/com.alianhome.getchannel.zip similarity index 100% rename from com.alianhome.getchannel.zip rename to Runtime/com.alianhome.getchannel.zip diff --git a/com.alianhome.getchannel.zip.meta b/Runtime/com.alianhome.getchannel.zip.meta similarity index 100% rename from com.alianhome.getchannel.zip.meta rename to Runtime/com.alianhome.getchannel.zip.meta diff --git a/Runtime/link.xml b/Runtime/link.xml new file mode 100644 index 0000000..a9a12ed --- /dev/null +++ b/Runtime/link.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Runtime/link.xml.meta b/Runtime/link.xml.meta new file mode 100644 index 0000000..5ceef5b --- /dev/null +++ b/Runtime/link.xml.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 78ecdf8d94f24dcea403a0d33b30916c +timeCreated: 1689920594 \ No newline at end of file diff --git a/Sample.meta b/Sample.meta new file mode 100644 index 0000000..b6bf8ef --- /dev/null +++ b/Sample.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2a3258570b1066c48b6d15d183e3b53b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Sample/BlankGetChannel.Sample.asmdef b/Sample/BlankGetChannel.Sample.asmdef new file mode 100644 index 0000000..1e8f822 --- /dev/null +++ b/Sample/BlankGetChannel.Sample.asmdef @@ -0,0 +1,15 @@ +{ + "name": "BlankGetChannel.Sample", + "references": [ + "BlankGetChannel.Runtime" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Sample/BlankGetChannel.Sample.asmdef.meta b/Sample/BlankGetChannel.Sample.asmdef.meta new file mode 100644 index 0000000..8f2cd93 --- /dev/null +++ b/Sample/BlankGetChannel.Sample.asmdef.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7623218a954845c0a99c049de0ddd77d +timeCreated: 1689920694 \ No newline at end of file diff --git a/BlankGetChannelExample.cs b/Sample/BlankGetChannelExample.cs similarity index 100% rename from BlankGetChannelExample.cs rename to Sample/BlankGetChannelExample.cs diff --git a/BlankGetChannelExample.cs.meta b/Sample/BlankGetChannelExample.cs.meta similarity index 100% rename from BlankGetChannelExample.cs.meta rename to Sample/BlankGetChannelExample.cs.meta diff --git a/BlankGetChannelExample.unity b/Sample/BlankGetChannelExample.unity similarity index 100% rename from BlankGetChannelExample.unity rename to Sample/BlankGetChannelExample.unity diff --git a/BlankGetChannelExample.unity.meta b/Sample/BlankGetChannelExample.unity.meta similarity index 100% rename from BlankGetChannelExample.unity.meta rename to Sample/BlankGetChannelExample.unity.meta diff --git a/package.json b/package.json new file mode 100644 index 0000000..bc62f54 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "com.alianblank.blankgetchannel", + "displayName": "Blank Get Channel", + "version": "1.0.0", + "unity": "2017.1", + "description": "获取渠道信息", + "author": { + "name": "alianblank", + "url": "https://github.com/AlianBlank/BlankGetChannel" + }, + "samples": [ + { + "displayName": "Samples", + "description": "Samples", + "path": "Samples~" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/AlianBlank/BlankGetChannel.git" + }, + "relatedPackages": {}, + "type": "library" +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..ecd43b7 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 95f13e6609fb4cb4d9769f7f29a51f66 +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: