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

start_hand & draw_count

parent 6da27854
......@@ -89,7 +89,7 @@ class Rooms extends Spine.Controller
$('#join_private_room').data('room_id', room.id)
$('#join_private_room_dialog').dialog('open')
else
mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, null, room.pvp, room.rule, room.mode, room.start_lp), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if room.server().auth)
mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, null, room.pvp, room.rule, room.mode, room.start_lp, room.start_hand, room.draw_count), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if room.server().auth)
login = ->
#Candy.Core.Event.Jabber.Presence = (msg)->
......@@ -181,6 +181,8 @@ $(document).ready ->
new_room.mode.value = 1 if new_room.mode.value == '2'
new_room.rule.value = 0
new_room.start_lp.value = 8000
new_room.start_hand.value = 5
new_room.draw_count.value = 1
if (server_id = parseInt new_room.server.value) and !Server.find(server_id).pvp
new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id
new_room.mode.onchange = ->
......@@ -211,7 +213,7 @@ $(document).ready ->
server_ip = new_room.server_ip.value
server_port = parseInt new_room.server_port.value
server_auth = new_room.server_auth.checked
mycard.join(server_ip, server_port, mycard.room_name(@name.value, @password.value, @pvp.checked, parseInt(@rule.value), parseInt(@mode.value), parseInt(@start_lp.value)), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if server_auth)
mycard.join(server_ip, server_port, mycard.room_name(@name.value, @password.value, @pvp.checked, parseInt(@rule.value), parseInt(@mode.value), parseInt(@start_lp.value), parseInt(@start_hand.value), parseInt(@draw_count.value)), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if server_auth)
$('#join_private_room').submit (ev)->
ev.preventDefault()
......@@ -221,7 +223,7 @@ $(document).ready ->
room_id = $(this).data('room_id')
if Room.exists room_id
room = Room.find(room_id)
mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, @password.value, room.pvp, room.rule, room.mode, room.start_lp), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if room.server().auth)
mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, @password.value, room.pvp, room.rule, room.mode, room.start_lp, room.start_hand, room.draw_count), Candy.Util.getCookie('username'), Candy.Util.getCookie('password') if room.server().auth)
else
alert '房间已经关闭'
......
......@@ -190,7 +190,7 @@
$('#join_private_room').data('room_id', room.id);
return $('#join_private_room_dialog').dialog('open');
} else {
return mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, null, room.pvp, room.rule, room.mode, room.start_lp), Candy.Util.getCookie('username'), room.server().auth ? Candy.Util.getCookie('password') : void 0);
return mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, null, room.pvp, room.rule, room.mode, room.start_lp, room.start_hand, room.draw_count), Candy.Util.getCookie('username'), room.server().auth ? Candy.Util.getCookie('password') : void 0);
}
};
......@@ -289,6 +289,8 @@
}
new_room.rule.value = 0;
new_room.start_lp.value = 8000;
new_room.start_hand.value = 5;
new_room.draw_count.value = 1;
if ((server_id = parseInt(new_room.server.value)) && !Server.find(server_id).pvp) {
return new_room.server.value = Server.choice(false, new_room.pvp.ckecked).id;
}
......@@ -334,7 +336,7 @@
server_port = parseInt(new_room.server_port.value);
server_auth = new_room.server_auth.checked;
}
return mycard.join(server_ip, server_port, mycard.room_name(this.name.value, this.password.value, this.pvp.checked, parseInt(this.rule.value), parseInt(this.mode.value), parseInt(this.start_lp.value)), Candy.Util.getCookie('username'), server_auth ? Candy.Util.getCookie('password') : void 0);
return mycard.join(server_ip, server_port, mycard.room_name(this.name.value, this.password.value, this.pvp.checked, parseInt(this.rule.value), parseInt(this.mode.value), parseInt(this.start_lp.value), parseInt(this.start_hand.value), parseInt(this.draw_count.value)), Candy.Util.getCookie('username'), server_auth ? Candy.Util.getCookie('password') : void 0);
};
$('#join_private_room').submit(function(ev) {
var room, room_id;
......@@ -344,7 +346,7 @@
room_id = $(this).data('room_id');
if (Room.exists(room_id)) {
room = Room.find(room_id);
return mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, this.password.value, room.pvp, room.rule, room.mode, room.start_lp), Candy.Util.getCookie('username'), room.server().auth ? Candy.Util.getCookie('password') : void 0);
return mycard.join(room.server().ip, room.server().port, mycard.room_name(room.name, this.password.value, room.pvp, room.rule, room.mode, room.start_lp, room.start_hand, room.draw_count), Candy.Util.getCookie('username'), room.server().auth ? Candy.Util.getCookie('password') : void 0);
} else {
return alert('房间已经关闭');
}
......
......@@ -116,13 +116,12 @@ html .ui-dialog{font-size:12px;
&.new_room_pvp{margin:2px 0 0 0;width:40px;}
}
input{float:left;margin:0 0 10px 0;
&#new_room_password{width:90px;}
&#new_room_pvp{margin:5px 0 0 10px;}
&.newRoomSubmit{border:none;background:#147CC3;border-radius:5px;color:#FFFFFF;padding:3px 8px;display:block;margin:0 0 10px 20px;}
&#new_room_start_lp, &#new_room_start_hand, &#new_room_draw_count{width:139px;}
}
select{float:left;display:block;margin:0 0 10px 0;width:96px;}
.newRoomName{display:block;float:left;height:60px;width:280px;border-bottom:1px solid #dddddd;padding-bottom:10px;margin-bottom:15px;}
.newRoomName{display:block;float:left;width:280px;border-bottom:1px solid #dddddd;padding-bottom:10px;margin-bottom:15px;}
#server_custom{float:left;display:block;width:280px;margin:5px 0 0 0;
#server_ip{margin:0 0 0 23px;width:65px;}
.newRoomColon{width:10px;margin:2px 8px 0 5px;}
......
......@@ -200,17 +200,16 @@
<div class="newRoomName">
<label for="new_room_name">房间名称</label><input type="text" id="new_room_name" name="name"/>
<label for="new_room_password">房间密码</label><input type="text" name="password" id="new_room_password" value=""/>
<input type="checkbox" name="pvp" id="new_room_pvp" value="pvp"/><label for="new_room_pvp" class="new_room_pvp">竞技场</label>
</div>
<label for="server">服务器</label>
<select id="server" name="server">
<option value="0" selected>自定义</option>
</select>
<div id="server_custom" hidden>
<input type="text" id="server_ip" name="server_ip" value="127.0.0.1"/><label class="newRoomColon" for="server_port">:</label><input type="number" id="server_port" name="server_port" value="7911"/>
<input type="checkbox" id="server_auth" name="server_auth"/><label class="newRoomApprove" for="server_auth">认证</label>
<label for="server">服务器</label>
<select id="server" name="server">
<option value="0" selected>自定义</option>
</select>
<input type="checkbox" name="pvp" id="new_room_pvp"/><label for="new_room_pvp" class="new_room_pvp">竞技场</label>
<div id="server_custom" hidden>
<input type="text" id="server_ip" name="server_ip" value="127.0.0.1"/><label class="newRoomColon" for="server_port">:</label><input type="number" id="server_port" name="server_port" value="7911"/>
<input type="checkbox" id="server_auth" name="server_auth"/><label class="newRoomApprove" for="server_auth">认证</label>
</div>
</div>
<div class="newRoomMode">
......@@ -223,20 +222,24 @@
</select>
<label for="new_room_mode">决斗模式</label>
<select id="new_room_mode" name="mode">
<option value="0">单局模式</option>
<option value="1" selected>比赛模式</option>
<option value="0" selected>单局模式</option>
<option value="1">比赛模式</option>
<option value="2">TAG</option>
</select>
</div>
<div class="newRoomExtra">
<h4>额外选项</h4>
<h4>额外选项 (无特殊需求请勿更改)</h4>
<label for="new_room_start_lp">初始LP</label>
<input type="number" name="start_lp" id="new_room_start_lp" min="0" max="99999" value="8000"/>
<label for="new_room_start_hand">初始手牌数</label>
<input type="number" name="start_hand" id="new_room_start_hand" min="0" max="60" value="5"/>
<label for="new_room_draw_count">每回合抽卡</label>
<input type="number" name="draw_count" id="new_room_draw_count" min="0" max="60" value="1"/>
<!--<div style="clear:both"></div>
<input type="checkbox" name="enable_priority" id="new_room_enable_priority"><label for="new_room_enable_priority" class="new_room_enable_priority">允许启动效果优先权</label>
<input type="checkbox" name="enable_no_check_deck" id="new_room_no_check_deck"><label for="new_room_no_check_deck" class="new_room_no_check_deck">不检查卡组</label>
<input type="checkbox" name="enable_priority" id="new_room_no_shuffle_deck"><label for="new_room_pvp" class="new_room_pvp">开局不洗卡组</label>-->
</div>
......
@mycard = {}
@mycard.room_name = (name, password, pvp = false, rule = 0, mode = 0, start_lp = 8000) ->
if rule != 0 or start_lp != 8000
result = "#{rule}#{mode}FFF#{start_lp},5,1,"
@mycard.room_name = (name, password, pvp = false, rule = 0, mode = 0, start_lp = 8000, start_hand = 5, draw_count = 1) ->
if rule != 0 or start_lp != 8000 or start_hand != 5 or draw_count != 1
result = "#{rule}#{mode}FFF#{start_lp},#{start_hand},#{draw_count},"
else if mode == 2
result = "T#"
else if pvp and mode == 1
......@@ -30,11 +30,11 @@
#http://my-card.in/rooms/127.0.0.1:8087/test
@mycard.room_url = (ip,port,room,username,password)->
result = 'http://my-card.in/rooms/' + room_string(ip,port,room,username,password)
result = 'http://my-card.in/rooms/' + @room_string(ip,port,room,username,password)
#mycard://127.0.0.1:8087/test
@mycard.room_url_mycard = (ip,port,room,username,password)->
result = 'mycard://' + room_string(ip,port,room,username,password)
result = 'mycard://' + @room_string(ip,port,room,username,password)
@mycard.join = (ip,port,room,username,password)->
window.location.href = room_url_mycard(ip,port,room,username,password)
\ No newline at end of file
window.location.href = @room_url_mycard(ip,port,room,username,password)
\ No newline at end of file
......@@ -3,7 +3,7 @@
this.mycard = {};
this.mycard.room_name = function(name, password, pvp, rule, mode, start_lp) {
this.mycard.room_name = function(name, password, pvp, rule, mode, start_lp, start_hand, draw_count) {
var result;
if (pvp == null) {
pvp = false;
......@@ -17,8 +17,14 @@
if (start_lp == null) {
start_lp = 8000;
}
if (rule !== 0 || start_lp !== 8000) {
result = "" + rule + mode + "FFF" + start_lp + ",5,1,";
if (start_hand == null) {
start_hand = 5;
}
if (draw_count == null) {
draw_count = 1;
}
if (rule !== 0 || start_lp !== 8000 || start_hand !== 5 || draw_count !== 1) {
result = "" + rule + mode + "FFF" + start_lp + "," + start_hand + "," + draw_count + ",";
} else if (mode === 2) {
result = "T#";
} else if (pvp && mode === 1) {
......@@ -37,9 +43,9 @@
return result;
};
this.mycard.join = function(ip, port, room, username, password) {
this.mycard.room_string = function(ip, port, room, username, password) {
var result;
result = 'mycard://';
result = '';
if (username) {
result += encodeURIComponent(username);
if (password) {
......@@ -48,7 +54,21 @@
result += '@';
}
result += ip + ':' + port + '/' + encodeURIComponent(room);
return window.location.href = result;
return result;
};
this.mycard.room_url = function(ip, port, room, username, password) {
var result;
return result = 'http://my-card.in/rooms/' + this.room_string(ip, port, room, username, password);
};
this.mycard.room_url_mycard = function(ip, port, room, username, password) {
var result;
return result = 'mycard://' + this.room_string(ip, port, room, username, password);
};
this.mycard.join = function(ip, port, room, username, password) {
return window.location.href = this.room_url_mycard(ip, port, room, username, password);
};
}).call(this);
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