Browse Source

修改访问数据的pai参数

dev
刘向辉 3 years ago
parent
commit
14264af999
  1. 6
      src/app/babylon/controller/data-manager.ts
  2. 10
      src/app/babylon/controller/serve-manager.ts
  3. 3
      src/app/babylon/controller/status/login-status.ts
  4. 5
      src/app/babylon/model/info/mark/model-info-mark.ts
  5. 2
      src/app/babylon/model/info/mark/other/mark-plan-particle-info.ts
  6. 4
      src/app/babylon/tool/particle-system-tool.ts
  7. 12
      src/app/service/babylon/building-basic-infos.service.ts

6
src/app/babylon/controller/data-manager.ts

@ -63,7 +63,7 @@ export class DataManager {
*/ */
static allMarkPlanData: AllMarkPlanData; static allMarkPlanData: AllMarkPlanData;
static initDebugData(institutionKey: string, onSuccess?: (key: string) => void, onError?: (key: string, error: string) => void) { static initDebugData(institutionID: number, onSuccess?: (key: string) => void, onError?: (key: string, error: string) => void) {
//本地捏造消防设备列表信息 //本地捏造消防设备列表信息
DataManager.initDebugData_facility(); DataManager.initDebugData_facility();
@ -75,7 +75,7 @@ export class DataManager {
if (dataFromServe) { if (dataFromServe) {
ServeManager.instance.getInstitutionData(institutionKey, (key, result) => { ServeManager.instance.getInstitutionData(institutionID, (key, result) => {
if (onSuccess) { if (onSuccess) {
DataManager.institutionData = plainToClass(InstitutionData, result); DataManager.institutionData = plainToClass(InstitutionData, result);
DataManager.institutionData.normalData.name = DataManager.institutionData_simple.name; DataManager.institutionData.normalData.name = DataManager.institutionData_simple.name;
@ -352,7 +352,7 @@ export class DataManager {
static init(simpleData: InsitutionDataSimple, onSuccess?: (key: string) => void) { static init(simpleData: InsitutionDataSimple, onSuccess?: (key: string) => void) {
DataManager.institutionData_simple = simpleData; DataManager.institutionData_simple = simpleData;
DataManager.initDebugData(simpleData.key, onSuccess); DataManager.initDebugData(simpleData.id, onSuccess);
} }
/** /**

10
src/app/babylon/controller/serve-manager.ts

@ -29,19 +29,19 @@ export class ServeManager {
} }
//从服务器获取单位信息 //从服务器获取单位信息
getInstitutionData(key: string = 'test', onSuccess?: (key: string, getInstitutionData(id: number = 1, onSuccess?: (key: string,
data: string data: string
) => void, onError?: (key: string, error: any) => void) { ) => void, onError?: (key: string, error: any) => void) {
this.buildingBISrv.getBuildingBasicInfos(key) this.buildingBISrv.getBuildingBasicInfos(id)
.subscribe(data => { .subscribe(data => {
//console.log("得到单位信息" + key, data); //console.log("得到单位信息" + key, data);
if (onSuccess) { if (onSuccess) {
onSuccess(key, JSON.parse((data as any).result)); onSuccess(id.toString(), JSON.parse((data as any).result));
} }
}, error => { }, error => {
console.error("From serve" + key + "===" + error); console.error("From serve:" + id, error);
if (onError) { if (onError) {
onError(key, error); onError(id.toString(), error);
} }
}) })
} }

3
src/app/babylon/controller/status/login-status.ts

@ -61,7 +61,8 @@ export class LoginSatus extends StatusBase {
// testIns1.key = "test"; // testIns1.key = "test";
// testIns1.name = "测试单位1"; // testIns1.name = "测试单位1";
// debugList.push(testIns1); // debugList.push(testIns1);
ServeManager.instance.getInstitutionData("InsList", (key, data) => { // -1 = InsList
ServeManager.instance.getInstitutionData(-1, (key, data) => {
debugList = plainToClass(InsitutionDataSimple, data); debugList = plainToClass(InsitutionDataSimple, data);
this.institutionList = debugList; this.institutionList = debugList;
if (onSuccess) { if (onSuccess) {

5
src/app/babylon/model/info/mark/model-info-mark.ts

@ -267,7 +267,9 @@ export class ModelInfo_mark extends ModelInfo {
// instance.uiFollowHeadBg.widthInPixels = maxWidth; // instance.uiFollowHeadBg.widthInPixels = maxWidth;
}, (50)); }, (50));
console.log("喷水", this.taskNeedWaterParticle());
if (this.taskNeedWaterParticle()) { if (this.taskNeedWaterParticle()) {
this.sprinklingWater(true); this.sprinklingWater(true);
} }
else { else {
@ -423,6 +425,9 @@ export class ModelInfo_mark extends ModelInfo {
// } // }
// } // }
} }
console.log("喷头", this.node_pz);
if (this.node_pz == null) { if (this.node_pz == null) {
result = false; result = false;
} }

2
src/app/babylon/model/info/mark/other/mark-plan-particle-info.ts

@ -68,6 +68,7 @@ export class ModelInfo_mark_particle extends ModelInfo_mark {
// instance.modelBox.scaling = new Vector3(100, 300, 100); // instance.modelBox.scaling = new Vector3(100, 300, 100);
ps.emitter = root; ps.emitter = root;
instance.particleSet.systems.push(ps); instance.particleSet.systems.push(ps);
console.log(ps.name, instance.isPlaying);
if (instance.isPlaying) { if (instance.isPlaying) {
instance.particleSet.start(); instance.particleSet.start();
} }
@ -127,6 +128,7 @@ export class ModelInfo_mark_particle extends ModelInfo_mark {
dispose() { dispose() {
if (this.particleSet != null) { if (this.particleSet != null) {
console.log("释放粒子", this.particleSet);
this.particleSet.dispose(); this.particleSet.dispose();
} }
super.dispose(); super.dispose();

4
src/app/babylon/tool/particle-system-tool.ts

@ -40,6 +40,7 @@ export class ParticleSystemTool {
let instance = this; let instance = this;
ParticleHelper.ParseFromFileAsync(null, path, this.scene, false).then((value: ParticleSystem) => { ParticleHelper.ParseFromFileAsync(null, path, this.scene, false).then((value: ParticleSystem) => {
value.stop(); value.stop();
value.name += "(prefab)";
instance.psPool.set(path, value); instance.psPool.set(path, value);
if (clone) { if (clone) {
let result = instance.cloneParticle(value, name); let result = instance.cloneParticle(value, name);
@ -65,10 +66,11 @@ export class ParticleSystemTool {
if (instance.psPool.has(path)) { if (instance.psPool.has(path)) {
let set = instance.psPool.get(path); let set = instance.psPool.get(path);
let result = instance.cloneParticle(set, name); let result = instance.cloneParticle(set, name);
console.log("克隆特效", name);
onSuccess(result); onSuccess(result);
} }
else { else {
console.log("加载特效", name);
instance.loadPrefab(null, path, true, (value: ParticleSystem) => { instance.loadPrefab(null, path, true, (value: ParticleSystem) => {
onSuccess(value); onSuccess(value);
}) })

12
src/app/service/babylon/building-basic-infos.service.ts

@ -27,8 +27,8 @@ export class BuildingBasicInfosService {
/** /**
* *
*/ */
getBuildingBasicInfos(name: string): Observable<string> { getBuildingBasicInfos(id: number): Observable<string> {
return this.getInfos(this.api_buildingInfo, name); return this.getInfos(this.api_buildingInfo, { gasStationId: id });
} }
/** /**
* *
@ -44,7 +44,7 @@ export class BuildingBasicInfosService {
* @param name * @param name
*/ */
getMarkData(name: string): Observable<string> { getMarkData(name: string): Observable<string> {
return this.getInfos(this.api_sandBox, name); return this.getInfos(this.api_sandBox, { "name": name });
} }
/** /**
@ -78,10 +78,10 @@ export class BuildingBasicInfosService {
* @param api * @param api
* @param name * @param name
*/ */
getInfos(api: string, name: string) { getInfos(api: string, params = {}) {
let id = { "name": name };
return this.http.get<string>(api + this.c_get, { params: id }).pipe(
return this.http.get<string>(api + this.c_get, { params: params }).pipe(
catchError((err) => this.handleError(err)) catchError((err) => this.handleError(err))
); );
} }

Loading…
Cancel
Save