implement the music game

This commit is contained in:
Akka
2022-06-26 20:16:50 +08:00
committed by Melledy
parent 977f1ca2ea
commit 12146ff09c
32 changed files with 780 additions and 80 deletions

View File

@@ -0,0 +1,38 @@
package emu.grasscutter.game.props;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;
@Getter
@AllArgsConstructor
public enum ActivityType {
NONE(0),
NEW_ACTIVITY_MUSIC_GAME(2202),
;
private final int value;
private static final Int2ObjectMap<ActivityType> map = new Int2ObjectOpenHashMap<>();
private static final Map<String, ActivityType> stringMap = new HashMap<>();
static {
Stream.of(values()).forEach(e -> {
map.put(e.getValue(), e);
stringMap.put(e.name(), e);
});
}
public static ActivityType getTypeByValue(int value) {
return map.getOrDefault(value, NONE);
}
public static ActivityType getTypeByName(String name) {
return stringMap.getOrDefault(name, NONE);
}
}