代码调整

This commit is contained in:
joylink_fanyuhong 2024-11-11 17:56:21 +08:00
parent dee2b5ca7f
commit 1d2c1c337e
8 changed files with 26 additions and 75 deletions

View File

@ -1,21 +0,0 @@
{
"frames": {
"normal.png": {
"frame": { "x": 0, "y": 0, "w": 33, "h": 33 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 33, "h": 33 },
"sourceSize": { "w": 33, "h": 33 },
"anchor": { "x": 0.5, "y": 0.5 }
}
},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.1",
"image": "FireShutter.png",
"format": "RGBA8888",
"size": { "w": 33, "h": 33 },
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

View File

@ -1,8 +1,8 @@
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic'; import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
// import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; // import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import FireShutterJson from './fireShutter.json'; import FasDeviceJson from '../pndDevice/PngDevice.json';
import FireShutterAssets from './fireShutter.png'; import FasDeviceAssets from '../pndDevice/FasDevice.png';
export interface IFireShutterData extends GraphicData { export interface IFireShutterData extends GraphicData {
get code(): string; get code(): string;
@ -11,6 +11,10 @@ export interface IFireShutterData extends GraphicData {
interface FireShutterTextures { interface FireShutterTextures {
normal: Texture; normal: Texture;
alarm: Texture;
fall: Texture;
interruption: Texture;
halfFall: Texture;
} }
export class FireShutter extends JlGraphic { export class FireShutter extends JlGraphic {
@ -52,11 +56,15 @@ export class FireShutterTemplate extends JlGraphicTemplate<FireShutter> {
throw new Error('资源未加载/加载失败'); throw new Error('资源未加载/加载失败');
} }
async loadAssets(): Promise<FireShutterTextures> { async loadAssets(): Promise<FireShutterTextures> {
const texture = await Assets.load(FireShutterAssets); const texture = await Assets.load(FasDeviceAssets);
const fireShutterSheet = new Spritesheet(texture, FireShutterJson); const fireShutterSheet = new Spritesheet(texture, FasDeviceJson);
const result = await fireShutterSheet.parse(); const result = await fireShutterSheet.parse();
this.fireShutterTextures = { this.fireShutterTextures = {
normal: result['normal.png'], normal: result['fireShutterNormal.png'],
alarm: result['fireShutterAlarm.png'],
fall: result['fireShutterFall.png'],
interruption: result['fireShutterInterruption.png'],
halfFall: result['fireShutterHalfFall.png'],
}; };
return this.fireShutterTextures as FireShutterTextures; return this.fireShutterTextures as FireShutterTextures;
} }

View File

@ -1,21 +0,0 @@
{
"frames": {
"normal.png": {
"frame": { "x": 0, "y": 0, "w": 21, "h": 11 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 21, "h": 11 },
"sourceSize": { "w": 21, "h": 11 },
"anchor": { "x": 0.5, "y": 0.5 }
}
},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.1",
"image": "SmokeDetector.png",
"format": "RGBA8888",
"size": { "w": 21, "h": 11 },
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

View File

@ -1,21 +0,0 @@
{
"frames": {
"normal.png": {
"frame": { "x": 0, "y": 0, "w": 22, "h": 46 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0, "y": 0, "w": 22, "h": 46 },
"sourceSize": { "w": 22, "h": 46 },
"anchor": { "x": 0.5, "y": 0.5 }
}
},
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.1",
"image": "SprayPump.png",
"format": "RGBA8888",
"size": { "w": 27, "h": 26 },
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:e7620bd2d73cc0b3e2deea9704e7eefc:f129a1d9e4b9ba57720b3861c22b155b:eb2d421f7759984b7713aa4aa5354134$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1,8 +1,8 @@
import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic'; import { GraphicData, JlGraphic, JlGraphicTemplate } from 'jl-graphic';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
// import { iscsGraphicData } from 'src/protos/iscs_graphic_data'; // import { iscsGraphicData } from 'src/protos/iscs_graphic_data';
import SprayPumpJson from './SprayPump.json'; import FasDeviceJson from '../pndDevice/PngDevice.json';
import SparyPumpAssets from './SprayPump.png'; import FasDeviceAssets from '../pndDevice/FasDevice.png';
export interface ISprayPumpData extends GraphicData { export interface ISprayPumpData extends GraphicData {
get code(): string; get code(): string;
@ -10,7 +10,10 @@ export interface ISprayPumpData extends GraphicData {
} }
interface SprayPumpTextures { interface SprayPumpTextures {
normal: Texture; run: Texture;
stop: Texture;
fault: Texture;
interruption: Texture;
} }
export class SprayPump extends JlGraphic { export class SprayPump extends JlGraphic {
@ -25,7 +28,7 @@ export class SprayPump extends JlGraphic {
this.sprayPumpTextures = sprayPumpTextures; this.sprayPumpTextures = sprayPumpTextures;
this._sprayPump.anchor.set(0.5); this._sprayPump.anchor.set(0.5);
this.addChild(this._sprayPump); this.addChild(this._sprayPump);
this._sprayPump.texture = this.sprayPumpTextures.normal; this._sprayPump.texture = this.sprayPumpTextures.run;
} }
get code(): string { get code(): string {
return this.datas.code; return this.datas.code;
@ -52,11 +55,14 @@ export class SprayPumpTemplate extends JlGraphicTemplate<SprayPump> {
throw new Error('资源未加载/加载失败'); throw new Error('资源未加载/加载失败');
} }
async loadAssets(): Promise<SprayPumpTextures> { async loadAssets(): Promise<SprayPumpTextures> {
const texture = await Assets.load(SparyPumpAssets); const texture = await Assets.load(FasDeviceAssets);
const sprayPumpSheet = new Spritesheet(texture, SprayPumpJson); const sprayPumpSheet = new Spritesheet(texture, FasDeviceJson);
const result = await sprayPumpSheet.parse(); const result = await sprayPumpSheet.parse();
this.sprayPumpTextures = { this.sprayPumpTextures = {
normal: result['normal.png'], run: result['sprayPumpRun.png'],
stop: result['sprayPumpStop.png'],
fault: result['sprayPumpFault.png'],
interruption: result['sprayPumpInterruption.png'],
}; };
return this.sprayPumpTextures as SprayPumpTextures; return this.sprayPumpTextures as SprayPumpTextures;
} }