Example #1
0
    /* Initialize the box.
     */
    public void Initialize(ListPositionCtrl listPositionCtrl)
    {
        _positionCtrl = listPositionCtrl;
        _listBank     = _positionCtrl.listBank;

        switch (_positionCtrl.direction)
        {
        case ListPositionCtrl.Direction.Vertical:
            UpdatePosition = MoveVertically;
            break;

        case ListPositionCtrl.Direction.Horizontal:
            UpdatePosition = MoveHorizontally;
            break;
        }

        _unitPos                 = _positionCtrl.unitPos;
        _lowerBoundPos           = _positionCtrl.lowerBoundPos;
        _upperBoundPos           = _positionCtrl.upperBoundPos;
        _changeSideLowerBoundPos = _lowerBoundPos + _unitPos * 0.5f;
        _changeSideUpperBoundPos = _upperBoundPos - _unitPos * 0.5f;

        _positionCurve = new CurveResolver(
            _positionCtrl.boxPositionCurve,
            _changeSideLowerBoundPos, _changeSideUpperBoundPos);
        _scaleCurve = new CurveResolver(
            _positionCtrl.boxScaleCurve,
            _changeSideLowerBoundPos, _changeSideUpperBoundPos);

        InitialPosition();
        InitialContent();
        AddClickEvent();
    }
Example #2
0
    /* Notice: ListBox will initialize its variables from ListPositionCtrl.
     * Make sure that the execution order of script ListPositionCtrl is prior to
     * ListBox.
     */
    void Start()
    {
        _positionCtrl = transform.GetComponentInParent <ListPositionCtrl>();
        _listBank     = _positionCtrl.listBank;

        _maxCurvePos             = _positionCtrl.canvasMaxPos_L * _positionCtrl.listCurvature;
        _unitPos                 = _positionCtrl.unitPos_L;
        _lowerBoundPos           = _positionCtrl.lowerBoundPos_L;
        _upperBoundPos           = _positionCtrl.upperBoundPos_L;
        _changeSideLowerBoundPos = _lowerBoundPos + _unitPos * 0.3f;
        _changeSideUpperBoundPos = _upperBoundPos - _unitPos * 0.3f;
        _cosValueAdjust          = _positionCtrl.positionAdjust;

        _initialLocalScale = transform.localScale;

        InitialPosition();
        InitialContent();
        AddClickEvent();
    }