package com.xtech.hello.server.user.NECcode.old;
import com.xtech.hello.server.common.enums.BackgroundTypeEnum;
import org.springframework.core.io.ClassPathResource;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* @name
* 背景资源
*/
public class BackgroundUtils {
private static final List<ClassPathResource> backgroundBigList = new ArrayList<>();
private static final List<ClassPathResource> backgroundSmallList = new ArrayList<>();
static {
for (int i = 0; i < 10; i++) {
ClassPathResource classPathResourceBig = new ClassPathResource("backgroundImg/big/" + i + ".jpg");
ClassPathResource classPathResourceSmall = new ClassPathResource("backgroundImg/small/" + i + ".jpg");
if (classPathResourceBig.exists()) {
backgroundBigList.add(classPathResourceBig);
}
if(classPathResourceSmall.exists()){
backgroundSmallList.add(classPathResourceSmall);
}
}
}
public static List<ClassPathResource> getBackgroundResource(BackgroundTypeEnum type){
if(type==BackgroundTypeEnum.SMALL){
return backgroundSmallList;
}else{
return backgroundBigList;
}
}
public static int getRandomNumber(int lowerbound, i