微件:Chibi:修订间差异
跳转到导航
跳转到搜索
小 (文本替换 - 替换“www.zjsnrwiki.com/images/”为“0v0.zjsnrwiki.com/images/”) |
无编辑摘要 |
||
(未显示同一用户的24个中间版本) | |||
第1行: | 第1行: | ||
<includeonly> | <includeonly> | ||
<script src="https:// | <script src="https://0v0.zjsnrwiki.com/gameRes/chibi/pixi.js"></script> | ||
<script src="https:// | <script src="https://0v0.zjsnrwiki.com/gameRes/chibi/pixiv5-spine3.8.js"></script> | ||
<script> | <script> | ||
function chibiAnimation(index, loadButton) { | function chibiAnimation(index, loadButton) { | ||
loadButton.style.display = "none"; | loadButton.style.display = "none"; | ||
const pngFile = 'https://0v0.zjsnrwiki.com/gameRes/chibi/spine/' + index + '/Ship_girl_' + index + '.png'; | |||
const atlasFile = 'https://0v0.zjsnrwiki.com/gameRes/chibi/spine/' + index + '/Ship_girl_' + index + '.atlas'; | |||
var jsonFile = index + '/Ship_girl_' + index + '.38.skel'; | |||
//特殊修复(记得atlas文件去空格)。转码工具:https://naganeko.pages.dev/chibi-gif/ | |||
if (index == '1050' || index == '1057' || index == '256' || index == '408_2') | |||
jsonFile = index + '/Ship_girl_' + index + '.38.json'; | |||
//分别加载png,atlas文件 | |||
var spineLoaderOptions = { | |||
metadata: { | |||
image: PIXI.BaseTexture.from(pngFile), | |||
spineAtlasFile: atlasFile | |||
} | |||
}; | |||
//调整半透明渲染模式 | |||
if (index != '40') | |||
spineLoaderOptions.metadata.image.alphaMode = PIXI.ALPHA_MODES.PMA; | |||
//加载播放器 | //加载播放器 | ||
const app = new PIXI.Application({ | const app = new PIXI.Application({ | ||
width: | width:800, | ||
height:600, | height:600, | ||
transparent:true | transparent:true | ||
第20行: | 第36行: | ||
app.stop(); | app.stop(); | ||
loader = new PIXI.Loader('https://0v0.zjsnrwiki.com/gameRes/chibi/spine/'); | |||
loader.add('spineCharacter', jsonFile, spineLoaderOptions); | |||
loader.onComplete.once(onAssetsLoaded); | |||
loader.load(); | |||
loader = new PIXI.Loader('https:// | |||
loader | |||
let chibi = null; | let chibi = null; | ||
第37行: | 第45行: | ||
function onAssetsLoaded(loader, res) { | function onAssetsLoaded(loader, res) { | ||
//载入骨架 | //载入骨架 | ||
第71行: | 第77行: | ||
rectangle = new PIXI.Graphics(); | rectangle = new PIXI.Graphics(); | ||
rectangle.beginFill(0x00FF00); | rectangle.beginFill(0x00FF00); | ||
rectangle.drawRect(0, 0, | rectangle.drawRect(0, 0, 800, 600); | ||
rectangle.endFill(); | rectangle.endFill(); | ||
rectangle.alpha = 0; | rectangle.alpha = 0; | ||
第79行: | 第85行: | ||
app.stage.addChild(rectangle); | app.stage.addChild(rectangle); | ||
app.stage.setChildIndex(rectangle, 0); | app.stage.setChildIndex(rectangle, 0); | ||
rectangle2 = new PIXI.Graphics(); | |||
rectangle2.beginFill(0xFFFFFF); | |||
rectangle2.drawRect(0, 0, 800, 600); | |||
rectangle2.endFill(); | |||
rectangle2.alpha = 0; | |||
rectangle2.x = 0; | |||
rectangle2.y = 0; | |||
rectangle2.cacheAsBitmap = true; | |||
app.stage.addChild(rectangle2); | |||
app.stage.setChildIndex(rectangle2, 0); | |||
}; | }; | ||
第156行: | 第173行: | ||
case 5: | case 5: | ||
chibi.state.setAnimation(0, 'wreck', true, 0); | chibi.state.setAnimation(0, 'wreck', true, 0); | ||
break; | |||
case 6: | |||
chibi.state.setAnimation(0, 'w', true, 0); | |||
break; | |||
case 7: | |||
chibi.state.setAnimation(0, 's', true, 0); | |||
break; | break; | ||
} | } | ||
第170行: | 第193行: | ||
button4.on('pointerdown', switchGreenCurtain); | button4.on('pointerdown', switchGreenCurtain); | ||
app.stage.addChild(button4); | app.stage.addChild(button4); | ||
function switchGreenCurtain() { | function switchGreenCurtain() { | ||
rectangle.alpha == 0 ? rectangle.alpha = 1 : rectangle.alpha = 0; | rectangle.alpha == 0 ? rectangle.alpha = 1 : rectangle.alpha = 0; | ||
} | } | ||
} | |||
</script> | //切换白幕按钮 | ||
const button5 = PIXI.Sprite.from('https://0v0.zjsnrwiki.com/images/4/44/Spine_W.png'); | |||
button5.x = 50; | |||
button5.y = 50; | |||
button5.interactive = true; | |||
button5.buttonMode = true; | |||
button5.on('pointerdown', switchWhiteCurtain); | |||
app.stage.addChild(button5); | |||
function switchWhiteCurtain() { | |||
rectangle2.alpha == 0 ? rectangle2.alpha = 1 : rectangle2.alpha = 0; | |||
} | |||
} | |||
</script> | |||
</includeonly> | </includeonly> |