mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交锻造系统
This commit is contained in:
9
JisolGameCocos/assets/script/ui/Home/ForgingBench.meta
Normal file
9
JisolGameCocos/assets/script/ui/Home/ForgingBench.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "30ce933c-5000-49b3-a16a-3595e42bacbb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import PetEquipData from '../../../data/PetEquipData';
|
||||
import { app } from '../../../App';
|
||||
import { GUI } from '../../UIConfig';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
//锻造台
|
||||
@ccclass('MainForgingBench')
|
||||
export class MainForgingBench extends Component {
|
||||
|
||||
//点击锻造
|
||||
async onClickForging(){
|
||||
if(!PetEquipData.getIns().isForgingBenchPet){
|
||||
app.layer.Open(GUI.Tips,{text:"请选择锻造宠"});
|
||||
return;
|
||||
}
|
||||
PetEquipData.getIns().forging();
|
||||
app.layer.Open(GUI.PetEquipForgingPopupView);
|
||||
}
|
||||
|
||||
//点击锻造宠
|
||||
async onClickForgingPet(){
|
||||
app.layer.Open(GUI.PetRadioView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9b2f1109-b0bc-4cfc-978e-768af2a09b25",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
11
JisolGameCocos/assets/script/ui/Pet/PetRadioView.ts
Normal file
11
JisolGameCocos/assets/script/ui/Pet/PetRadioView.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//宠物单选页面
|
||||
@ccclass('PetRadioView')
|
||||
export class PetRadioView extends JNLayerBase {
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/ui/Pet/PetRadioView.ts.meta
Normal file
9
JisolGameCocos/assets/script/ui/Pet/PetRadioView.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "54ddf509-ad07-4caa-8931-ce6abfd7bbc5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/script/ui/PetEquip.meta
Normal file
9
JisolGameCocos/assets/script/ui/PetEquip.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "d35cf27a-07da-4228-b168-0b8b1f030c5f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//锻造宠物装备页面
|
||||
@ccclass('PetEquipForgingPopupView')
|
||||
export class PetEquipForgingPopupView extends JNLayerBase {
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "19e44699-645c-4b07-aff3-552dc7a12ba8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -15,6 +15,10 @@ import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
|
||||
import { Label } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export enum IntoBattleState{
|
||||
请选择 = "请选择",下阵 = "下阵",替阵 = "替阵",上阵 = "上阵"
|
||||
}
|
||||
|
||||
//上阵页面
|
||||
@ccclass('IntoBattleView')
|
||||
export class IntoBattleView extends JNLayerBase {
|
||||
@@ -100,9 +104,35 @@ export class IntoBattleView extends JNLayerBase {
|
||||
|
||||
//刷新上阵
|
||||
onUpdateTactical(){
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
this.tacticalLabel.string = `${petId ? "下阵" : "上阵"}`
|
||||
|
||||
//选择的宠物
|
||||
this.tacticalLabel.string = `${this.getIntoBattleState()}`;
|
||||
|
||||
}
|
||||
|
||||
//获取当前状态
|
||||
getIntoBattleState():IntoBattleState{
|
||||
|
||||
//选择的宠物
|
||||
let selectPet = this.pets[this.index];
|
||||
if(this.index == -1 || !selectPet) {
|
||||
return IntoBattleState.请选择
|
||||
}
|
||||
|
||||
//判断选中的宠物是否存在阵法里 存在则下阵
|
||||
let selectIndex = PlayerTacticalData.getIns().getItemIndex(selectPet.petId);
|
||||
if(selectIndex >= 0){
|
||||
|
||||
//存在 如果存在的下标是当前下标则下阵 不是 则替换
|
||||
if(selectIndex == this.tIndex)
|
||||
return IntoBattleState.下阵
|
||||
else return IntoBattleState.替阵;
|
||||
|
||||
}else{
|
||||
//不存在则上阵
|
||||
return IntoBattleState.上阵;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//点击Item
|
||||
@@ -118,26 +148,21 @@ export class IntoBattleView extends JNLayerBase {
|
||||
//点击上阵
|
||||
async onClickTactical(){
|
||||
|
||||
if(this.index < 0){
|
||||
let state = this.getIntoBattleState();
|
||||
|
||||
if(state == IntoBattleState.请选择){
|
||||
app.layer.Open(GUI.Tips,{text:"请选择要上阵的宠物."})
|
||||
return;
|
||||
}
|
||||
//获取当前阵法下标是否存在宠物
|
||||
let petId = PlayerTacticalData.getIns().getItem(this.tIndex);
|
||||
|
||||
if(petId) {
|
||||
//下阵
|
||||
}else if(state == IntoBattleState.上阵 || state == IntoBattleState.替阵){
|
||||
//修改上阵信息
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
|
||||
app.layer.Open(GUI.Tips,{text:"上阵成功"});
|
||||
}else if(state == IntoBattleState.下阵){
|
||||
//修改上阵信息
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,0);
|
||||
app.layer.Open(GUI.Tips,{text:"下阵成功"});
|
||||
//上阵完 关闭页面
|
||||
app.layer.CloseNode(this.node);
|
||||
return;
|
||||
}
|
||||
|
||||
//修改上阵信息
|
||||
await PlayerTacticalData.getIns().UpdateIndexTactical(this.tIndex,this.pets[this.index].petId);
|
||||
app.layer.Open(GUI.Tips,{text:"上阵成功"});
|
||||
|
||||
//上阵完 关闭页面
|
||||
app.layer.CloseNode(this.node);
|
||||
|
||||
|
@@ -21,10 +21,16 @@ export enum GUI{
|
||||
/** 主页页面 */
|
||||
MainChat = "MainChat", //主页聊天页面
|
||||
IntoBattleView = "IntoBattleView", //上阵页面
|
||||
PetUpStarView = "PetUpStarView", //宠物升星页面
|
||||
MainOnHookView = "MainOnHookView", //挂机弹窗
|
||||
MapSelectView = "MapSelectView", //地图选择页面
|
||||
|
||||
|
||||
/**宠物 */
|
||||
PetUpStarView = "PetUpStarView", //宠物升星页面
|
||||
PetRadioView = "PetRadioView", //宠物单选页面
|
||||
PetEquipForgingPopupView = "PetEquipForgingPopupView", //弹出锻造宠物装备页面
|
||||
|
||||
|
||||
/**游戏模式页面 */
|
||||
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
|
||||
CampGuardianView = "CampGuardianView", //阵营守护战斗页面
|
||||
@@ -106,6 +112,16 @@ const UIPetConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
uri: "prefab/ui/宠物/宠物升星页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
[GUI.PetRadioView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/宠物/宠物单选页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
[GUI.PetEquipForgingPopupView]:{
|
||||
layer:GLayer.Popup,
|
||||
uri: "prefab/ui/宠物装备/弹出锻造装备页面",
|
||||
anims:BackOutScale,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user