chunk 2: remaining non-audio non-NewImport assets
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74aac366abb0b49c4ae35753bd593035
|
||||
timeCreated: 1584470389
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dc8d2f667bef4d6282f1ef78789563f
|
||||
timeCreated: 1583983813
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c50396695ba7f40cebd28a120835f9ad
|
||||
timeCreated: 1584473221
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 975f8e9ecabe54f47b17e10650a63056
|
||||
folderAsset: yes
|
||||
timeCreated: 1576618908
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Google.Play.Common",
|
||||
"includePlatforms": [
|
||||
"Android",
|
||||
"Editor"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4318b6f3695442c4983c360248781db
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93def26183931461286e11aeb1034694
|
||||
folderAsset: yes
|
||||
timeCreated: 1580835047
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e43abcde8c6454e9ac390000f5d9695
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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.
|
||||
|
||||
namespace Google.Play.Common.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// Android API constants. Also includes some Java class, method, and field names for use by
|
||||
/// <a href="https://docs.unity3d.com/ScriptReference/AndroidJavaObject.html">AndroidJavaObject</a>.
|
||||
/// </summary>
|
||||
public static class AndroidConstants
|
||||
{
|
||||
public const string GooglePlayServicesPackageName = "com.google.android.gms";
|
||||
public const string GooglePlayStorePackageName = "com.android.vending";
|
||||
|
||||
public const string ActivityMethodGetIntent = "getIntent";
|
||||
public const string ActivityMethodStartActivityForResult = "startActivityForResult";
|
||||
|
||||
public const string BundleClass = "android.os.Bundle";
|
||||
public const string BundleMethodGetBoolean = "getBoolean";
|
||||
public const string BundleMethodGetByteArray = "getByteArray";
|
||||
public const string BundleMethodGetInt = "getInt";
|
||||
public const string BundleMethodPutByteArray = "putByteArray";
|
||||
public const string BundleMethodPutInt = "putInt";
|
||||
|
||||
public const string ContentResolverMethodCall = "call";
|
||||
|
||||
public const string ContextMethodGetContentResolver = "getContentResolver";
|
||||
public const string ContextMethodGetPackageManager = "getPackageManager";
|
||||
|
||||
public const string IntentActionMain = "android.intent.action.MAIN";
|
||||
public const string IntentActionView = "android.intent.action.VIEW";
|
||||
public const string IntentCategoryDefault = "android.intent.category.DEFAULT";
|
||||
public const string IntentCategoryLauncher = "android.intent.category.LAUNCHER";
|
||||
public const string IntentClass = "android.content.Intent";
|
||||
public const string IntentMethodAddCategory = "addCategory";
|
||||
public const string IntentMethodGetStringExtra = "getStringExtra";
|
||||
public const string IntentMethodPutExtra = "putExtra";
|
||||
public const string IntentMethodSetData = "setData";
|
||||
public const string IntentMethodSetPackage = "setPackage";
|
||||
|
||||
public const string ObjectMethodGetClass = "getClass";
|
||||
|
||||
public const string PackageInfoFieldSignatures = "signatures";
|
||||
|
||||
public const int PackageManagerFieldGetSignatures = 64;
|
||||
public const string PackageManagerMethodGetPackageInfo = "getPackageInfo";
|
||||
public const string PackageManagerMethodResolveActivity = "resolveActivity";
|
||||
public const string PackageManagerMethodResolveContentProvider = "resolveContentProvider";
|
||||
|
||||
public const string ProcessClass = "android.os.Process";
|
||||
public const string ProcessMethodMyUid = "myUid";
|
||||
|
||||
public const string ProviderInfoFieldPackageName = "packageName";
|
||||
|
||||
public const string SignatureMethodToByteArray = "toByteArray";
|
||||
|
||||
public const string UriClass = "android.net.Uri";
|
||||
public const string UriMethodParse = "parse";
|
||||
|
||||
public const string UriBuilderClass = "android.net.Uri$Builder";
|
||||
public const string UriBuilderMethodAppendQueryParameter = "appendQueryParameter";
|
||||
public const string UriBuilderMethodAuthority = "authority";
|
||||
public const string UriBuilderMethodBuild = "build";
|
||||
public const string UriBuilderMethodScheme = "scheme";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c40261b45b4a848379e77043c231bf64
|
||||
timeCreated: 1540331105
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
// 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.Play.Common.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides implementation for <see cref="PlayAsyncOperation{TResult,TError}"/>.
|
||||
/// </summary>
|
||||
public abstract class PlayAsyncOperationImpl<TResult, TError> : PlayAsyncOperation<TResult, TError>
|
||||
{
|
||||
private TResult _result;
|
||||
|
||||
public override event Action<PlayAsyncOperation<TResult, TError>> Completed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (IsDone)
|
||||
{
|
||||
value.Invoke(this);
|
||||
return;
|
||||
}
|
||||
|
||||
base.Completed += value;
|
||||
}
|
||||
remove { base.Completed -= value; }
|
||||
}
|
||||
|
||||
public void SetResult(TResult result)
|
||||
{
|
||||
_result = result;
|
||||
IsDone = true;
|
||||
InvokeCompletedEvent();
|
||||
}
|
||||
|
||||
public void SetError(TError errorCode)
|
||||
{
|
||||
Error = errorCode;
|
||||
IsDone = true;
|
||||
InvokeCompletedEvent();
|
||||
}
|
||||
|
||||
protected override TResult GetResultImpl()
|
||||
{
|
||||
return _result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef4e6ba1afbc4eeca3d1a96d7c115e52
|
||||
timeCreated: 1566434163
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 840ce5a886bda45e39e981eb29b5023d
|
||||
folderAsset: yes
|
||||
timeCreated: 1540331103
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,159 @@
|
||||
// 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;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Google.Play.Common.LoadingScreen
|
||||
{
|
||||
/// <summary>
|
||||
/// A loading bar that can be used to display download progress to the user.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
public class LoadingBar : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// The outline width.
|
||||
/// </summary>
|
||||
public float OutlineWidth = 6f;
|
||||
|
||||
/// <summary>
|
||||
/// The inner border width.
|
||||
/// </summary>
|
||||
public float InnerBorderWidth = 6f;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the <see cref="Outline"/> and <see cref="Background"/> RectTransforms will update to match the
|
||||
/// outline and border width.
|
||||
/// </summary>
|
||||
[Tooltip(
|
||||
"If true, the Outline and Background RectTransforms will update to match the outline and border width.")]
|
||||
public bool ResizeAutomatically = true;
|
||||
|
||||
/// <summary>
|
||||
/// AssetBundle download and install progress. The value set in the Editor is ignored at runtime.
|
||||
/// </summary>
|
||||
[Tooltip("AssetBundle download and install progress. The value set in the Editor is ignored at runtime.")]
|
||||
[Range(0f, 1f)]
|
||||
public float Progress = 0.25f;
|
||||
|
||||
/// <summary>
|
||||
/// The loading bar background.
|
||||
/// </summary>
|
||||
public RectTransform Background;
|
||||
|
||||
/// <summary>
|
||||
/// The loading bar outline.
|
||||
/// </summary>
|
||||
public RectTransform Outline;
|
||||
|
||||
/// <summary>
|
||||
/// The loading bar progress holder.
|
||||
/// </summary>
|
||||
public RectTransform ProgressHolder;
|
||||
|
||||
/// <summary>
|
||||
/// The loading bar progress fill.
|
||||
/// </summary>
|
||||
public RectTransform ProgressFill;
|
||||
|
||||
/// <summary>
|
||||
/// Proportion of the loading bar allocated to AssetBundle download progress.
|
||||
/// The remainder of the loading bar is allocated to install progress.
|
||||
/// </summary>
|
||||
[Tooltip("Proportion of the loading bar allocated to AssetBundle download progress. " +
|
||||
"The remainder of the loading bar is allocated to install progress.")]
|
||||
[Range(0f, 1f)]
|
||||
public float AssetBundleDownloadToInstallRatio = 0.8f;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (ResizeAutomatically)
|
||||
{
|
||||
ApplyBorderWidth();
|
||||
SetProgress(Progress);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the border width to the loading bar.
|
||||
/// </summary>
|
||||
public void ApplyBorderWidth()
|
||||
{
|
||||
Outline.anchorMin = Vector3.zero;
|
||||
Outline.anchorMax = Vector3.one;
|
||||
Outline.sizeDelta = Vector2.one * (OutlineWidth + InnerBorderWidth);
|
||||
|
||||
Background.anchorMin = Vector3.zero;
|
||||
Background.anchorMax = Vector3.one;
|
||||
Background.sizeDelta = Vector2.one * (InnerBorderWidth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the loading bar progress to the specified value in the range [0,1].
|
||||
/// </summary>
|
||||
/// <param name="proportionOfLoadingBar">The loading bar's current progress in the range [0,1].</param>
|
||||
public void SetProgress(float proportionOfLoadingBar)
|
||||
{
|
||||
Progress = proportionOfLoadingBar;
|
||||
if (ProgressFill != null)
|
||||
{
|
||||
ProgressFill.anchorMax = new Vector2(proportionOfLoadingBar, ProgressFill.anchorMax.y);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a loading bar by the progress made by an asynchronous operation. The bar will interpolate between
|
||||
/// <see cref="startingFillProportion"/> and <see cref="endingFillProportion"/> as the operation progresses.
|
||||
/// </summary>
|
||||
/// <param name="operation">The <see cref="AsyncOperation"/> indicating progress.</param>
|
||||
/// <param name="startingFillProportion">The starting position from which to fill.</param>
|
||||
/// <param name="endingFillProportion">The ending position to fill to.</param>
|
||||
/// <param name="skipFinalUpdate">
|
||||
/// If true, the bar will only fill before the operation has finished.
|
||||
/// This is useful in cases where an async operation will set its progress to 1, even when it has failed.
|
||||
/// </param>
|
||||
public IEnumerator FillUntilDone(AsyncOperation operation, float startingFillProportion,
|
||||
float endingFillProportion, bool skipFinalUpdate)
|
||||
{
|
||||
var previousFillProportion = startingFillProportion;
|
||||
var isDone = false;
|
||||
while (!isDone)
|
||||
{
|
||||
if (operation.isDone)
|
||||
{
|
||||
isDone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var fillProportion = Mathf.Lerp(startingFillProportion, endingFillProportion, operation.progress);
|
||||
fillProportion = Mathf.Max(previousFillProportion, fillProportion); // Progress can only increase.
|
||||
SetProgress(fillProportion);
|
||||
previousFillProportion = fillProportion;
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (skipFinalUpdate)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
var finalFillProportion = Mathf.Lerp(startingFillProportion, endingFillProportion, operation.progress);
|
||||
finalFillProportion = Mathf.Max(previousFillProportion, finalFillProportion);
|
||||
SetProgress(finalFillProportion);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcbdd4679cf6e41568c661c1c762b33d
|
||||
timeCreated: 1539016701
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,169 @@
|
||||
// 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;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Google.Play.Common.LoadingScreen
|
||||
{
|
||||
/// <summary>
|
||||
/// Downloads the AssetBundle available at AssetBundleUrl and updates LoadingBar with its progress.
|
||||
/// </summary>
|
||||
public class LoadingScreen : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// The URL used to fetch the AssetBundle on <see cref="Start"/>.
|
||||
/// </summary>
|
||||
[Tooltip("The URL used to fetch the AssetBundle on Start.")]
|
||||
public string AssetBundleUrl;
|
||||
|
||||
/// <summary>
|
||||
/// The LoadingBar used to indicated download and install progress.
|
||||
/// </summary>
|
||||
[Tooltip("The LoadingBar used to indicated download and install progress.")]
|
||||
public LoadingBar LoadingBar;
|
||||
|
||||
/// <summary>
|
||||
/// The button displayed when a download error occurs. Should call ButtonEventRetryDownload in its onClick()
|
||||
/// event.
|
||||
/// </summary>
|
||||
[Tooltip("The button displayed when a download error occurs. " +
|
||||
"Should call ButtonEventRetryDownload in its onClick() event.")]
|
||||
public Button RetryButton;
|
||||
|
||||
// Number of attempts before we show the user a retry button.
|
||||
private const int InitialAttemptCount = 3;
|
||||
private AssetBundle _bundle;
|
||||
private int _assetBundleRetrievalAttemptCount;
|
||||
private float _maxLoadingBarProgress;
|
||||
private bool _downloading;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AttemptAssetBundleDownload(InitialAttemptCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to retry the AssetBundle download one time.
|
||||
/// </summary>
|
||||
public void ButtonEventRetryDownload()
|
||||
{
|
||||
AttemptAssetBundleDownload(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to download the AssetBundle available at AssetBundleUrl.
|
||||
/// If it fails numberOfAttempts times, then it will display a retry button.
|
||||
/// </summary>
|
||||
private void AttemptAssetBundleDownload(int numberOfAttempts)
|
||||
{
|
||||
if (_downloading)
|
||||
{
|
||||
Debug.Log("Download attempt ignored because a download is already in progress.");
|
||||
return;
|
||||
}
|
||||
|
||||
HideRetryButton();
|
||||
_maxLoadingBarProgress = 0f;
|
||||
StartCoroutine(AttemptAssetBundleDownloadsCo(numberOfAttempts));
|
||||
}
|
||||
|
||||
private IEnumerator AttemptAssetBundleDownloadsCo(int numberOfAttempts)
|
||||
{
|
||||
_downloading = true;
|
||||
|
||||
for (var i = 0; i < numberOfAttempts; i++)
|
||||
{
|
||||
_assetBundleRetrievalAttemptCount++;
|
||||
Debug.LogFormat("Attempt #{0} at downloading AssetBundle...", _assetBundleRetrievalAttemptCount);
|
||||
|
||||
yield return GetAssetBundle(AssetBundleUrl);
|
||||
|
||||
if (_bundle != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
|
||||
if (_bundle == null)
|
||||
{
|
||||
ShowRetryButton();
|
||||
_downloading = false;
|
||||
yield break;
|
||||
}
|
||||
|
||||
var sceneLoadOperation = SceneManager.LoadSceneAsync(_bundle.GetAllScenePaths()[0]);
|
||||
var installStartFill = Mathf.Max(LoadingBar.AssetBundleDownloadToInstallRatio, _maxLoadingBarProgress);
|
||||
yield return LoadingBar.FillUntilDone(sceneLoadOperation, installStartFill, 1f, false);
|
||||
|
||||
_downloading = false;
|
||||
}
|
||||
|
||||
private IEnumerator GetAssetBundle(string assetBundleUrl)
|
||||
{
|
||||
UnityWebRequest webRequest;
|
||||
var downloadOperation = StartAssetBundleDownload(assetBundleUrl, out webRequest);
|
||||
|
||||
yield return LoadingBar.FillUntilDone(downloadOperation,
|
||||
_maxLoadingBarProgress, LoadingBar.AssetBundleDownloadToInstallRatio, true);
|
||||
|
||||
if (IsNetworkError(webRequest))
|
||||
{
|
||||
_maxLoadingBarProgress = LoadingBar.Progress;
|
||||
Debug.LogFormat("Failed to download AssetBundle: {0}", webRequest.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bundle = DownloadHandlerAssetBundle.GetContent(webRequest);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowRetryButton()
|
||||
{
|
||||
LoadingBar.gameObject.SetActive(false);
|
||||
RetryButton.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void HideRetryButton()
|
||||
{
|
||||
LoadingBar.gameObject.SetActive(true);
|
||||
RetryButton.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private static bool IsNetworkError(UnityWebRequest request)
|
||||
{
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
return request.result == UnityWebRequest.Result.ConnectionError ||
|
||||
request.result == UnityWebRequest.Result.ProtocolError;
|
||||
#else
|
||||
return request.isHttpError || request.isNetworkError;
|
||||
#endif
|
||||
}
|
||||
|
||||
private static AsyncOperation StartAssetBundleDownload(string assetBundleUrl, out UnityWebRequest webRequest)
|
||||
{
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
webRequest = UnityWebRequestAssetBundle.GetAssetBundle(assetBundleUrl);
|
||||
#else
|
||||
webRequest = UnityWebRequest.GetAssetBundle(assetBundleUrl);
|
||||
#endif
|
||||
return webRequest.SendWebRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 387db7af181f74e18ae5ac6796940d73
|
||||
timeCreated: 1539016701
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
// 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 UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Google.Play.Common.LoadingScreen
|
||||
{
|
||||
/// <summary>
|
||||
/// A UI component that scrolls a tiled texture horizontally.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RawImage))]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class ScrollingFillAnimator : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// How fast the fill texture will scroll in units per second.
|
||||
/// </summary>
|
||||
[Tooltip("How fast the fill texture will scroll in units per second.")]
|
||||
public float ScrollSpeed = 2.5f;
|
||||
|
||||
private RawImage _image;
|
||||
private RectTransform _rectTransform;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
LazyInit();
|
||||
|
||||
var uvRect = _image.uvRect;
|
||||
uvRect = ScrollUvs(uvRect);
|
||||
uvRect = ScaleUvs(uvRect);
|
||||
_image.uvRect = uvRect;
|
||||
}
|
||||
|
||||
// Move the uvs to the left so that the texture appears to scroll to the right.
|
||||
private Rect ScrollUvs(Rect uvRect)
|
||||
{
|
||||
// Don't scroll the uvs in edit mode, because Update is called too intermittently to be a useful preview.
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
uvRect.x -= ScrollSpeed * Time.deltaTime;
|
||||
}
|
||||
return uvRect;
|
||||
}
|
||||
|
||||
// Scale the uv rect so that the texture tiles across its rect instead of scaling with it.
|
||||
private Rect ScaleUvs(Rect uvRect)
|
||||
{
|
||||
if (_image.texture == null)
|
||||
{
|
||||
return uvRect;
|
||||
}
|
||||
|
||||
uvRect.size = new Vector2(_rectTransform.rect.width / _image.texture.width,
|
||||
_rectTransform.rect.height / _image.texture.height);
|
||||
return uvRect;
|
||||
}
|
||||
|
||||
private void LazyInit()
|
||||
{
|
||||
if (_rectTransform == null)
|
||||
{
|
||||
_rectTransform = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
if (_image == null)
|
||||
{
|
||||
_image = GetComponent<RawImage>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 781257c89d9b2471490603c8f2d3c8bf
|
||||
timeCreated: 1540231614
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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 UnityEngine;
|
||||
|
||||
namespace Google.Play.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an asynchronous operation that produces a result upon completion.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult">The type of the result of the operation.</typeparam>
|
||||
/// <typeparam name="TError">The type of error that can be encountered during this operation.</typeparam>
|
||||
public abstract class PlayAsyncOperation<TResult, TError> : CustomYieldInstruction
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not the operation has finished.
|
||||
/// </summary>
|
||||
public bool IsDone { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the operation completed without error.
|
||||
/// </summary>
|
||||
public abstract bool IsSuccessful { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The error that prevented this operation from completing successfully.
|
||||
/// In the case of a successful operation, this value can be ignored.
|
||||
/// </summary>
|
||||
public TError Error { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Event that is invoked upon operation completion. If an event handler is registered after the operation has
|
||||
/// completed, and thus after this event has been invoked, then the handler will be called synchronously.
|
||||
/// </summary>
|
||||
public virtual event Action<PlayAsyncOperation<TResult, TError>> Completed = delegate { };
|
||||
|
||||
/// <summary>
|
||||
/// Implements the <a href="https://docs.unity3d.com/ScriptReference/CustomYieldInstruction-keepWaiting.html">CustomYieldInstruction.keepWaiting</a>
|
||||
/// property so that this request can be yielded on in a coroutine.
|
||||
/// </summary>
|
||||
public override bool keepWaiting
|
||||
{
|
||||
get { return !IsDone; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the result, if the operation is done.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Throws if GetResult is called before the operation is done, or if an error occured during the operation.
|
||||
/// </exception>
|
||||
public TResult GetResult()
|
||||
{
|
||||
if (!IsDone)
|
||||
{
|
||||
throw new InvalidOperationException("GetResult called before operation is done.");
|
||||
}
|
||||
|
||||
if (!IsSuccessful)
|
||||
{
|
||||
throw new InvalidOperationException("GetResult called after operation failed with error: " + Error);
|
||||
}
|
||||
|
||||
return GetResultImpl();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Completed"/> event.
|
||||
/// </summary>
|
||||
protected void InvokeCompletedEvent()
|
||||
{
|
||||
Completed.Invoke(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the operation result.
|
||||
/// </summary>
|
||||
/// <returns>The result of the operation.</returns>
|
||||
protected abstract TResult GetResultImpl();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d2af36ca1634e2cb69727786850bffb
|
||||
timeCreated: 1566426514
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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 UnityEngine;
|
||||
|
||||
namespace Google.Play.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper methods related to the UnityPlayer Java class.
|
||||
/// </summary>
|
||||
public static class UnityPlayerHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current activity running in Unity. This object should be disposed after use.
|
||||
/// </summary>
|
||||
/// <returns>A wrapped activity object. The AndroidJavaObject should be disposed.</returns>
|
||||
public static AndroidJavaObject GetCurrentActivity()
|
||||
{
|
||||
using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
||||
{
|
||||
return unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2924b88fc93a49d198487f00587c26b
|
||||
timeCreated: 1540331105
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
// 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.
|
||||
|
||||
namespace Google.Play.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty class used as a type parameter for any <see cref="PlayAsyncOperation{TResult,TError}"/> that doesn't
|
||||
/// produce a result.
|
||||
/// </summary>
|
||||
public sealed class VoidResult
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb64affac9f342c494796eef5685e62c
|
||||
timeCreated: 1573064807
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70dfdc0125ba34e1dbab06844cab909a
|
||||
folderAsset: yes
|
||||
timeCreated: 1540331103
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d14bfb96dcd6d4c3696d465d53ac2f40
|
||||
timeCreated: 1539645899
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,108 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ed040dcefe674d42904db3a38e46697
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 0
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 4fce17097ff88407aa279b4a2f1185d8
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/GooglePlayPlugins/com.google.play.common/package.json
Normal file
13
Assets/GooglePlayPlugins/com.google.play.common/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "com.google.play.common",
|
||||
"displayName": "Google Play Common",
|
||||
"description": "The Google Play Common package provides common files required by some Google Play packages, such as Play Instant.\n\nThis package doesn't provide any features when installed separately.",
|
||||
"version": "1.9.1",
|
||||
"unity": "2018.4",
|
||||
"author": {
|
||||
"name": "Google LLC"
|
||||
},
|
||||
"dependencies": {
|
||||
"com.google.android.appbundle": "1.9.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c042cbf8b0ac343e3a978d389f5ae055
|
||||
timeCreated: 1576695771
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user