app center;增加發送ping的秒
This commit is contained in:
1 parent
1bd1ffdb5a
commit
d754ff3b15
719 files changed
+34172
-2875
No files matched your search
+53
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
public static class AppCenterGuiFieldHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A disposable wrapper for Verticals, to ensure they're paired properly, and to make the code visually block together within them
|
||||
/// </summary>
|
||||
public class UnityHorizontal : IDisposable
|
||||
{
|
||||
public UnityHorizontal(params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(options);
|
||||
}
|
||||
|
||||
public UnityHorizontal(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A disposable wrapper for Horizontals, to ensure they're paired properly, and to make the code visually block together within them
|
||||
/// </summary>
|
||||
public class UnityVertical : IDisposable
|
||||
{
|
||||
public UnityVertical(params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(options);
|
||||
}
|
||||
|
||||
public UnityVertical(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d96a7c436f35b439192d00d70db71bf2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public static partial class AppCenterEditorHelper
|
||||
{
|
||||
public static string EDEX_NAME = "AppCenterEditorExtensions";
|
||||
public static string EDEX_ROOT = Path.Combine(Application.dataPath, "AppCenterEditorExtensions/Editor");
|
||||
public static string APPCENTER_SETTINGS_TYPENAME = "AppCenterSettings";
|
||||
public static string APPCENTER_WRAPPER_SDK_TYPENAME = "WrapperSdk";
|
||||
public static string DEFAULT_SDK_LOCATION = "Assets/AppCenter";
|
||||
public static string DEFAULT_SDK_LOCATION_PATH = Application.dataPath + "/AppCenter";
|
||||
public static string MSG_SPIN_BLOCK = "{\"useSpinner\":true, \"blockUi\":true }";
|
||||
public static string ANALYTICS_SDK_DOWNLOAD_PATH = "/Resources/AppCenterAnalyticsUnitySdk.unitypackage";
|
||||
public static string CRASHES_SDK_DOWNLOAD_PATH = "/Resources/AppCenterCrashesUnitySdk.unitypackage";
|
||||
public static string DISTRIBUTE_SDK_DOWNLOAD_PATH = "/Resources/AppCenterDistributeUnitySdk.unitypackage";
|
||||
public static string EDEX_UPGRADE_PATH = "/Resources/AppCenterUnityEditorExtensions.unitypackage";
|
||||
public static string EDEX_PACKAGES_PATH = "/Resources/MostRecentPackage.unitypackage";
|
||||
|
||||
private static GUISkin _uiStyle;
|
||||
|
||||
public static GUISkin uiStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_uiStyle != null)
|
||||
return _uiStyle;
|
||||
_uiStyle = GetUiStyle();
|
||||
return _uiStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SharedErrorCallback(string error)
|
||||
{
|
||||
AppCenterEditor.RaiseStateUpdate(AppCenterEditor.EdExStates.OnError, error);
|
||||
}
|
||||
|
||||
private static GUISkin GetUiStyle()
|
||||
{
|
||||
var searchRoot = string.IsNullOrEmpty(EDEX_ROOT) ? Application.dataPath : EDEX_ROOT;
|
||||
string[] guiPaths;
|
||||
|
||||
if (Directory.Exists(searchRoot))
|
||||
{
|
||||
guiPaths = FindGuiSkinPaths(searchRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
EDEX_ROOT = FindEdexRoot();
|
||||
guiPaths = FindGuiSkinPaths(EDEX_ROOT);
|
||||
}
|
||||
|
||||
foreach (var eachPath in guiPaths)
|
||||
{
|
||||
var loadPath = eachPath.Substring(eachPath.LastIndexOf("Assets" + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
return (GUISkin) AssetDatabase.LoadAssetAtPath(loadPath, typeof(GUISkin));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string[] FindGuiSkinPaths(string searchPath)
|
||||
{
|
||||
return Directory.GetFiles(searchPath, "AppCenterStyles.guiskin", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
private static string FindEdexRoot()
|
||||
{
|
||||
var directoryList = Directory.GetDirectories(Application.dataPath, "*" + EDEX_NAME, SearchOption.AllDirectories);
|
||||
if (directoryList.Length == 0)
|
||||
{
|
||||
throw new DirectoryNotFoundException(EDEX_NAME + " not found");
|
||||
}
|
||||
|
||||
var relativePath = directoryList[0].Substring(directoryList[0].LastIndexOf("Assets" + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
return Path.Combine(relativePath, "Editor");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7e4708e69744494f98d2972fc0a1584
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,99 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
[CreateAssetMenu(fileName = "AppCenterEditorPrefsSO", menuName = "App Center/Make Prefs SO", order = 1)]
|
||||
#endif
|
||||
public class AppCenterEditorPrefsSO : ScriptableObject
|
||||
{
|
||||
public const string EdExLastCheckDateKey = "EdExLastCheckDateKey";
|
||||
public const string SdkLastCheckDateKey = "SdkLastCheckDateKey";
|
||||
public string SdkPath;
|
||||
public string EdExPath;
|
||||
public bool PanelIsShown;
|
||||
public int curMainMenuIdx;
|
||||
private string _latestSdkVersion;
|
||||
private string _latestEdExVersion;
|
||||
private DateTime _lastSdkVersionCheck;
|
||||
private DateTime _lastEdExVersionCheck;
|
||||
private static AppCenterEditorPrefsSO _instance;
|
||||
|
||||
public string EdSet_latestSdkVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return _latestSdkVersion;
|
||||
}
|
||||
set
|
||||
{
|
||||
_latestSdkVersion = value;
|
||||
_lastSdkVersionCheck = DateTime.UtcNow;
|
||||
PlayerPrefs.SetString(SdkLastCheckDateKey, _lastSdkVersionCheck.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
public string EdSet_latestEdExVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return _latestEdExVersion;
|
||||
}
|
||||
set
|
||||
{
|
||||
_latestEdExVersion = value;
|
||||
_lastEdExVersionCheck = DateTime.UtcNow;
|
||||
PlayerPrefs.SetString(EdExLastCheckDateKey, _lastEdExVersionCheck.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime EdSet_lastSdkVersionCheck
|
||||
{
|
||||
get
|
||||
{
|
||||
return PlayerPrefs.HasKey(SdkLastCheckDateKey) ? DateTime.Parse(PlayerPrefs.GetString(SdkLastCheckDateKey), CultureInfo.InvariantCulture) : _lastSdkVersionCheck;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime EdSet_lastEdExVersionCheck
|
||||
{
|
||||
get
|
||||
{
|
||||
return PlayerPrefs.HasKey(EdExLastCheckDateKey) ? DateTime.Parse(PlayerPrefs.GetString(EdExLastCheckDateKey), CultureInfo.InvariantCulture) : _lastEdExVersionCheck;
|
||||
}
|
||||
}
|
||||
|
||||
public static AppCenterEditorPrefsSO Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance != null)
|
||||
return _instance;
|
||||
|
||||
var settingsList = Resources.LoadAll<AppCenterEditorPrefsSO>("AppCenterEditorPrefsSO");
|
||||
if (settingsList.Length == 1)
|
||||
_instance = settingsList[0];
|
||||
if (_instance != null)
|
||||
return _instance;
|
||||
_instance = CreateInstance<AppCenterEditorPrefsSO>();
|
||||
if (!Directory.Exists(Path.Combine(Application.dataPath, "AppCenterEditorExtensions/Editor/Resources")))
|
||||
Directory.CreateDirectory(Path.Combine(Application.dataPath, "AppCenterEditorExtensions/Editor/Resources"));
|
||||
AssetDatabase.CreateAsset(_instance, "Assets/AppCenterEditorExtensions/Editor/Resources/AppCenterEditorPrefsSO.asset");
|
||||
AssetDatabase.SaveAssets();
|
||||
EdExLogger.LoggerInstance.LogWithTimeStamp("Created missing AppCenterEditorPrefsSO file");
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
EditorUtility.SetDirty(_instance);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb9dcf2e78804b9384db79873454e2f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
public static partial class AppCenterEditorHelper
|
||||
{
|
||||
public static string EDEX_VERSION = "3.0.0";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca7cc6f0d12514529b75b5a1e489ef41
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// Author: Sebastiaan Fehr (Seb@TheBinaryMill.com)
|
||||
/// Date: March 2013
|
||||
/// Summary: Creates MonoBehaviour instance through which
|
||||
/// static classes can call StartCoroutine.
|
||||
/// Description: Classes that do not inherit from MonoBehaviour, or static
|
||||
/// functions within MonoBehaviours are inertly unable to
|
||||
/// call StartCoroutene, as this function is not static and
|
||||
/// does not exist on Object. This Class creates a proxy though
|
||||
/// which StartCoroutene can be called, and destroys it when
|
||||
/// no longer needed.
|
||||
/// </summary>
|
||||
public class Coroutiner
|
||||
{
|
||||
|
||||
public static Coroutine StartCoroutine(IEnumerator iterationResult)
|
||||
{
|
||||
//Create GameObject with MonoBehaviour to handle task.
|
||||
GameObject routeneHandlerGo = new GameObject("Coroutiner");
|
||||
CoroutinerInstance routeneHandler
|
||||
= routeneHandlerGo.AddComponent(typeof(CoroutinerInstance))
|
||||
as CoroutinerInstance;
|
||||
return routeneHandler.ProcessWork(iterationResult);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CoroutinerInstance : MonoBehaviour
|
||||
{
|
||||
|
||||
public Coroutine ProcessWork(IEnumerator iterationResult)
|
||||
{
|
||||
return StartCoroutine(DestroyWhenComplete(iterationResult));
|
||||
}
|
||||
|
||||
public IEnumerator DestroyWhenComplete(IEnumerator iterationResult)
|
||||
{
|
||||
yield return StartCoroutine(iterationResult);
|
||||
DestroyImmediate(gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4761e800aa3aef34a9e4b2083e5acb5c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
//Factory.
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
class EdExLogger
|
||||
{
|
||||
private static IEdExLogger _instance;
|
||||
|
||||
public static IEdExLogger LoggerInstance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new LocalLogger();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private EdExLogger()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecaed167bfab43f4b952d32525e60583
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
interface IEdExLogger
|
||||
{
|
||||
void LogWithTimeStamp(string message);
|
||||
|
||||
void LogWarning(string message);
|
||||
|
||||
void LogError(string message);
|
||||
|
||||
void Log(string message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bd5be8d50f07d94b9ecdd399064d573
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppCenterEditor
|
||||
{
|
||||
class LocalLogger: IEdExLogger
|
||||
{
|
||||
public void LogWithTimeStamp(string message)
|
||||
{
|
||||
Debug.Log(GetUniqueMessage(message));
|
||||
}
|
||||
|
||||
public void LogWarning(string message)
|
||||
{
|
||||
Debug.LogWarning(GetUniqueMessage(message));
|
||||
}
|
||||
|
||||
public void LogError(string message)
|
||||
{
|
||||
Debug.LogError(GetUniqueMessage(message));
|
||||
}
|
||||
|
||||
public void Log(string message)
|
||||
{
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
private string GetUniqueMessage(string message)
|
||||
{
|
||||
// Return unique message in order to distinguish similar messages.
|
||||
return string.Format("[App Center EdEx MSG{0}] {1}", DateTime.Now.Millisecond, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bc93f39e9d0fc34eb720ccbc6bd5dc9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user