Esempio n. 1
0
    public GameObject Get(Vector3 myDir, float x = 1f, float y = 1f)
    {
        //IL_0001: Unknown result type (might be due to invalid IL or missing references)
        //IL_0006: Expected O, but got Unknown
        //IL_0008: Unknown result type (might be due to invalid IL or missing references)
        //IL_0009: Unknown result type (might be due to invalid IL or missing references)
        //IL_000e: Unknown result type (might be due to invalid IL or missing references)
        //IL_0011: Unknown result type (might be due to invalid IL or missing references)
        //IL_0016: Expected O, but got Unknown
        //IL_0016: Unknown result type (might be due to invalid IL or missing references)
        //IL_001b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0093: Unknown result type (might be due to invalid IL or missing references)
        //IL_0098: Expected O, but got Unknown
        //IL_0098: Unknown result type (might be due to invalid IL or missing references)
        //IL_009d: Unknown result type (might be due to invalid IL or missing references)
        //IL_009e: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c6: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00cd: 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_010a: Expected O, but got Unknown
        Transform val = this.get_transform();

        myDir = val.TransformDirection(myDir);
        Vector3    center = GetCenter(this.get_gameObject());
        float      num    = 3.40282347E+38f;
        GameObject result = null;

        for (int i = 0; i < list.size; i++)
        {
            UIKeyNavigation uIKeyNavigation = list[i];
            if (!(uIKeyNavigation == this) && uIKeyNavigation.constraint != Constraint.Explicit && uIKeyNavigation.isColliderEnabled)
            {
                UIWidget component = uIKeyNavigation.GetComponent <UIWidget>();
                if (!(component != null) || component.alpha != 0f)
                {
                    Vector3 val2 = GetCenter(uIKeyNavigation.get_gameObject()) - center;
                    float   num2 = Vector3.Dot(myDir, val2.get_normalized());
                    if (!(num2 < 0.707f))
                    {
                        val2    = val.InverseTransformDirection(val2);
                        val2.x *= x;
                        val2.y *= y;
                        float sqrMagnitude = val2.get_sqrMagnitude();
                        if (!(sqrMagnitude > num))
                        {
                            result = uIKeyNavigation.get_gameObject();
                            num    = sqrMagnitude;
                        }
                    }
                }
            }
        }
        return(result);
    }
    protected GameObject Get(Vector3 myDir, bool horizontal)
    {
        Transform transform = base.get_transform();

        myDir = transform.TransformDirection(myDir);
        Vector3    center = UIKeyNavigation.GetCenter(base.get_gameObject());
        float      num    = 3.40282347E+38f;
        GameObject result = null;

        for (int i = 0; i < UIKeyNavigation.list.size; i++)
        {
            UIKeyNavigation uIKeyNavigation = UIKeyNavigation.list[i];
            if (!(uIKeyNavigation == this))
            {
                UIButton component = uIKeyNavigation.GetComponent <UIButton>();
                if (!(component != null) || component.isEnabled)
                {
                    Vector3 vector = UIKeyNavigation.GetCenter(uIKeyNavigation.get_gameObject()) - center;
                    float   num2   = Vector3.Dot(myDir, vector.get_normalized());
                    if (num2 >= 0.707f)
                    {
                        vector = transform.InverseTransformDirection(vector);
                        if (horizontal)
                        {
                            vector.y *= 2f;
                        }
                        else
                        {
                            vector.x *= 2f;
                        }
                        float sqrMagnitude = vector.get_sqrMagnitude();
                        if (sqrMagnitude <= num)
                        {
                            result = uIKeyNavigation.get_gameObject();
                            num    = sqrMagnitude;
                        }
                    }
                }
            }
        }
        return(result);
    }