浏览代码

Merge branch 'kgdev' into 'master'

fix some obvious typos :)

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!142
/main
Shenhua Gu 6 年前
当前提交
920bedf6
共有 15 个文件被更改,包括 104 次插入64 次删除
  1. 19
      Runtime/async/coroutine.cs
  2. 2
      Runtime/engine/UIWidgetsPanel.cs
  3. 3
      Runtime/material/button_theme.cs
  4. 8
      Runtime/material/popup_menu.cs
  5. 15
      Runtime/painting/image_provider.cs
  6. 40
      Runtime/painting/image_resolution.cs
  7. 12
      Runtime/promise/Promise.cs
  8. 6
      Runtime/promise/Promise_NonGeneric.cs
  9. 2
      Runtime/rendering/sliver_persistent_header.cs
  10. 9
      Runtime/widgets/binding.cs
  11. 4
      Runtime/widgets/page_storage.cs
  12. 4
      Runtime/widgets/single_child_scroll_view.cs
  13. 4
      Samples/UIWidgetsGallery/GalleryMain.cs
  14. 3
      Samples/UIWidgetsGallery/gallery/example_code_parser.cs
  15. 37
      Tests/Resources/ali_landscape.png.meta

19
Runtime/async/coroutine.cs


internal volatile Exception lastError;
internal bool isDone;
readonly Promise<object> _promise = new Promise<object>();
readonly Promise<object> _promise = new Promise<object>(isSync: true);
public IPromise<object> promise {
get { return this._promise; }

this._routine = routine;
this._window = window;
this._isBackground = isBackground;
if (isBackground && BackgroundCallbacks.getInstance() != null) {
this._unhook = BackgroundCallbacks.getInstance().addCallback(this._moveNext);

this._moveNext(true); // try to run the first enumeration in the current loop.
this._isBackground = isBackground;
this._moveNext(false);
}
void _moveNext(bool firstTime) {
D.assert(!this.isDone);
var lastError = this.lastError;

return;
}
bool hasNext;
bool hasNext = true;
hasNext = this._processIEnumeratorRecursive(this._routine);
if (firstTime) {
hasNext = this._routine.MoveNext();
}
if (hasNext) {
hasNext = this._processIEnumeratorRecursive(this._routine);
}
}
catch (Exception ex) {
this.stop(ex);

2
Runtime/engine/UIWidgetsPanel.cs


this.material = mat;
}
void Update() {
protected virtual void Update() {
PerformanceUtils.instance.updateDeltaTime(Time.unscaledDeltaTime);
this._displayMetrics.Update();
UIWidgetsMessageManager.ensureUIWidgetsMessageManagerIfNeeded();

3
Runtime/material/button_theme.cs


return 0.0f;
}
if (button is OutlineButton)
if (button is OutlineButton) {
}
return 8.0f;
}

8
Runtime/material/popup_menu.cs


}
public static partial class PopupMenuUtils {
public static IPromise<T> showMenu<T>(
public static IPromise<object> showMenu<T>(
BuildContext context,
RelativeRect position,
List<PopupMenuEntry<T>> items,

initialValue: initialValue,
elevation: elevation,
theme: Theme.of(context, shadowThemeOnly: true)
)).Then(result => (T) result);
));
}
}

),
Offset.zero & overlay.size
);
PopupMenuUtils.showMenu<T>(
PopupMenuUtils.showMenu(
context: this.context,
elevation: this.widget.elevation,
items: this.widget.itemBuilder(this.context),

}
if (this.widget.onSelected != null) {
this.widget.onSelected(newValue);
this.widget.onSelected((T) newValue);
}
});
}

15
Runtime/painting/image_provider.cs


IEnumerator _loadAssetAsync(AssetBundleImageKey key) {
if (key.bundle == null) {
ResourceRequest request = Resources.LoadAsync(key.name);
yield return request;
yield return request.asset;
if (request.asset) {
yield return request.asset;
} else {
yield return request;
yield return request.asset;
}
yield return request;
yield return request.asset;
if (request.asset) {
yield return request.asset;
} else {
yield return request.asset;
}
}
}
}

40
Runtime/painting/image_resolution.cs


using System;
using System.Collections;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

public readonly string assetName;
public readonly AssetBundle bundle;
protected override
IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
protected override IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, this.assetName);
AssetBundleImageKey key;
var cache = AssetBundleCache.instance.get(configuration.bundle);

