public Vector2 GetScreenPosition()
        {
            if (!this.arrow)
            {
                return(Vector2.zero);
            }
            if (this.arrow.GetComponent <ScrollViewOrientation>() != null)
            {
                this.arrow.GetComponent <ScrollViewOrientation>().CenterSelf();
            }
            Camera camera = null;

            if (this.arrow as RectTransform)
            {
                camera = this.uiCamera;
            }
            else
            {
                GameObject[] array = GameObject.FindGameObjectsWithTag("MainCamera");
                if (array == null || array.Length == 0)
                {
                    return(Vector2.zero);
                }
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].layer == this.arrow.gameObject.layer)
                    {
                        camera = array[i].GetComponent <Camera>();
                        this.MainCamera3DInputCtrl = camera.GetComponent <HandleInputInViewPortRect>();
                        if (this.MainCamera3DInputCtrl != null)
                        {
                            this.MainCamera3DInputCtrl.Handle(false);
                        }
                        break;
                    }
                }
            }
            if (!camera)
            {
                UnityEngine.Debug.LogError("Can Not Find Camera");
                return(Vector2.zero);
            }
            Vector3 vector = camera.WorldToViewportPoint(this.arrow.position);
            float   num    = this.getScreenSize().x *vector.x;
            float   num2   = this.getScreenSize().y *vector.y;

            return(Vector2.right * (num - this.getScreenSize().x * 0.5f) + Vector2.up * (num2 - this.getScreenSize().y * 0.5f) + this.centerOffset);
        }
Esempio n. 2
0
    private static int Handle(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)ToLua.CheckObject(L, 1, typeof(HandleInputInViewPortRect));
            bool isHandle = LuaDLL.luaL_checkboolean(L, 2);
            handleInputInViewPortRect.Handle(isHandle);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Esempio n. 3
0
    private static int get_MatchHeight(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)obj;
            float matchHeight = handleInputInViewPortRect.MatchHeight;
            LuaDLL.lua_pushnumber(L, (double)matchHeight);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index MatchHeight on a nil value");
        }
        return(result);
    }
Esempio n. 4
0
    private static int set_CameraActionCtrl(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)obj;
            HandleCameraAction        cameraActionCtrl          = (HandleCameraAction)ToLua.CheckUnityObject(L, 2, typeof(HandleCameraAction));
            handleInputInViewPortRect.CameraActionCtrl = cameraActionCtrl;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index CameraActionCtrl on a nil value");
        }
        return(result);
    }
Esempio n. 5
0
    private static int set_DisplayWidth(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)obj;
            float displayWidth = (float)LuaDLL.luaL_checknumber(L, 2);
            handleInputInViewPortRect.DisplayWidth = displayWidth;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index DisplayWidth on a nil value");
        }
        return(result);
    }
Esempio n. 6
0
    private static int get_CameraActionCtrl(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)obj;
            HandleCameraAction        cameraActionCtrl          = handleInputInViewPortRect.CameraActionCtrl;
            ToLua.Push(L, cameraActionCtrl);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index CameraActionCtrl on a nil value");
        }
        return(result);
    }
Esempio n. 7
0
    private static int CutViewPortRect(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 4);
            HandleInputInViewPortRect handleInputInViewPortRect = (HandleInputInViewPortRect)ToLua.CheckObject(L, 1, typeof(HandleInputInViewPortRect));
            float displayWidth    = (float)LuaDLL.luaL_checknumber(L, 2);
            float rectYRatio      = (float)LuaDLL.luaL_checknumber(L, 3);
            float rectHeightRatio = (float)LuaDLL.luaL_checknumber(L, 4);
            handleInputInViewPortRect.CutViewPortRect(displayWidth, rectYRatio, rectHeightRatio);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
        private new void Start()
        {
            this.SelfTr     = base.transform;
            this.SelfParent = this.SelfTr.parent;
            if (!this.uiCamera)
            {
                this.uiCamera = Util.FindInParents <Camera>(base.gameObject, true);
            }
            HandleInputInViewPortRect component = base.GetComponent <HandleInputInViewPortRect>();

            if (component && this.uiCamera)
            {
                component.Camera              = this.uiCamera;
                component.IsIgnoreGUI         = true;
                component.OnTouchScreenAction = new Action <Vector3>(this.TouchScreen);
            }
            if (!this.mainCV)
            {
                this.mainCV = Util.FindInParents <Canvas>(base.gameObject, false);
            }
            this.findPrevScrollRect();
        }