private void OnEnable()
        {
            simpleScrollSnap = target as SimpleScrollSnap;

            // Serialized Properties
            movementType        = serializedObject.FindProperty("movementType");
            movementAxis        = serializedObject.FindProperty("movementAxis");
            automaticallyLayout = serializedObject.FindProperty("automaticallyLayout");
            sizeControl         = serializedObject.FindProperty("sizeControl");
            size = serializedObject.FindProperty("size");
            automaticLayoutSpacing = serializedObject.FindProperty("automaticLayoutSpacing");
            leftMargin             = serializedObject.FindProperty("leftMargin");
            rightMargin            = serializedObject.FindProperty("rightMargin");
            topMargin                   = serializedObject.FindProperty("topMargin");
            bottomMargin                = serializedObject.FindProperty("bottomMargin");
            infinitelyScroll            = serializedObject.FindProperty("infinitelyScroll");
            useOcclusionCulling         = serializedObject.FindProperty("useOcclusionCulling");
            infiniteScrollingEndSpacing = serializedObject.FindProperty("infiniteScrollingEndSpacing");
            startingPanel               = serializedObject.FindProperty("startingPanel");
            swipeGestures               = serializedObject.FindProperty("swipeGestures");
            minimumSwipeSpeed           = serializedObject.FindProperty("minimumSwipeSpeed");
            previousButton              = serializedObject.FindProperty("previousButton");
            nextButton                  = serializedObject.FindProperty("nextButton");
            pagination                  = serializedObject.FindProperty("pagination");
            toggleNavigation            = serializedObject.FindProperty("toggleNavigation");
            snapTarget                  = serializedObject.FindProperty("snapTarget");
            snappingSpeed               = serializedObject.FindProperty("snappingSpeed");
            thresholdSnappingSpeed      = serializedObject.FindProperty("thresholdSnappingSpeed");
            hardSnap         = serializedObject.FindProperty("hardSnap");
            useUnscaledTime  = serializedObject.FindProperty("useUnscaledTime");
            onPanelSelecting = serializedObject.FindProperty("onPanelSelecting");
            onPanelSelected  = serializedObject.FindProperty("onPanelSelected");
            onPanelChanging  = serializedObject.FindProperty("onPanelChanging");
            onPanelChanged   = serializedObject.FindProperty("onPanelChanged");
        }
示例#2
0
    public void goToPlayerShop()
    {
        shop.SetColors();
        int equippedIndex;

        if (inEnemy)
        {
            ExitEnemyAnim();
        }
        else if (inSword)
        {
            ExitSwordAnim();
        }


        Invoke("EnterPlayerAnim", 0.5f);
        moveToPlayerShop = true;
        scrollSnap       = PlayerShopCanvas.transform.GetComponentInChildren <DanielLochner.Assets.SimpleScrollSnap.SimpleScrollSnap>();
        equippedIndex    = shop.updateScrollSnap(scrollSnap);
        shop.updateShopUIReferences(HeroShopAchievementRequirement, HeroShopPurchaseButton,
                                    HeroShopItemName);
        shop.setItemValues();
        if (equippedIndex > -1)
        {
            scrollSnap.GoToPanel(equippedIndex);
        }
    }
示例#3
0
            public TransitionEffect(string label, float minValue, float maxValue, float minDisplacement, float maxDisplacement, AnimationCurve function, SimpleScrollSnap simpleScrollSnap)
            {
                this.label            = label;
                this.simpleScrollSnap = simpleScrollSnap;
                this.minValue         = minValue;
                this.maxValue         = maxValue;
                this.minDisplacement  = minDisplacement;
                this.maxDisplacement  = maxDisplacement;
                this.function         = function;

                SetDefaultValues(minValue, maxValue, minDisplacement, maxDisplacement, function);
                #if UNITY_EDITOR
                UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
                #endif
            }
示例#4
0
    public int updateScrollSnap(DanielLochner.Assets.SimpleScrollSnap.SimpleScrollSnap _scrollSnap)
    {
        int equippedIndex = -1;

        itemList.Clear();
        scrollSnap = _scrollSnap;
        GameObject content = _scrollSnap.transform.GetChild(0).GetChild(0).gameObject;

        foreach (Transform child in content.transform)
        {
            Item i = child.GetComponent <Item>();
            itemList.Add(i);
            if (i.purchaseState == Item.ButtonState.equipped)
            {
                if (i.type == Item.Type.enemyColor && i.enemyColor.ToString() == ColorDataBase.enemyColorName)
                {
                    equippedIndex = itemList.Count - 1;
                }
                else if (i.type == Item.Type.enemyColor && i.enemyColor.ToString() != ColorDataBase.enemyColorName)
                {
                    i.purchaseState = Item.ButtonState.purchased;
                }

                else if (i.type == Item.Type.swordColor && i.heroColor.ToString() == ColorDataBase.swordColorName)
                {
                    equippedIndex = itemList.Count - 1;
                }
                else if (i.type == Item.Type.swordColor && i.heroColor.ToString() != ColorDataBase.swordColorName)
                {
                    i.purchaseState = Item.ButtonState.purchased;
                }
                else
                {
                    equippedIndex = itemList.Count - 1;
                }
            }
            else if (i.type == Item.Type.swordColor && i.heroColor.ToString() == ColorDataBase.swordColorName)
            {
                equippedIndex = itemList.Count - 1;
            }
            else if (i.type == Item.Type.enemyColor && i.enemyColor.ToString() == ColorDataBase.enemyColorName)
            {
                equippedIndex = itemList.Count - 1;
            }
        }
        return(equippedIndex);
    }
示例#5
0
        private void OnEnable()
        {
            scrollSnap = target as SimpleScrollSnap;

            #region Serialized Properties
            // Movement and Layout Settings
            movementType       = serializedObject.FindProperty("movementType");
            movementAxis       = serializedObject.FindProperty("movementAxis");
            useAutomaticLayout = serializedObject.FindProperty("useAutomaticLayout");
            sizeControl        = serializedObject.FindProperty("sizeControl");
            size = serializedObject.FindProperty("size");
            automaticLayoutSpacing   = serializedObject.FindProperty("automaticLayoutSpacing");
            automaticLayoutMargins   = serializedObject.FindProperty("automaticLayoutMargins");
            useInfiniteScrolling     = serializedObject.FindProperty("useInfiniteScrolling");
            infiniteScrollingSpacing = serializedObject.FindProperty("infiniteScrollingSpacing");
            useOcclusionCulling      = serializedObject.FindProperty("useOcclusionCulling");
            startingPanel            = serializedObject.FindProperty("startingPanel");

            // Navigation Settings
            useSwipeGestures    = serializedObject.FindProperty("useSwipeGestures");
            minimumSwipeSpeed   = serializedObject.FindProperty("minimumSwipeSpeed");
            previousButton      = serializedObject.FindProperty("previousButton");
            nextButton          = serializedObject.FindProperty("nextButton");
            pagination          = serializedObject.FindProperty("pagination");
            useToggleNavigation = serializedObject.FindProperty("useToggleNavigation");

            // Snap Settings
            snapTarget           = serializedObject.FindProperty("snapTarget");
            snapSpeed            = serializedObject.FindProperty("snapSpeed");
            thresholdSpeedToSnap = serializedObject.FindProperty("thresholdSpeedToSnap");
            useHardSnapping      = serializedObject.FindProperty("useHardSnapping");
            useUnscaledTime      = serializedObject.FindProperty("useUnscaledTime");

            // ShowEvents
            onTransitionEffects = serializedObject.FindProperty("onTransitionEffects");
            onPanelSelecting    = serializedObject.FindProperty("onPanelSelecting");
            onPanelSelected     = serializedObject.FindProperty("onPanelSelected");
            onPanelCentering    = serializedObject.FindProperty("onPanelCentering");
            onPanelCentered     = serializedObject.FindProperty("onPanelCentered");
            #endregion
        }
示例#6
0
    public void goToShop()
    {
        int equippedIndex;

        ShopCamera.enabled     = true;
        MainMenuCamera.enabled = false;
        EnterPlayerAnim();
        mainMenuCanvas.enabled = false;
        shop.transform.GetChild(0).gameObject.SetActive(true);
        scrollSnap  = PlayerShopCanvas.transform.GetComponentInChildren <DanielLochner.Assets.SimpleScrollSnap.SimpleScrollSnap>();
        exitingShop = false;


        equippedIndex = shop.updateScrollSnap(scrollSnap);
        shop.updateShopUIReferences(HeroShopAchievementRequirement, HeroShopPurchaseButton,
                                    HeroShopItemName);
        shop.setItemValues();
        if (equippedIndex > -1)
        {
            scrollSnap.GoToPanel(equippedIndex);
        }
    }
 void Start()
 {
     scrollSnap = this.GetComponent <DanielLochner.Assets.SimpleScrollSnap.SimpleScrollSnap>();
 }
示例#8
0
 private void Awake()
 {
     sss         = GetComponent <SimpleScrollSnap>();
     toggleWidth = toggle.GetComponent <RectTransform>().sizeDelta.x;
 }
示例#9
0
 private void Awake()
 {
     sss = GetComponent <SimpleScrollSnap>();
     Debug.Log("got it");
 }