Пример #1
0
    /// <summary>
    /// Raises the substract button click event.
    /// </summary>
    void OnSubstractBtnClick(GameObject go)
    {
        if (!CSUtils.IsNumber(m_RightContent.countInput.text))
        {
            return;
        }

        int            count      = int.Parse(m_RightContent.countInput.text);
        UIGraphControl graph_ctrl = m_MiddleContent.graphCtrl;

        if (graph_ctrl.rootNode == null)
        {
            return;
        }
        if (count > graph_ctrl.rootNode.ms.m_productItemCount)
        {
            count -= graph_ctrl.rootNode.ms.m_productItemCount;
        }
        this.UpdateInputCount(count);
    }
Пример #2
0
    // ---------------------------------
    // Call Back
    // ---------------------------------

    /// <summary>
    /// Raises the count input changed event.
    /// </summary>
    //	void OnCountInputSubmit(string text)
    //	{
    //
    //	}

    void OnCountInputSelected(GameObject go, bool isSelect)
    {
        //lz-2016.08.12 当取消选中的时候更改值
        if (isSelect)
        {
            return;
        }
        int count = 1;

        if (CSUtils.IsNumber(m_RightContent.countInput.text))
        {
            count = int.Parse(m_RightContent.countInput.text);
        }
        UIGraphControl graph_ctrl = m_MiddleContent.graphCtrl;

        if (graph_ctrl.rootNode == null)
        {
            return;
        }

        //lz-2016.08.03 输入的数量限制在范围内
        count = Mathf.Clamp(count, graph_ctrl.rootNode.ms.m_productItemCount, graph_ctrl.GetMaxCount());
        this.UpdateInputCount(count, false);
    }