修复一些自定义房间问题,添加房间描述
This commit is contained in:
@@ -224,11 +224,6 @@ function applyCustomGame()--Apply CUSTOMENV, BAG, MISSION
|
|||||||
GAME.modeEnv.mission=nil
|
GAME.modeEnv.mission=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function applyRoomConf()--Apply room configs
|
|
||||||
for k,v in next,NET.roomState.roomData do
|
|
||||||
GAME.modeEnv[k]=v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function loadGame(M,ifQuickPlay,ifNet)--Load a mode and go to game scene
|
function loadGame(M,ifQuickPlay,ifNet)--Load a mode and go to game scene
|
||||||
freshDate()
|
freshDate()
|
||||||
if legalGameTime()then
|
if legalGameTime()then
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ ROOMENV={
|
|||||||
--Control
|
--Control
|
||||||
nextCount=6,
|
nextCount=6,
|
||||||
holdCount=1,
|
holdCount=1,
|
||||||
infHold=true,
|
infHold=false,
|
||||||
phyHold=false,
|
phyHold=false,
|
||||||
|
|
||||||
--Visual
|
--Visual
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ return{
|
|||||||
net_newRoom={
|
net_newRoom={
|
||||||
title="Custom room config",
|
title="Custom room config",
|
||||||
roomName="Room name(default to username's room)",
|
roomName="Room name(default to username's room)",
|
||||||
|
roomDescription="Room description",
|
||||||
|
|
||||||
life="Lives",
|
life="Lives",
|
||||||
pushSpeed="Push Speed",
|
pushSpeed="Push Speed",
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ return{
|
|||||||
net_newRoom={
|
net_newRoom={
|
||||||
-- title="Custom room config",
|
-- title="Custom room config",
|
||||||
-- roomName="Room name(default to username's room)",
|
-- roomName="Room name(default to username's room)",
|
||||||
|
-- roomDescription="Room description",
|
||||||
|
|
||||||
life="Vie",
|
life="Vie",
|
||||||
-- pushSpeed="Push Speed",
|
-- pushSpeed="Push Speed",
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ return{
|
|||||||
net_newRoom={
|
net_newRoom={
|
||||||
-- title="Custom room config",
|
-- title="Custom room config",
|
||||||
-- roomName="Room name(default to username's room)",
|
-- roomName="Room name(default to username's room)",
|
||||||
|
-- roomDescription="Room description",
|
||||||
|
|
||||||
life="Vidas",
|
life="Vidas",
|
||||||
pushSpeed="Garbage Speed",
|
pushSpeed="Garbage Speed",
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ return{
|
|||||||
net_newRoom={
|
net_newRoom={
|
||||||
-- title="Custom room config",
|
-- title="Custom room config",
|
||||||
-- roomName="Room name(default to username's room)",
|
-- roomName="Room name(default to username's room)",
|
||||||
|
-- roomDescription="Room description",
|
||||||
|
|
||||||
life="Vida",
|
life="Vida",
|
||||||
-- pushSpeed="Garbage Speed",
|
-- pushSpeed="Garbage Speed",
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ return{
|
|||||||
net_newRoom={
|
net_newRoom={
|
||||||
title="自定义房间参数",
|
title="自定义房间参数",
|
||||||
roomName="房间名(留空默认 用户名's room)",
|
roomName="房间名(留空默认 用户名's room)",
|
||||||
|
roomDescription="房间描述",
|
||||||
|
|
||||||
life="命数",
|
life="命数",
|
||||||
pushSpeed="上涨速度",
|
pushSpeed="上涨速度",
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
local yield=YIELD
|
local yield=YIELD
|
||||||
|
local function marginTask(P)
|
||||||
|
local S=P.stat
|
||||||
|
while true do yield()if S.frame>90*60 then P.strength=1;P:setFrameColor(1)break end end
|
||||||
|
while true do yield()if S.frame>135*60 then P.strength=2;P:setFrameColor(2)break end end
|
||||||
|
while true do yield()if S.frame>180*60 then P.strength=3;P:setFrameColor(3)break end end
|
||||||
|
while true do yield()if S.frame>260*60 then P.strength=4;P:setFrameColor(4)break end end
|
||||||
|
end
|
||||||
return{
|
return{
|
||||||
color=COLOR.white,
|
color=COLOR.white,
|
||||||
env={
|
env={},
|
||||||
drop=30,
|
|
||||||
freshLimit=15,
|
|
||||||
pushSpeed=5,
|
|
||||||
garbageSpeed=2,
|
|
||||||
allowMod=false,
|
|
||||||
task=function(P)
|
|
||||||
local S=P.stat
|
|
||||||
while true do yield()if S.frame>90*60 then P.strength=1;P:setFrameColor(1)break end end
|
|
||||||
while true do yield()if S.frame>135*60 then P.strength=2;P:setFrameColor(2)break end end
|
|
||||||
while true do yield()if S.frame>180*60 then P.strength=3;P:setFrameColor(3)break end end
|
|
||||||
while true do yield()if S.frame>260*60 then P.strength=4;P:setFrameColor(4)break end end
|
|
||||||
end,
|
|
||||||
bgm={'battle','cruelty','distortion','far','final','hope','magicblock','new era','push','race','rockblock','secret7th','secret8th','shining terminal','storm','super7th','warped','waterfall','moonbeam'},
|
|
||||||
},
|
|
||||||
load=function()
|
load=function()
|
||||||
applyRoomConf()
|
TABLE.clear(GAME.modeEnv)
|
||||||
|
for k,v in next,NET.roomState.roomData do
|
||||||
|
GAME.modeEnv[k]=v
|
||||||
|
end
|
||||||
|
GAME.modeEnv.allowMod=false
|
||||||
|
GAME.modeEnv.task=marginTask
|
||||||
|
|
||||||
local L=TABLE.copy(netPLY.list)
|
local L=TABLE.copy(netPLY.list)
|
||||||
local N=1
|
local N=1
|
||||||
for i,p in next,L do
|
for i,p in next,L do
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ function NET.fetchRoom()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.createRoom(roomName,capacity,roomType,roomData,password)
|
function NET.createRoom(roomName,description,capacity,roomType,roomData,password)
|
||||||
if NET.lock('enterRoom',1.26)then
|
if NET.lock('enterRoom',1.26)then
|
||||||
NET.roomState.private=not not password
|
NET.roomState.private=not not password
|
||||||
NET.roomState.capacity=capacity
|
NET.roomState.capacity=capacity
|
||||||
@@ -322,6 +322,7 @@ function NET.createRoom(roomName,capacity,roomType,roomData,password)
|
|||||||
name=roomName,
|
name=roomName,
|
||||||
type=roomType,
|
type=roomType,
|
||||||
version=VERSION.short,
|
version=VERSION.short,
|
||||||
|
description=description,
|
||||||
},
|
},
|
||||||
roomData=roomData,
|
roomData=roomData,
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
local ROOMENV=ROOMENV
|
local ROOMENV=ROOMENV
|
||||||
|
|
||||||
local roomName=WIDGET.newInputBox{name="roomNameBox",x=40,y=170,w=1200,h=80}
|
local roomName=WIDGET.newText{name="roomName",x=40,y=150,align='L'}
|
||||||
|
local roomNameBox=WIDGET.newInputBox{name="roomNameBox",x=40,y=200,w=640,h=60}
|
||||||
|
local description=WIDGET.newText{name="roomDescription",x=700,y=50,align='L'}
|
||||||
|
local descriptionBox=WIDGET.newInputBox{name="descriptionBox",x=700,y=100,w=550,h=160,font=25}
|
||||||
|
|
||||||
local sList={
|
local sList={
|
||||||
visible={"show","easy","slow","medium","fast","none"},
|
visible={"show","easy","slow","medium","fast","none"},
|
||||||
@@ -20,10 +23,11 @@ local sList={
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
local function createRoom()
|
local function createRoom()
|
||||||
local roomname=STRING.trim(roomName.value)
|
local roomname=STRING.trim(roomNameBox.value)
|
||||||
if #roomname==0 then roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room"end
|
if #roomname==0 then roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room"end
|
||||||
NET.createRoom(
|
NET.createRoom(
|
||||||
roomname,
|
roomname,
|
||||||
|
descriptionBox.value,
|
||||||
ROOMENV.capacity,"normal",ROOMENV
|
ROOMENV.capacity,"normal",ROOMENV
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -39,10 +43,12 @@ function scene.sceneBack()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(k)
|
function scene.keyDown(k)
|
||||||
if k=="return"then
|
if k=="return"and #EDITING==0 then
|
||||||
createRoom()
|
createRoom()
|
||||||
elseif k=="escape"then
|
elseif k=="escape"then
|
||||||
SCN.go('net_rooms')
|
SCN.go('net_rooms')
|
||||||
|
else
|
||||||
|
WIDGET.keyPressed(k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,8 +57,10 @@ scene.widgetList={
|
|||||||
WIDGET.newText{name="title",x=40,y=15,font=70,align='L'},
|
WIDGET.newText{name="title",x=40,y=15,font=70,align='L'},
|
||||||
|
|
||||||
--Room name
|
--Room name
|
||||||
WIDGET.newText{name="roomName",x=40,y=120,align='L'},
|
|
||||||
roomName,
|
roomName,
|
||||||
|
roomNameBox,
|
||||||
|
description,
|
||||||
|
descriptionBox,
|
||||||
|
|
||||||
--Selectors
|
--Selectors
|
||||||
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=ROOMval("life"), code=ROOMsto("life")},
|
WIDGET.newSelector{name="life", x=170,y=410,w=260,color='R',list=sList.life, disp=ROOMval("life"), code=ROOMsto("life")},
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ function scene.draw()
|
|||||||
gc.setColor(1,1,.7)
|
gc.setColor(1,1,.7)
|
||||||
gc.printf(R.roomInfo.name,870,240,365)
|
gc.printf(R.roomInfo.name,870,240,365)
|
||||||
setFont(20)
|
setFont(20)
|
||||||
|
gc.setColor(.8,.8,.8)
|
||||||
|
gc.printf(R.roomInfo.description,870,295,365)
|
||||||
if R.start then
|
if R.start then
|
||||||
gc.setColor(0,1,.2)
|
gc.setColor(0,1,.2)
|
||||||
gc.print(text.started,870,475)
|
gc.print(text.started,870,475)
|
||||||
|
|||||||
Reference in New Issue
Block a user