make SigniZone checkable && action effect button on EnerZone

This commit is contained in:
WEBXOSS 2017-02-28 10:27:08 +08:00
parent ea66554769
commit 62eec8e4dd
8 changed files with 42 additions and 29 deletions

View file

@ -174,6 +174,12 @@ Card.prototype.addButton = function (txt,onclick) {
// return;
// }
// 兼容参数为 button
if (txt.constructor === Button) {
var btn = txt;
this.buttonLayer.addButton(btn);
return;
}
var btn = new Button(txt,onclick.bind(this,this));
this.buttonLayer.addButton(btn);
// this.outlineOn();

View file

@ -1,6 +1,6 @@
<!DOCTYPE html>
<!-- <html> -->
<html manifest="../webxoss.appcache">
<html>
<!-- <html manifest="../webxoss.appcache"> -->
<head>
<meta charset="UTF-8">
<title>DeckEditor</title>
@ -73,12 +73,12 @@
</div>
</section>
<script src="../Localize.min.js"></script>
<!-- <script src="../Localize.min.js"></script>
<script src="../ImageAndDetail.min.js"></script>
<script src="./Deck.min.js"></script>
<script src="./DeckEditor.js"></script>
<script src="./DeckEditor.js"></script> -->
<!-- <script src="../lib/util.js"></script>
<script src="../lib/util.js"></script>
<script src="../Localize.js"></script>
<script src="../ImageFileCache.js"></script>
<script src="../ImageManager.js"></script>
@ -86,6 +86,6 @@
<script src="../DeckManager.js"></script>
<script src="./Rules.js"></script>
<script src="./Searcher.js"></script>
<script src="./editor.js"></script> -->
<script src="./editor.js"></script>
</body>
</html>

View file

@ -28,6 +28,7 @@ function ImageManager (dir) {
}
ImageManager.prototype.getUrlByPid = function (pid) {
if (!pid) return this.black.src;
var url = window.ImageFileCache.getUrlByPid(pid);
if (url) return url;
url = this.dir + 'images/' + ('0000' + pid).slice(-4) + '.jpg';

View file

@ -1314,8 +1314,8 @@ var map_ru = {
'アイヤイ': 'Aiyai',
'アルフォウ': 'Alfou',
'ハナレ': 'Hanare',
'リル': 'リル',
'メル': 'メル',
'リル': 'Ril',
'メル': 'Mel',
'精像': 'Миф',
'天使': 'Ангел',
'悪魔': 'Демон',

View file

@ -68,7 +68,7 @@ Selector.prototype.showButtons = function () {
var buttonCarrier;
var description = msg.descriptions[idx];
if (card.shouldUseDialog()) {
if (card.zone.constructor === TileZone) {
if (card.zone.constructor === TileZone && card.zone.name !== 'EnerZone') {
buttonCarrier = this.game.buttonZone;
} else {
buttonCarrier = card.zone;

32
Zone.js
View file

@ -79,12 +79,24 @@ Zone.prototype.update = function () {
var txt = (this._amount === 0)? '' : this._amount;
this.setText(txt);
}
var changed = this.changed;
var changed = this.buttonLayer.update() || this.changed;
this.changed = false;
return changed;
};
Zone.prototype.addButton = function () {};
Zone.prototype.removeButtons = function () {};
Zone.prototype.addButton = function (txt,onclick/*,card*/) {
var btn = new Button(txt,onclick.bind(this,this));
this.buttonLayer.addButton(btn);
};
Zone.prototype.removeButtons = function () {
this.buttonLayer.removeAllButtons();
if (this.checkable && this.cards.length>1) {
if (this.name === 'SigniZone') {
this.cards[0].addButton(this.viewCardsButton);
} else {
this.buttonLayer.addButton(this.viewCardsButton);
}
}
};
Zone.prototype.setText = function (txt) {
this.changed = true;
if (!txt) {
@ -149,18 +161,6 @@ StackZone.prototype.updateCardPosition = function () {
},this);
};
StackZone.prototype.addButton = function (txt,onclick/*,card*/) {
var btn = new Button(txt,onclick.bind(this,this));
this.buttonLayer.addButton(btn);
};
StackZone.prototype.removeButtons = function () {
this.buttonLayer.removeAllButtons();
if (this.checkable && this.cards.length>1) {
this.buttonLayer.addButton(this.viewCardsButton);
}
};
StackZone.prototype.addViewCardsButton = function () {
this.buttonLayer.addButton(this.viewCardsButton);
};
@ -187,7 +187,7 @@ Zone.prototype.removeStates = function () {
};
StackZone.prototype.update = function () {
var changed = this.buttonLayer.update() || this.changed;
var changed = this.changed;
if (this.showPower) {
if (this._amount !== this.cards.length) {
this._amount = this.cards.length;

View file

@ -21,6 +21,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 190,
y: 421,
checkable: true,
showPower: true
}),
new StackZone({
@ -28,6 +29,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 288,
y: 421,
checkable: true,
showPower: true
}),
new StackZone({
@ -35,6 +37,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 386,
y: 421,
checkable: true,
showPower: true
}),
],
@ -134,6 +137,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 576-190,
y: 734-421,
checkable: true,
showPower: true,
opposite: true
}),
@ -142,6 +146,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 576-288,
y: 734-421,
checkable: true,
showPower: true,
opposite: true
}),
@ -150,6 +155,7 @@ Game.prototype.initZones = function () {
name: 'SigniZone',
x: 576-386,
y: 734-421,
checkable: true,
showPower: true,
opposite: true
}),

View file

@ -227,12 +227,12 @@
<script src="./CardInfo_ru.js" defer="defer"></script>
<script src="./CardInfo_ko.js" defer="defer"></script>
<script src="./Localize.min.js" defer="defer"></script>
<!-- <script src="./Localize.min.js" defer="defer"></script>
<script src="./ImageAndDetail.min.js" defer="defer"></script>
<script src="./DeckEditor/Deck.min.js" defer="defer"></script>
<script src="./webxoss.js" defer="defer"></script>
<script src="./webxoss.js" defer="defer"></script> -->
<!-- <script src="./Localize.js" defer="defer"></script>
<script src="./Localize.js" defer="defer"></script>
<script src="./ImageFileCache.js" defer="defer"></script>
<script src="./ImageManager.js" defer="defer"></script>
<script src="./Detail.js" defer="defer"></script>
@ -257,6 +257,6 @@
<script src="./DeckManager.js" defer="defer"></script>
<script src="./DeckEditor/Rules.js" defer="defer"></script>
<script src="./DeckEditor/Searcher.js" defer="defer"></script>
<script src="./RoomManager.js" defer="defer"></script> -->
<script src="./RoomManager.js" defer="defer"></script>
</body>
</html>