Example #1
0
    // Token: 0x06004EB8 RID: 20152 RVA: 0x00145F20 File Offset: 0x00144120
    internal static bool RequestKeyboardFocus(global::UIInput input)
    {
        if (input == global::UIUnityEvents.lastInput)
        {
            return(true);
        }
        if (global::UIUnityEvents.lastInput)
        {
            return(false);
        }
        if (!input.label || !input.label.enabled)
        {
            return(false);
        }
        int layer = input.label.gameObject.layer;
        global::UICamera uicamera = global::UICamera.FindCameraForLayer(layer);

        if (!uicamera)
        {
            return(false);
        }
        if (uicamera.SetKeyboardFocus(input))
        {
            global::UIUnityEvents.ChangeFocus(uicamera, input, input.label);
            return(true);
        }
        return(false);
    }
Example #2
0
 // Token: 0x06004EB3 RID: 20147 RVA: 0x00145CD8 File Offset: 0x00143ED8
 private static void TextDrag(global::UICamera camera, global::UIInput input, UnityEngine.Event @event, global::UILabel label)
 {
     if (input == global::UIUnityEvents.lastInput && camera == global::UIUnityEvents.lastInputCamera)
     {
         global::UIUnityEvents.lastLabel = label;
         TextEditor te = null;
         if (!global::UIUnityEvents.GetTextEditor(out te))
         {
             return;
         }
         if (global::UIUnityEvents.controlID == GUIUtility.hotControl)
         {
             global::UITextPosition uitextPosition = camera.RaycastText(Input.mousePosition, label);
             if ([email protected])
             {
                 global::UIUnityEvents.SelectTextPosition(@event, te, ref uitextPosition);
             }
             else
             {
                 global::UIUnityEvents.MoveTextPosition(@event, te, ref uitextPosition);
             }
             @event.Use();
         }
         global::UIUnityEvents.TextSharedEnd(false, te, @event);
     }
 }
Example #3
0
 // Token: 0x06004E9C RID: 20124 RVA: 0x001453C4 File Offset: 0x001435C4
 public static void CameraCreated(global::UICamera camera)
 {
     if (Application.isPlaying && !global::UIUnityEvents.LateLoaded.singleton)
     {
         Debug.Log("singleton check failed.");
     }
 }
Example #4
0
 // Token: 0x06004EB1 RID: 20145 RVA: 0x00145C14 File Offset: 0x00143E14
 private static void TextClickUp(global::UICamera camera, global::UIInput input, UnityEngine.Event @event, global::UILabel label)
 {
     if (input == global::UIUnityEvents.lastInput && camera == global::UIUnityEvents.lastInputCamera)
     {
         global::UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!global::UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         if (global::UIUnityEvents.controlID == GUIUtility.hotControl)
         {
             textEditor.MouseDragSelectsWholeWords(false);
             GUIUtility.hotControl = 0;
             @event.Use();
             global::UIUnityEvents.SetKeyboardControl();
         }
         else
         {
             Debug.Log(string.Concat(new object[]
             {
                 "Did not match ",
                 global::UIUnityEvents.controlID,
                 " ",
                 GUIUtility.hotControl
             }));
         }
         global::UIUnityEvents.TextSharedEnd(false, textEditor, @event);
     }
 }
 // Token: 0x06004DF9 RID: 19961 RVA: 0x00137320 File Offset: 0x00135520
 private void PanelUpdate(bool letFill)
 {
     this.UpdateTransformMatrix();
     this.UpdateTransforms();
     if (this.mLayer != base.gameObject.layer)
     {
         this.mLayer = base.gameObject.layer;
         global::UICamera uicamera = global::UICamera.FindCameraForLayer(this.mLayer);
         this.mCam = ((!(uicamera != null)) ? global::NGUITools.FindCameraForLayer(this.mLayer) : uicamera.cachedCamera);
         global::UIPanel.SetChildLayer(this.cachedTransform, this.mLayer);
         global::UIDrawCall.Iterator iterator = (global::UIDrawCall.Iterator) this.mDrawCalls;
         while (iterator.Has)
         {
             iterator.Current.gameObject.layer = this.mLayer;
             iterator = iterator.Next;
         }
     }
     this.UpdateWidgets();
     if (this.mDepthChanged)
     {
         this.mDepthChanged = false;
         this.mWidgets.Sort(new Comparison <global::UIWidget>(global::UIWidget.CompareFunc));
     }
     if (letFill)
     {
         this.FillUpdate();
     }
     else
     {
         this.UpdateDrawcalls();
     }
     this.mRebuildAll = false;
 }
    // Token: 0x06004DEE RID: 19950 RVA: 0x00136818 File Offset: 0x00134A18
    protected void Start()
    {
        this.mLayer = base.gameObject.layer;
        global::UICamera uicamera = global::UICamera.FindCameraForLayer(this.mLayer);

        this.mCam = ((!(uicamera != null)) ? global::NGUITools.FindCameraForLayer(this.mLayer) : uicamera.cachedCamera);
    }
