|
@@ -1,4 +1,4 @@
|
|
|
-import { AudioClip, AudioSourceComponent, ButtonComponent, Color, EventTouch, find, instantiate, LabelComponent, LayoutComponent, loader, Material, ModelComponent, Node, Prefab, Quat, SpriteComponent, SpriteFrame, systemEvent, SystemEventType, Touch, Vec2, view, _decorator } from 'cc';
|
|
|
+import { ButtonComponent, EventTouch, find, instantiate, LabelComponent, LayoutComponent, loader, ModelComponent, Node, Prefab, Quat, SpriteComponent, SpriteFrame, SystemEventType, Touch, Vec2, view, _decorator } from 'cc';
|
|
|
import { GUIManager } from '../../../engines/gui/GUIManager';
|
|
|
import { GUIMediator } from '../../../engines/gui/GUIMediator';
|
|
|
import { DataModelEventType } from '../../../engines/models/DataModelEventType';
|
|
@@ -9,10 +9,8 @@ import { PlatformManager } from '../../../Platform/PlatformManager';
|
|
|
import GameConfigManager from '../../models/GameConfigManager';
|
|
|
import { GameModel } from '../../models/GameModel';
|
|
|
import { GamePropertys } from '../../models/GamePropertys';
|
|
|
-import { WeaponCell } from '../../models/weapons/WeaponCell';
|
|
|
import { UIConst } from '../UIConst';
|
|
|
import { WeaponCellListView } from './WeaponCellListView';
|
|
|
-import { WeaponCellScript } from './WeaponCellScript';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('PrepareMediator')
|
|
@@ -123,6 +121,7 @@ export class PrepareMediator extends GUIMediator {
|
|
|
|
|
|
private weaponCellListView: WeaponCellListView;
|
|
|
|
|
|
+
|
|
|
onLoad(): void {
|
|
|
this.weaponCellListView = new WeaponCellListView(this);
|
|
|
}
|
|
@@ -152,9 +151,16 @@ export class PrepareMediator extends GUIMediator {
|
|
|
this.modelView.node.active = true;
|
|
|
|
|
|
let weaponConfig: any = GameConfigManager.GetWeaponConfig(GameModel.single.currentWeaponId);
|
|
|
- if (this.prefabInstance) {
|
|
|
+ if (this.modelPrefab) {
|
|
|
this.modelView.mesh = null;
|
|
|
+ let target=this.modelView.materials[0];
|
|
|
+ target.setProperty("mainTexture", null);
|
|
|
+
|
|
|
this.prefabInstance.destroy();
|
|
|
+ this.prefabInstance=null;
|
|
|
+ let deps:string[]=loader.getDependsRecursively(this.modelPrefab);
|
|
|
+ loader.release(deps);
|
|
|
+ this.modelPrefab=null;
|
|
|
}
|
|
|
loader.loadRes(weaponConfig.prefab, Prefab, (err, prefab) => {
|
|
|
if (err) {
|
|
@@ -180,7 +186,8 @@ export class PrepareMediator extends GUIMediator {
|
|
|
this.RemoveEvents();
|
|
|
|
|
|
this.modelView.mesh = null;
|
|
|
- this.modelView.setMaterial(null, 0);
|
|
|
+ let target=this.modelView.materials[0];
|
|
|
+ target.setProperty("mainTexture", null);
|
|
|
if (this.prefabInstance) {
|
|
|
this.prefabInstance.destroy();
|
|
|
}
|