1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-10-31 10:36:53 +00:00

some responsive stuff

This commit is contained in:
exane 2015-07-02 18:17:33 +02:00
parent 89b1396c50
commit 2de34251b5
8 changed files with 66 additions and 17 deletions

3
.gitignore vendored
View File

@ -1,7 +1,6 @@
node_modules node_modules
.idea .idea
public/build public/
public/index.html
test/spec test/spec
assets/cards/* assets/cards/*
client/scss/_cards.scss client/scss/_cards.scss

16
Config.example..js Normal file
View File

@ -0,0 +1,16 @@
window.Config = {};
Config.Server = {
"hostname": "192.168.123.1",
"port": 16918,
secure: false
}
Config.Gwent = {
notification_duration: 4000
}
Config.Site = {
base: "/gwent-online/site/public"
}

View File

@ -4,6 +4,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Gwent</title> <title>Gwent</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5, user-scalable=no" />
<meta name="HandheldFriendly" content="true" />
<link rel="stylesheet" href="build/bootstrap.css"> <link rel="stylesheet" href="build/bootstrap.css">
<link rel="stylesheet" href="build/cards.css"> <link rel="stylesheet" href="build/cards.css">
<link rel="stylesheet" href="build/main.css"> <link rel="stylesheet" href="build/main.css">

View File

@ -180,7 +180,8 @@ let SideView = Backbone.View.extend({
$field.addClass("field-frost"); $field.addClass("field-frost");
} }
calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin(this.$el.find(".field-close"));
}, },
renderRangeField: function(){ renderRangeField: function(){
if(!this.field.ranged) return; if(!this.field.ranged) return;
@ -208,7 +209,8 @@ let SideView = Backbone.View.extend({
$field.addClass("field-fog"); $field.addClass("field-fog");
} }
calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin(this.$el.find(".field-range"));
}, },
renderSiegeField: function(){ renderSiegeField: function(){
if(!this.field.siege) return; if(!this.field.siege) return;
@ -236,7 +238,8 @@ let SideView = Backbone.View.extend({
$field.addClass("field-rain"); $field.addClass("field-rain");
} }
calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin(this.$el.find(".field-siege"));
}, },
renderWeatherField: function(){ renderWeatherField: function(){
if(!this.field.weather) return; if(!this.field.weather) return;
@ -295,6 +298,7 @@ let BattleView = Backbone.View.extend({
this.$hand = this.$el.find(".field-hand"); this.$hand = this.$el.find(".field-hand");
this.$preview = this.$el.find(".card-preview"); this.$preview = this.$el.find(".card-preview");
//$(window).on("resize", this.calculateMargin.bind(this, this.$hand));
let interval = setInterval(function(){ let interval = setInterval(function(){
if(!user.get("room")) return; if(!user.get("room")) return;
@ -445,7 +449,7 @@ let BattleView = Backbone.View.extend({
if(this.handCards){ if(this.handCards){
calculateCardMargin(this.$el.find(".field-hand .card"), 538, 70, this.handCards.length); this.calculateMargin(this.$el.find(".field-hand"));
} }
if(this.user.get("isReDrawing")){ if(this.user.get("isReDrawing")){
@ -589,6 +593,18 @@ let BattleView = Backbone.View.extend({
side.render(); side.render();
} }
})*/ })*/
},
calculateMargin: function($container/*, totalWidth, cardWidth, n*/){
var n = $container.children().size();
let w = $container.width(), c = $container.find(".card").outerWidth() + 3;
let res;
if(n < 6)
res = 0;
else {
res = -((w - c) / (n - 1) - c) + 1
}
$container.find(".card").css("margin-left", -res);
} }
}); });

View File

@ -4,6 +4,9 @@
$height: 600px; $height: 600px;
$game-height: 800px; $game-height: 800px;
.container {
min-width: 960px;
}
.board { .board {
height: $game-height; height: $game-height;
@ -180,16 +183,18 @@ $game-height: 800px;
div { div {
position: fixed; position: fixed;
//left:0; //left:0;
z-index: 110; z-index: 310;
//height: 100px !important; //height: 100px !important;
i { i {
display: block; display: block;
margin-left: -15px;
} }
.preview-description { .preview-description {
width: 238px; width: 238px;
min-height: 200px; min-height: 200px;
background: rgba(16, 16, 16, 0.57); background: rgba(16, 16, 16, 0.57);
color: #ffffff; color: #ffffff;
margin-left: -15px;
p { p {
padding: 10px; padding: 10px;
@ -265,13 +270,22 @@ $game-height: 800px;
} }
.waiting-for-opponent { .waiting-for-opponent {
position: absolute; position: fixed;
//left: 43%; //left: 43%;
left: 30%; cursor: default;
top: 505px; width: 100%;
border: 1px solid black; text-align: center;
border-radius: 10px; //left: calc(50% - 400px) ;
padding: 0px 200px; left: 0;
//top: calc(50% - 60px);
top: calc(100% - 60px);
//border: 1px solid black;
//border-radius: 10px;
/*
padding: 0px 200px;*/
font-size: 25px;
line-height: 20px;
padding: 20px;
z-index: 300; z-index: 300;
color: #ff8927; color: #ff8927;
//text-shadow: 0px 0px 1px #000; //text-shadow: 0px 0px 1px #000;
@ -327,6 +341,7 @@ $game-height: 800px;
width: 200px; width: 200px;
text-align: left; text-align: left;
} }
.image-gif-loader { .image-gif-loader {
background: url("../../assets/content-load.gif"); background: url("../../assets/content-load.gif");
display: block; display: block;

View File

@ -1,6 +1,6 @@
<div class="col-xs-12 info-name">{{data.name}}</div> <div class="col-xs-12 info-name">{{data.name}}</div>
<div class="col-xs-6 field-single field-leader">{{>card leader}}</div> <div class="col-xs-12 col-lg-6 field-single field-leader">{{>card leader}}</div>
<div class="col-xs-6"> <div class="col-xs-12 col-lg-6">
<div class="row"> <div class="row">
<div class="col-xs-6">Points:</div> <div class="col-xs-6">Points:</div>
<div class="col-xs-6 score">{{data.score}}</div> <div class="col-xs-6 score">{{data.score}}</div>

View File

@ -2,7 +2,7 @@
window.Config = {}; window.Config = {};
Config.Server = { Config.Server = {
"hostname": "localhost", "hostname": "192.168.123.1",
"port": 16918, "port": 16918,
secure: false secure: false
} }

View File

@ -856,6 +856,7 @@ Battleside = (function(){
if(!left){ if(!left){
self.send("redraw:close", null, true); self.send("redraw:close", null, true);
//console.log("redraw finished"); //console.log("redraw finished");
self.wait();
deferred.resolve("done"); deferred.resolve("done");
//self.socket.off("redraw:reDrawCard", h1); //self.socket.off("redraw:reDrawCard", h1);
} }