app center;增加發送ping的秒
This commit is contained in:
1 parent
1bd1ffdb5a
commit
d754ff3b15
719 files changed
+34172
-2875
No files matched your search
@@ -0,0 +1,34 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65a57d979f383420a894f22dfe19f005
|
||||
folderAsset: yes
|
||||
timeCreated: 1498496047
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.AppCenter.Plugins.Android.Utility
|
||||
{
|
||||
class AndroidUtility
|
||||
{
|
||||
private static AndroidJavaObject _context;
|
||||
private const string PREFS_NAME = "AppCenterUserPrefs";
|
||||
|
||||
public static AndroidJavaObject GetAndroidContext()
|
||||
{
|
||||
if (_context != null)
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
_context = activity.Call<AndroidJavaObject>("getApplicationContext");
|
||||
return _context;
|
||||
}
|
||||
|
||||
public static void SetPreferenceInt(string prefKey, int prefValue)
|
||||
{
|
||||
AndroidJavaObject context = GetAndroidContext();
|
||||
AndroidJavaObject sharedPreferences = context.Call<AndroidJavaObject>("getSharedPreferences", new object[] { PREFS_NAME, 0 });
|
||||
AndroidJavaObject editor = sharedPreferences.Call<AndroidJavaObject>("edit");
|
||||
editor = editor.Call<AndroidJavaObject>("putInt", new object[] { prefKey, prefValue });
|
||||
editor.Call("apply");
|
||||
}
|
||||
|
||||
public static void SetPreferenceString(string prefKey, string prefValue)
|
||||
{
|
||||
AndroidJavaObject context = GetAndroidContext();
|
||||
AndroidJavaObject sharedPreferences = context.Call<AndroidJavaObject>("getSharedPreferences", new object[] { PREFS_NAME, 0 });
|
||||
AndroidJavaObject editor = sharedPreferences.Call<AndroidJavaObject>("edit");
|
||||
editor = editor.Call<AndroidJavaObject>("putString", new object[] { prefKey, prefValue });
|
||||
editor.Call("apply");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7653ac593f8a4859bc75b4952e2a9dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaDateHelper
|
||||
{
|
||||
private const string DotNetDateFormat = "yyyy-MM-dd'T'HH:mm:ss.fffK";
|
||||
|
||||
private static AndroidJavaObject _javaDateFormatter;
|
||||
private static AndroidJavaObject JavaDateFormatter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_javaDateFormatter == null)
|
||||
{
|
||||
_javaDateFormatter = new AndroidJavaObject("java.text.SimpleDateFormat", "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
||||
}
|
||||
return _javaDateFormatter;
|
||||
}
|
||||
}
|
||||
|
||||
public static AndroidJavaObject DateTimeConvert(DateTime date)
|
||||
{
|
||||
// 'DotNetDateFormat' contains timezone info with time separator.
|
||||
// 'javaDateFormatter' uses date format with timezone info without time separator.
|
||||
// Time separator should be removed from date string before 'parse' call.
|
||||
var dateString = date.ToString(DotNetDateFormat);
|
||||
int separatorIndex = dateString.LastIndexOf(CultureInfo.CurrentCulture.DateTimeFormat.TimeSeparator);
|
||||
dateString = dateString.Remove(separatorIndex, 1);
|
||||
return JavaDateFormatter.Call<AndroidJavaObject>("parse", dateString);
|
||||
}
|
||||
|
||||
public static DateTimeOffset DateTimeConvert(AndroidJavaObject date)
|
||||
{
|
||||
// Unable to use DateTimeOffset.ParseExact(dateString, DotNetDateFormat, CultureInfo.InvariantCulture) here
|
||||
// because it throws "Invalid format string" exception
|
||||
var dateString = JavaDateFormatter.Call<string>("format", date);
|
||||
var dateTime = DateTime.ParseExact(dateString, DotNetDateFormat, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
|
||||
return new DateTimeOffset(dateTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebd2662d8c212481b8ae72fe6be77873
|
||||
timeCreated: 1498578955
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaNumberHelper
|
||||
{
|
||||
public static AndroidJavaObject Convert(int val)
|
||||
{
|
||||
AndroidJavaObject javaInteger = new AndroidJavaObject("java.lang.Integer", val);
|
||||
return javaInteger;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(long val)
|
||||
{
|
||||
AndroidJavaObject javaLong = new AndroidJavaObject("java.lang.Long", val);
|
||||
return javaLong;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(float val)
|
||||
{
|
||||
AndroidJavaObject javaFloat = new AndroidJavaObject("java.lang.Float", val);
|
||||
return javaFloat;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject Convert(double val)
|
||||
{
|
||||
AndroidJavaObject javaDouble = new AndroidJavaObject("java.lang.Double", val);
|
||||
return javaDouble;
|
||||
}
|
||||
|
||||
//TODO how to support decimal?
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcfb87d5b5fb94c77b4d361b4791a677
|
||||
timeCreated: 1498578955
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#if UNITY_ANDROID
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.AppCenter.Unity.Internal.Utility
|
||||
{
|
||||
public class JavaStringMapHelper
|
||||
{
|
||||
public static Dictionary<string, string> ConvertFromJava(AndroidJavaObject map)
|
||||
{
|
||||
var keySet = map.Call<AndroidJavaObject>("keySet");
|
||||
var keyArray = keySet.Call<AndroidJavaObject>("toArray");
|
||||
string[] keys = AndroidJNIHelper.ConvertFromJNIArray<string[]>(keyArray.GetRawObject());
|
||||
var dictionary = new Dictionary<string, string>();
|
||||
foreach (var key in keys)
|
||||
{
|
||||
var val = map.Call<string>("get", key);
|
||||
dictionary[key] = val;
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static AndroidJavaObject ConvertToJava(IDictionary<string, string> properties)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string[] keys = properties.Keys.ToArray();
|
||||
string[] values = properties.Values.ToArray();
|
||||
int count = properties.Count;
|
||||
var javaMap = new AndroidJavaObject("java.util.HashMap");
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
javaMap.Call<AndroidJavaObject>("put", keys[i], values[i]);
|
||||
}
|
||||
return javaMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80fb4bb7b657748d399b89f4367331e8
|
||||
timeCreated: 1498496048
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Position=0, Mandatory = $false, HelpMessage="Source folder", ValueFromPipeline = $true)]
|
||||
$Source,
|
||||
[Parameter(Position=1, Mandatory = $false, HelpMessage="Destination file path", ValueFromPipeline = $true)]
|
||||
$Destination
|
||||
)
|
||||
|
||||
Try
|
||||
{
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::CreateFromDirectory($Source, $Destination)
|
||||
}
|
||||
Catch
|
||||
{
|
||||
$Exc = $_.Exception.Message
|
||||
Write-Error "File $Destination was not created. Error: $Exc"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27462eedb9e0e4dee8d0ff51fe4dee0d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Position=0, Mandatory = $false, HelpMessage="Source file", ValueFromPipeline = $true)]
|
||||
$Source,
|
||||
[Parameter(Position=1, Mandatory = $false, HelpMessage="Destination path", ValueFromPipeline = $true)]
|
||||
$Destination
|
||||
)
|
||||
|
||||
New-Item -ItemType directory -Path $Destination
|
||||
|
||||
Try
|
||||
{
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::ExtractToDirectory($Source, $Destination)
|
||||
}
|
||||
Catch
|
||||
{
|
||||
$Exc = $_.Exception.Message
|
||||
Write-Error "Folder $Destination was not created. Error: $Exc"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fff91df92b854ad680ee28ba1c36fce
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f313f109a3454802b5cae94a72ee306
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20e621e7423ed4dd4b6826b8dab0c7eb
|
||||
timeCreated: 1512463304
|
||||
licenseType: Free
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
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.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68c3a86f609b440b1b95a05639da7861
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1865e2b19b6434dcf9e4f48f7208d7a0
|
||||
timeCreated: 1503351439
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10c16a9d75c5c48cca25985ae8bf3ec6
|
||||
timeCreated: 1504718816
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user