package com.genlot.nativesdk.model;

import android.util.ArrayMap;

/**
 * 游戏配置
 */
public abstract class GameBaseConfig {
    private GameBaseAttr mBaseAttr;
    protected ArrayMap<Integer, GamePlayTypeAttr> playTypeMap;

    public GameBaseConfig() {
        mBaseAttr = initGameBaseAttr();
        playTypeMap = new ArrayMap<>();
    }

    protected abstract GameBaseAttr initGameBaseAttr();

    protected abstract GamePlayTypeAttr buildPlayTypeAttr(int playTypeID);

    public GameBaseAttr gameBaseAttr(){
        return mBaseAttr;
    }

    public GamePlayTypeAttr gamePlayTypeAttr(int playTypeID) {
        GamePlayTypeAttr attr = playTypeMap.get(playTypeID);
        if (attr != null) {
            return attr;
        }
        return buildPlayTypeAttr(playTypeID);
    }
}
