Commit 2937f290 authored by 神楽坂玲奈's avatar 神楽坂玲奈

0.0.8

parent ed96da3d
......@@ -8,7 +8,7 @@
"port": 10800
},
"main": "th135.exe",
"summary": "喵喵喵喵喵帕斯 \nnyanpass nyanpass",
"summary": "使用说明: \n- 点 [添加] 选择自己游戏路径 \n- 点 [开始] 运行游戏,并在10800端口建主 \n- 点 [反重力场] 获取公网IP和端口 \n- 把那个通过QQ等即时通讯工具告诉你的对手",
"download": {
"url": "http://test2.my-card.in/downloads/maotama/th135_1.33.7z",
"size": 313177031,
......@@ -37,7 +37,7 @@
"protocol": "udp",
"port": 10800
},
"summary": "诶嘿★~",
"summary": "使用说明: \n- 点 [添加] 选择自己游戏路径 \n- 点 [开始] 运行游戏,并在10800端口建主 \n- 点 [反重力场] 获取公网IP和端口 \n- 把那个通过QQ等即时通讯工具告诉你的对手",
"download": {
"url": "http://test2.my-card.in/downloads/maotama/th123_1.10a.7z",
"size": 250272482,
......@@ -161,5 +161,24 @@
]
}
]
},
{
"id": "ygopro",
"category": "game",
"name": "游戏王 YGOPro",
"summary": "现在放这只是摆看的,还没支持。 \n**不要**在这里尝试安装,会崩。 \n想玩的请去下萌卡 https://my-card.in/ "
},
{
"id": "thbh",
"category": "game",
"name": "东方暴打油库里",
"summary": "大家好我们是学了十二年3D技术的MyACG制作组,我们制作了最近大热的《东方project》同人游戏,希望大家能够喜欢,多多交流经验。",
"download": {
"url": "http://test2.my-card.in/downloads/maotama/thbh.7z",
"size": 17548549,
"checksum": "6364783f2a50d36f01355727a343f184"
},
"main": "THBH.exe",
"languages": ["zh-CN"]
}
]
\ No newline at end of file
......@@ -202,7 +202,7 @@
})(Candy.Core.Event || {}, Strophe, jQuery);
//父窗口焦點
Candy.View = function(self, $) {
(function(self, $) {
/** PrivateObject: _current
* Object containing current container & roomJid which the client sees.
*/
......@@ -335,7 +335,23 @@ Candy.View = function(self, $) {
return _options;
};
return self;
}(Candy.View || {}, jQuery);
})(Candy.View || {}, jQuery);
//presence 接受多个el参数
(function(self, Strophe, $) {
/** Class: Candy.Core.Action.Jabber
* Jabber actions
*/
self.Jabber.Presence = function (attr, el) {
var pres = $pres(attr).c("priority").t(Candy.Core.getOptions().presencePriority.toString()).up().c("c", Candy.Core.getConnection().caps.generateCapsAttrs()).up();
for(var i=1; i<arguments.length; i++){
el = arguments[i];
pres.node.appendChild(el.node);
}
Candy.Core.getConnection().send(pres.tree());
}
})(Candy.Core.Action || {}, Strophe, jQuery);
//中文验证,看起来SHA1、MD5、PLAIN都对中文支持有问题。通过更换base64库可以修复PLAIN,然后在这里只允许PLAIN认证
Strophe.Connection.prototype._connect_cb = function(req, _callback, raw) {
......
......@@ -107,6 +107,17 @@ $(document).ready(function () {
window.addEventListener('message', function (event) {
var msg = event.data
switch (msg.type) {
case 'status':
if (msg.status && msg.show){
Candy.Core.Action.Jabber.Presence(null,$build('show').t(msg.show), $build('status').t(msg.status));
}else if(msg.status){
Candy.Core.Action.Jabber.Presence(null,$build('status').t(msg.status));
}else if(msg.show){
Candy.Core.Action.Jabber.Presence(null,$build('show').t(msg.show));
}else{
Candy.Core.Action.Jabber.Presence();
}
break;
case 'chat':
Candy.View.Pane.PrivateRoom.open(msg.jid, msg.jid.split('@')[0], true, true);
break;
......
......@@ -35,7 +35,7 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left" ng-if="current_user">
<li><a href="javascript:;">首页</a></li>
<li class="disabled"><a href="javascript:;">首页</a></li>
<li class="active"><a href="javascript:;">游戏</a></li>
<li class="disabled"><a href="javascript:;">漫画</a></li>
<li class="disabled"><a href="javascript:;">音乐</a></li>
......@@ -87,7 +87,7 @@
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
<input id="roster_search" type="text" name="name" class="form-control">
<input id="roster_search" type="text" name="name" class="form-control" placeholder="好友系统还没写好">
</div>
</form>
</div>
......
......@@ -42,8 +42,9 @@ angular.module('maotama.controllers', [])
if app.category == category
"active"
]
.controller 'AppsShowController', ['$scope', '$routeParams', ($scope, $routeParams)->
.controller 'AppsShowController', ['$scope', '$routeParams','$rootScope', ($scope, $routeParams, $rootScope)->
$scope.tunnel_servers = require './tunnel_servers.json'
$scope.candy = document.getElementById('candy')
db.apps.findOne {id: $routeParams.app_id}, (err, doc)->
throw err if err
$scope.app = doc
......@@ -160,7 +161,19 @@ angular.module('maotama.controllers', [])
$scope.run = ()->
$scope.runtime.running = true
game = child_process.spawn $scope.app.main, [],
$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}",
"--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",
],
cwd: $scope.local.installation
game.stdout.setEncoding('utf8');
game.stdout.on 'data', (data)->
......@@ -185,10 +198,15 @@ angular.module('maotama.controllers', [])
}, $scope.profile, (err, numReplaced, newDoc)->
throw err if err
$scope.$digest();
when 'SCORE'
score = parseInt $(command).text()
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "得分", score
else
window.LOCAL_NW.desktopNotifications.notify $scope.app.icon, "unknown command", matches[1]
game.on 'close', (code)->
$scope.runtime.running = false
$scope.candy.contentWindow.postMessage(type: 'status', $scope.candy.src)
$scope.$digest();
$scope.achievement_unlocked_count = (category)->
......@@ -220,7 +238,6 @@ angular.module('maotama.controllers', [])
$scope.runtime.tunnel = address
$scope.$digest()
]
.controller 'UserController', ['$scope','$rootScope', '$http', ($scope, $rootScope, $http)->
......
......@@ -88,8 +88,9 @@
};
}
]).controller('AppsShowController', [
'$scope', '$routeParams', function($scope, $routeParams) {
'$scope', '$routeParams', '$rootScope', function($scope, $routeParams, $rootScope) {
$scope.tunnel_servers = require('./tunnel_servers.json');
$scope.candy = document.getElementById('candy');
db.apps.findOne({
id: $routeParams.app_id
}, function(err, doc) {
......@@ -257,12 +258,17 @@
$scope.run = function() {
var game;
$scope.runtime.running = true;
game = child_process.spawn($scope.app.main, [], {
$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, "--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"], {
cwd: $scope.local.installation
});
game.stdout.setEncoding('utf8');
game.stdout.on('data', function(data) {
var achievement, achievement_item, command, matches, _base, _i, _len, _name, _ref;
var achievement, achievement_item, command, matches, score, _base, _i, _len, _name, _ref;
console.log(data);
if (matches = data.match(/<maotama>(.+)<\/maotama>/)) {
_ref = $(matches[1]);
......@@ -293,6 +299,10 @@
return $scope.$digest();
});
break;
case 'SCORE':
score = parseInt($(command).text());
window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "得分", score);
break;
default:
window.LOCAL_NW.desktopNotifications.notify($scope.app.icon, "unknown command", matches[1]);
}
......@@ -301,6 +311,9 @@
});
return game.on('close', function(code) {
$scope.runtime.running = false;
$scope.candy.contentWindow.postMessage({
type: 'status'
}, $scope.candy.src);
return $scope.$digest();
});
};
......
This diff is collapsed.
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