Exemple #1
0
        /// <summary>
        /// Initialize all the buttons' scale size.
        /// </summary>
        private void InitAsympScale()
        {
            // if not this effect, return it.
            if (!mAsympEffect)
            {
                return;
            }

            JCS_RollSelectorButton currentBtn = null;

            int centerIndex = JCS_Mathf.FindMiddleIndex(mButtons.Length);

            // initialzie the scroll index.
            for (int index = 0;
                 index < mButtons.Length;
                 ++index)
            {
                currentBtn = mButtons[index];

                Vector3 scale = Vector3.zero;
                if (index <= centerIndex)
                {
                    scale = (mAsympDiffScale * index) + mAsympDiffScale;
                }
                else
                {
                    scale = (mAsympDiffScale * (index - ((index - centerIndex) * 2))) + mAsympDiffScale;
                }

                if (mPanelRoot != null)
                {
                    scale.x /= mPanelRoot.PanelDeltaWidthRatio;
                    scale.y /= mPanelRoot.PanelDeltaHeightRatio;
                }

                JCS_ScaleEffect se = currentBtn.GetScaleEffect();

                if (se == null)
                {
                    JCS_Debug.LogError(
                        "JCS_ScaleEffect are null but we still want the effect. plz make sure all the button have JCS_ScaleEffet component!");

                    // close the effect.
                    mAsympEffect = false;

                    return;
                }

                se.RecordScale += scale;

                // the change value plus the original scale.
                // so it will keep the original setting form the
                // level designer.
                se.TowardScale += scale + se.GetScaleValue();

                se.JCS_OnMouseOver();
            }
        }