Inheritance: MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
Exemplo n.º 1
0
 static public int get_fastSwipeThreshold(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushValue(l, self.fastSwipeThreshold);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 2
0
 static public int PreviousScreen(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         self.PreviousScreen();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 3
0
 static public int get_linkScrolrectScrollSensitivity(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushValue(l, self.linkScrolrectScrollSensitivity);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 4
0
 static public int get_StartingPage(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushValue(l, self.StartingPage);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 5
0
 static public int get_autoLayoutItems(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushValue(l, self.autoLayoutItems);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 6
0
 static public int get_direction(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushEnum(l, (int)self.direction);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 7
0
 static public int get_itemsVisibleAtOnce(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         pushValue(l, self.itemsVisibleAtOnce);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 8
0
 static public int UpdateListItemPositions(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         self.UpdateListItemPositions();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 9
0
 static public int CurrentPage(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         var ret = self.CurrentPage();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 10
0
 static public int set_direction(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         UnityEngine.UI.Extensions.ScrollSnap.ScrollDirection v;
         checkEnum(l, 2, out v);
         self.direction = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 11
0
 static public int set_useFastSwipe(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Boolean v;
         checkType(l, 2, out v);
         self.useFastSwipe = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 12
0
 static public int set_linkScrolrectScrollSensitivity(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Boolean v;
         checkType(l, 2, out v);
         self.linkScrolrectScrollSensitivity = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 13
0
 static public int set_prevButton(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         UnityEngine.UI.Button v;
         checkType(l, 2, out v);
         self.prevButton = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 14
0
 static public int set_fastSwipeThreshold(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Int32 v;
         checkType(l, 2, out v);
         self.fastSwipeThreshold = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 15
0
 static public int SetItemSize(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         self.SetItemSize(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 16
0
 static public int OnDrag(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap      self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         self.OnDrag(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 17
0
 static public int ChangePage(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         self.ChangePage(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 18
0
 static public int set_itemsVisibleAtOnce(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         System.Int32 v;
         checkType(l, 2, out v);
         self.itemsVisibleAtOnce = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 19
0
 static public int set_StartingPage(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.StartingPage = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 20
0
    public void Init()
    {
        if (DataSet.unlockedLevelIdx == -1)
        {
            // the first time enter the game, need to unlock title screen
            DataSet.unlockedLevelIdx        = 0;
            DataSet.completedLevelIdx       = 0;
            DataSet.recentCompletedLevelIdx = 0;
            targetPage = 0;
        }

        scrollSnap  = GetComponent <UnityEngine.UI.Extensions.ScrollSnap>();
        contentList = new List <Transform>();
        foreach (Transform t in content)
        {
            contentList.Add(t);
        }
        contentDistance = 1.0f / (contentList.Count - 1);

        ResumeContentPosition();

        if (!unlockAllLevel)
        {
            if (DataSet.recentCompletedLevelIdx == DataSet.unlockedLevelIdx && DataSet.recentCompletedLevelIdx > DataSet.completedLevelIdx)
            {
                // the newest level is just completed & need to unlock next level
                if (DataSet.unlockedLevelIdx < contentList.Count - 1)
                {
                    // this is not the last level
                    ++DataSet.unlockedLevelIdx;
                }
            }

            for (int i = DataSet.unlockedLevelIdx + 1; i < contentList.Count; ++i)
            {
                contentList[i].gameObject.SetActive(false);
            }
        }
        else
        {
            DataSet.unlockedLevelIdx = contentList.Count - 1;
        }
    }
Exemplo n.º 21
0
 static public int set_onPageChange(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.ScrollSnap self = (UnityEngine.UI.Extensions.ScrollSnap)checkSelf(l);
         UnityEngine.UI.Extensions.ScrollSnap.PageSnapChange v;
         int op = LuaDelegation.checkDelegate(l, 2, out v);
         if (op == 0)
         {
             self.onPageChange = v;
         }
         else if (op == 1)
         {
             self.onPageChange += v;
         }
         else if (op == 2)
         {
             self.onPageChange -= v;
         }
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        static public void FixedScrollSnapBase(MenuCommand menuCommand, string name, ScrollSnap.ScrollDirection direction, int itemVisible, int itemCount, Vector2 itemSize)
        {
            GameObject scrollSnapRoot = CreateUIElementRoot(name, menuCommand, s_ThickGUIElementSize);
            GameObject itemList = CreateUIObject("List", scrollSnapRoot);

            // Set RectTransform to stretch
            RectTransform rectTransformScrollSnapRoot = scrollSnapRoot.GetComponent<RectTransform>();
            rectTransformScrollSnapRoot.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransformScrollSnapRoot.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransformScrollSnapRoot.anchoredPosition = Vector2.zero;

            if (direction == ScrollSnap.ScrollDirection.Horizontal)
            {
                rectTransformScrollSnapRoot.sizeDelta = new Vector2(itemVisible * itemSize.x, itemSize.y);
            }
            else
            {
                rectTransformScrollSnapRoot.sizeDelta = new Vector2(itemSize.x, itemVisible * itemSize.y);
            }

            Image image = scrollSnapRoot.AddComponent<Image>();
            image.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(kBackgroundSpriteResourcePath);
            image.type = Image.Type.Sliced;
            image.color = new Color(1f, 1f, 1f, 1f);

            Mask listMask = scrollSnapRoot.AddComponent<Mask>();
            listMask.showMaskGraphic = false;

            ScrollRect scrollRect = scrollSnapRoot.AddComponent<ScrollRect>();
            scrollRect.vertical = direction == ScrollSnap.ScrollDirection.Vertical;
            scrollRect.horizontal = direction == ScrollSnap.ScrollDirection.Horizontal;

            ScrollSnap scrollSnap = scrollSnapRoot.AddComponent<ScrollSnap>();
            scrollSnap.direction = direction;
            scrollSnap.itemsVisibleAtOnce = itemVisible;

            //Setup Content container
            RectTransform rectTransformContent = itemList.GetComponent<RectTransform>();
            rectTransformContent.anchorMin = Vector2.zero;
            rectTransformContent.anchorMax = new Vector2(1f, 1f);
            rectTransformContent.sizeDelta = Vector2.zero;
            scrollRect.content = rectTransformContent;

            //Setup Item list container
            if (direction == ScrollSnap.ScrollDirection.Horizontal)
            {
                itemList.AddComponent<HorizontalLayoutGroup>();
                ContentSizeFitter sizeFitter = itemList.AddComponent<ContentSizeFitter>();
                sizeFitter.horizontalFit = ContentSizeFitter.FitMode.MinSize;
            }
            else
            {
                itemList.AddComponent<VerticalLayoutGroup>();
                ContentSizeFitter sizeFitter = itemList.AddComponent<ContentSizeFitter>();
                sizeFitter.verticalFit = ContentSizeFitter.FitMode.MinSize;
            }

            //Setup children
            for (var i = 0; i < itemCount; i++)
            {
                GameObject item = CreateUIObject(string.Format("Item_{0:00}", i), itemList);
                GameObject childText = CreateUIObject("Text", item);

                Image pageImage = item.AddComponent<Image>();
                pageImage.sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
                pageImage.type = Image.Type.Sliced;
                pageImage.color = s_DefaultSelectableColor;

                LayoutElement elementLayout = item.AddComponent<LayoutElement>();
                if (direction == ScrollSnap.ScrollDirection.Horizontal)
                {
                    elementLayout.minWidth = itemSize.x;
                }
                else
                {
                    elementLayout.minHeight = itemSize.y;
                }

                RectTransform rectTransformPage01 = item.GetComponent<RectTransform>();
                rectTransformPage01.anchorMin = new Vector2(0f, 0.5f);
                rectTransformPage01.anchorMax = new Vector2(0f, 0.5f);
                rectTransformPage01.pivot = new Vector2(0f, 0.5f);

                //Setup Text on Page01
                Text text = childText.AddComponent<Text>();
                text.text = item.name;
                text.alignment = TextAnchor.MiddleCenter;
                text.color = new Color(0.196f, 0.196f, 0.196f);

                //Setup Text 1st Child
                RectTransform rectTransformPage01Text = childText.GetComponent<RectTransform>();
                rectTransformPage01Text.anchorMin = new Vector2(0.5f, 0.5f);
                rectTransformPage01Text.anchorMax = new Vector2(0.5f, 0.5f);
                rectTransformPage01Text.pivot = new Vector2(0.5f, 0.5f);
            }
            Selection.activeGameObject = scrollSnapRoot;
        }