refactor(all-in-one): Organize DomainTypes into Flag objects and change type in handleConvertion
- Refactored DomainTypes to a list of Flag objects for better organization - Changed the domain parameter type in handleConvertion from DomainTypes to string, to remove unnecessary coupling from code.
This commit is contained in:
parent
1b14be445e
commit
2b9a2720bc
@ -1,18 +1,15 @@
|
||||
import { Show, createEffect } from 'solid-js'
|
||||
import { Show } from 'solid-js'
|
||||
import type { Component } from 'solid-js'
|
||||
import type { MotionComponentProps, Variant } from '@motionone/solid'
|
||||
import { Motion, Presence } from '@motionone/solid'
|
||||
|
||||
export interface AnimateViewProps extends MotionComponentProps {
|
||||
animation: Record<string, Variant>
|
||||
animation?: Record<string, Variant>
|
||||
condition: boolean
|
||||
class?: string
|
||||
}
|
||||
|
||||
export const AnimateView: Component<AnimateViewProps> = (props) => {
|
||||
createEffect(() => {
|
||||
console.log(props.condition)
|
||||
})
|
||||
return (
|
||||
<Presence>
|
||||
<Show when={props.condition}>
|
||||
|
@ -2,3 +2,4 @@ export * from './Loader'
|
||||
export * from './AnimateView'
|
||||
export * from './Image'
|
||||
export * from './Button'
|
||||
export * from './Flag'
|
||||
|
@ -1,13 +1,13 @@
|
||||
export enum DomainTypes {
|
||||
Portuguese = 'com.br',
|
||||
Turkish = 'com.tr',
|
||||
English = 'com',
|
||||
German = 'de',
|
||||
Spanish = 'es',
|
||||
Finnish = 'fi',
|
||||
French = 'fr',
|
||||
Italian = 'it',
|
||||
Dutch = 'nl'
|
||||
}
|
||||
// ISO 3166-1-alpha-2 Flags
|
||||
|
||||
export const SUPPORTED_LANGS = Object.keys(DomainTypes)
|
||||
export const SUPPORTED_LANGS = [
|
||||
{ name: 'Portuguese', code: 'br', domain: 'com.br' },
|
||||
{ name: 'Turkish', code: 'tr', domain: 'com.tr' },
|
||||
{ name: 'English', code: 'us', domain: 'com' },
|
||||
{ name: 'German', code: 'de', domain: 'de' },
|
||||
{ name: 'Spanish', code: 'es', domain: 'es' },
|
||||
{ name: 'Finnish', code: 'fi', domain: 'fi' },
|
||||
{ name: 'French', code: 'fr', domain: 'fr' },
|
||||
{ name: 'Italian', code: 'it', domain: 'it' },
|
||||
{ name: 'Dutch', code: 'nl', domain: 'nl' }
|
||||
]
|
||||
|
@ -1,48 +0,0 @@
|
||||
import type { IFurni, IFurniData, IXML, KeyValuePairs } from '../types'
|
||||
|
||||
export class FurniData {
|
||||
public data: IFurniData = { floorItems: [], wallItems: [] }
|
||||
public fileName: string
|
||||
|
||||
constructor(data: IXML, fileName: string) {
|
||||
this.fileName = fileName
|
||||
|
||||
this.parseRoomItemTypes(data.roomitemtypes.furnitype)
|
||||
this.parseWallItemTypes(data.roomitemtypes.furnitype)
|
||||
}
|
||||
|
||||
private parseRoomItemTypes(roomItems: IFurni[]): void {
|
||||
for (const roomItem of roomItems) {
|
||||
this.data.floorItems.push(roomItem)
|
||||
}
|
||||
}
|
||||
|
||||
private parseWallItemTypes(wallItems: IFurni[]): void {
|
||||
for (const wallItem of wallItems) {
|
||||
this.data.wallItems.push(wallItem)
|
||||
}
|
||||
}
|
||||
|
||||
private getClassNameRevision(itemType: IFurni): { className: string; revision: number } {
|
||||
const className = itemType.classname.split('*')[0]
|
||||
const revision = itemType.revision
|
||||
|
||||
return { className, revision }
|
||||
}
|
||||
|
||||
public get classNamesAndRevisions(): KeyValuePairs<string, string> {
|
||||
const entries: KeyValuePairs<string, string> = {}
|
||||
|
||||
for (const roomItem of this.data.floorItems) {
|
||||
const { className, revision } = this.getClassNameRevision(roomItem)
|
||||
entries[className] = String(revision)
|
||||
}
|
||||
|
||||
for (const wallItem of this.data.wallItems) {
|
||||
const { className, revision } = this.getClassNameRevision(wallItem)
|
||||
entries[className] = String(revision)
|
||||
}
|
||||
|
||||
return entries
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
export * from './EffectMap'
|
||||
export * from './FigureMap'
|
||||
export * from './FigureData'
|
||||
export * from './FurniData'
|
@ -2,13 +2,12 @@ import { ResponseType } from '@tauri-apps/api/http'
|
||||
|
||||
import { GAMEDATA_ENDPOINTS, client } from '../config/Endpoints'
|
||||
import type { ConvertionHandler } from '../types'
|
||||
import type { DomainTypes } from '../config/Domain'
|
||||
import { parseData } from './parseData'
|
||||
import { Convertion } from '../config/Convertion'
|
||||
import { downloadGamedata } from './rusty'
|
||||
|
||||
export const handleConvertion = async (
|
||||
domain: DomainTypes,
|
||||
domain: string,
|
||||
callback: ConvertionHandler,
|
||||
assetsOption = false
|
||||
): Promise<void> => {
|
||||
|
14
src/types/Converters.d.ts
vendored
14
src/types/Converters.d.ts
vendored
@ -1,11 +1,4 @@
|
||||
import type {
|
||||
IFigureDataPalette,
|
||||
IFigureDataSetType,
|
||||
IFigureMapLibrary,
|
||||
IFloorItem,
|
||||
IFurni,
|
||||
IProduct
|
||||
} from './SubConverters'
|
||||
import type { IFigureDataPalette, IFigureDataSetType, IFigureMapLibrary, IProduct } from './SubConverters'
|
||||
|
||||
export interface IFigureData {
|
||||
palettes: IFigureDataPalette[]
|
||||
@ -17,11 +10,6 @@ export interface IFigureMap {
|
||||
parts: Record<string, Record<number, number>>
|
||||
}
|
||||
|
||||
export interface IFurniData {
|
||||
floorItems: IFloorItem[]
|
||||
wallItems: IFurni[]
|
||||
}
|
||||
|
||||
export type IEffectMap = Record<string, Record<string, string>>
|
||||
|
||||
export interface IProductData {
|
||||
|
30
src/types/SubConverters.d.ts
vendored
30
src/types/SubConverters.d.ts
vendored
@ -1,33 +1,3 @@
|
||||
export interface IFloorItemDimensions {
|
||||
x: number
|
||||
y: number
|
||||
defaultDirection: number
|
||||
}
|
||||
|
||||
export interface IFloorItemPermissions {
|
||||
canSitOn: boolean
|
||||
canLayOn: boolean
|
||||
canStandOn: boolean
|
||||
}
|
||||
|
||||
export interface IFloorItem extends IFurni {
|
||||
dimensions: IFloorItemDimensions
|
||||
permissions: IFloorItemPermissions
|
||||
}
|
||||
|
||||
export interface IFurni {
|
||||
id: number
|
||||
classname: string
|
||||
description?: string
|
||||
name?: string
|
||||
furniLine?: string
|
||||
customParams?: string
|
||||
adurl?: string
|
||||
offerID?: number
|
||||
excludeDynamic: boolean
|
||||
specialType: number
|
||||
}
|
||||
|
||||
export type Club = 'idle' | 'HC' | 'VIP'
|
||||
|
||||
export interface IFigureDataPaletteType {
|
||||
|
Loading…
Reference in New Issue
Block a user