MoveToTheLastChild() public static method

Move the object to the last child of the Unty's tree system(Hierarchy) transform.
public static MoveToTheLastChild ( Transform trans ) : void
trans Transform
return void
Esempio n. 1
0
        /// <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_Util.MoveToTheLastChild(mFocusBtn.transform);

            // Active anim, so can set the focused button to center.
            FindScrollIndex();
        }
Esempio n. 2
0
        /// <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_Util.MoveToTheLastChild(this.transform);

            // Once it move to the last child, meaning the window have been focus.
            SwapToTheLastOpenWindowList();
        }
Esempio n. 3
0
        private void Start()
        {
            // everytime it reload the scene.
            // move to the last child make sure everything get cover by this.
            JCS_Util.MoveToTheLastChild(this.transform);

            this.mStartingPosition = this.transform.localPosition;
        }
 /// <summary>
 /// Iterate through children and move them all to the last child
 /// once so the rendering order is preserved.
 /// </summary>
 private void ReorderChildren()
 {
     for (int count = 0; count < mRectTransform.childCount; ++count)
     {
         var trans = mRectTransform.GetChild(count);
         JCS_Util.MoveToTheLastChild(trans);
     }
 }
Esempio n. 5
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_Util.MoveToTheLastChild(arr[index].transform);

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

            if (Input.GetKeyDown(mMoveLastKey))
            {
                JCS_Util.MoveToTheLastChild(this.transform);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Show the dialogue without the sound.
        /// </summary>
        public virtual void Show(bool mute = false)
        {
            mIsVisible = true;

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

            JCS_Util.MoveToTheLastChild(this.transform);
        }
        /// <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_Util.MoveToTheLastChild(layer.transform);

                // make sure is sorted already.
                layer.Sorted = true;
            }
        }
 public void FadeIn(float time)
 {
     mAO.FadeIn(time);
     JCS_Util.MoveToTheLastChild(this.transform);
 }
Esempio n. 10
0
        /// <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_Util.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;
            }
        }
Esempio n. 11
0
 private void LateUpdate()
 {
     JCS_Util.MoveToTheLastChild(this.mRectTransform);
 }