예제 #1
0
        // Use this for initialization
        void Awake()
        {
            scrollRect = gameObject.AddComponent <SuperScrollRect> ();

            scrollRect.vertical = isVertical;

            scrollRect.horizontal = !isVertical;

            scrollRect.isRestrain = isRestrain;

            gameObject.AddComponent <RectMask2D>();

            Image img = gameObject.AddComponent <Image>();

            img.material = new Material(Shader.Find("Custom/UI/Default"));

            img.color = Color.clear;

//			Mask mask = gameObject.AddComponent<Mask>();
//
//			mask.showMaskGraphic = false;
//
//			gameObject.AddComponent<Image>();

            if (autoStart)
            {
                Init();
            }
        }
예제 #2
0
        // Use this for initialization
        void Start()
        {
            SuperScrollRect scrollRect = gameObject.AddComponent <SuperScrollRect>();

            scrollRect.content = childTransform;

            scrollRect.horizontal = true;

            scrollRect.vertical = true;

            scrollRect.movementType = ScrollRect.MovementType.Clamped;

            //SuperFunction.Instance.RemoveEventListener (SuperScrollRect.eventDispatcher, SuperScrollRect.CLOSE_MOVE, scrollRect.CloseMove);

            //SuperFunction.Instance.RemoveEventListener (SuperScrollRect.eventDispatcher, SuperScrollRect.OPEN_MOVE, scrollRect.OpenMove);

            containerHalfRect = (transform as RectTransform).rect.size / 2;

            SuperFunction.Instance.AddEventListener <float, Vector2>(ScreenScale.Instance.gameObject, ScreenScale.SCALE_CHANGE, ScaleChange);

            childWidth = childTransform.rect.width;

            childHeight = childTransform.rect.height;

            if (minScale == 0)
            {
                float widthScale = containerHalfRect.x * 2 / childWidth * 1.001f;

                float heightScale = containerHalfRect.y * 2 / childHeight * 1.001f;

                minScale = Mathf.Max(widthScale, heightScale);
            }

            if (maxScale == 0)
            {
                maxScale = 1;
            }

            SuperDebug.Log("SuperScaleScrollRect  minScale:" + minScale + "   maxScale:" + maxScale);
        }
예제 #3
0
        // Use this for initialization
        void Awake()
        {
            scrollRect = gameObject.AddComponent <SuperScrollRect>();

            scrollRect.vertical = isVertical;

            scrollRect.horizontal = !isVertical;

            scrollRect.isRestrain = isRestrain;

            //			gameObject.AddComponent<RectMask2D>();

            gameObject.AddComponent <Image>();

            Mask mask = gameObject.AddComponent <Mask>();

            mask.showMaskGraphic = false;

            if (autoStart)
            {
                Init();
            }
        }