Support for loop effect from 2018 summer event.
Support for pattern argument including a <character=> tag.
This commit is contained in:
parent
36fd987c4d
commit
733c576cf2
@ -1 +1 @@
|
|||||||
Subproject commit cbbcd61805a9fbfc95fea46b5bf0cb51b7c8b3c1
|
Subproject commit e45642773aa255babfde41b770ce1e4c78ca5251
|
96
Js/Player.js
96
Js/Player.js
@ -55,6 +55,17 @@ class Player {
|
|||||||
try {
|
try {
|
||||||
let c = utage.currentPlayingFile[i];
|
let c = utage.currentPlayingFile[i];
|
||||||
if(c.comment) { continue; }
|
if(c.comment) { continue; }
|
||||||
|
//They use this to set the sprite set for a charater but have an alternate name displayed
|
||||||
|
if(c.Arg2 && c.Arg2.toLowerCase().includes("<character=")) {
|
||||||
|
try {
|
||||||
|
let reg = /<Character=.*?>/;
|
||||||
|
let match = c.Arg2.match(reg);
|
||||||
|
c.Arg2 = c.Arg2.replace(reg, "");
|
||||||
|
c.Character = match[0].match(/(?<=<Character=)(.*)(?=>)/)[0];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
let command = c.Command ? c.Command.toLowerCase() : '';
|
let command = c.Command ? c.Command.toLowerCase() : '';
|
||||||
switch(command) {
|
switch(command) {
|
||||||
//BG images
|
//BG images
|
||||||
@ -75,24 +86,25 @@ class Player {
|
|||||||
if(Arg2 === '<Off>') {
|
if(Arg2 === '<Off>') {
|
||||||
Arg2 = '<Off>'
|
Arg2 = '<Off>'
|
||||||
}
|
}
|
||||||
if(c.Arg1 && this.utage.characterInfo[c.Arg1] && !Arg2) {
|
let charToLoad = c.Character || c.Arg1;
|
||||||
|
if(charToLoad && this.utage.characterInfo[charToLoad] && !Arg2) {
|
||||||
Arg2 = this.defaultCharPattern;
|
Arg2 = this.defaultCharPattern;
|
||||||
}
|
}
|
||||||
//I know the nesting here isint pretty
|
//I know the nesting here isint pretty
|
||||||
//If the character at arg1|arg2 exists and arg2 is not <off>
|
//If the character at arg1|arg2 exists and arg2 is not <off>
|
||||||
if(this.utage.characterInfo[c.Arg1] && this.utage.characterInfo[c.Arg1][Arg2] && Arg2 && Arg2 != "<Off>") {
|
if(this.utage.characterInfo[charToLoad] && this.utage.characterInfo[charToLoad][Arg2] && Arg2 && Arg2 != "<Off>") {
|
||||||
if(!this.loader.resources[`char|${c.Arg1}|${Arg2}`]) {
|
if(!this.loader.resources[`char|${charToLoad}|${Arg2}`]) {
|
||||||
this.loader.add(`char|${c.Arg1}|${Arg2}`, this.utage.characterInfo[c.Arg1][Arg2].FileName);
|
this.loader.add(`char|${charToLoad}|${Arg2}`, this.utage.characterInfo[charToLoad][Arg2].FileName);
|
||||||
}
|
}
|
||||||
//If the character at arg1|arg2 isint here check at arg1|none. If not there put error in console.
|
//If the character at arg1|arg2 isint here check at arg1|none. If not there put error in console.
|
||||||
} else if(c.Arg1 && Arg2 && Arg2 != "<Off>" &&
|
} else if(charToLoad && Arg2 && Arg2 != "<Off>" &&
|
||||||
(!this.utage.characterInfo[c.Arg1] || !this.utage.characterInfo[c.Arg1][Arg2])) {
|
(!this.utage.characterInfo[charToLoad] || !this.utage.characterInfo[charToLoad][Arg2])) {
|
||||||
if(this.utage.characterInfo[c.Arg1] && this.utage.characterInfo[c.Arg1]['none']) {
|
if(this.utage.characterInfo[charToLoad] && this.utage.characterInfo[charToLoad]['none']) {
|
||||||
if(!this.loader.resources[`char|${c.Arg1}|none`]) {
|
if(!this.loader.resources[`char|${charToLoad}|none`]) {
|
||||||
this.loader.add(`char|${c.Arg1}|none`, this.utage.characterInfo[c.Arg1]['none'].FileName);
|
this.loader.add(`char|${charToLoad}|none`, this.utage.characterInfo[charToLoad]['none'].FileName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`Failed to get Character: ${c.Arg1}|${Arg2}`);
|
console.log(`Failed to get Character: ${charToLoad}|${Arg2}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//These voices arent in the Sound.tsv because fuck you
|
//These voices arent in the Sound.tsv because fuck you
|
||||||
@ -224,9 +236,25 @@ class Player {
|
|||||||
//this isint in the texture file.
|
//this isint in the texture file.
|
||||||
this.loader.add('bg|titlecard', `${this.utage.rootDirectory}XDUData/Sample/Texture/BG/bg_title.jpg`);
|
this.loader.add('bg|titlecard', `${this.utage.rootDirectory}XDUData/Sample/Texture/BG/bg_title.jpg`);
|
||||||
break;
|
break;
|
||||||
case "scenetitle13":
|
case "scenetitlebridal":
|
||||||
this.loader.add('bg|titlecard', `${this.utage.rootDirectory}XDUData/Sample/Texture/BG/event0010.png`);
|
this.loader.add('bg|titlecard', `${this.utage.rootDirectory}CustomData/Sample/Texture/BG/eventbridal.png`);
|
||||||
break;
|
break;
|
||||||
|
case "scenetitle13":
|
||||||
|
this.loader.add('bg|titlecard', `${this.utage.rootDirectory}XDUData/Sample/Texture/BG/event0001.png`);
|
||||||
|
break;
|
||||||
|
case "loopeffect01": {
|
||||||
|
switch(c.Arg1) {
|
||||||
|
case "underwater01": {
|
||||||
|
if(!toLoadSe['se_斬撃音_単体']) {
|
||||||
|
toLoadSe['se_斬撃音_単体'] = this.utage.soundInfo['se_斬撃音_単体'];
|
||||||
|
}
|
||||||
|
if(!this.loader.resources['bg|underwater01']) {
|
||||||
|
this.loader.add('bg|underwater01', `${this.utage.rootDirectory}CustomData/Sample/Texture/BG/bg_underwater01.jpg`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
case "attachit02":
|
case "attachit02":
|
||||||
case "attachit03":
|
case "attachit03":
|
||||||
if(this.utage.soundInfo['se_打撃音(大)']) {
|
if(this.utage.soundInfo['se_打撃音(大)']) {
|
||||||
@ -306,6 +334,7 @@ class Player {
|
|||||||
for(let l of Object.keys(this.utage.layerInfo)) {
|
for(let l of Object.keys(this.utage.layerInfo)) {
|
||||||
layersToAdd.push(this.utage.layerInfo[l]);
|
layersToAdd.push(this.utage.layerInfo[l]);
|
||||||
}
|
}
|
||||||
|
layersToAdd.push({LayerName: "bg|loopeffect", Type: "Bg", X: 0, Y: 0, Order: 1})
|
||||||
layersToAdd.sort(compare);
|
layersToAdd.sort(compare);
|
||||||
let parentContainer = new PIXI.Container();
|
let parentContainer = new PIXI.Container();
|
||||||
parentContainer.position.set(this.center.x, this.center.y);
|
parentContainer.position.set(this.center.x, this.center.y);
|
||||||
@ -761,6 +790,27 @@ class Player {
|
|||||||
this.processShake(delta, cur);
|
this.processShake(delta, cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "loopeffect01": {
|
||||||
|
let container = this.layers["bg|loopeffect"].container;
|
||||||
|
switch((cur.Arg1 || "").toLowerCase()) {
|
||||||
|
case "underwater01": {
|
||||||
|
this.audio.playSound("se_斬撃音_単体", "Se");
|
||||||
|
let sprite = new PIXI.Sprite(this.loader.resources['bg|underwater01'].texture);
|
||||||
|
sprite.scale.set(1.30273438, 1.30273438);
|
||||||
|
sprite.anchor.set(0.5, 0.5);
|
||||||
|
sprite.alpha = 0;
|
||||||
|
container.addChild(sprite);
|
||||||
|
this.lerpTargets.push({type: 'alpha', object: sprite, curTime: 0, time: 1000, finalV: 1, initV: 0});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "divaclearloopdecorate": {
|
||||||
|
let container = this.layers["bg|loopeffect"].container;
|
||||||
|
this.lerpTargets.push({type: 'alpha', object: container.children[0], curTime: 0, time: 1000, finalV: 0, initV: 1, post: "destroy"});
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
this.processCommandOther(delta);
|
this.processCommandOther(delta);
|
||||||
break;
|
break;
|
||||||
@ -992,7 +1042,8 @@ class Player {
|
|||||||
//special is used if the command actually has a command param such as Henshin since normal text commands dont.
|
//special is used if the command actually has a command param such as Henshin since normal text commands dont.
|
||||||
//ignoreCurrent is used for if you are remvoing a current character yourself and don't want this to add another fade out to it such as somethingnew_appearance01.
|
//ignoreCurrent is used for if you are remvoing a current character yourself and don't want this to add another fade out to it such as somethingnew_appearance01.
|
||||||
checkPutCharacterScreen(cur, special = false, ignoreCurrent = false,) {
|
checkPutCharacterScreen(cur, special = false, ignoreCurrent = false,) {
|
||||||
if((!cur.Command || special) && cur.Arg1 && this.utage.characterInfo[cur.Arg1]) {
|
let charToLoad = cur.Character || cur.Arg1;
|
||||||
|
if((!cur.Command || special) && charToLoad && this.utage.characterInfo[charToLoad]) {
|
||||||
let lay = undefined;
|
let lay = undefined;
|
||||||
let curChar = undefined; //The character that is currently on screen with the same name as Arg1.
|
let curChar = undefined; //The character that is currently on screen with the same name as Arg1.
|
||||||
let prevChar = undefined; //The character that is already on the layer we are trying to put the new char on.
|
let prevChar = undefined; //The character that is already on the layer we are trying to put the new char on.
|
||||||
@ -1000,7 +1051,7 @@ class Player {
|
|||||||
if(!ignoreCurrent) {
|
if(!ignoreCurrent) {
|
||||||
for(let c of Object.keys(this.currentCharacters)) {
|
for(let c of Object.keys(this.currentCharacters)) {
|
||||||
if(!this.currentCharacters[c]) { continue; }
|
if(!this.currentCharacters[c]) { continue; }
|
||||||
if(this.currentCharacters[c].charName === cur.Arg1) {
|
if(this.currentCharacters[c].charName === charToLoad) {
|
||||||
curChar = this.currentCharacters[c];
|
curChar = this.currentCharacters[c];
|
||||||
lay = this.currentCharacters[c].layer;
|
lay = this.currentCharacters[c].layer;
|
||||||
if(!cur.Arg3) {
|
if(!cur.Arg3) {
|
||||||
@ -1016,11 +1067,11 @@ class Player {
|
|||||||
} else if (!cur.Arg2 && curChar) {
|
} else if (!cur.Arg2 && curChar) {
|
||||||
cur.Arg2 = curChar.character.Pattern;
|
cur.Arg2 = curChar.character.Pattern;
|
||||||
}
|
}
|
||||||
let chr = this.utage.characterInfo[cur.Arg1][cur.Arg2];
|
let chr = this.utage.characterInfo[charToLoad][cur.Arg2];
|
||||||
if(!chr) {
|
if(!chr) {
|
||||||
//Non character sprites don't have a pattern and just use none as a key so if we don't find a character at arg1|arg2 look for this.
|
//Non character sprites don't have a pattern and just use none as a key so if we don't find a character at arg1|arg2 look for this.
|
||||||
cur.Arg2 = 'none';
|
cur.Arg2 = 'none';
|
||||||
chr = this.utage.characterInfo[cur.Arg1][cur.Arg2];
|
chr = this.utage.characterInfo[charToLoad][cur.Arg2];
|
||||||
}
|
}
|
||||||
//If we didn't find the character at all just abandon.
|
//If we didn't find the character at all just abandon.
|
||||||
if(!chr) { return; }
|
if(!chr) { return; }
|
||||||
@ -1048,19 +1099,19 @@ class Player {
|
|||||||
this.currentCharacters[curChar.layer.info.LayerName] = undefined;
|
this.currentCharacters[curChar.layer.info.LayerName] = undefined;
|
||||||
}
|
}
|
||||||
//If this character is already here and not changing patterns don't change anything.
|
//If this character is already here and not changing patterns don't change anything.
|
||||||
else if(curChar && curChar.charName === cur.Arg1 && curChar.character.Pattern === cur.Arg2) {
|
else if(curChar && curChar.charName === charToLoad && curChar.character.Pattern === cur.Arg2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ignoreCurrent) {
|
if(!ignoreCurrent) {
|
||||||
//If the layer already has a different character on it remove it.
|
//If the layer already has a different character on it remove it.
|
||||||
if(prevChar && (prevChar.charName !== cur.Arg1 || prevChar.character.Pattern !== chr.Pattern)) {
|
if(prevChar && (prevChar.charName !== charToLoad || prevChar.character.Pattern !== chr.Pattern)) {
|
||||||
this.lerpTargets.push({type: 'alpha', object: prevChar.sprite, curTime: 0, time: 200, finalV: 0, initV: 1, post: "destroy" });
|
this.lerpTargets.push({type: 'alpha', object: prevChar.sprite, curTime: 0, time: 200, finalV: 0, initV: 1, post: "destroy" });
|
||||||
this.currentCharacters[cur.Arg3] = undefined;
|
this.currentCharacters[cur.Arg3] = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let sprite = new PIXI.Sprite(this.loader.resources[`char|${cur.Arg1}|${cur.Arg2}`].texture);
|
let sprite = new PIXI.Sprite(this.loader.resources[`char|${charToLoad}|${cur.Arg2}`].texture);
|
||||||
sprite.scale.set(Number(chr.Scale), Number(chr.Scale));
|
sprite.scale.set(Number(chr.Scale), Number(chr.Scale));
|
||||||
let anchor = commonFunctions.getAnchorFromCharPivot(chr.Pivot);
|
let anchor = commonFunctions.getAnchorFromCharPivot(chr.Pivot);
|
||||||
sprite.anchor.set(anchor.x, anchor.y);
|
sprite.anchor.set(anchor.x, anchor.y);
|
||||||
@ -1088,7 +1139,7 @@ class Player {
|
|||||||
//Im halving this because their fades take too fucking long and looks bad.
|
//Im halving this because their fades take too fucking long and looks bad.
|
||||||
fadeTime = (Number(cur.Arg6) * 1000) / 2;
|
fadeTime = (Number(cur.Arg6) * 1000) / 2;
|
||||||
}
|
}
|
||||||
this.currentCharacters[cur.Arg3] = { layer: lay, character: chr, charName: cur.Arg1, sprite: sprite };
|
this.currentCharacters[cur.Arg3] = { layer: lay, character: chr, charName: charToLoad, sprite: sprite };
|
||||||
if(fadeTime > 0) {
|
if(fadeTime > 0) {
|
||||||
this.lerpTargets.push({type: 'alpha', object: sprite, curTime: 0, time: fadeTime, finalV: 1, initV: 0 });
|
this.lerpTargets.push({type: 'alpha', object: sprite, curTime: 0, time: fadeTime, finalV: 1, initV: 0 });
|
||||||
} else {
|
} else {
|
||||||
@ -1159,8 +1210,9 @@ class Player {
|
|||||||
//future note: This might be better to just look for the character in character info if this start failing.
|
//future note: This might be better to just look for the character in character info if this start failing.
|
||||||
for(let c of Object.keys(this.currentCharacters)) {
|
for(let c of Object.keys(this.currentCharacters)) {
|
||||||
if(!this.currentCharacters[c]) { continue; }
|
if(!this.currentCharacters[c]) { continue; }
|
||||||
if(this.currentCharacters[c].charName === cur.Arg1) {
|
if(this.currentCharacters[c].charName === cur.Arg1 || this.currentCharacters[c].charName === cur.Character) {
|
||||||
this.text.characterName(true, utage.charTranslations[this.currentCharacters[c].character.NameText] || this.currentCharacters[c].character.NameText);
|
let nameToUse = this.currentCharacters[c].character.NameText;
|
||||||
|
this.text.characterName(true, utage.charTranslations[nameToUse] || nameToUse);
|
||||||
this.text.dialogText(true, text);
|
this.text.dialogText(true, text);
|
||||||
this.currentCharacters[c].sprite.tint = 0xFFFFFF;
|
this.currentCharacters[c].sprite.tint = 0xFFFFFF;
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b64fcc69003059085d4073a672953c91f7c97cc4
|
Subproject commit b607fb797dd7896a0f365d2cd89ac61608571c82
|
@ -20,7 +20,7 @@ class UtageInfo {
|
|||||||
this.bgmLoopData = {};
|
this.bgmLoopData = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
loadUtageSettings(resolve, reject) {
|
loadUtageSettings() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let promises = [
|
let promises = [
|
||||||
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissions.json`), //0
|
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissions.json`), //0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user