AssetBundle chosenBundle = this.bundle ? this.bundle : configuration.bundle;
var devicePixelRatio = configuration.devicePixelRatio ?? Window.instance.devicePixelRatio;
var coroutine = Window.instance.startCoroutine(this._loadAssetAsync(chosenBundle, devicePixelRatio));
return coroutine.promise.Then(result => {
D.assert(result != null);
key = (AssetBundleImageKey) result;
cache[assetConfig] = key;
return key;
});
key = this._loadAsset(chosenBundle, devicePixelRatio);
cache[assetConfig] = key;
return Promise<AssetBundleImageKey>.Resolved(key);
IEnumerator _loadAssetAsync(AssetBundle bundle, float devicePixelRatio) {
AssetBundleImageKey _loadAsset(AssetBundle bundle, float devicePixelRatio) {
var upper = devicePixelRatio.ceil();
var upper = Mathf.Min(3, devicePixelRatio.ceil());
ResourceRequest request = Resources.LoadAsync(assetName);
yield return request;
asset = request.asset;
}
else {
AssetBundleRequest request = bundle.LoadAssetAsync(assetName);
yield return request;
asset = request.asset;
asset = Resources.Load(assetName);
} else {
asset = bundle.LoadAsset(assetName);
}
else {
} else {
yield return new AssetBundleImageKey(
return new AssetBundleImageKey(
yield break;
yield return new AssetBundleImageKey(
return new AssetBundleImageKey(
bundle,
this.assetName,
scale: 1.0f

12
Runtime/promise/Promise.cs


/// Handle errors for the promise.
/// </summary>
public IPromise<PromisedT> Catch(Func<Exception, PromisedT> onRejected) {
var resultPromise = new Promise<PromisedT>();
var resultPromise = new Promise<PromisedT>(isSync: true);
resultPromise.WithName(this.Name);
Action<PromisedT> resolveHandler = v => resultPromise.Resolve(v);

// Otherwise there is now way to get the converted value to pass to the resulting promise.
// Argument.NotNull(() => onResolved);
var resultPromise = new Promise<ConvertedT>();
var resultPromise = new Promise<ConvertedT>(isSync: true);
resultPromise.WithName(this.Name);
Action<PromisedT> resolveHandler = v => {

var remainingCount = promisesArray.Length;
var results = new PromisedT[remainingCount];
var progress = new float[remainingCount];
var resultPromise = new Promise<IEnumerable<PromisedT>>();
var resultPromise = new Promise<IEnumerable<PromisedT>>(isSync: true);
resultPromise.WithName("All");
promisesArray.Each((promise, index) => {

);
}
var resultPromise = new Promise<PromisedT>();
var resultPromise = new Promise<PromisedT>(isSync: true);
resultPromise.WithName("Race");
var progress = new float[promisesArray.Length];

public static IPromise<PromisedT> Rejected(Exception ex) {
// Argument.NotNull(() => ex);
var promise = new Promise<PromisedT>();
var promise = new Promise<PromisedT>(isSync: true);
var promise = new Promise<PromisedT>();
var promise = new Promise<PromisedT>(isSync: true);
promise.WithName(this.Name);
this.Then(x => promise.Resolve(x));

6
Runtime/promise/Promise_NonGeneric.cs


// Otherwise there is now way to get the converted value to pass to the resulting promise.
// Argument.NotNull(() => onResolved);
var resultPromise = new Promise<ConvertedT>();
var resultPromise = new Promise<ConvertedT>(isSync: true);
resultPromise.WithName(this.Name);
Action resolveHandler = () => {

public static IPromise Rejected(Exception ex) {
// Argument.NotNull(() => ex);
var promise = new Promise();
var promise = new Promise(isSync: true);
var promise = new Promise();
var promise = new Promise(isSync: true);
Window.instance.run(duration, () => { promise.Resolve(); });
return promise;

2
Runtime/rendering/sliver_persistent_header.cs


Curve curve = null,
TimeSpan? duration = null
) {
D.assert(this.vsync != null);
D.assert(vsync != null);
this.vsync = vsync;
this.curve = curve ?? Curves.ease;
this.duration = duration ?? new TimeSpan(0, 0, 0, 0, 300);

9
Runtime/widgets/binding.cs


element.unmount();
}
this._renderViewElement.visitChildren(unMountAll);
this._renderViewElement.deactivate();
this._renderViewElement.unmount();
if (this._renderViewElement != null) {
this._renderViewElement.visitChildren(unMountAll);
this._renderViewElement.deactivate();
this._renderViewElement.unmount();
this._renderViewElement = null;
}
}
public void attachRootWidget(Widget rootWidget) {

4
Runtime/widgets/page_storage.cs


}
if (identifier != null) {
return this._storage[identifier];
return this._storage.getOrDefault(identifier);
return contextIdentifier.isNotEmpty ? this._storage[contextIdentifier] : null;
return contextIdentifier.isNotEmpty ? this._storage.getOrDefault(contextIdentifier) : null;
}
}

4
Runtime/widgets/single_child_scroll_view.cs


}
if (this.attached) {
this.offset.removeListener(this._hasScrolled);
this._offset.removeListener(this._hasScrolled);
this.offset = value;
this._offset = value;
if (this.attached) {
this._offset.addListener(this._hasScrolled);
}

4
Samples/UIWidgetsGallery/GalleryMain.cs


return new GalleryApp();
}
protected override void Start() {
base.Start();
protected override void OnEnable() {
base.OnEnable();
FontManager.instance.addFont(Resources.Load<Font>("MaterialIcons-Regular"));
FontManager.instance.addFont(Resources.Load<Font>("GalleryIcons"));
}

3
Samples/UIWidgetsGallery/gallery/example_code_parser.cs


Dictionary<string, string> _exampleCode;
public string getExampleCode(string tag, AssetBundle bundle) {
if (this._exampleCode == null)
if (this._exampleCode == null) {
}
return this._exampleCode.getOrDefault(tag);
}

37
Tests/Resources/ali_landscape.png.meta


TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
serializedVersion: 7
mipmaps:
mipMapMode: 0
enableMipMap: 1

wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0

platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1

正在加载...
取消
保存