浏览代码

format

/siyaoH-1.17-rawTouches
siyao 3 年前
当前提交
bb1d27a4
共有 1 个文件被更改,包括 48 次插入20 次删除
  1. 68
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs

68
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs


UIWidgetsWindowType getWindowType();
}
_textFonts[key: family] = font;
_textFonts[key: family] = font;
public object fontsToObject() {
Dictionary<string, TextFont> settings = _textFonts;
if (settings == null || settings.Count == 0) {

for (var j = 0; j < setting.Value.fonts.Length; j++) {
var fontDic = new Dictionary<string, object>();
var fileExist = false;
if (setting.Value.fonts[j].asset.Length > 0) {
var assetPath = setting.Value.fonts[j].asset;
var assetAbsolutePath = Path.Combine(Application.streamingAssetsPath, assetPath);

if (!File.Exists(assetAbsolutePath)) {
#endif
Debug.LogError($"The font asset (family: \"{setting.Key}\", path: \"{assetPath}\") is not found");
Debug.LogError(
$"The font asset (family: \"{setting.Key}\", path: \"{assetPath}\") is not found");
fontDic.Add("asset", value: setting.Value.fonts[j].asset);
}

UIWidgetsMessageManager.instance?.AddChannelMessageDelegate("ViewportMetricsChanged",
_handleViewMetricsChanged);
}
Input_Update();

#if !UNITY_EDITOR
// 8 MB
const long kCollectAfterAllocating = 8 * 1024 * 1024;

lastFrameMemory = mem;
}
#endif
#endregion
#if !UNITY_EDITOR && UNITY_ANDROID

//the hook API cannot be automatically called on IOS, so we need try hook it here
Hooks.tryHook();
#endif
#if !UNITY_EDITOR
TryEnableOnDemandGC();
Application.lowMemory += () => {

#endif
base.OnEnable();
D.assert(_wrapper == null);
_configurations = new Configurations();
_wrapper = new UIWidgetsPanelWrapper();

AddFont(family: font.family, font: font);
}
}
_wrapper.Initiate(this, width: _currentWidth, height: _currentHeight, dpr: _currentDevicePixelRatio,
_configurations: _configurations);
_configurations.Clear();

protected virtual void onEnable() {
}
_configurations.AddFont(family,font);
_configurations.AddFont(family, font);
}
protected void AddFont(string family, List<string> assets, List<int> weights) {

textFont.fonts = fonts;
AddFont(family: family, font: textFont);
}
enum UIWidgetsInputMode
{
enum UIWidgetsInputMode {
Mouse,
Touch
}

}
void Input_OnEnable() {
Input.touchRawProcess += LogTouch;
Input.touchRawProcess += ProcessRawTouch;
public static int count = 0;
public void LogTouch(Input.ProcessRawTouchesParam param) {
_wrapper.OnDrag(new Vector2(param.x, param.y), (int) param.pointerId);
public void ProcessRawTouch(Input.ProcessRawTouchesParam param) {
var position = _getPointerPosition(new Vector2(param.x, param.y));
var pointerId = -1 - param.pointerId;
switch (param.phase) {
case 0:
_wrapper.OnPointerDown(position, pointerId);
break;
case 1:
_wrapper.OnDrag(position, pointerId);
break;
case 3:
_wrapper.OnPointerUp(position, pointerId);
break;
default:
break;
}
Input.touchRawProcess -= LogTouch;
Input.touchRawProcess -= ProcessRawTouch;
Debug.Log($"count {count}");
//we only process hover events for desktop applications
if (_inputMode == UIWidgetsInputMode.Mouse) {
if (_isEntered) {

}
}
}
#if UNITY_ANDROID && !UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.Escape)) {
using (Isolate.getScope(anyIsolate)) {

if (_inputMode != UIWidgetsInputMode.Mouse) {
return;
}
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnMouseMove(pos);
}

return;
}
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnMouseScroll(Input.mouseScrollDelta, pos);
}

return;
}
D.assert(eventData.pointerId < 0);
_isEntered = true;
_lastMousePosition = Input.mousePosition;

if (_inputMode != UIWidgetsInputMode.Mouse) {
return;
}
D.assert(eventData.pointerId < 0);
_isEntered = false;
_wrapper.OnPointerLeave();

#if UNITY_EDITOR || (!UNITY_IOS && !UNITY_ANDROID)
#endif
#if UNITY_EDITOR || (!UNITY_IOS && !UNITY_ANDROID)
#endif
#if UNITY_EDITOR || (!UNITY_IOS && !UNITY_ANDROID)
#endif
}
}
}
正在加载...
取消
保存