Nikatlas 6 anni fa
parent
commit
ca6e195df8

BIN
public/files/assets/cards/sketches/2.png


BIN
public/files/assets/cards/sketches/3.png


BIN
public/files/assets/cards/sketches/4.png


BIN
public/files/assets/cards/sketches/5.png


+ 1 - 1
src/Game/assets/deck.js

@@ -4,7 +4,7 @@ let Deck = {
 	Textures: [],
 	Filenames: []
 };
-for(var i=0;i<2;i++) {
+for(var i=0;i<6;i++) {
 	let filename = '/files/assets/cards/sketches/' + i + '.png';
 	Deck.Filenames.push(filename);
 	Deck.Textures.push(PIXI.Texture.fromImage(filename));

+ 5 - 2
src/Game/views/base/Card.js

@@ -52,7 +52,8 @@ class Card extends GuiableContainer{
 
     construct(props) {
         let {
-            id
+            id,
+            team
         } = props;
 
         let [w,h] = [494,683];
@@ -81,7 +82,7 @@ class Card extends GuiableContainer{
         this.hitArea = new PIXI.Rectangle(-hw/2,-hh/2,hw,hh);
         this.cursor = 'pointer';
 
-        this.scale.set(0.5);
+        this.scale.set(0.355);
 
         this.addChild(this.sprite);
         this.addChild(this.label);
@@ -89,6 +90,7 @@ class Card extends GuiableContainer{
         dragAndDrop(this);
 
         this.loadCard(id || 0);
+        this.setTeam(team || 0);
     }
 
     setTeam(team) {
@@ -141,6 +143,7 @@ class Card extends GuiableContainer{
         });
         this._tween.time = milliseconds;
         this._tween.start();
+        return this;
     }
 
     _kill() {

+ 28 - 4
src/Game/views/demo/CardToHolder.js

@@ -9,11 +9,35 @@ class CardToHolder extends PIXI.Container{
 
         let {GameLayer} = props;
 
-        let card = new Card({GameLayer});
-        this.addChild(card);
+        // let card = new Card({GameLayer});
+        // this.addChild(card);
         
-        let card2 = new Card({GameLayer, 'x': -200});
-        this.addChild(card2);
+        let view = new PIXI.Container();
+
+        view.addChild(new Card({GameLayer, 'x': -220, 'y': -230, team: 0, id: 4}));
+        view.addChild(new Card({GameLayer, 'x': -220, 'y': 0, team: 1, id: 5}));
+        view.addChild(new Card({GameLayer, 'x': -220, 'y': 230, team: 1, id: 4}));
+        view.addChild(new Card({GameLayer, 'x': -50, 'y': -230, team: 1, id: 5}));
+        view.addChild(new Card({GameLayer, 'x': -50, 'y': 0, team: 0, id: 2}));
+        view.addChild(new Card({GameLayer, 'x': -50, 'y': 230, team: 1, id: 3}));
+        view.addChild(new Card({GameLayer, 'x': 120, 'y': -230, team: 0, id: 1}));
+        view.addChild(new Card({GameLayer, 'x': 120, 'y': 0, team: 1, id: 3}));
+        view.addChild(new Card({GameLayer, 'x': 120, 'y': 230, team: 1, id: 3}));
+
+        view.position.set(-200,0);
+        this.addChild(view);
+
+
+        let deck = new PIXI.Container();
+
+        deck.addChild(new Card({GameLayer, 'x': -180, 'y': -230, team: 0, id: 3}).scaleTo(0.27));
+        deck.addChild(new Card({GameLayer, 'x': -180, 'y': -50, team: 1, id: 1}).scaleTo(0.27));
+        deck.addChild(new Card({GameLayer, 'x': -50, 'y': -230, team: 1, id: 5}).scaleTo(0.27));
+        deck.addChild(new Card({GameLayer, 'x': -50, 'y': -50, team: 1, id: 4}).scaleTo(0.27));
+        deck.addChild(new Card({GameLayer, 'x': -120, 'y': 130, team: 1, id: 3}).scaleTo(0.27));
+        deck.position.set(610,110);
+        this.addChild(deck);
+
 
         let holder = new CardHolder({'x':-170,'y':0,'w':203,'h':323});
         this.addChild(holder);