chunk 2: remaining non-audio non-NewImport assets
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Google.Android.AppBundle.Editor.Internal.PlayServices;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Utility class that uses <see cref="AndroidSdkManager"/> to install Android SDK packages.
|
||||
/// </summary>
|
||||
public static class AndroidSdkPackageInstaller
|
||||
{
|
||||
/// <summary>
|
||||
/// Installs the specified Android SDK package.
|
||||
/// </summary>
|
||||
public static void InstallPackage(string packageName, string displayName, string androidSdkRoot)
|
||||
{
|
||||
// In many cases the SDK install is quick and clearly indicates download/install progress. However, on
|
||||
// some systems it can take a couple minutes and not indicate progress - set expectations with a dialog.
|
||||
// TODO: figure out if we can target this message only for when it is needed.
|
||||
const string message =
|
||||
"On some systems the install process is slow and does not provide feedback, " +
|
||||
"which may lead you to believe that Unity has frozen or crashed.\n\n" +
|
||||
"Click \"OK\" to continue.";
|
||||
if (!EditorUtility.DisplayDialog(
|
||||
"Install Note", message, WindowUtils.OkButtonText, WindowUtils.CancelButtonText))
|
||||
{
|
||||
Debug.LogFormat("Cancelled install of {0}", displayName);
|
||||
return;
|
||||
}
|
||||
|
||||
AndroidSdkManager.Create(androidSdkRoot, manager =>
|
||||
{
|
||||
manager.QueryPackages(collection =>
|
||||
{
|
||||
var package = collection.GetMostRecentAvailablePackage(packageName);
|
||||
if (package == null)
|
||||
{
|
||||
ShowMessage(string.Format("Unable to locate the {0} package", displayName));
|
||||
return;
|
||||
}
|
||||
|
||||
if (package.Installed)
|
||||
{
|
||||
ShowMessage(string.Format(
|
||||
"The {0} package is already installed at the latest available version ({1})",
|
||||
displayName, package.VersionString));
|
||||
return;
|
||||
}
|
||||
|
||||
var packages = new HashSet<AndroidSdkPackageNameVersion> {package};
|
||||
manager.InstallPackages(packages, success =>
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
ShowMessage(string.Format("Successfully updated the {0} package to version {1}",
|
||||
displayName, package.VersionString));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMessage(string.Format("Failed to install the {0} package", displayName));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private static void ShowMessage(string message)
|
||||
{
|
||||
Debug.LogFormat("AndroidSdkPackageInstaller: {0}", message);
|
||||
EditorUtility.DisplayDialog("Android SDK Package Installer", message, WindowUtils.OkButtonText);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5ea775d810d14f8fa45dd2c58e82c2d
|
||||
timeCreated: 1540331105
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Serializable class encapsulating parameters for running a command line process. This fields of this class
|
||||
/// are set up to survive a Unity script reload.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CommandLineParameters
|
||||
{
|
||||
[SerializeField] public string FileName;
|
||||
[SerializeField] public string Arguments;
|
||||
|
||||
// Unity doesn't support serializing dictionaries, but does support List<string>.
|
||||
// See https://docs.unity3d.com/Manual/script-Serialization.html
|
||||
[SerializeField] private List<string> _environmentKeys;
|
||||
[SerializeField] private List<string> _environmentValues;
|
||||
|
||||
public void AddEnvironmentVariable(string key, string value)
|
||||
{
|
||||
if (_environmentKeys == null || _environmentValues == null)
|
||||
{
|
||||
_environmentKeys = new List<string>();
|
||||
_environmentValues = new List<string>();
|
||||
}
|
||||
|
||||
_environmentKeys.Add(key);
|
||||
_environmentValues.Add(value);
|
||||
}
|
||||
|
||||
public Dictionary<string, string> EnvironmentVariables
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_environmentKeys == null || _environmentKeys.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_environmentKeys.Count != _environmentValues.Count)
|
||||
{
|
||||
throw new Exception(string.Format(
|
||||
"EnvironmentVariables size mismatch for keys ({0}) and values({1})",
|
||||
_environmentKeys.Count, _environmentValues.Count));
|
||||
}
|
||||
|
||||
var dictionary = new Dictionary<string, string>();
|
||||
for (var i = 0; i < _environmentKeys.Count; i++)
|
||||
{
|
||||
dictionary.Add(_environmentKeys[i], _environmentValues[i]);
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23981fb4f0d5d48e391fbad81c9bfe3d
|
||||
timeCreated: 1540331104
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty <see cref="ICollection"/> that cannot be added to.
|
||||
/// </summary>
|
||||
public class EmptyCollection<T> : ICollection<T>
|
||||
{
|
||||
public int Count
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return Enumerable.Empty<T>().GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
// No-op.
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
// No-op.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b677c4aa42424e8a8f010edab946dab
|
||||
timeCreated: 1556120328
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,112 @@
|
||||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty <see cref="IDictionary"/> that cannot be added to.
|
||||
/// </summary>
|
||||
public class EmptyDictionary<TKey, TValue> : IDictionary<TKey, TValue>
|
||||
{
|
||||
private readonly EmptyCollection<TKey> EmptyKeys = new EmptyCollection<TKey>();
|
||||
private readonly EmptyCollection<TValue> EmptyValues = new EmptyCollection<TValue>();
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
|
||||
{
|
||||
return Enumerable.Empty<KeyValuePair<TKey, TValue>>().GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public ICollection<TKey> Keys
|
||||
{
|
||||
get { return EmptyKeys; }
|
||||
}
|
||||
|
||||
public ICollection<TValue> Values
|
||||
{
|
||||
get { return EmptyValues; }
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ContainsKey(TKey key)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetValue(TKey key, out TValue value)
|
||||
{
|
||||
value = default(TValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
public TValue this[TKey key]
|
||||
{
|
||||
get { throw new KeyNotFoundException(); }
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public void Add(TKey key, TValue value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public bool Remove(TKey key)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<TKey, TValue> item)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
// No-op.
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
|
||||
{
|
||||
// No-op.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e05b9f7c9861d4fdb82d564ad551cc52
|
||||
timeCreated: 1556120328
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,82 @@
|
||||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// An attribute used to annotate enums with a displayable name and description.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class NameAndDescriptionAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public NameAndDescriptionAttribute(string name, string description)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A human-readable string name for the enum.
|
||||
/// </summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A human-readable string description for the enum.
|
||||
/// </summary>
|
||||
public string Description { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the attribute associated with the specified enum.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">Thrown if the specified enum has no attribute.</exception>
|
||||
public static NameAndDescriptionAttribute GetAttribute<T>(T source)
|
||||
{
|
||||
var attribute = GetOptionalAttribute(source);
|
||||
if (attribute == null)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Unexpected missing NameAndDescriptionAttribute on enum " + source, "source");
|
||||
}
|
||||
|
||||
return attribute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the attribute associated with the specified enum, or null if the specified enum has no attribute.
|
||||
/// </summary>
|
||||
public static NameAndDescriptionAttribute GetOptionalAttribute<T>(T source)
|
||||
{
|
||||
var fieldInfo = source.GetType().GetField(source.ToString());
|
||||
var attributes = (NameAndDescriptionAttribute[]) fieldInfo.GetCustomAttributes(
|
||||
typeof(NameAndDescriptionAttribute), false);
|
||||
if (attributes.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (attributes.Length > 1)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Unexpected number of NameAndDescriptionAttributes on enum " + source, "source");
|
||||
}
|
||||
|
||||
return attributes[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65e9e61a98d19471a9a122488b21324e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using Google.Android.AppBundle.Editor.Internal.PlayServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// A CommandLineDialog that potentially waits to run the specified command until after an AppDomain reset.
|
||||
///
|
||||
/// Unity versions prior to 2018.3 reload all Editor scripts a few seconds after a call to BuildPlayer finishes.
|
||||
/// This reload also resets the AppDomain and aborts any actively running threads, including any threads managing a
|
||||
/// child process. This EditorWindow therefore waits to run the specified command until after the AppDomain is
|
||||
/// reset.
|
||||
/// </summary>
|
||||
public class PostBuildCommandLineDialog : CommandLineDialog
|
||||
{
|
||||
[SerializeField] public CommandLineParameters CommandLineParams;
|
||||
|
||||
// Use two bool fields to detect when this script is reloaded and the AppDomain is reset.
|
||||
// See https://docs.unity3d.com/Manual/script-Serialization.html
|
||||
private static bool _nonserializedField;
|
||||
[SerializeField] private bool _serializedField;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CommandLineParams = new CommandLineParameters();
|
||||
_nonserializedField = false;
|
||||
_serializedField = false;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
// Starting with Unity 2018.3 the AppDomain is not reset after building an APK.
|
||||
// In this case we run the command when the window is first shown.
|
||||
// Note: some beta versions of 2018.3 reset the AppDomain as in earlier versions of Unity.
|
||||
if (!_nonserializedField)
|
||||
{
|
||||
_nonserializedField = true;
|
||||
RunCommandAsync();
|
||||
}
|
||||
#else
|
||||
PollForAppDomainReset();
|
||||
#endif
|
||||
base.Update();
|
||||
}
|
||||
|
||||
private void PollForAppDomainReset()
|
||||
{
|
||||
// This block is entered twice: when the window is initially shown and later after the AppDomain is reset.
|
||||
if (!_nonserializedField)
|
||||
{
|
||||
_nonserializedField = true;
|
||||
if (_serializedField)
|
||||
{
|
||||
Debug.Log("The AppDomain has been reset.");
|
||||
RunCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
bodyText += "Waiting for scripts to reload...\n\n";
|
||||
Debug.Log("Waiting for the AppDomain reset...");
|
||||
_serializedField = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RunCommandAsync()
|
||||
{
|
||||
RunAsync(
|
||||
CommandLineParams.FileName,
|
||||
CommandLineParams.Arguments,
|
||||
commandLineResult =>
|
||||
{
|
||||
if (commandLineResult.exitCode == 0)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// After adding the button we need to scroll down a little more.
|
||||
scrollPosition.y = Mathf.Infinity;
|
||||
noText = "Close";
|
||||
Repaint();
|
||||
}
|
||||
},
|
||||
envVars: CommandLineParams.EnvironmentVariables);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a dialog box which can display command line output.
|
||||
/// </summary>
|
||||
public static PostBuildCommandLineDialog CreateDialog(string title)
|
||||
{
|
||||
var window = (PostBuildCommandLineDialog) GetWindow(typeof(PostBuildCommandLineDialog), true, title);
|
||||
window.Initialize();
|
||||
return window;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d5c63912979b43acb5315e369b6740b
|
||||
timeCreated: 1540331105
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides Regex utilities.
|
||||
/// </summary>
|
||||
public static class RegexHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a Regex for the specified pattern and options, setting "Compiled" if possible.
|
||||
/// </summary>
|
||||
public static Regex CreateCompiled(string pattern, RegexOptions options = RegexOptions.None)
|
||||
{
|
||||
#if !NET_2_0_SUBSET
|
||||
options |= RegexOptions.Compiled;
|
||||
#endif
|
||||
return new Regex(pattern, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cf420257eac24e9eb40bbf4f8ac09cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright 2018 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper methods for working with <see cref="EditorWindow"/>.
|
||||
/// </summary>
|
||||
public static class WindowUtils
|
||||
{
|
||||
public const string OkButtonText = "OK";
|
||||
public const string CancelButtonText = "Cancel";
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the running instance of Unity is headless (e.g. a command line build),
|
||||
/// and false if it's a normal instance of Unity.
|
||||
/// </summary>
|
||||
public static bool IsHeadlessMode()
|
||||
{
|
||||
return SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a4fd3b81224a4a1d9367053ed584a0f
|
||||
timeCreated: 1540331104
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user