mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交挂机
This commit is contained in:
@@ -7,7 +7,7 @@ import { JNGLayerBase } from '../../components/JNComponent';
|
||||
import { app } from '../../App';
|
||||
import { GAction } from '../../consts/GAction';
|
||||
import { GAPI } from '../../consts/GAPI';
|
||||
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
|
||||
import GOnHookManager, { GOnHookManagerEvent } from '../../manager/battle/mode/GOnHookManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainView')
|
||||
@@ -15,16 +15,35 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
@property(Label)
|
||||
playerNameLabel:Label; //玩家名称
|
||||
|
||||
@property(Label)
|
||||
onHookLabel:Label; //挂机文本
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
|
||||
super.onJNLoad(data);
|
||||
|
||||
//发送消息
|
||||
ChatData.getIns().onSend({
|
||||
message:`${PlayerData.getIns().data.playerId} 加入游戏`
|
||||
});
|
||||
|
||||
this.onUpdateView();
|
||||
|
||||
|
||||
//监听
|
||||
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
onJNClose(): void {
|
||||
super.onJNClose();
|
||||
//取消监听
|
||||
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
|
||||
}
|
||||
|
||||
onUpdateOnHook(){
|
||||
this.onHookLabel.string = (GOnHookManager.getIns().isOnHook) ? "挂机中" : "挂机";
|
||||
}
|
||||
|
||||
//更新UI界面
|
||||
|
@@ -2,9 +2,12 @@ import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
|
||||
import GOnHookData from '../../../data/GOnHookData';
|
||||
import { TD } from '../../../App';
|
||||
import { app, TD } from '../../../App';
|
||||
import { NodeEventType } from 'cc';
|
||||
import { TablePetIconSelectScroll } from '../../Consts/Pet/table/TablePetIconSelectScroll';
|
||||
import { Label } from 'cc';
|
||||
import GOnHookManager from '../../../manager/battle/mode/GOnHookManager';
|
||||
import { GUI } from '../../UIConfig';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainOnHookView')
|
||||
@@ -13,6 +16,10 @@ export class MainOnHookView extends JNGLayerBase {
|
||||
//野怪列表
|
||||
@property(JNScrollView)
|
||||
views:JNScrollView;
|
||||
|
||||
//挂机按钮
|
||||
@property(Label)
|
||||
onHookLabel:Label;
|
||||
|
||||
onJNLoad(){
|
||||
|
||||
@@ -28,11 +35,12 @@ export class MainOnHookView extends JNGLayerBase {
|
||||
onUpdateView(){
|
||||
|
||||
//显示当前地图可出现的所有宠物
|
||||
|
||||
let mapInfo = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap);
|
||||
let pets = mapInfo.petIds.map(petId => TD.TbGRole.get(petId));
|
||||
this.views.refreshData(pets);
|
||||
|
||||
this.onHookLabel.string = (!GOnHookManager.getIns().isOnHook) ? "挂机" : "取消挂机"
|
||||
|
||||
}
|
||||
|
||||
//点击Item
|
||||
@@ -43,6 +51,14 @@ export class MainOnHookView extends JNGLayerBase {
|
||||
|
||||
}
|
||||
|
||||
//点击挂机
|
||||
onClickOnHook(){
|
||||
GOnHookManager.getIns().onHookCatchPets = this.views.getItems<TablePetIconSelectScroll>().filter(item => item.select.isSelect).map(item => item.data)
|
||||
GOnHookManager.getIns().isOnHook = !GOnHookManager.getIns().isOnHook;
|
||||
app.layer.Open(GUI.Tips,{text:`${(GOnHookManager.getIns().isOnHook) ? "挂机" : "取消挂机"} 设置成功`})
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -91,8 +91,7 @@ export class MainSreepsList extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if(await GOnHookManager.getIns().onCatchCreeps(item.data))
|
||||
app.layer.Open(GUI.Tips,{text:"捕捉成功!"});
|
||||
await GOnHookManager.getIns().onCatchCreeps(item.data)
|
||||
|
||||
}
|
||||
|
||||
@@ -107,8 +106,7 @@ export class MainSreepsList extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if(await GOnHookManager.getIns().onSellCreeps(item.data))
|
||||
app.layer.Open(GUI.Tips,{text:"出售成功!"});
|
||||
await GOnHookManager.getIns().onSellCreeps(item.data)
|
||||
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,8 @@ import { app, TD } from '../../App';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { ProgressBar } from 'cc';
|
||||
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
|
||||
import { Toggle } from 'cc';
|
||||
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PetUpStarView')
|
||||
@@ -30,6 +32,9 @@ export class PetUpStarView extends JNLayerBase {
|
||||
@property(JProgressBar)
|
||||
viewPetExpProgress:JProgressBar; //预览宠物经验条
|
||||
|
||||
@property(Toggle)
|
||||
isEngulfToggle:Toggle; //是否主动吞噬 0 星 宠物
|
||||
|
||||
data:PlayerPetOV;
|
||||
|
||||
onJNLoad(data: PlayerPetOV): void {
|
||||
@@ -70,6 +75,9 @@ export class PetUpStarView extends JNLayerBase {
|
||||
|
||||
this.onUpdateSelect();
|
||||
|
||||
//更新吞噬
|
||||
this.isEngulfToggle.isChecked = GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data) >= 0;
|
||||
|
||||
}
|
||||
|
||||
//刷新信息
|
||||
@@ -149,6 +157,7 @@ export class PetUpStarView extends JNLayerBase {
|
||||
|
||||
//点击合成
|
||||
async onClickUp(){
|
||||
|
||||
//获取被合成的Id
|
||||
let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId);
|
||||
|
||||
@@ -158,9 +167,16 @@ export class PetUpStarView extends JNLayerBase {
|
||||
}
|
||||
|
||||
await API.PetUpStar(this.data.petId,pets);
|
||||
app.layer.Open(GUI.Tips,{text:"合成成功"});
|
||||
|
||||
}
|
||||
|
||||
//点击吞噬选择
|
||||
onClickEngulfToggle(){
|
||||
GOnHookManager.getIns().onHookEngulfPets.splice(GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data),1);
|
||||
if(this.isEngulfToggle.isChecked){
|
||||
GOnHookManager.getIns().onHookEngulfPets.push(this.data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -132,8 +132,7 @@ export class IntoBattleView extends JNLayerBase {
|
||||
app.layer.Open(GUI.Tips,{text:"请选择宠物."})
|
||||
return;
|
||||
}
|
||||
if(await API.PetUpLevel(this.pets[this.index].petId))
|
||||
app.layer.Open(GUI.Tips,{text:"升级成功!"})
|
||||
await API.PetUpLevel(this.pets[this.index].petId)
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user