Example #7
0
        static StackObject *AssignFromStack_MainUICamera_0(ref object o, ILIntepreter __intp, StackObject *ptr_of_this_method, IList <object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            global::UICamera @MainUICamera = (global::UICamera)typeof(global::UICamera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            ((global::UIHierarchyHelper)o).MainUICamera = @MainUICamera;
            return(ptr_of_this_method);
        }
Example #8
0
 // Token: 0x06004EB5 RID: 20149 RVA: 0x00145D78 File Offset: 0x00143F78
 private static void TextKeyUp(global::UICamera camera, global::UIInput input, UnityEngine.Event @event, global::UILabel label)
 {
     if (input == global::UIUnityEvents.lastInput && camera == global::UIUnityEvents.lastInputCamera)
     {
         global::UIUnityEvents.lastLabel = label;
         TextEditor te = null;
         if (!global::UIUnityEvents.GetTextEditor(out te))
         {
             return;
         }
         global::UIUnityEvents.TextSharedEnd(false, te, @event);
     }
 }
Example #9
0
    // Token: 0x06004EAD RID: 20141 RVA: 0x00145A98 File Offset: 0x00143C98
    private static void ChangeFocus(global::UICamera camera, global::UIInput input, global::UILabel label)
    {
        bool flag = global::UIUnityEvents.lastInput != input;

        if (flag)
        {
            global::UIUnityEvents.lastInput        = input;
            global::UIUnityEvents.textInputContent = null;
            global::UIUnityEvents.requiresBinding  = input;
            global::UIUnityEvents.focusSetInOnGUI  = global::UIUnityEvents.inOnGUI;
        }
        global::UIUnityEvents.lastInputCamera = camera;
        global::UIUnityEvents.lastLabel       = label;
    }
Example #10
0
        static StackObject *ProcessMouse_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            global::UICamera instance_of_this_method = (global::UICamera)typeof(global::UICamera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ProcessMouse();

            return(__ret);
        }
Example #11
0
    // Token: 0x06004EAF RID: 20143 RVA: 0x00145B2C File Offset: 0x00143D2C
    private static void TextClickDown(global::UICamera camera, global::UIInput input, UnityEngine.Event @event, global::UILabel label)
    {
        global::UITextPosition uitextPosition = ([email protected]) ? camera.RaycastText(Input.mousePosition, label) : default(global::UITextPosition);
        TextEditor             textEditor     = null;

        global::UIUnityEvents.ChangeFocus(camera, input, label);
        if (!global::UIUnityEvents.GetTextEditor(out textEditor))
        {
            Debug.LogError("Null Text Editor");
        }
        else
        {
            GUIUtility.hotControl = global::UIUnityEvents.controlID;
            global::UIUnityEvents.SetKeyboardControl();
            global::UIUnityEvents.MoveTextPosition(@event, textEditor, ref uitextPosition);
            int clickCount = @event.clickCount;
            if (clickCount != 2)
            {
                if (clickCount == 3)
                {
                    if (input.trippleClickSelect)
                    {
                        textEditor.SelectCurrentParagraph();
                        textEditor.MouseDragSelectsWholeWords(true);
                        textEditor.DblClickSnap(1);
                    }
                }
            }
            else
            {
                textEditor.SelectCurrentWord();
                textEditor.DblClickSnap(0);
                textEditor.MouseDragSelectsWholeWords(true);
            }
            @event.Use();
        }
        global::UIUnityEvents.TextSharedEnd(false, textEditor, @event);
    }
    // Token: 0x06004D74 RID: 19828 RVA: 0x00134284 File Offset: 0x00132484
    internal void OnEvent(global::UICamera camera, NGUIHack.Event @event, EventType type)
    {
        switch (type)
        {
        case 0:
            if (@event.button == 0)
            {
                global::UIUnityEvents.TextClickDown(camera, this, @event, this.label);
            }
            break;

        case 1:
            if (@event.button == 0)
            {
                global::UIUnityEvents.TextClickUp(camera, this, @event, this.label);
            }
            else
            {
                Debug.Log("Wee");
            }
            break;

        case 3:
            if (@event.button == 0)
            {
                global::UIUnityEvents.TextDrag(camera, this, @event, this.label);
            }
            break;

        case 4:
            global::UIUnityEvents.TextKeyDown(camera, this, @event, this.label);
            break;

        case 5:
            global::UIUnityEvents.TextKeyUp(camera, this, @event, this.label);
            break;
        }
    }
Example #13
0
 // Token: 0x0600496E RID: 18798 RVA: 0x001185A8 File Offset: 0x001167A8
 private void OnPress(bool pressed)
 {
     if (base.enabled && base.gameObject.activeInHierarchy && this.target != null)
     {
         this.mPressed = pressed;
         if (pressed)
         {
             if ((this.restrictWithinPanel || this.restrictToScreen) && this.mPanel == null)
             {
                 this.FindPanel();
             }
             if (this.restrictWithinPanel)
             {
                 this.mBounds = global::NGUIMath.CalculateRelativeWidgetBounds(this.mPanel.cachedTransform, this.target);
             }
             if (this.restrictToScreen)
             {
                 global::UICamera uicamera = global::UICamera.FindCameraForLayer(base.gameObject.layer);
                 Rect             rect     = global::UIDragObject.screenBorder.Add(uicamera.camera.pixelRect);
                 this.mBounds = global::AABBox.CenterAndSize(rect.center, new Vector3(rect.width, rect.height, 0f));
             }
             this.mMomentum = Vector3.zero;
             this.mScroll   = 0f;
             global::SpringPosition component = this.target.GetComponent <global::SpringPosition>();
             if (component != null)
             {
                 component.enabled = false;
             }
             this.mLastPos = global::UICamera.lastHit.point;
             Transform transform = global::UICamera.currentCamera.transform;
             this.mPlane = new Plane(((!(this.mPanel != null)) ? transform.rotation : this.mPanel.cachedTransform.rotation) * Vector3.back, this.mLastPos);
         }
         else if (this.restrictWithinPanel && this.mPanel.clipping != global::UIDrawCall.Clipping.None && this.dragEffect == global::UIDragObject.DragEffect.MomentumAndSpring)
         {
             this.mPanel.ConstrainTargetToBounds(this.target, ref this.mBounds, false);
         }
     }
 }
Example #14
0
 // Token: 0x06004EB7 RID: 20151 RVA: 0x00145DD4 File Offset: 0x00143FD4
 private static void TextKeyDown(global::UICamera camera, global::UIInput input, UnityEngine.Event @event, global::UILabel label)
 {
     if (input == global::UIUnityEvents.lastInput && camera == global::UIUnityEvents.lastInputCamera)
     {
         global::UIUnityEvents.lastLabel = label;
         TextEditor textEditor = null;
         if (!global::UIUnityEvents.GetTextEditor(out textEditor))
         {
             return;
         }
         if (!global::UIUnityEvents.GetKeyboardControl())
         {
             Debug.Log("Did not " + @event);
             return;
         }
         bool changed = false;
         if (global::UIUnityEvents.TextEditorHandleEvent(@event, textEditor))
         {
             @event.Use();
             changed = true;
         }
         else
         {
             KeyCode keyCode = @event.keyCode;
             if (keyCode == 9)
             {
                 return;
             }
             if (keyCode == null)
             {
                 char character = @event.character;
                 if (character == '\t')
                 {
                     return;
                 }
                 bool           flag = character == '\n';
                 global::BMFont bmFont;
                 if (flag && !input.inputMultiline && [email protected])
                 {
                     global::UIUnityEvents.submit = true;
                 }
                 else if (label.font && (bmFont = label.font.bmFont) != null)
                 {
                     if (flag || (character != '\0' && bmFont.ContainsGlyph((int)character)))
                     {
                         textEditor.Insert(character);
                         changed = true;
                     }
                     else if (character == '\0')
                     {
                         if (Input.compositionString.Length > 0)
                         {
                             textEditor.ReplaceSelection(string.Empty);
                             changed = true;
                         }
                         @event.Use();
                     }
                 }
             }
         }
         global::UIUnityEvents.TextSharedEnd(changed, textEditor, @event);
     }
 }
Example #15
0
 // Token: 0x06004EB6 RID: 20150 RVA: 0x00145DC4 File Offset: 0x00143FC4
 internal static void TextKeyDown(global::UICamera camera, global::UIInput input, NGUIHack.Event @event, global::UILabel label)
 {
     global::UIUnityEvents.TextKeyDown(camera, input, @event.real, label);
 }
Example #16
0
 // Token: 0x060049CF RID: 18895 RVA: 0x0011B478 File Offset: 0x00119678
 private void OnClick()
 {
     if (this.mChild == null && this.atlas != null && this.font != null && this.items.Count > 1)
     {
         this.mLabelList.Clear();
         this.handleEvents = true;
         if (this.mPanel == null)
         {
             this.mPanel = global::UIPanel.Find(base.transform, true);
         }
         Transform      transform = base.transform;
         global::AABBox aabbox    = global::NGUIMath.CalculateRelativeWidgetBounds(transform.parent, transform);
         this.mChild       = new GameObject("Drop-down List");
         this.mChild.layer = base.gameObject.layer;
         Transform transform2 = this.mChild.transform;
         transform2.parent        = transform.parent;
         transform2.localPosition = aabbox.min;
         transform2.localRotation = Quaternion.identity;
         transform2.localScale    = Vector3.one;
         this.mBackground         = global::NGUITools.AddSprite(this.mChild, this.atlas, this.backgroundSprite);
         this.mBackground.pivot   = global::UIWidget.Pivot.TopLeft;
         this.mBackground.depth   = global::NGUITools.CalculateNextDepth(this.mPanel.gameObject);
         this.mBackground.color   = this.backgroundColor;
         Vector4 border = this.mBackground.border;
         this.mBgBorder = border.y;
         this.mBackground.cachedTransform.localPosition = new Vector3(0f, border.y, 0f);
         this.mHighlight       = global::NGUITools.AddSprite(this.mChild, this.atlas, this.highlightSprite);
         this.mHighlight.pivot = global::UIWidget.Pivot.TopLeft;
         this.mHighlight.color = this.highlightColor;
         global::UIAtlas.Sprite sprite = this.mHighlight.sprite;
         float num  = sprite.inner.yMin - sprite.outer.yMin;
         float num2 = (float)this.font.size * this.textScale;
         float num3 = 0f;
         float num4 = -this.padding.y;
         List <global::UILabel> list = new List <global::UILabel>();
         int i     = 0;
         int count = this.items.Count;
         while (i < count)
         {
             string          text    = this.items[i];
             global::UILabel uilabel = global::NGUITools.AddWidget <global::UILabel>(this.mChild);
             uilabel.pivot = global::UIWidget.Pivot.TopLeft;
             uilabel.font  = this.font;
             uilabel.text  = ((!this.isLocalized || !(global::Localization.instance != null)) ? text : global::Localization.instance.Get(text));
             uilabel.color = this.textColor;
             uilabel.cachedTransform.localPosition = new Vector3(border.x, num4, 0f);
             uilabel.MakePixelPerfect();
             if (this.textScale != 1f)
             {
                 Vector3 localScale = uilabel.cachedTransform.localScale;
                 uilabel.cachedTransform.localScale = localScale * this.textScale;
             }
             list.Add(uilabel);
             num4 -= num2;
             num4 -= this.padding.y;
             num3  = Mathf.Max(num3, uilabel.relativeSize.x * num2);
             global::UIEventListener uieventListener = global::UIEventListener.Get(uilabel.gameObject);
             uieventListener.onHover   = new global::UIEventListener.BoolDelegate(this.OnItemHover);
             uieventListener.onPress   = new global::UIEventListener.BoolDelegate(this.OnItemPress);
             uieventListener.parameter = text;
             if (this.mSelectedItem == text)
             {
                 this.Highlight(uilabel, true);
             }
             this.mLabelList.Add(uilabel);
             i++;
         }
         num3 = Mathf.Max(num3, aabbox.size.x - border.x * 2f);
         Vector3 center;
         center..ctor(num3 * 0.5f / num2, -0.5f, 0f);
         Vector3 size;
         size..ctor(num3 / num2, (num2 + this.padding.y) / num2, 1f);
         int j      = 0;
         int count2 = list.Count;
         while (j < count2)
         {
             global::UILabel   uilabel2  = list[j];
             global::UIHotSpot uihotSpot = global::NGUITools.AddWidgetHotSpot(uilabel2.gameObject);
             center.z         = uihotSpot.center.z;
             uihotSpot.center = center;
             uihotSpot.size   = size;
             j++;
         }
         num3 += border.x * 2f;
         num4 -= border.y;
         this.mBackground.cachedTransform.localScale = new Vector3(num3, -num4 + border.y, 1f);
         this.mHighlight.cachedTransform.localScale  = new Vector3(num3 - border.x * 2f + (sprite.inner.xMin - sprite.outer.xMin) * 2f, num2 + num * 2f, 1f);
         bool flag = this.position == global::UIPopupList.Position.Above;
         if (this.position == global::UIPopupList.Position.Auto)
         {
             global::UICamera uicamera = global::UICamera.FindCameraForLayer(base.gameObject.layer);
             if (uicamera != null)
             {
                 flag = (uicamera.cachedCamera.WorldToViewportPoint(transform.position).y < 0.5f);
             }
         }
         if (this.isAnimated)
         {
             float bottom = num4 + num2;
             this.Animate(this.mHighlight, flag, bottom);
             int k      = 0;
             int count3 = list.Count;
             while (k < count3)
             {
                 this.Animate(list[k], flag, bottom);
                 k++;
             }
             this.AnimateColor(this.mBackground);
             this.AnimateScale(this.mBackground, flag, bottom);
         }
         if (flag)
         {
             transform2.localPosition = new Vector3(aabbox.min.x, aabbox.max.y - num4 - border.y, aabbox.min.z);
         }
     }
     else
     {
         this.OnSelect(false);
     }
 }