大改联网的lock子模块,大改对战的玩家数据结构,重做联网对战准备界面

This commit is contained in:
MrZ626
2021-04-08 23:43:10 +08:00
parent 2bdbc4d792
commit ca267fd565
8 changed files with 104 additions and 100 deletions

View File

@@ -707,7 +707,7 @@ function draw.norm_remote(P)
--Draw username
setFont(30)
gc_setColor(1,1,1)
mStr(P.userName,150,-60)
mStr(P.username,150,-60)
--Fill field
gc_setColor(0,0,0,.6)

View File

@@ -134,10 +134,9 @@ local function newEmptyPlayer(id,mini)
P.atker,P.atking,P.lastRecv={}
--Network-related
P.userName="_"
P.userID=-1
P.subID=-1
P.ready=false
P.username="_"
P.uid=-1
P.sid=-1
P.dropDelay,P.lockDelay=0,0
P.showTime=false
@@ -240,7 +239,7 @@ local function loadRemoteEnv(P,confStr)--Load gameEnv
conf=JSON.decode(conf)
else
conf={}
LOG.print("Bad conf from "..P.userName.."#"..P.userID)
LOG.print("Bad conf from "..P.username.."#"..P.uid)
end
P.gameEnv={}--Current game setting environment
@@ -383,10 +382,9 @@ function PLY.newRemotePlayer(id,mini,data)
P.streamProgress=1
data.p=P
P.userID=data.uid
P.userName=data.username
P.subID=data.sid
P.ready=data.ready
P.uid=data.uid
P.username=data.username
P.sid=data.sid
loadRemoteEnv(P,data.conf)
applyGameEnv(P)
@@ -408,8 +406,8 @@ function PLY.newPlayer(id,mini)
P.type="human"
P.sound=true
P.userID=USER.uid
P.subID=-1
P.uid=USER.uid
P.sid=-1
loadGameEnv(P)
applyGameEnv(P)

View File

@@ -222,7 +222,7 @@ function Player:setConf(confStr)
end
end
else
LOG.print("Bad conf from "..self.userName.."#"..self.userID)
LOG.print("Bad conf from "..self.username.."#"..self.uid)
end
end
@@ -340,7 +340,7 @@ function Player:attack(R,send,time,line,fromStream)
if self.type=="human"then--Local player attack others
ins(GAME.rep,GAME.frame)
ins(GAME.rep,
R.subID+
R.sid+
send*0x100+
time*0x10000+
line*0x100000000+
@@ -350,7 +350,7 @@ function Player:attack(R,send,time,line,fromStream)
if fromStream and R.type=="human"then--Local player receiving lines
ins(GAME.rep,GAME.frame)
ins(GAME.rep,
self.subID+
self.sid+
send*0x100+
time*0x10000+
line*0x100000000+

View File

@@ -396,7 +396,7 @@ function update.remote_alive(P,dt)
local line=int(event/0x100000000)%0x10000
local L=PLY_ALIVE
for i=1,#L do
if L[i].subID==sid then
if L[i].sid==sid then
P:attack(L[i],amount,time,line,true)
if SETTING.atkFX>0 then
P:createBeam(L[i],amount,P.cur.color)
@@ -408,7 +408,7 @@ function update.remote_alive(P,dt)
local L=PLY_ALIVE
local sid=event%0x100
for i=1,#L do
if L[i].subID==sid then
if L[i].sid==sid then
P:receive(
L[i],
int(event/0x100)%0x100,--amount