package com.sheep.gamegroup.absBase;

/**
 * Created by realicing on 2018/11/22.
 * realicing@sina.com
 */
public abstract class AbsFocus {

    public static final int NONE = -1;
    public static final int YES = 1;
    public static final int NO = 0;

    private int focusState = NONE;
    public boolean isFocus(){
        switch (focusState){
            case -1:
                focusState = initFocusState();
                break;
        }
        return focusState == YES;
    }

    public abstract int getTheFocusId();

    //初始化关注状态
    protected int initFocusState(){
        return getTheFocusId() > 0 ? YES : NO;
    }

    public void setFocus(boolean focus) {
        focusState = focus ? YES : NO;
    }
}
