130 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
import { ConfigParseUtils } from './ConfigParseUtils';
 | 
						|
 | 
						|
 | 
						|
 | 
						|
import { DressSourceType } from './Enums';
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * PetPartConfig数据结构
 | 
						|
 */
 | 
						|
export class PetPartConfigData {
 | 
						|
 | 
						|
    private _id: number;
 | 
						|
 | 
						|
    private _name: string;
 | 
						|
 | 
						|
    private _bundle: string;
 | 
						|
 | 
						|
    private _path: string;
 | 
						|
 | 
						|
    private _sourceType: DressSourceType;
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /** id */
 | 
						|
 | 
						|
    public get id(): number {
 | 
						|
 | 
						|
        return this._id;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /** 装扮名称 */
 | 
						|
 | 
						|
    public get name(): string {
 | 
						|
 | 
						|
        return this._name;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /** bundle */
 | 
						|
 | 
						|
    public get bundle(): string {
 | 
						|
 | 
						|
        return this._bundle;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /** 资源路径 */
 | 
						|
 | 
						|
    public get path(): string {
 | 
						|
 | 
						|
        return this._path;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /** 资源类型 */
 | 
						|
 | 
						|
    public get sourceType(): DressSourceType {
 | 
						|
 | 
						|
        return this._sourceType;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
    public constructor(
 | 
						|
 | 
						|
        id: number,
 | 
						|
 | 
						|
        name: string,
 | 
						|
 | 
						|
        bundle: string,
 | 
						|
 | 
						|
        path: string,
 | 
						|
 | 
						|
        sourceType: DressSourceType
 | 
						|
 | 
						|
    ) {
 | 
						|
 | 
						|
        this._id = id;
 | 
						|
 | 
						|
        this._name = name;
 | 
						|
 | 
						|
        this._bundle = bundle;
 | 
						|
 | 
						|
        this._path = path;
 | 
						|
 | 
						|
        this._sourceType = sourceType;
 | 
						|
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * 解析配置数据
 | 
						|
 */
 | 
						|
export function parsePetPartConfigData(data: any): PetPartConfigData {
 | 
						|
    return new PetPartConfigData(
 | 
						|
 | 
						|
        ConfigParseUtils.parseInt(data.id),
 | 
						|
 | 
						|
        ConfigParseUtils.parseString(data.name),
 | 
						|
 | 
						|
        ConfigParseUtils.parseString(data.bundle),
 | 
						|
 | 
						|
        ConfigParseUtils.parseString(data.path),
 | 
						|
 | 
						|
        data.sourceType as DressSourceType
 | 
						|
 | 
						|
    );
 | 
						|
} |