欢迎光临散文网 会员登陆 & 注册

【易次元2.0参考代码】NPC之信息展示

2023-03-19 15:45 作者:L-折骨  | 我要投稿

本文禁止以任何形式转载!仅供参考!

//生成NPC(数量10)

await NPC2(10);

//NPC信息界面底图

await ac.createImage({name: 'DT_NPCxinxi',index: 0,inlayer: 'window',resId: '$43112619',pos: {x: 640,y: 360,},anchor: {x: 50,y: 50,},opacity: 100,scale: 100,visible: true,verticalFlip: false,horizontalFlip: false,});

//层级(不是自适应模式可以删除)

await ac.createLayer({name: 'C_NPC',index: 100,inlayer: 'window',visible: true,pos: {x: 640,y: 360,},anchor: {x: 50,y: 50,},size: {width: 1280,height: 720,},clipMode: true,});

//NPC立绘调用

await NPC();

await ac.createText({name: 'WB_shuxing',index: 0,inlayer: 'C_NPC',visible: true,content: 姓名:  年龄:,pos: {x: 405,y: 399,},size: {width: 640,height: 360,},direction: ac.TEXT_DIRECTION_TYPES.horizontal,halign: ac.HALIGN_TYPES.left,valign: ac.VALIGN_TYPES.center,spacing: 1,anchor: {x: 50,y: 50,},});

//变量显示控件

await ac.createVarDisplay({name: 'BL_xingming',index: 0,inlayer: 'C_NPC',visible: true,pos: {x: 370,y: 445,},size: {width: 300,height: 50,},direction: ac.TEXT_DIRECTION_TYPES.horizontal,halign: ac.HALIGN_TYPES.left,valign: ac.VALIGN_TYPES.center,spacing: 1,anchor: {x: 50,y: 50,},bindFunc: () => ac.arr.NPC姓名[ac.var.判定变量],});

await ac.createVarDisplay({name: 'BL_nianling',index: 0,inlayer: 'C_NPC',visible: true,pos: {x: 370,y: 350,},size: {width: 300,height: 50,},direction: ac.TEXT_DIRECTION_TYPES.horizontal,halign: ac.HALIGN_TYPES.left,valign: ac.VALIGN_TYPES.center,spacing: 1,anchor: {x: 50,y: 50,},bindFunc: () => ac.arr.NPC年龄[ac.var.判定变量],});

if (ac.var.NPC数量 > 1) {

async function SJ_shang() {

if (ac.var.判定变量 === 1) {

ac.var.判定变量 = ac.var.NPC数量;

} else {

ac.var.判定变量 = ac.var.判定变量 - 1;

}

ac.updateNotification();

await NPC();

}

await ac.createOption({name: 'AN_shang',index: 20,inlayer: 'C_NPC',visible: true,nResId: '$40497908',sResId: '$40497908',content: 上一页,pos: {x: 300,y: 60,},anchor: {x: 50,y: 50,},clickAudio: {resId: '$31358305',vol: 60,},onTouchEnded: SJ_shang,});

async function SJ_xia() {

if (ac.var.判定变量 === ac.var.NPC数量) {

ac.var.判定变量 = 1;

} else {

ac.var.判定变量 = ac.var.判定变量 + 1;

}

ac.updateNotification();

await NPC();

}

await ac.createOption({name: 'AN_xia',index: 20,inlayer: 'C_NPC',visible: true,nResId: '$40497908',sResId: '$40497908',content: 下一页,pos: {x: 700,y: 60,},anchor: {x: 50,y: 50,},clickAudio: {resId: '$31358305',vol: 60,},onTouchEnded: SJ_xia,});

}


【易次元2.0参考代码】NPC之信息展示的评论 (共 条)

分享到微博请遵守国家法律