浏览代码

update

/main
fzhangtj 6 年前
当前提交
08f74fa2
共有 6 个文件被更改,包括 10 次插入37 次删除
  1. 13
      Assets/UIWidgets/Tests/EditableTextWiget.cs
  2. 14
      Assets/UIWidgets/rendering/editable.cs
  3. 1
      Assets/UIWidgets/service/text_input.cs
  4. 7
      Assets/UIWidgets/widgets/editable_text.cs
  5. 6
      Assets/UIWidgets/widgets/focus_manager.cs
  6. 6
      Assets/UIWidgets/widgets/framework.cs

13
Assets/UIWidgets/Tests/EditableTextWiget.cs


using UIWidgets.painting;
using UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
using Color = UIWidgets.ui.Color;
namespace UIWidgets.Tests
{

private WidgetsBindings widgetsBindings;
private PaintingBinding paintingBinding;

padding: EdgeInsets.all(15.0),
color: ui.Color.fromARGB(255, 244, 190, 85),
child: new EditableText(
maxLines: 100,
textInput: windowAdapter.textInput,
maxLines: 100,
controller: new TextEditingController("click to edit"),
focusNode: new FocusNode(),
style: new TextStyle(),

);
this.widgetsBindings = new WidgetsBindings(windowAdapter);
if (widgetsBindings != null) {
widgetsBindings.attachRootWidget(root);
}
this.windowAdapter.attachRootWidget(root);
this.titleContent = new GUIContent("EditableTextWiget");
this.widgetsBindings = null;
}
}
}

14
Assets/UIWidgets/rendering/editable.cs


D.assert(_showCursor != null);
D.assert(!_showCursor.value || cursorColor != null);
// _tap = new TapGestureRecognizer(owner.binding, this);
// _doubleTap = new DoubleTapGestureRecognizer(owner.binding, this);
// _tap.onTapDown = this._handleTapDown;
// _tap.onTap = this._handleTap;
// _doubleTap.onDoubleTap = this._handleDoubleTap;
_tap = new TapGestureRecognizer(this);
_doubleTap = new DoubleTapGestureRecognizer(this);
_tap.onTapDown = this._handleTapDown;

public override void attach(object ownerObject)
{
base.attach(ownerObject);
_tap = new TapGestureRecognizer(owner.binding, this);
_doubleTap = new DoubleTapGestureRecognizer(owner.binding, this);
_tap.onTapDown = this._handleTapDown;
_tap.onTap = this._handleTap;
_doubleTap.onDoubleTap = this._handleDoubleTap;
_offset.addListener(markNeedsLayout);
_showCursor.addListener(markNeedsPaint);
}

_tap.dispose();
_tap = null;
_doubleTap.dispose();
_doubleTap = null;
_offset.removeListener(markNeedsLayout);
_showCursor.removeListener(markNeedsPaint);
base.detach();

1
Assets/UIWidgets/service/text_input.cs


{
internal TextInputConnection _currentConnection;
internal TextEditingValue _value;
private List<char> inputValue = new List<char>();
static Dictionary<Event, TextEditOp> s_Keyactions;
private string _lastCompositionString;

7
Assets/UIWidgets/widgets/editable_text.cs


public class EditableText : StatefulWidget
{
public readonly TextInput textInput;
public readonly TextEditingController controller;
public readonly FocusNode focusNode;

public readonly bool rendererIgnoresPointer;
public EditableText(TextInput textInput, TextEditingController controller, FocusNode focusNode, TextStyle style,
public EditableText(TextEditingController controller, FocusNode focusNode, TextStyle style,
Color cursorColor, bool obscureText = false, bool autocorrect = false,
TextAlign textAlign = TextAlign.left, TextDirection? textDirection = null,
double textScaleFactor = 1.0, int maxLines = 1,

D.assert(focusNode != null);
D.assert(style != null);
D.assert(cursorColor != null);
D.assert(textInput != null);
this.textInput = textInput;
this.controller = controller;
this.focusNode = focusNode;
this.obscureText = obscureText;

if (!_hasInputConnection) {
TextEditingValue localValue = _value;
_lastKnownRemoteTextEditingValue = localValue;
_textInputConnection = widget.textInput.attach(this);
_textInputConnection = Window.instance.textInput.attach(this);
_textInputConnection.setEditingState(localValue);
}
}

6
Assets/UIWidgets/widgets/focus_manager.cs


public class FocusManager
{
public FocusManager(Window window)
public FocusManager()
this.window = window;
public readonly Window window;
public readonly FocusScopeNode rootScope = new FocusScopeNode();
internal FocusNode _currentFocus;

}
_haveScheduledUpdate = true;
window.scheduleMicrotask(_update);
Window.instance.scheduleMicrotask(_update);
}

6
Assets/UIWidgets/widgets/framework.cs


}
public class BuildOwner {
public BuildOwner(Window window, VoidCallback onBuildScheduled = null) {
public BuildOwner(VoidCallback onBuildScheduled = null) {
this.focusManager = new FocusManager(window);
}
public VoidCallback onBuildScheduled;

get { return this._dirtyElementsNeedsResorting != null; }
}
public readonly FocusManager focusManager;
public readonly FocusManager focusManager = new FocusManager();
public void scheduleBuildFor(Element element) {
D.assert(element != null);

D.assert(_child != null);
}
catch (Exception e) {
Debug.LogError(e);
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e));
this._child = this.updateChild(null, built, this.slot);
}

正在加载...
取消
保存