/// <summary>
        /// Move the last child of the current child will make the
        /// panel in front of any other GUI in the current panel.
        /// </summary>
        public void MoveToTheLastChild()
        {
            JCS_Utility.MoveToTheLastChild(this.transform);

            // Once it move to the last child, meaning the window have been focus.
            SwapToTheLastOpenWindowList();
        }
示例#2
0
        //========================================
        //      Self-Define
        //------------------------------
        //----------------------
        // Public Functions

        /// <summary>
        /// Initialize the focus selector
        /// </summary>
        /// <param name="rbs"></param>
        public void SetFocusSelector(JCS_RollSelectorButton rbs)
        {
            // if still animating disabled.
            if (mAnimating)
            {
                return;
            }

            // record down the last focus buttons index.
            mLastScrollIndex = mFocusBtn.ScrollIndex;

            // assign new focus button!
            this.mFocusBtn = rbs;

            foreach (JCS_RollSelectorButton btn in mButtons)
            {
                btn.SetInteractable(false);
            }

            // only enable this
            mFocusBtn.SetInteractable(true);

            // show in front.
            JCS_Utility.MoveToTheLastChild(mFocusBtn.transform);

            // Active anim, so can set the focused button to center.
            FindScrollIndex();
        }
示例#3
0
        private void Start()
        {
            // everytime it reload the scene.
            // move to the last child make sure everything get cover by this.
            JCS_Utility.MoveToTheLastChild(this.transform);

            this.mStartingPosition = this.transform.localPosition;
        }
示例#4
0
        /// <summary>
        /// Re-order all the object.
        /// </summary>
        /// <param name="arr"> sorted object. </param>
        private void OriganizeChildOrder(JCS_GUIComponentLayer[] arr)
        {
            for (int index = 0; index < arr.Length; ++index)
            {
                // this will make gui ontop of each other.
                JCS_Utility.MoveToTheLastChild(arr[index].transform);

                // make sure is sorted already.
                arr[index].Sorted = true;
            }
        }
示例#5
0
        private void Test()
        {
            if (!mTestWithKey)
            {
                return;
            }

            if (Input.GetKeyDown(mMoveLastKey))
            {
                JCS_Utility.MoveToTheLastChild(this.transform);
            }
        }
示例#6
0
        /// <summary>
        /// Re-order all the object.
        /// </summary>
        /// <param name="arr">sorted object. </param>
        private void OriganizeChildOrder(JCS_PanelLayer[] arr)
        {
            for (int index = 0; index < arr.Length; ++index)
            {
                var layer = arr[index];

                // this will make gui ontop of each other.
                JCS_Utility.MoveToTheLastChild(layer.transform);

                // make sure is sorted already.
                layer.Sorted = true;
            }
        }
        /// <summary>
        /// Show the dialogue without the sound.
        /// </summary>
        public void ShowDialogueWithoutSound()
        {
            mIsVisible = true;

            //this.gameObject.SetActive(true);

            // active all the child object
            for (int index = 0; index < this.transform.childCount; ++index)
            {
                this.transform.GetChild(index).gameObject.SetActive(true);
            }

            JCS_Utility.MoveToTheLastChild(this.transform);
        }
示例#8
0
        //----------------------
        // Protected Functions

        //----------------------
        // Private Functions

        /// <summary>
        /// Initilaize the buttons in the array.
        /// </summary>
        private void InitButton()
        {
            JCS_RollSelectorButton currentBtn = null;
            int indexCounter = 0;

            JCS_RollSelectorButton[] buttons = new JCS_RollSelectorButton[mButtons.Length];

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

                if (currentBtn == null)
                {
                    JCS_Debug.LogError(
                        "Missing jcs_button assign in the inspector...");
                    continue;
                }

                // set to array object to know this handler.
                currentBtn.SetRollSelector(this);


                Vector3 newPos = this.transform.localPosition;

                bool isEven = JCS_Mathf.IsEven(index);

                if (index != 0)
                {
                    currentBtn.SetInteractable(false);
                }
                else
                {
                    // the first one (center)
                    mFocusBtn = currentBtn;
                    JCS_Utility.MoveToTheLastChild(mFocusBtn.transform);
                    currentBtn.SetInteractable(true);
                    mLastScrollIndex = currentBtn.ScrollIndex;
                }

                if (!isEven)
                {
                    ++indexCounter;
                }

                float intervalDistance = mSpacing * indexCounter;

                switch (mDimension)
                {
                case JCS_2DDimensions.VERTICAL:
                {
                    if (mPanelRoot != null)
                    {
                        intervalDistance /= mPanelRoot.PanelDeltaWidthRatio;
                    }

                    if (isEven)
                    {
                        newPos.y += intervalDistance;
                    }
                    else
                    {
                        newPos.y -= intervalDistance;
                    }
                }
                break;

                case JCS_2DDimensions.HORIZONTAL:
                {
                    if (mPanelRoot != null)
                    {
                        intervalDistance /= mPanelRoot.PanelDeltaHeightRatio;
                    }

                    if (isEven)
                    {
                        newPos.x += intervalDistance;
                    }
                    else
                    {
                        newPos.x -= intervalDistance;
                    }
                }
                break;
                }

                currentBtn.GetRectTransfom().localPosition = newPos;

                // set friction.
                currentBtn.SimpleTrackAction.Friction = mScrollFriction;
                // set tracking
                currentBtn.SetTrackPosition();

                // get the correct order
                int correctIndex = 0;

                if (isEven)
                {
                    correctIndex = ((mButtons.Length - 1) - index) / 2;
                }
                else
                {
                    correctIndex = ((mButtons.Length) + index) / 2;
                }

                buttons[correctIndex] = currentBtn;
            }

            mButtons = buttons;

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

                // set index.
                currentBtn.ScrollIndex = index;
            }
        }
 public void FadeIn(float time)
 {
     mAO.FadeIn(time);
     JCS_Utility.MoveToTheLastChild(this.transform);
 }
示例#10
0
 private void LateUpdate()
 {
     JCS_Utility.MoveToTheLastChild(this.mRectTransform);
 }