Ignore time of day tint on Pokemon sprites in UI
parent
b831dd7835
commit
60260faaa4
|
@ -188,6 +188,7 @@ export class EggHatchPhase extends BattlePhase {
|
||||||
this.scene.validateAchv(achvs.HATCH_SHINY);
|
this.scene.validateAchv(achvs.HATCH_SHINY);
|
||||||
this.eggContainer.setVisible(false);
|
this.eggContainer.setVisible(false);
|
||||||
this.pokemonSprite.play(pokemon.getSpriteKey(true));
|
this.pokemonSprite.play(pokemon.getSpriteKey(true));
|
||||||
|
this.pokemonSprite.pipelineData['ignoreTimeTint'] = true;
|
||||||
this.pokemonSprite.setVisible(true);
|
this.pokemonSprite.setVisible(true);
|
||||||
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
|
this.scene.time.delayedCall(Utils.fixedInt(1000), () => {
|
||||||
pokemon.cry();
|
pokemon.cry();
|
||||||
|
|
|
@ -84,6 +84,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
|
|
||||||
[ this.pokemonSprite, this.pokemonTintSprite, this.pokemonEvoSprite, this.pokemonEvoTintSprite ].map(sprite => {
|
[ this.pokemonSprite, this.pokemonTintSprite, this.pokemonEvoSprite, this.pokemonEvoTintSprite ].map(sprite => {
|
||||||
sprite.play(pokemon.getSpriteKey(true));
|
sprite.play(pokemon.getSpriteKey(true));
|
||||||
|
sprite.pipelineData['ignoreTimeTint'] = true;
|
||||||
sprite.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: false });
|
sprite.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: false });
|
||||||
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
||||||
if (pokemon.summonData?.speciesForm)
|
if (pokemon.summonData?.speciesForm)
|
||||||
|
@ -98,8 +99,8 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
pokemon.getPossibleEvolution(this.evolution).then(evolvedPokemon => {
|
pokemon.getPossibleEvolution(this.evolution).then(evolvedPokemon => {
|
||||||
|
|
||||||
[ this.pokemonEvoSprite, this.pokemonEvoTintSprite ].map(sprite => {
|
[ this.pokemonEvoSprite, this.pokemonEvoTintSprite ].map(sprite => {
|
||||||
console.log(evolvedPokemon.getSpriteKey(true))
|
|
||||||
sprite.play(evolvedPokemon.getSpriteKey(true));
|
sprite.play(evolvedPokemon.getSpriteKey(true));
|
||||||
|
sprite.pipelineData['ignoreTimeTint'] = true;
|
||||||
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
||||||
if (evolvedPokemon.summonData?.speciesForm)
|
if (evolvedPokemon.summonData?.speciesForm)
|
||||||
k += 'Base';
|
k += 'Base';
|
||||||
|
|
|
@ -16,6 +16,7 @@ varying float outTintEffect;
|
||||||
varying vec4 outTint;
|
varying vec4 outTint;
|
||||||
|
|
||||||
uniform float time;
|
uniform float time;
|
||||||
|
uniform int ignoreTimeTint;
|
||||||
uniform int isOutside;
|
uniform int isOutside;
|
||||||
uniform vec3 dayTint;
|
uniform vec3 dayTint;
|
||||||
uniform vec3 duskTint;
|
uniform vec3 duskTint;
|
||||||
|
@ -53,7 +54,7 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply day/night tint */
|
/* Apply day/night tint */
|
||||||
if (color.a > 0.0) {
|
if (color.a > 0.0 && ignoreTimeTint == 0) {
|
||||||
vec3 dayNightTint;
|
vec3 dayNightTint;
|
||||||
|
|
||||||
if (time < 0.25) {
|
if (time < 0.25) {
|
||||||
|
@ -124,6 +125,7 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines
|
||||||
|
|
||||||
onPreRender(): void {
|
onPreRender(): void {
|
||||||
this.set1f('time', 0);
|
this.set1f('time', 0);
|
||||||
|
this.set1i('ignoreTimeTint', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
onBind(gameObject: Phaser.GameObjects.GameObject): void {
|
onBind(gameObject: Phaser.GameObjects.GameObject): void {
|
||||||
|
@ -132,10 +134,14 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines
|
||||||
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
||||||
const scene = sprite.scene as BattleScene;
|
const scene = sprite.scene as BattleScene;
|
||||||
|
|
||||||
|
const data = sprite.pipelineData;
|
||||||
|
const ignoreTimeTint = data['ignoreTimeTint'] as boolean;
|
||||||
|
|
||||||
let time = scene.currentBattle?.waveIndex
|
let time = scene.currentBattle?.waveIndex
|
||||||
? ((scene.currentBattle.waveIndex + scene.getWaveCycleOffset()) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000
|
? ((scene.currentBattle.waveIndex + scene.getWaveCycleOffset()) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000
|
||||||
: Utils.getCurrentTime();
|
: Utils.getCurrentTime();
|
||||||
this.set1f('time', time);
|
this.set1f('time', time);
|
||||||
|
this.set1i('ignoreTimeTint', ignoreTimeTint ? 1 : 0);
|
||||||
this.set1i('isOutside', scene.arena.isOutside() ? 1 : 0);
|
this.set1i('isOutside', scene.arena.isOutside() ? 1 : 0);
|
||||||
this.set3fv('dayTint', scene.arena.getDayTint().map(c => c / 255));
|
this.set3fv('dayTint', scene.arena.getDayTint().map(c => c / 255));
|
||||||
this.set3fv('duskTint', scene.arena.getDuskTint().map(c => c / 255));
|
this.set3fv('duskTint', scene.arena.getDuskTint().map(c => c / 255));
|
||||||
|
|
|
@ -18,6 +18,7 @@ varying float outTintEffect;
|
||||||
varying vec4 outTint;
|
varying vec4 outTint;
|
||||||
|
|
||||||
uniform float time;
|
uniform float time;
|
||||||
|
uniform int ignoreTimeTint;
|
||||||
uniform int isOutside;
|
uniform int isOutside;
|
||||||
uniform vec3 dayTint;
|
uniform vec3 dayTint;
|
||||||
uniform vec3 duskTint;
|
uniform vec3 duskTint;
|
||||||
|
@ -87,7 +88,7 @@ void main()
|
||||||
color.rgb += tone.rgb * (color.a / 255.0);
|
color.rgb += tone.rgb * (color.a / 255.0);
|
||||||
|
|
||||||
/* Apply day/night tint */
|
/* Apply day/night tint */
|
||||||
if (color.a > 0.0) {
|
if (color.a > 0.0 && ignoreTimeTint == 0) {
|
||||||
vec3 dayNightTint;
|
vec3 dayNightTint;
|
||||||
|
|
||||||
if (time < 0.25) {
|
if (time < 0.25) {
|
||||||
|
|
|
@ -197,6 +197,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||||
this.numberText.setShadowColor(getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
|
this.numberText.setShadowColor(getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
|
||||||
|
|
||||||
this.pokemonSprite.play(this.pokemon.getSpriteKey(true));
|
this.pokemonSprite.play(this.pokemon.getSpriteKey(true));
|
||||||
|
this.pokemonSprite.pipelineData['ignoreTimeTint'] = true;
|
||||||
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
[ 'spriteColors', 'fusionSpriteColors' ].map(k => {
|
||||||
delete this.pokemonSprite.pipelineData[`${k}Base`];
|
delete this.pokemonSprite.pipelineData[`${k}Base`];
|
||||||
if (this.pokemon.summonData?.speciesForm)
|
if (this.pokemon.summonData?.speciesForm)
|
||||||
|
|
Loading…
Reference in New Issue