added chunithm version selector in admin settings
This commit is contained in:
@ -34,11 +34,10 @@ import { toast } from "../../ui/use-toast";
|
||||
import { updateAvatarParts } from "./actions";
|
||||
type chunithm_avatar = chuni_static_avatar;
|
||||
|
||||
|
||||
const getAvatarTextureSrc = (id: number | undefined) => {
|
||||
if (id === undefined) return "";
|
||||
return `avatarAccessory/CHU_UI_Avatar_Tex_0${id}.png`;
|
||||
}
|
||||
};
|
||||
|
||||
type AvatarSelectionProps = {
|
||||
avatarHeadSelectionData: {
|
||||
@ -116,18 +115,18 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
}, []);
|
||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
// Existing state
|
||||
const unchangedHeadId = avatarHeadId;
|
||||
const unchangedFaceId = avatarFaceId;
|
||||
const unchangedBackId = avatarBackId;
|
||||
const unchangedWearId = avatarWearId;
|
||||
const unchangedItemId = avatarItemId;
|
||||
const defaultHeadId = avatarHeadId;
|
||||
const defaultFaceId = avatarFaceId;
|
||||
const defaultBackId = avatarBackId;
|
||||
const defaultWearId = avatarWearId;
|
||||
const defaultItemId = avatarItemId;
|
||||
|
||||
// either change to the new body part id or fallback to the unchanged if nothing has changed
|
||||
const newHeadId = data.AvatarHeadAccessory ?? unchangedHeadId;
|
||||
const newFaceId = data.AvatarFaceAccessory ?? unchangedFaceId;
|
||||
const newBackId = data.AvatarBackAccessory ?? unchangedBackId;
|
||||
const newWearId = data.AvatarWearAccessory ?? unchangedWearId;
|
||||
const newItemId = data.AvatarItemAccessory ?? unchangedItemId;
|
||||
// either change to the new body part id or fallback to the default if nothing has changed
|
||||
const newHeadId = data.AvatarHeadAccessory ?? defaultHeadId;
|
||||
const newFaceId = data.AvatarFaceAccessory ?? defaultFaceId;
|
||||
const newBackId = data.AvatarBackAccessory ?? defaultBackId;
|
||||
const newWearId = data.AvatarWearAccessory ?? defaultWearId;
|
||||
const newItemId = data.AvatarItemAccessory ?? defaultItemId;
|
||||
|
||||
updateAvatarParts(newHeadId, newFaceId, newBackId, newWearId, newItemId)
|
||||
.then(() => {
|
||||
@ -265,7 +264,7 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
name="AvatarHeadAccessory"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Avatar Head Item</FormLabel>
|
||||
<FormLabel className="pb-2">Avatar Head Item</FormLabel>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
@ -330,7 +329,7 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
name="AvatarFaceAccessory"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Avatar Face Item</FormLabel>
|
||||
<FormLabel className="pb-2">Avatar Face Item</FormLabel>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
@ -395,7 +394,7 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
name="AvatarItemAccessory"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Avatar Hand Item</FormLabel>
|
||||
<FormLabel className="pb-2">Avatar Hand Item</FormLabel>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
@ -460,7 +459,7 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
name="AvatarBackAccessory"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Avatar Back Item</FormLabel>
|
||||
<FormLabel className="pb-2">Avatar Back Item</FormLabel>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
@ -525,7 +524,7 @@ export const AvatarCustomization: FC<AvatarSelectionProps> = ({
|
||||
name="AvatarWearAccessory"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Avatar Clothing Item</FormLabel>
|
||||
<FormLabel className="pb-2">Avatar Clothing Item</FormLabel>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<FormControl>
|
||||
|
Reference in New Issue
Block a user