Ejemplo n.º 1
0
    /// <summary>
    /// 点击事件
    /// </summary>
    /// <param name="go">物体</param>
    /// <param name="objs">参数</param>
    protected virtual void OnClick(GameObject go, object[] objs)
    {
        Vector2Int vector = (Vector2Int)objs[0];

        m_GroupScrollerView.SetSelection(vector);
        m_GroupScrollerView.ScrollToSelection();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 选择性别或者皮肤按钮
    /// </summary>
    /// <param name="index">toggle 索引</param>
    /// <param name="select">是否点击</param>
    private void OnTopToggleClick(int index, bool select)
    {
        Animator animator = m_TopToggles[index].GetComponent <Animator>();

        if (select)
        {
            m_TopTogglesIndex = index;
            animator.SetBool("IsOn", true);

            m_GenderRoot.gameObject.SetActive(index == 0);
            m_SkinRoot.gameObject.SetActive(index == 1);

            GroupScrollerView scroller = index == 0 ? m_GroupScrollerViewSex : m_GroupScrollerViewSkin;
            int        selectedIndex   = index == 0 ? m_GenderTierIndex : m_SkinTierIndex;
            GameObject scrollerRow     = scroller.SetSelection(new Vector2Int(0, selectedIndex));
            if (scrollerRow)
            {
                scrollerRow.GetComponent <Toggle>().isOn = true;
                scrollerRow.GetComponent <Animator>().SetBool("IsOn", true);

                FocusTo(scrollerRow.GetComponent <Toggle>());
            }
        }
        else
        {
            animator.SetTrigger("Normal");
            animator.SetBool("IsOn", false);
        }
    }