【易次元2.0參考代碼】NPC之信息展示
本文禁止以任何形式轉(zhuǎn)載!僅供參考!
//生成NPC(數(shù)量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,});
//層級(jí)(不是自適應(yīng)模式可以刪除)
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立繪調(diào)用
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數(shù)量 > 1) {
async function SJ_shang() {
if (ac.var.判定變量 === 1) {
ac.var.判定變量 = ac.var.NPC數(shù)量;
} 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: 上一頁(yè)
,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數(shù)量) {
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: 下一頁(yè)
,pos: {x: 700,y: 60,},anchor: {x: 50,y: 50,},clickAudio: {resId: '$31358305',vol: 60,},onTouchEnded: SJ_xia,});
}