mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交新手引导
This commit is contained in:
@@ -16,7 +16,6 @@ export class HomeView extends JNGLayerBase {
|
||||
frameText:Label;
|
||||
|
||||
async onLoad(){
|
||||
app.layer.Open(GUI.Tips,{text:(await API.GetPlayerInfo()).msg});
|
||||
}
|
||||
|
||||
update(){
|
||||
|
29
JisolGameCocos/assets/script/ui/Home/MainView.ts
Normal file
29
JisolGameCocos/assets/script/ui/Home/MainView.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { _decorator, Component, Label, Node } from 'cc';
|
||||
import { app, JNGLayerBase } from '../../App';
|
||||
import { sp } from 'cc';
|
||||
import PlayerPetData from '../../data/PlayerPetData';
|
||||
import { GUI } from '../UIConfig';
|
||||
import { UIPetAnim } from '../../consts/GData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainView')
|
||||
export class MainView extends JNGLayerBase {
|
||||
|
||||
//宠物
|
||||
@property(sp.Skeleton)
|
||||
spine:sp.Skeleton;
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
//显示被选择的宠物
|
||||
this.spine.skeletonData = app.battleRes.roleSpine[PlayerPetData.getIns().getData()[0].petTbId];
|
||||
this.spine.setAnimation(0,UIPetAnim.std,true);
|
||||
}
|
||||
|
||||
//点击回到之前的主页
|
||||
onClickHome(){
|
||||
app.layer.Open(GUI.Home);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
1
JisolGameCocos/assets/script/ui/Home/MainView.ts.meta
Normal file
1
JisolGameCocos/assets/script/ui/Home/MainView.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"b51bf2af-b227-4d3c-a05b-162ac0160408","files":[],"subMetas":{},"userData":{}}
|
@@ -35,7 +35,7 @@ export default class LoadingView extends JNGLayerBase {
|
||||
await NoviceManager.getIns().onStart();
|
||||
|
||||
//关闭加载页
|
||||
await app.layer.Open(GUI.Home);
|
||||
await app.layer.Open(GUI.Main);
|
||||
app.layer.Close(GUI.Loading);
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import Singleton from "../../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||
import { app } from "../../App";
|
||||
import PlayerData from "../../data/PlayerData";
|
||||
import PlayerPetData from "../../data/PlayerPetData";
|
||||
import { GUI } from "../UIConfig";
|
||||
|
||||
export default class NoviceManager extends Singleton{
|
||||
@@ -7,11 +9,19 @@ export default class NoviceManager extends Singleton{
|
||||
//新手引导执行
|
||||
async onStart(){
|
||||
|
||||
if(!(app.data.getPlayerInfo().novice)){
|
||||
//获取玩家信息是否引导过
|
||||
if(!(PlayerData.getIns().data.novice)){
|
||||
//如果没有过引导则打开引导页面
|
||||
await app.layer.OpenToClose(GUI.NoviceNamingView);
|
||||
}
|
||||
|
||||
//获取玩家信息是否选择过宠物(有没有宠物)
|
||||
//如果没有宠物则弹出让玩家选择宠物
|
||||
if(PlayerPetData.getIns().getData().length == 0){
|
||||
//没有宠物则弹出选择宠物页面
|
||||
await app.layer.OpenToClose(GUI.NoviceSelectPetView);
|
||||
}
|
||||
|
||||
console.log("新手引导结束");
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,83 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { JNGLayerBase } from '../../App';
|
||||
import { JNGLayerBase, TD, app } from '../../App';
|
||||
import { TbGGlobalEnum } from '../../../resources/config/TbGGlobalEnum';
|
||||
import { _decorator,Node } from 'cc';
|
||||
import { sp } from 'cc';
|
||||
import { UIPetAnim } from '../../consts/GData';
|
||||
import { Sprite } from 'cc';
|
||||
import { Color } from 'cc';
|
||||
import { API } from '../../consts/API';
|
||||
import { GUI } from '../UIConfig';
|
||||
import PlayerPetData from '../../data/PlayerPetData';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@ccclass('NoviceSelectPetView')
|
||||
export class NoviceSelectPetView extends JNGLayerBase {
|
||||
|
||||
//选择宠物的节点
|
||||
@property([Node])
|
||||
selects:Node[] = [];
|
||||
|
||||
//可选择宠物的列表
|
||||
petIds:number[];
|
||||
//选择index
|
||||
index:number = 0;
|
||||
|
||||
async onJNLoad(data?: any) {
|
||||
|
||||
super.onJNLoad();
|
||||
|
||||
//加载配置表 (找到可选择的宠物Id)
|
||||
let info = TD.TbGGlobal.get(TbGGlobalEnum.SELECT_PET_ID);
|
||||
this.petIds = JSON.parse(info.args);
|
||||
|
||||
//显示宠物
|
||||
this.selects.forEach((item,index) => {
|
||||
//获取Spine组件
|
||||
let spine = item.getComponentInChildren(sp.Skeleton);
|
||||
//设置显示的角色
|
||||
spine.skeletonData = app.battleRes.roleSpine[this.petIds[index]];
|
||||
//全部角色播放等待动画
|
||||
spine.setAnimation(0,UIPetAnim.std,true);
|
||||
})
|
||||
|
||||
this.onUpdateView();
|
||||
|
||||
}
|
||||
|
||||
//更新UI
|
||||
onUpdateView(){
|
||||
|
||||
this.selects.forEach(item => {
|
||||
item.getComponent(Sprite).color = new Color("8D8D8D");
|
||||
})
|
||||
|
||||
//被选择赋黑
|
||||
this.selects[this.index].getComponent(Sprite).color = new Color("#000000");
|
||||
|
||||
}
|
||||
|
||||
//点击选择
|
||||
onClickSelect(e,data){
|
||||
|
||||
let index = parseInt(data);
|
||||
|
||||
this.index = index;
|
||||
|
||||
//更新UI
|
||||
this.onUpdateView();
|
||||
|
||||
}
|
||||
|
||||
//点击确定
|
||||
async onClickOk(){
|
||||
|
||||
//向服务器确认选择
|
||||
console.log(await PlayerPetData.getIns().SelectNovicePet(this.petIds[this.index]));
|
||||
app.layer.Open(GUI.Tips,{text:"选择宠物成功 欢迎来到宠物世界..."});
|
||||
//关闭页面
|
||||
app.layer.CloseNode(this.node);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -18,6 +18,7 @@ export enum GUI{
|
||||
NoviceSelectPetView = "NoviceSelectPetView", //新手引导页面 - 选择宠物
|
||||
|
||||
Home = "Home", //主页面
|
||||
Main = "Main", //主页面2
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +83,16 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
|
||||
},
|
||||
},
|
||||
[GUI.Main]:{
|
||||
layer:GLayer.View,
|
||||
uri: "prefab/ui/主页/MainView",
|
||||
anims:{
|
||||
front:JNLayerAnim.Enlarge,
|
||||
back:JNLayerAnim.Smaller,
|
||||
frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
|
||||
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
|
||||
},
|
||||
},
|
||||
...UISystemConfig, //系统页面
|
||||
...UINoviceConfig, //新手引导页面
|
||||
}
|
||||
|
Reference in New Issue
Block a user