This commit is contained in:
2020-07-19 12:52:05 +08:00
parent 30d5701d96
commit d92ad2ecca
33 changed files with 1689 additions and 769 deletions

View File

@@ -498,15 +498,14 @@ public class UIInput : MonoBehaviour
protected virtual void OnSelect (bool isSelected)
{
if (!enabled) return; // add by chenbin
if (isSelected)
if (isSelected)
{
#if !MOBILE
if (mOnGUI == null)
if (mOnGUI == null && this.enabled)
mOnGUI = gameObject.AddComponent<UIInputOnGUI>();
#endif
OnSelectEvent();
}
OnSelectEvent();
}
else
{
#if !MOBILE
@@ -526,8 +525,8 @@ public class UIInput : MonoBehaviour
protected void OnSelectEvent ()
{
#if !MOBILE // add by chenbin
selection = this;
#if !MOBILE // add by chenbin
selection = this;
if (mDoInit) Init();
// Unity has issues bringing up the keyboard properly if it's in "hideInput" mode and you happen
@@ -810,6 +809,7 @@ public class UIInput : MonoBehaviour
void init4GUI()
{
if (!this.enabled) return;
#if !UNITY_EDITOR && !UNITY_STANDALONE_OSX
isShowGUI = false;
return;
@@ -860,7 +860,7 @@ public class UIInput : MonoBehaviour
#if UNITY_EDITOR || UNITY_STANDALONE_OSX
void OnGUI() {
if(isShowGUI) {
if(isShowGUI && this.enabled) {
if (mDoInit)
Init ();
GUI.SetNextControlName("__MyTextField");
@@ -1444,54 +1444,57 @@ public class UIInput : MonoBehaviour
mBlankTex.Apply();
}
// Create the selection highlight
if (start != end)
if (this.enabled) //add by chenbin
{
if (mHighlight == null)
// Create the selection highlight
if (start != end)
{
mHighlight = NGUITools.AddWidget<UITexture>(label.cachedGameObject);
mHighlight.name = "Input Highlight";
mHighlight.mainTexture = mBlankTex;
mHighlight.fillGeometry = false;
mHighlight.pivot = label.pivot;
mHighlight.SetAnchor(label.cachedTransform);
if (mHighlight == null)
{
mHighlight = NGUITools.AddWidget<UITexture>(label.cachedGameObject);
mHighlight.name = "Input Highlight";
mHighlight.mainTexture = mBlankTex;
mHighlight.fillGeometry = false;
mHighlight.pivot = label.pivot;
mHighlight.SetAnchor(label.cachedTransform);
}
else
{
mHighlight.pivot = label.pivot;
mHighlight.mainTexture = mBlankTex;
mHighlight.MarkAsChanged();
mHighlight.enabled = true;
}
}
// Create the carter
if (mCaret == null)
{
mCaret = NGUITools.AddWidget<UITexture>(label.cachedGameObject);
mCaret.name = "Input Caret";
mCaret.mainTexture = mBlankTex;
mCaret.fillGeometry = false;
mCaret.pivot = label.pivot;
mCaret.SetAnchor(label.cachedTransform);
}
else
{
mHighlight.pivot = label.pivot;
mHighlight.mainTexture = mBlankTex;
mHighlight.MarkAsChanged();
mHighlight.enabled = true;
mCaret.pivot = label.pivot;
mCaret.mainTexture = mBlankTex;
mCaret.MarkAsChanged();
mCaret.enabled = true;
}
}
// Create the carter
if (mCaret == null)
{
mCaret = NGUITools.AddWidget<UITexture>(label.cachedGameObject);
mCaret.name = "Input Caret";
mCaret.mainTexture = mBlankTex;
mCaret.fillGeometry = false;
mCaret.pivot = label.pivot;
mCaret.SetAnchor(label.cachedTransform);
}
else
{
mCaret.pivot = label.pivot;
mCaret.mainTexture = mBlankTex;
mCaret.MarkAsChanged();
mCaret.enabled = true;
}
if (start != end)
{
label.PrintOverlay(start, end, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor);
mHighlight.enabled = mHighlight.geometry.hasVertices;
}
else
{
label.PrintOverlay(start, end, mCaret.geometry, null, caretColor, selectionColor);
if (mHighlight != null) mHighlight.enabled = false;
if (start != end)
{
label.PrintOverlay(start, end, mCaret.geometry, mHighlight.geometry, caretColor, selectionColor);
mHighlight.enabled = mHighlight.geometry.hasVertices;
}
else
{
label.PrintOverlay(start, end, mCaret.geometry, null, caretColor, selectionColor);
if (mHighlight != null) mHighlight.enabled = false;
}
}
// Reset the blinking time