private void LayoutUpdateItem(RingLayoutItem item, float t)
 {
     // 開始場所によって変える必要がありそう
     // 0.1単位でOrderセット
     item.Canvas.sortingOrder      = Mathf.CeilToInt(t * 10);
     item.RectTransform.localScale = Vector3.one * Mathf.Lerp(0.6f, 1f, t);
 }
예제 #2
0
        /// <summary>
        /// 要素を追加
        /// </summary>
        public void Add(GameObject gameObject, int count = 1)
        {
            for (var i = 0; i < count; i++)
            {
                var index = _items.Count;
                // 初期化処理
                InitEvent?.Invoke(gameObject);

                gameObject.transform.parent = transform;
                var pos = gameObject.transform.position;
                pos.z = transform.position.z;
                gameObject.transform.position = pos;

                var item = new RingLayoutItem(gameObject.transform as RectTransform, index);
                item.Button?.onClick.AddListener(() => ClickEvent?.Invoke(index));
                _items.Add(item);
            }
            Reposition();
        }
        private void LayoutMenuUpdateItem(RingLayoutItem item, float t)
        {
            item.Canvas.sortingOrder = Mathf.CeilToInt(t * 10);
            foreach (var image in item.Images)
            {
                image.color = new Color(t, t, t);
            }

            if (item.Button == null)
            {
                return;
            }

            // 複数アクティブになる可能性あり
            if (t > 0.9f)
            {
                item.Button.interactable = true;
            }
            else if (item.Button.interactable)
            {
                item.Button.interactable = false;
            }
        }