Work on deck panel.

This commit is contained in:
marcins78@gmail.com
2012-12-22 22:14:18 +00:00
parent 88c64a621d
commit 2520f28b49
2 changed files with 40 additions and 9 deletions

View File

@@ -63,6 +63,7 @@
<script type="text/javascript" src="/generic-tcg/js/CardContainer.js"></script>
<script type="text/javascript" src="/generic-tcg/js/CardGroup.js"></script>
<script type="text/javascript" src="/generic-tcg/js/RowCardLayoutCardGroup.js"></script>
<script type="text/javascript" src="/generic-tcg/js/AttachedCardsLayoutCardGroup.js"></script>
<script type="text/javascript" src="/generic-tcg/js/jquery/jquery-sizes.js"></script>
<script type="text/javascript" src="js/gemp-012/communication.js"></script>

View File

@@ -38,12 +38,28 @@ var DeckPanel = Class.extend({
this.tabs = $(deckDiv).tabs();
var isFirstWithSameBlueprintIdInGroup =
function(testedCardId, cardGroup, blueprintId) {
var first;
var finished = false;
cardGroup.iterCards(
function(cardDiv, cardId, props, layoutFunc) {
if (!finished && props["blueprintId"] == blueprintId) {
first = (cardId == testedCardId);
finished = true;
}
});
return first;
};
this.ringBearerContainer = new CardContainer(this.ringBearerDiv, this.layoutCardContainer);
var ringBearerGroup = new RowCardLayoutCardGroup(this.ringBearerDiv,
function() {
return true;
});
ringBearerGroup.setZIndexBase(10);
ringBearerGroup.setZIndexBase(100);
this.ringBearerContainer.addCardGroup("main", ringBearerGroup);
this.ringContainer = new CardContainer(this.ringDiv, this.layoutCardContainer);
@@ -51,7 +67,7 @@ var DeckPanel = Class.extend({
function() {
return true;
});
ringGroup.setZIndexBase(10);
ringGroup.setZIndexBase(100);
this.ringContainer.addCardGroup("main", ringGroup);
this.sitesContainer = new CardContainer(this.sitesDiv, this.layoutCardContainer);
@@ -59,23 +75,37 @@ var DeckPanel = Class.extend({
function() {
return true;
});
sitesGroup.setZIndexBase(10);
sitesGroup.setZIndexBase(100);
this.sitesContainer.addCardGroup("main", sitesGroup);
this.fpContainer = new CardContainer(this.fpDiv, this.layoutCardContainer);
var fpGroup = new RowCardLayoutCardGroup(this.fpDiv,
function() {
var fpGroup = new AttachedCardsLayoutCardGroup(this.fpDiv,
function(cardDiv, cardId, props) {
return true;
},
function(cardDiv, cardId, props) {
return isFirstWithSameBlueprintIdInGroup(cardId, fpGroup, props["blueprintId"]);
});
fpGroup.setZIndexBase(10);
fpGroup.addAttachedGroup(-1/7, 0,
function(cardDiv, cardId, props, cardDivAtt, cardIdAtt, propsAtt) {
return propsAtt["blueprintId"] == props["blueprintId"];
});
fpGroup.setZIndexBase(100);
this.fpContainer.addCardGroup("main", fpGroup);
this.shadowContainer = new CardContainer(this.shadowDiv, this.layoutCardContainer);
var shadowGroup = new RowCardLayoutCardGroup(this.shadowDiv,
function() {
var shadowGroup = new AttachedCardsLayoutCardGroup(this.shadowDiv,
function(cardDiv, cardId, props) {
return true;
},
function(cardDiv, cardId, props) {
return isFirstWithSameBlueprintIdInGroup(cardId, shadowGroup, props["blueprintId"]);
});
shadowGroup.setZIndexBase(10);
shadowGroup.addAttachedGroup(-1/7, 0,
function(cardDiv, cardId, props, cardDivAtt, cardIdAtt, propsAtt) {
return propsAtt["blueprintId"] == props["blueprintId"];
});
shadowGroup.setZIndexBase(100);
this.shadowContainer.addCardGroup("main", shadowGroup);
},