|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
using Unity.UIWidgets.foundation; |
|
|
|
using Unity.UIWidgets.ui; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
namespace Unity.UIWidgets.widgets { |
|
|
|
public class FocusNode : ChangeNotifier { |
|
|
|
|
|
|
this.rootScope._manager = this; |
|
|
|
D.assert(this.rootScope._firstChild == null); |
|
|
|
D.assert(this.rootScope._lastChild == null); |
|
|
|
this.unfocusIfNeed(); |
|
|
|
internal readonly FocusScopeNode _noneScope = new FocusScopeNode(); |
|
|
|
|
|
|
|
|
|
|
|
internal FocusNode _currentFocus; |
|
|
|
|
|
|
|
internal void _willDisposeFocusNode(FocusNode node) { |
|
|
|
|
|
|
if (this._currentFocus != null) { |
|
|
|
this._currentFocus._notify(); |
|
|
|
} |
|
|
|
|
|
|
|
Debug.Log($"updated none={this._noneScope.ToString()}:\n{this.ToString()}"); |
|
|
|
public void unfocusIfNeed() { |
|
|
|
if (this._noneScope._parent != null && this._noneScope.isFirstFocus) { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.rootScope.setFirstFocus(this._noneScope); |
|
|
|
} |
|
|
|
|
|
|
|
public void focusIfNeed() { |
|
|
|
if (this._noneScope._parent == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
this._noneScope.detach(); |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() { |
|
|
|
var status = this._haveScheduledUpdate ? " UPDATE SCHEDULED" : ""; |
|
|
|
var indent = " "; |
|
|
|