/// <summary>
    /// Set the selected state.
    /// </summary>

    protected virtual void OnSelect(bool isSelected)
    {
        if (isEnabled && tweenTarget != null)
        {
            if (UICamera.currentScheme == UICamera.ControlScheme.Controller)
            {
                OnHover(isSelected);
            }
            else if (!isSelected && UICamera.CountInputSources() < 2)
            {
                OnHover(isSelected);
            }
        }
    }
Ejemplo n.º 2
0
 public void SetEnableUIInput(bool is_enable)
 {
     if (enableUIInput != is_enable)
     {
         enableUIInput = is_enable;
         if (is_enable)
         {
             nguiCamera.useTouch = initUseTouch;
             nguiCamera.useMouse = initUseMouse;
         }
         else
         {
             nguiCamera.useTouch = false;
             nguiCamera.useMouse = false;
             if (!nguiCamera.allowMultiTouch && UICamera.CountInputSources() == 1)
             {
                 UICamera.MouseOrTouch touch = UICamera.GetTouch(1, false);
                 if (touch != null && touch.pressed != null)
                 {
                     UIButton component = touch.pressed.GetComponent <UIButton>();
                     if (component != null)
                     {
                         component.SetState(UIButtonColor.State.Normal, true);
                     }
                     UIScrollView componentInParent = touch.pressed.GetComponentInParent <UIScrollView>();
                     if (componentInParent != null)
                     {
                         componentInParent.Press(false);
                     }
                     touch.pressed = null;
                 }
                 if (UICamera.currentTouch != null)
                 {
                     nguiCamera.ProcessTouch(false, true);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
    void OnGUI()
    {
        Rect rect = new Rect(5f, 5f, 1000f, 22f);

        if (mRayDebug)
        {
            UICamera.ControlScheme scheme = UICamera.currentScheme;
            string text = "Scheme: " + scheme;
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text      = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", "");
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;

            text = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.ignoreControllerInput)
            {
                text += ", ignore controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.color = Color.black;
            GUI.Label(rect, text);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, text);
            rect.y += 18f;
            rect.x += 1f;
        }

        for (int i = 0, imax = mLines.Count; i < imax; ++i)
        {
            GUI.color = Color.black;
            GUI.Label(rect, mLines[i]);
            rect.y   -= 1f;
            rect.x   -= 1f;
            GUI.color = Color.white;
            GUI.Label(rect, mLines[i]);
            rect.y += 18f;
            rect.x += 1f;
        }
    }
Ejemplo n.º 4
0
    private void OnGUI()
    {
        Rect position = new Rect(5f, 5f, 1000f, 18f);

        if (NGUIDebug.mRayDebug)
        {
            UICamera.ControlScheme currentScheme = UICamera.currentScheme;
            string text = "Scheme: " + currentScheme;
            GUI.color = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", string.Empty);
            GUI.color   = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
            text        = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.color = Color.black;
            GUI.Label(position, text);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, text);
            position.y += 18f;
            position.x += 1f;
        }
        int i     = 0;
        int count = NGUIDebug.mLines.Count;

        while (i < count)
        {
            GUI.color = Color.black;
            GUI.Label(position, NGUIDebug.mLines[i]);
            position.y -= 1f;
            position.x -= 1f;
            GUI.color   = Color.white;
            GUI.Label(position, NGUIDebug.mLines[i]);
            position.y += 18f;
            position.x += 1f;
            i++;
        }
    }
Ejemplo n.º 5
0
    private void OnGUI()
    {
        //IL_003c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0046: Unknown result type (might be due to invalid IL or missing references)
        //IL_0073: Unknown result type (might be due to invalid IL or missing references)
        //IL_007d: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_0105: Unknown result type (might be due to invalid IL or missing references)
        //IL_010f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0160: Unknown result type (might be due to invalid IL or missing references)
        //IL_016a: Unknown result type (might be due to invalid IL or missing references)
        //IL_0197: Unknown result type (might be due to invalid IL or missing references)
        //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
        //IL_01f2: Unknown result type (might be due to invalid IL or missing references)
        //IL_01fc: Unknown result type (might be due to invalid IL or missing references)
        //IL_0229: Unknown result type (might be due to invalid IL or missing references)
        //IL_0233: Unknown result type (might be due to invalid IL or missing references)
        //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
        //IL_02ab: Unknown result type (might be due to invalid IL or missing references)
        //IL_02d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_02e2: Unknown result type (might be due to invalid IL or missing references)
        //IL_0322: Unknown result type (might be due to invalid IL or missing references)
        //IL_032c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0363: Unknown result type (might be due to invalid IL or missing references)
        //IL_036d: Unknown result type (might be due to invalid IL or missing references)
        Rect val = default(Rect);

        val._002Ector(5f, 5f, 1000f, 18f);
        if (mRayDebug)
        {
            UICamera.ControlScheme currentScheme = UICamera.currentScheme;
            string text = "Scheme: " + currentScheme;
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", string.Empty);
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
            text = "Active events: " + UICamera.CountInputSources();
            if (UICamera.disableController)
            {
                text += ", disabled controller";
            }
            if (UICamera.inputHasFocus)
            {
                text += ", input focus";
            }
            GUI.set_color(Color.get_black());
            GUI.Label(val, text);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, text);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
        }
        int i = 0;

        for (int count = mLines.Count; i < count; i++)
        {
            GUI.set_color(Color.get_black());
            GUI.Label(val, mLines[i]);
            val.set_y(val.get_y() - 1f);
            val.set_x(val.get_x() - 1f);
            GUI.set_color(Color.get_white());
            GUI.Label(val, mLines[i]);
            val.set_y(val.get_y() + 18f);
            val.set_x(val.get_x() + 1f);
        }
    }