|
@@ -161,11 +161,8 @@ export class GunfightShootUI extends BaseExp {
|
|
|
const gData:any = Game.I.player.pData;
|
|
|
if(!gData)return;
|
|
|
this.crossHair.active = true;//准心
|
|
|
- if(gData.type == 2){//步枪
|
|
|
- this.scopeOverlay.active = false;//标准贴图
|
|
|
- }else{
|
|
|
- this.scopeOverlay.active = true;//标准贴图
|
|
|
- }
|
|
|
+ //步枪没有开镜贴图
|
|
|
+ this.scopeOverlay.active = !this.isRifleGun();
|
|
|
this.gun_name_label.string = gData.name_lang;
|
|
|
const isSnipeGun: boolean = gData.type == 1;
|
|
|
//换弹夹进度条
|
|
@@ -324,10 +321,10 @@ export class GunfightShootUI extends BaseExp {
|
|
|
this.isZoomingIn = true;
|
|
|
//将 zoomingSpeed 转换为持续时间(450对应1.2秒)
|
|
|
this.zoomDuration = 72 / gData.zoomingSpeed;
|
|
|
- //使用枪械类型决定视口倍数
|
|
|
+ //使用枪械类型决定视口倍数 步枪使用 rifleZoom 狙击枪使用 scopeZoom
|
|
|
const zoomMultiplier = isRifle ?
|
|
|
- 1 / gData.rifleZoom : // 步枪使用 rifleZoom
|
|
|
- 1 / gData.scopeZoom; // 狙击枪使用 scopeZoom
|
|
|
+ 1 / gData.rifleZoom :
|
|
|
+ 1 / gData.scopeZoom;
|
|
|
this.targetFov = this.originalFov * zoomMultiplier;
|
|
|
//保持原有速度计算逻辑
|
|
|
const fovDifference = this.originalFov - this.targetFov;
|
|
@@ -365,7 +362,7 @@ export class GunfightShootUI extends BaseExp {
|
|
|
let screenPos = camera2D.worldToScreen(worldPos);
|
|
|
//校准补偿准心的偏移量
|
|
|
screenPos.x -= 0;
|
|
|
- screenPos.y += 20;
|
|
|
+ screenPos.y += this._isScopeOpen ? 80 : 20;
|
|
|
//从摄像机发射通过准心的射线
|
|
|
const ray = new geometry.Ray();
|
|
|
Game.I.camera.screenPointToRay(screenPos.x, screenPos.y, ray);
|
|
@@ -413,7 +410,16 @@ export class GunfightShootUI extends BaseExp {
|
|
|
if (btnName === 'pause_btn') { // 暂停页面
|
|
|
uiMgr.show(Constants.popUIs.pauseUI);
|
|
|
}else if (btnName === 'shot_btn') {//射击
|
|
|
- Game.I.player.shoot();
|
|
|
+ if(this.isRifleGun){
|
|
|
+ //模拟按下射击
|
|
|
+ this._isScopeOpen = true;
|
|
|
+ Game.I.player.shoot();
|
|
|
+ this.scheduleOnce(()=>{
|
|
|
+ this._isScopeOpen = false;
|
|
|
+ },1.5)
|
|
|
+ }else{
|
|
|
+ Game.I.player.shoot();
|
|
|
+ }
|
|
|
}else if (btnName === 'cut_gun_btn') {//切枪
|
|
|
Game.I.player.randomCutGun()
|
|
|
}else if(btnName === 'clean_btn'){//重新加载数据
|