Commit c7cf5dd5 authored by 神楽坂玲奈's avatar 神楽坂玲奈

thbh

parent 2937f290
...@@ -163,16 +163,16 @@ angular.module('maotama.controllers', []) ...@@ -163,16 +163,16 @@ angular.module('maotama.controllers', [])
$scope.runtime.running = true $scope.runtime.running = true
$scope.candy.contentWindow.postMessage(type: 'status', status: "正在玩 #{$scope.app.name}", show: "dnd" , $scope.candy.src) $scope.candy.contentWindow.postMessage(type: 'status', status: "正在玩 #{$scope.app.name}", show: "dnd" , $scope.candy.src)
game = child_process.spawn $scope.app.main, ["--maotama-username=#{$rootScope.current_user.name}", game = child_process.spawn $scope.app.main, ["--maotama-username=#{$rootScope.current_user.name}",
"--maotama-ranking-0=0", "--maotama-ranking-#{$rootScope.current_user.name}=#{$scope.profile.score}",
"--maotama-ranking-1=1", "--maotama-ranking-博丽灵梦=6500",
"--maotama-ranking-2=2", "--maotama-ranking-♂Van♂=5800",
"--maotama-ranking-3=3", "--maotama-ranking-比利♂海灵顿=5600",
"--maotama-ranking-4=4", "--maotama-ranking-德国Boy=5430",
"--maotama-ranking-5=5", "--maotama-ranking-麦当劳叔叔=5400",
"--maotama-ranking-6=6", "--maotama-ranking-村口王师傅=5200",
"--maotama-ranking-7=7", "--maotama-ranking-帝国元首=4800",
"--maotama-ranking-8=8", "--maotama-ranking-葛老师=3600",
"--maotama-ranking-HJ=9", "--maotama-ranking-五道杠大队长=3300",
], ],
cwd: $scope.local.installation cwd: $scope.local.installation
game.stdout.setEncoding('utf8'); game.stdout.setEncoding('utf8');
...@@ -200,10 +200,16 @@ angular.module('maotama.controllers', []) ...@@ -200,10 +200,16 @@ angular.module('maotama.controllers', [])
$scope.$digest(); $scope.$digest();
when 'SCORE' when 'SCORE'
score = parseInt $(command).text() score = parseInt $(command).text()
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "得分", score if !$scope.profile.score or score > $scope.profile.score
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "最高得分", score
else $scope.profile.score = score
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "unknown command", matches[1] db.profile.update {
id: $scope.app.id
}, $scope.profile, (err, numReplaced, newDoc)->
throw err if err
$scope.$digest();
else
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "unknown command", matches[1]
game.on 'close', (code)-> game.on 'close', (code)->
$scope.runtime.running = false $scope.runtime.running = false
$scope.candy.contentWindow.postMessage(type: 'status', $scope.candy.src) $scope.candy.contentWindow.postMessage(type: 'status', $scope.candy.src)
......
...@@ -263,7 +263,7 @@ ...@@ -263,7 +263,7 @@
status: "正在玩 " + $scope.app.name, status: "正在玩 " + $scope.app.name,
show: "dnd" show: "dnd"
}, $scope.candy.src); }, $scope.candy.src);
game = child_process.spawn($scope.app.main, ["--maotama-username=" + $rootScope.current_user.name, "--maotama-ranking-0=0", "--maotama-ranking-1=1", "--maotama-ranking-2=2", "--maotama-ranking-3=3", "--maotama-ranking-4=4", "--maotama-ranking-5=5", "--maotama-ranking-6=6", "--maotama-ranking-7=7", "--maotama-ranking-8=8", "--maotama-ranking-HJ=9"], { game = child_process.spawn($scope.app.main, ["--maotama-username=" + $rootScope.current_user.name, "--maotama-ranking-" + $rootScope.current_user.name + "=" + $scope.profile.score, "--maotama-ranking-博丽灵梦=6500", "--maotama-ranking-♂Van♂=5800", "--maotama-ranking-比利♂海灵顿=5600", "--maotama-ranking-德国Boy=5430", "--maotama-ranking-麦当劳叔叔=5400", "--maotama-ranking-村口王师傅=5200", "--maotama-ranking-帝国元首=4800", "--maotama-ranking-葛老师=3600", "--maotama-ranking-五道杠大队长=3300"], {
cwd: $scope.local.installation cwd: $scope.local.installation
}); });
game.stdout.setEncoding('utf8'); game.stdout.setEncoding('utf8');
...@@ -301,10 +301,20 @@ ...@@ -301,10 +301,20 @@
break; break;
case 'SCORE': case 'SCORE':
score = parseInt($(command).text()); score = parseInt($(command).text());
window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "得分", score); if (!$scope.profile.score || score > $scope.profile.score) {
break; window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "最高得分", score);
default: $scope.profile.score = score;
window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "unknown command", matches[1]); db.profile.update({
id: $scope.app.id
}, $scope.profile, function(err, numReplaced, newDoc) {
if (err) {
throw err;
}
return $scope.$digest();
});
} else {
window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "unknown command", matches[1]);
}
} }
} }
} }
......
This diff is collapsed.
...@@ -64,7 +64,9 @@ win.on 'new-win-policy', (frame, url, policy)-> ...@@ -64,7 +64,9 @@ win.on 'new-win-policy', (frame, url, policy)->
gui.Shell.openExternal( url ); gui.Shell.openExternal( url );
policy.ignore() policy.ignore()
$('body').on 'click', 'a[data-toggle="tab"]', (e)->
e.preventDefault()
$(this).tab('show')
#用户 #用户
pre_load_photo = (jid, name, domain)-> pre_load_photo = (jid, name, domain)->
......
...@@ -101,6 +101,11 @@ ...@@ -101,6 +101,11 @@
return policy.ignore(); return policy.ignore();
}); });
$('body').on('click', 'a[data-toggle="tab"]', function(e) {
e.preventDefault();
return $(this).tab('show');
});
pre_load_photo = function(jid, name, domain) { pre_load_photo = function(jid, name, domain) {
var hash; var hash;
switch (domain) { switch (domain) {
......
This diff is collapsed.
...@@ -112,6 +112,96 @@ ...@@ -112,6 +112,96 @@
<img class="friend img-thumbnail" src="https://lh5.googleusercontent.com/-crYEtoQ-4Ho/AAAAAAAAAAI/AAAAAAAAAZE/OVA-78yQjU8/s46-c-k-no/photo.jpg"> <img class="friend img-thumbnail" src="https://lh5.googleusercontent.com/-crYEtoQ-4Ho/AAAAAAAAAAI/AAAAAAAAAZE/OVA-78yQjU8/s46-c-k-no/photo.jpg">
<img class="friend img-thumbnail" src="https://lh5.googleusercontent.com/-crYEtoQ-4Ho/AAAAAAAAAAI/AAAAAAAAAZE/OVA-78yQjU8/s46-c-k-no/photo.jpg"> <img class="friend img-thumbnail" src="https://lh5.googleusercontent.com/-crYEtoQ-4Ho/AAAAAAAAAAI/AAAAAAAAAZE/OVA-78yQjU8/s46-c-k-no/photo.jpg">
<h2 class="sub-header" ng-if="profile.score">排行榜</h2>
<!-- Nav tabs -->
<ul class="nav nav-tabs" ng-if="profile.score">
<li><a href="#ranking_global" data-toggle="tab">所有人</a></li>
<li class="active"><a href="#ranking_friends" data-toggle="tab">好友</a></li>
</ul>
<div class="tab-content" ng-if="profile.score">
<div class="tab-pane fade" id="ranking_global">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>昵称</th>
<th>得分</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>博丽灵梦</td>
<td>6500</td>
</tr>
<tr>
<td>2</td>
<td>♂Van♂</td>
<td>5800</td>
</tr>
<tr>
<td>3</td>
<td>比利♂海灵顿</td>
<td>5430</td>
</tr>
<tr>
<td>4</td>
<td>麦当劳叔叔</td>
<td>5600</td>
</tr>
<tr>
<td>5</td>
<td>德国Boy</td>
<td>5400</td>
</tr>
<tr>
<td>6</td>
<td>村口王师傅</td>
<td>5200</td>
</tr>
<tr>
<td>7</td>
<td>帝国元首</td>
<td>4800</td>
</tr>
<tr>
<td>8</td>
<td>葛老师</td>
<td>3600</td>
</tr>
<tr>
<td>9</td>
<td>五道杠大队长</td>
<td>3300</td>
</tr>
<tr>
<td>10</td>
<td>游泳教练</td>
<td>0</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane fade in active" id="ranking_friends">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>昵称</th>
<th>得分</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>{{current_user.name}}</td>
<td>{{profile.score}}</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
<h2 class="sub-header" ng-repeat-start="achievement in app.achievements">{{achievement.name}}</h2> <h2 class="sub-header" ng-repeat-start="achievement in app.achievements">{{achievement.name}}</h2>
<div class="clearfix" ng-if="achievement_unlocked_count($index) > 0"> <div class="clearfix" ng-if="achievement_unlocked_count($index) > 0">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment