implement counting of dog. some minor adjustments
This commit is contained in:
parent
0c02e83bff
commit
8ce9263b3d
1 changed files with 68 additions and 4 deletions
|
@ -16,14 +16,14 @@ var myStyles = `
|
|||
position: absolute;
|
||||
top: 620px;
|
||||
width: 850px;
|
||||
height: 580px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
#playedLow {
|
||||
position: absolute;
|
||||
top: 750px;
|
||||
width: 850px;
|
||||
height: 580px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.playedCardsLayout {
|
||||
|
@ -70,6 +70,7 @@ var createCardPlace = function(value, shift, node) {
|
|||
var playedCards = document.createElement('ul');
|
||||
playedCards.id = 'playedCards' + value;
|
||||
// playedCards.className = 'layoutPlayedCards list-unstyled col-lg-2';
|
||||
// playedCards.className = 'playedCardsLayout list-unstyled';
|
||||
playedCards.className = 'playedCardsLayout list-unstyled';
|
||||
playedCards.style.width = '160px';
|
||||
playedCards.style.marginLeft = '25px';
|
||||
|
@ -95,6 +96,8 @@ var OnlineTichuCounter = {
|
|||
$playedCards: {},
|
||||
played: {},
|
||||
total_played: [],
|
||||
exchanged_to: {},
|
||||
exchanged_from: {},
|
||||
|
||||
action: {
|
||||
|
||||
|
@ -103,7 +106,7 @@ var OnlineTichuCounter = {
|
|||
// console.log(card);
|
||||
// console.log(otc.played);
|
||||
index = 0;
|
||||
if(card.Shape > 4) {
|
||||
if(card.Shape >= 4) {
|
||||
index = 1;
|
||||
} else {
|
||||
index = card.Value;
|
||||
|
@ -141,10 +144,11 @@ var OnlineTichuCounter = {
|
|||
for(let i = 1; i < 15; i++) {
|
||||
otc.played[i] = [];
|
||||
}
|
||||
otc.total_played = [];
|
||||
},
|
||||
|
||||
drawPlayedCards: function() {
|
||||
console.log('drawing played cards');
|
||||
// console.log('drawing played cards');
|
||||
console.log(otc.played);
|
||||
for(let i = 1; i < 15; i++) {
|
||||
displayCardsHtmlString = "";
|
||||
|
@ -202,4 +206,64 @@ MyTableState = (function() {
|
|||
return result;
|
||||
})();
|
||||
|
||||
|
||||
MyChat = (function() {
|
||||
var cached_function = ot.reaction.Chat;
|
||||
|
||||
return function() {
|
||||
var result = cached_function.apply(this, arguments);
|
||||
|
||||
message = arguments[0];
|
||||
if (message.User.Username === "System") {
|
||||
var messageArray = message.Text.replace(/</g, '<').replace(/>/g, '>').split(' ');
|
||||
message.Text = messageArray.join(' ');
|
||||
messageArray = message.Text.replace(/</g, '<').replace(/>/g, '>').split(' ');
|
||||
|
||||
for(var i in messageArray) {
|
||||
if(messageArray[i] == "dogs") {
|
||||
otc.action.handlePlayedCard({
|
||||
"Shape": 5,
|
||||
"Value": 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
})();
|
||||
|
||||
MyExchangeCards = (function() {
|
||||
var cached_function = ot.action.ExchangeCards;
|
||||
|
||||
return function() {
|
||||
|
||||
otc.exchanged_to['west'] = {
|
||||
Shape: ot.$westExchange.children('li:nth-child(1)').data('shape'),
|
||||
Value: ot.$westExchange.children('li:nth-child(1)').data('value') };
|
||||
otc.exchanged_to['north'] = {
|
||||
Shape: ot.$northExchange.children('li:nth-child(1)').data('shape'),
|
||||
Value: ot.$northExchange.children('li:nth-child(1)').data('value') };
|
||||
otc.exchanged_to['east'] = {
|
||||
Shape: ot.$eastExchange.children('li:nth-child(1)').data('shape'),
|
||||
Value: ot.$eastExchange.children('li:nth-child(1)').data('value') };
|
||||
|
||||
console.log(otc.exchanged_to);
|
||||
|
||||
var result = cached_function.apply(this, arguments);
|
||||
return result;
|
||||
}
|
||||
})();
|
||||
|
||||
MyReviewExchange = (function() {
|
||||
var cached_function = ot.reaction.ReviewExchange;
|
||||
|
||||
return function() {
|
||||
var result = cached_function.apply(this, arguments);
|
||||
return result;
|
||||
}
|
||||
})();
|
||||
|
||||
ot.reaction.TableState = MyTableState;
|
||||
ot.reaction.Chat = MyChat;
|
||||
ot.action.ExchangeCards = MyExchangeCards;
|
||||
|
|
Loading…
Reference in a new issue