mirror of
https://github.com/exane/not-gwent-online
synced 2024-10-31 10:36:53 +00:00
previewB
This commit is contained in:
parent
4b26af7db1
commit
1e85167c6f
@ -398,9 +398,9 @@ let BattleView = Backbone.View.extend({
|
||||
},
|
||||
onMouseover: function(e){
|
||||
let target = $(e.target).closest(".card");
|
||||
//this.user.set("showPreview", target.find("img").attr("src"));
|
||||
//this.user.set("showPreview", target.data().key);
|
||||
this.user.set("showPreview", new Preview({key: target.data().key}));
|
||||
var hasPreviewB = target.parent().hasClass("preview-b");
|
||||
|
||||
this.user.set("showPreview", new Preview({key: target.data().key, previewB: hasPreviewB}));
|
||||
},
|
||||
onMouseleave: function(e){
|
||||
this.user.get("showPreview").remove();
|
||||
@ -837,6 +837,24 @@ let User = Backbone.Model.extend({
|
||||
this.get("app").send("response:chooseWhichSideBegins", {
|
||||
side: roomSide
|
||||
})
|
||||
},
|
||||
getCardData: function(card) {
|
||||
if(!card || !card.ability) return;
|
||||
var abilities;
|
||||
|
||||
if(Array.isArray(card.ability)){
|
||||
abilities = card.ability.slice();
|
||||
}
|
||||
else {
|
||||
abilities = [];
|
||||
abilities.push(card.ability);
|
||||
}
|
||||
|
||||
abilities = abilities.map((ability) => {
|
||||
return abilityData[ability].description;
|
||||
})
|
||||
|
||||
return abilities;
|
||||
}
|
||||
});
|
||||
|
||||
@ -905,6 +923,10 @@ let Preview = Backbone.View.extend({
|
||||
template: require("../templates/preview.handlebars"),
|
||||
initialize: function(opt){
|
||||
this.card = cardData[opt.key];
|
||||
this.size = opt.size || "lg";
|
||||
this.previewB = opt.previewB || false;
|
||||
|
||||
this.$el.addClass(this.previewB ? "preview-b" : "");
|
||||
|
||||
if(!this.card || !this.card.ability) return;
|
||||
|
||||
@ -925,7 +947,9 @@ let Preview = Backbone.View.extend({
|
||||
render: function(){
|
||||
let html = this.template({
|
||||
card: this.card,
|
||||
abilities: this.abilities
|
||||
abilities: this.abilities,
|
||||
size: this.size,
|
||||
previewB: this.previewB
|
||||
})
|
||||
this.$el.html(html);
|
||||
return this;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<h3 class="bbm-modal__title">Choose up to 2 cards you wish to redraw!</h3>
|
||||
<span class="btn-sub bbm-close">CLOSE</span>
|
||||
</div>
|
||||
<div class="bbm-modal__section">
|
||||
<div class="bbm-modal__section preview-b">
|
||||
{{#each handCards as |val key|}}
|
||||
{{>card val}}
|
||||
{{/each}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<i class="card-lg-{{card.faction}} card-lg-{{card.faction}}-{{card.img}}"></i>
|
||||
<div class="preview-description">
|
||||
<i class="card-{{this.size}}-{{card.faction}} card-{{this.size}}-{{card.faction}}-{{card.img}}"></i>
|
||||
<div class="preview-description {{#if previewB}}preview-b{{/if}}">
|
||||
<p>{{card.name}}</p>
|
||||
{{#each abilities as |val key|}}
|
||||
<p>{{val}}</p>
|
||||
|
Loading…
Reference in New Issue
Block a user