package com.bokecc.livemodule.view.redpacket;


import static com.bokecc.livemodule.view.redpacket.RedPacketRes.TYPE_PACKET;

/**
 * Created on 2018/10/3.
 * 红包
 *
 * @author ice
 */
public class BoxInfo {
    //红包ID（拿这个去问服务器是否中奖）
    private int awardId;
    public String prizeName;
    public int amount;
    public int type = TYPE_PACKET;
    private int mIndex = -1; //图片list的索引（普通动画下滑  BOOM动画  中奖动画）。

    private float mX, mY; //飘落物此刻的坐标。

    public int addIndex() {
        mIndex+=1;
        return mIndex;
    }

    public int getmIndex() {
        return mIndex;
    }

    public void setmIndex(int mIndex) {
        this.mIndex = mIndex;
    }

    public int getAwardId() {
        return awardId;
    }
    public void setType(int type) {
        if (this.type!=type){
            mIndex = 0;
        }
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public float nextX(int dx) {
        mX = mX + dx;
        return mX;
    }

    public float nextY(float dy) {
        mY = mY + dy;
        return mY;
    }

    /*判断某个点是否在区域内*/
    public boolean isInArea(int x, int y, int width, int height) {
        boolean inX = x > mX && x < mX + width;
        boolean inY = y > mY && y < mY + height;
        return inX && inY;
    }



    @Override
    public String toString() {
        return "BoxInfo{" +
                "awardId=" + awardId +
                ", prizeName='" + prizeName + '\'' +
                ", amount=" + amount +
                ", mIndex=" + mIndex +
                ", mX=" + mX +
                ", mY=" + mY +
                ", type=" + type +
                '}';
    }


}
