mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-04-25 07:57:01 -05:00
Rename switchSides -> switchViewpoint
New name is a lot clearer.
This commit is contained in:
parent
0dcff6c2c3
commit
7305b5892b
|
|
@ -260,7 +260,7 @@
|
|||
updateControls: function () {
|
||||
if (this.battle.scene.customControls) return;
|
||||
var controlsShown = this.controlsShown;
|
||||
var switchSidesButton = '<p><button class="button" name="switchSides"><i class="fa fa-random"></i> Switch sides</button></p>';
|
||||
var switchSidesButton = '<p><button class="button" name="switchViewpoint"><i class="fa fa-random"></i> Switch sides</button></p>';
|
||||
this.controlsShown = false;
|
||||
|
||||
if (this.battle.seeking !== null) {
|
||||
|
|
@ -1089,14 +1089,14 @@
|
|||
if (!sideData.id) return;
|
||||
this.side = sideData.id;
|
||||
if (this.battle.mySide.sideid !== this.side) {
|
||||
this.battle.setPerspective(this.side);
|
||||
this.battle.setViewpoint(this.side);
|
||||
this.$chat = this.$chatFrame.find('.inner');
|
||||
}
|
||||
},
|
||||
updateSide: function () {
|
||||
var sideData = this.request.side;
|
||||
this.battle.myPokemon = sideData.pokemon;
|
||||
this.battle.setPerspective(sideData.id);
|
||||
this.battle.setViewpoint(sideData.id);
|
||||
for (var i = 0; i < sideData.pokemon.length; i++) {
|
||||
var pokemonData = sideData.pokemon[i];
|
||||
if (this.request.active && this.request.active[i]) pokemonData.canGmax = this.request.active[i].gigantamax || false;
|
||||
|
|
@ -1157,8 +1157,8 @@
|
|||
|
||||
e.stopPropagation();
|
||||
},
|
||||
switchSides: function () {
|
||||
this.battle.switchSides();
|
||||
switchViewpoint: function () {
|
||||
this.battle.switchViewpoint();
|
||||
},
|
||||
pause: function () {
|
||||
this.tooltips.hideTooltip();
|
||||
|
|
|
|||
|
|
@ -172,9 +172,9 @@ var Replays = {
|
|||
|
||||
if (this.battle.paused) {
|
||||
var resetDisabled = !this.battle.started ? ' disabled' : '';
|
||||
this.$('.replay-controls').html('<button data-action="play"><i class="fa fa-play"></i> Play</button><button data-action="reset"' + resetDisabled + '><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchSides"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
this.$('.replay-controls').html('<button data-action="play"><i class="fa fa-play"></i> Play</button><button data-action="reset"' + resetDisabled + '><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchViewpoint"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
} else {
|
||||
this.$('.replay-controls').html('<button data-action="pause"><i class="fa fa-pause"></i> Pause</button><button data-action="reset"><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchSides"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
this.$('.replay-controls').html('<button data-action="pause"><i class="fa fa-pause"></i> Pause</button><button data-action="reset"><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchViewpoint"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
}
|
||||
},
|
||||
pause: function () {
|
||||
|
|
@ -200,8 +200,8 @@ var Replays = {
|
|||
if (isNaN(turn) || turn < 0) alert("Invalid turn");
|
||||
this.battle.seekTurn(turn);
|
||||
},
|
||||
switchSides: function () {
|
||||
this.battle.switchSides();
|
||||
switchViewpoint: function () {
|
||||
this.battle.switchViewpoint();
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ var ReplayPanel = Panels.StaticPanel.extend({
|
|||
|
||||
if (this.battle.paused) {
|
||||
var resetDisabled = !this.battle.started ? ' disabled' : '';
|
||||
this.$('.replay-controls').html('<button data-action="play"><i class="fa fa-play"></i> Play</button><button data-action="reset"' + resetDisabled + '><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchSides"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
this.$('.replay-controls').html('<button data-action="play"><i class="fa fa-play"></i> Play</button><button data-action="reset"' + resetDisabled + '><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchViewpoint"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
} else {
|
||||
this.$('.replay-controls').html('<button data-action="pause"><i class="fa fa-pause"></i> Pause</button><button data-action="reset"><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchSides"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
this.$('.replay-controls').html('<button data-action="pause"><i class="fa fa-pause"></i> Pause</button><button data-action="reset"><i class="fa fa-undo"></i> Reset</button> <button data-action="rewind"><i class="fa fa-step-backward"></i> Last turn</button><button data-action="ff"><i class="fa fa-step-forward"></i> Next turn</button> <button data-action="ffto"><i class="fa fa-fast-forward"></i> Go to turn...</button> <button data-action="switchViewpoint"><i class="fa fa-random"></i> Switch sides</button>');
|
||||
}
|
||||
},
|
||||
clickReplayDownloadButton: function (e) {
|
||||
|
|
@ -216,8 +216,8 @@ var ReplayPanel = Panels.StaticPanel.extend({
|
|||
if (isNaN(turn) || turn < 0) alert("Invalid turn");
|
||||
this.battle.seekTurn(turn);
|
||||
},
|
||||
switchSides: function() {
|
||||
this.battle.switchSides();
|
||||
switchViewpoint: function() {
|
||||
this.battle.switchViewpoint();
|
||||
},
|
||||
remove: function() {
|
||||
this.battle.destroy();
|
||||
|
|
|
|||
|
|
@ -792,7 +792,7 @@ export class BattleScene implements BattleSceneStub {
|
|||
let newBGNum = 0;
|
||||
for (let siden = 0; siden < 2 || (this.battle.gameType === 'multi' && siden < 4); siden++) {
|
||||
let side = this.battle.sides[siden];
|
||||
const spriteIndex = +this.battle.sidesSwitched ^ (siden % 2);
|
||||
const spriteIndex = +this.battle.viewpointSwitched ^ (siden % 2);
|
||||
let textBuf = '';
|
||||
let buf = '';
|
||||
let buf2 = '';
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ class BattleTooltips {
|
|||
// mouse over active pokemon
|
||||
// pokemon definitely exists, serverPokemon maybe
|
||||
let sideIndex = parseInt(args[1], 10);
|
||||
let side = this.battle.sides[+this.battle.sidesSwitched ^ sideIndex];
|
||||
let side = this.battle.sides[+this.battle.viewpointSwitched ^ sideIndex];
|
||||
let activeIndex = parseInt(args[2], 10);
|
||||
let pokemonIndex = activeIndex;
|
||||
if (activeIndex >= 1 && this.battle.sides.length > 2) {
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,7 @@ export interface ServerPokemon extends PokemonDetails, PokemonHealth {
|
|||
export class Battle {
|
||||
scene: BattleSceneStub;
|
||||
|
||||
sidesSwitched = false;
|
||||
viewpointSwitched = false;
|
||||
|
||||
stepQueue: string[];
|
||||
/** See battle.instantAdd */
|
||||
|
|
@ -1303,10 +1303,10 @@ export class Battle {
|
|||
resetToCurrentTurn() {
|
||||
this.seekTurn(this.ended ? Infinity : this.turn, true);
|
||||
}
|
||||
switchSides() {
|
||||
this.setPerspective(this.sidesSwitched ? 'p1' : 'p2');
|
||||
switchViewpoint() {
|
||||
this.setViewpoint(this.viewpointSwitched ? 'p1' : 'p2');
|
||||
}
|
||||
setPerspective(sideid: SideID) {
|
||||
setViewpoint(sideid: SideID) {
|
||||
if (this.mySide.sideid === sideid) return;
|
||||
if (sideid.length !== 2 || !sideid.startsWith('p')) return;
|
||||
const side = this[sideid];
|
||||
|
|
@ -1314,11 +1314,11 @@ export class Battle {
|
|||
this.mySide = side;
|
||||
|
||||
if ((side.n % 2) === this.p1.n) {
|
||||
this.sidesSwitched = false;
|
||||
this.viewpointSwitched = false;
|
||||
this.nearSide = this.p1;
|
||||
this.farSide = this.p2;
|
||||
} else {
|
||||
this.sidesSwitched = true;
|
||||
this.viewpointSwitched = true;
|
||||
this.nearSide = this.p2;
|
||||
this.farSide = this.p1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class BattleRoom extends ChatRoom {
|
|||
this.update(null);
|
||||
return true;
|
||||
} case 'switchsides': {
|
||||
this.battle.switchSides();
|
||||
this.battle.switchViewpoint();
|
||||
return true;
|
||||
} case 'cancel': case 'undo': {
|
||||
if (!this.choices || !this.request) {
|
||||
|
|
@ -304,7 +304,7 @@ class BattlePanel extends PSRoomPanel<BattleRoom> {
|
|||
|
||||
if (request.side) {
|
||||
room.battle.myPokemon = request.side.pokemon;
|
||||
room.battle.setPerspective(request.side.id);
|
||||
room.battle.setViewpoint(request.side.id);
|
||||
room.side = request.side;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ class SearchPanel extends preact.Component {
|
|||
this.submitForm(e);
|
||||
};
|
||||
url(replay: ReplayResult) {
|
||||
const sidesSwitched = (toID(replay.p2) === toID(this.user));
|
||||
return replay.id + (replay.password ? `-${replay.password}pw` : '') + (sidesSwitched ? '?p2' : '');
|
||||
const viewpointSwitched = (toID(replay.p2) === toID(this.user));
|
||||
return replay.id + (replay.password ? `-${replay.password}pw` : '') + (viewpointSwitched ? '?p2' : '');
|
||||
}
|
||||
formatid(replay: ReplayResult) {
|
||||
let formatid = replay.format;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user