mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-19 13:39:18 +00:00
Compare commits
40 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8647c1a859 | ||
|
a41c68fb13 | ||
|
c5b26d716e | ||
|
1e0959c4cf | ||
|
3e54670a1b | ||
|
b41b86bbd3 | ||
|
db2bc0e3cd | ||
|
eedcf5c4dc | ||
|
c171ebc211 | ||
|
5a463239bb | ||
|
5c06cfdbac | ||
|
7985a242fd | ||
|
bef1df48aa | ||
|
8d989d543a | ||
|
849ce34fe5 | ||
|
195a400dc2 | ||
|
66dfcaa0f5 | ||
|
9917a62526 | ||
|
62e50f8b6c | ||
|
dc66be1599 | ||
|
858eba5243 | ||
|
d113cffc7d | ||
|
6af9a14be5 | ||
|
e3fe773634 | ||
|
17cac19c62 | ||
|
26bdd41285 | ||
|
6bf70463fa | ||
|
e3d844abad | ||
|
0373665382 | ||
|
3b0db64792 | ||
|
dd8b731ade | ||
|
c4489e0912 | ||
|
348c889e14 | ||
|
c6473db561 | ||
|
e165d49cb1 | ||
|
26370dce61 | ||
|
f3a12b2aa9 | ||
|
1f5802ee14 | ||
|
080a384ade | ||
|
9469b27348 |
@@ -1,3 +1,7 @@
|
|||||||
|
# What to be concerned for internet syncing
|
||||||
|
1. Server received too late (solution: force confirmation)
|
||||||
|
2. Client received too late (solution: prediction and frame chasing, big impact on user experience because the graphics will be inconsistent if mismatches occur too often)
|
||||||
|
|
||||||
# Potential avalanche from local lag
|
# Potential avalanche from local lag
|
||||||
Under the current "input delay" algorithm, the lag of a single player would cause all the other players to receive outdated commands, e.g. when at a certain moment
|
Under the current "input delay" algorithm, the lag of a single player would cause all the other players to receive outdated commands, e.g. when at a certain moment
|
||||||
- player#1: renderFrameId = 100, significantly lagged due to local CPU overheated
|
- player#1: renderFrameId = 100, significantly lagged due to local CPU overheated
|
||||||
@@ -7,9 +11,9 @@ Under the current "input delay" algorithm, the lag of a single player would caus
|
|||||||
|
|
||||||
players #2, #3 #4 would receive "outdated(in their subjective feelings) but all-confirmed commands" from then on, thus forced to rollback and chase many frames - the lag due to "large range of frame-chasing" would then further deteriorate the situation - like an avalanche.
|
players #2, #3 #4 would receive "outdated(in their subjective feelings) but all-confirmed commands" from then on, thus forced to rollback and chase many frames - the lag due to "large range of frame-chasing" would then further deteriorate the situation - like an avalanche.
|
||||||
|
|
||||||
In a "no-server & p2p" setup, I couldn't think of a proper way to cope with such edge case. Solely on the frontend we could only mitigate the impact to players #2, #3, #4, e.g. a potential lag due to "large range of frame-chasing" is proactively avoided in `<proj-root>/frontend/assets/scripts/Map.js, function update(dt)`.
|
In a "no-server & p2p" setup, I couldn't think of a proper way to cope with such edge case. Solely on the frontend we could only mitigate the impact to players #2, #3, #4, e.g. a potential lag due to "large range of frame-chasing" is proactively avoided in `<proj-root>/frontend/assets/scripts/Map.js, function update(dt)`.
|
||||||
|
|
||||||
However in a "server as authority" setup, the server could force confirming an inputFrame without player#1's upsync, and notify player#1 to apply a "roomDownsyncFrame" as well as drop all its outdated local inputFrames.
|
To be fair, **a "p2p" setup can reduce round-trip to single-trip**, but w/o a point of authority in such case player#1 needs a way to recognize the slowness (e.g. check the received peer inputs) and ticks faster for a while to catch up; in contrast in a "server as authority" setup, the server could force confirming an inputFrame without player#1's upsync, and notify player#1 to apply a "roomDownsyncFrame" as well as drop all its outdated local inputFrames.
|
||||||
|
|
||||||
# Start up frames
|
# Start up frames
|
||||||
renderFrameId | generatedInputFrameId | toApplyInputFrameId
|
renderFrameId | generatedInputFrameId | toApplyInputFrameId
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
This project is a demo for a websocket-based rollback netcode inspired by [GGPO](https://github.com/pond3r/ggpo/blob/master/doc/README.md).
|
This project is a demo for a websocket-based rollback netcode inspired by [GGPO](https://github.com/pond3r/ggpo/blob/master/doc/README.md).
|
||||||
|
|
||||||
_(the following gif is sped up to ~1.5x for file size reduction, kindly note that around ~11s countdown, the attack animation is resumed from a partial progress)_
|
_(the following gif is sped up to ~1.5x for file size reduction, kindly note that animations are resumed from a partial progress)_
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Please also checkout [this demo video](https://pan.baidu.com/s/1U1wb7KWyHorZElNWcS5HHA?pwd=30wh) to see how this demo carries out a full 60fps synchronization with the help of _batched input upsync/downsync_ for satisfying network I/O performance.
|
Please also checkout [this demo video](https://pan.baidu.com/s/1Lmot9cb0pYylfUvC8G4fDg?pwd=ia97) to see how this demo carries out a full 60fps synchronization with the help of _batched input upsync/downsync_ for satisfying network I/O performance.
|
||||||
|
|
||||||
The video mainly shows the following features.
|
The video mainly shows the following features.
|
||||||
- The backend receives inputs from frontend peers and broadcasts back for synchronization.
|
- The backend receives inputs from frontend peers and broadcasts back for synchronization.
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
PROJECTNAME=server.exe
|
PROJECTNAME=server.exe
|
||||||
ROOT_DIR=.
|
ROOT_DIR=.
|
||||||
|
GOPROXY=https://mirrors.aliyun.com/goproxy
|
||||||
all: help
|
all: help
|
||||||
|
|
||||||
gen-constants:
|
gen-constants:
|
||||||
@@ -13,13 +14,13 @@ run-test-and-hotreload:
|
|||||||
ServerEnv=TEST CompileDaemon -log-prefix=false -build="go build" -command="./$(PROJECTNAME)"
|
ServerEnv=TEST CompileDaemon -log-prefix=false -build="go build" -command="./$(PROJECTNAME)"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -o $(ROOT_DIR)/$(PROJECTNAME)
|
GOPROXY=$(GOPROXY) go build -o $(ROOT_DIR)/$(PROJECTNAME)
|
||||||
|
|
||||||
run-prod: build-prod
|
run-prod: build-prod
|
||||||
./$(PROJECTNAME)
|
./$(PROJECTNAME)
|
||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
go build -ldflags "-s -w -X main.VERSION=$(shell git rev-parse --short HEAD)-$(shell date "+%Y%m%d-%H:%M:%S")" -o $(ROOT_DIR)/$(PROJECTNAME)
|
GOPROXY=$(GOPROXY) go build -ldflags "-s -w -X main.VERSION=$(shell git rev-parse --short HEAD)-$(shell date "+%Y%m%d-%H:%M:%S")" -o $(ROOT_DIR)/$(PROJECTNAME)
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
||||||
|
@@ -17,12 +17,16 @@ func toPbPlayers(modelInstances map[int32]*Player, withMetaInfo bool) map[int32]
|
|||||||
VirtualGridY: last.VirtualGridY,
|
VirtualGridY: last.VirtualGridY,
|
||||||
DirX: last.DirX,
|
DirX: last.DirX,
|
||||||
DirY: last.DirY,
|
DirY: last.DirY,
|
||||||
ColliderRadius: last.ColliderRadius,
|
VelX: last.VelX,
|
||||||
|
VelY: last.VelY,
|
||||||
Speed: last.Speed,
|
Speed: last.Speed,
|
||||||
BattleState: last.BattleState,
|
BattleState: last.BattleState,
|
||||||
|
CharacterState: last.CharacterState,
|
||||||
|
InAir: last.InAir,
|
||||||
|
JoinIndex: last.JoinIndex,
|
||||||
|
ColliderRadius: last.ColliderRadius,
|
||||||
Score: last.Score,
|
Score: last.Score,
|
||||||
Removed: last.Removed,
|
Removed: last.Removed,
|
||||||
JoinIndex: last.JoinIndex,
|
|
||||||
}
|
}
|
||||||
if withMetaInfo {
|
if withMetaInfo {
|
||||||
toRet[k].Name = last.Name
|
toRet[k].Name = last.Name
|
||||||
|
@@ -13,6 +13,7 @@ import (
|
|||||||
type PlayerBattleState struct {
|
type PlayerBattleState struct {
|
||||||
ADDED_PENDING_BATTLE_COLLIDER_ACK int32
|
ADDED_PENDING_BATTLE_COLLIDER_ACK int32
|
||||||
READDED_PENDING_BATTLE_COLLIDER_ACK int32
|
READDED_PENDING_BATTLE_COLLIDER_ACK int32
|
||||||
|
READDED_BATTLE_COLLIDER_ACKED int32
|
||||||
ACTIVE int32
|
ACTIVE int32
|
||||||
DISCONNECTED int32
|
DISCONNECTED int32
|
||||||
LOST int32
|
LOST int32
|
||||||
@@ -26,11 +27,12 @@ func InitPlayerBattleStateIns() {
|
|||||||
PlayerBattleStateIns = PlayerBattleState{
|
PlayerBattleStateIns = PlayerBattleState{
|
||||||
ADDED_PENDING_BATTLE_COLLIDER_ACK: 0,
|
ADDED_PENDING_BATTLE_COLLIDER_ACK: 0,
|
||||||
READDED_PENDING_BATTLE_COLLIDER_ACK: 1,
|
READDED_PENDING_BATTLE_COLLIDER_ACK: 1,
|
||||||
ACTIVE: 2,
|
READDED_BATTLE_COLLIDER_ACKED: 2,
|
||||||
DISCONNECTED: 3,
|
ACTIVE: 3,
|
||||||
LOST: 4,
|
DISCONNECTED: 4,
|
||||||
EXPELLED_DURING_GAME: 5,
|
LOST: 5,
|
||||||
EXPELLED_IN_DISMISSAL: 6,
|
EXPELLED_DURING_GAME: 6,
|
||||||
|
EXPELLED_IN_DISMISSAL: 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,10 @@ func NewRingBuffer(n int32) *RingBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rb *RingBuffer) Put(pItem interface{}) {
|
func (rb *RingBuffer) Put(pItem interface{}) {
|
||||||
|
for 0 < rb.Cnt && rb.Cnt >= rb.N {
|
||||||
|
// Make room for the new element
|
||||||
|
rb.Pop()
|
||||||
|
}
|
||||||
rb.Eles[rb.Ed] = pItem
|
rb.Eles[rb.Ed] = pItem
|
||||||
rb.EdFrameId++
|
rb.EdFrameId++
|
||||||
rb.Cnt++
|
rb.Cnt++
|
||||||
@@ -69,5 +73,8 @@ func (rb *RingBuffer) GetByOffset(offsetFromSt int32) interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rb *RingBuffer) GetByFrameId(frameId int32) interface{} {
|
func (rb *RingBuffer) GetByFrameId(frameId int32) interface{} {
|
||||||
|
if frameId >= rb.EdFrameId || frameId < rb.StFrameId {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return rb.GetByOffset(frameId - rb.StFrameId)
|
return rb.GetByOffset(frameId - rb.StFrameId)
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -265,9 +265,14 @@ func Serve(c *gin.Context) {
|
|||||||
WorldToVirtualGridRatio: pRoom.WorldToVirtualGridRatio,
|
WorldToVirtualGridRatio: pRoom.WorldToVirtualGridRatio,
|
||||||
VirtualGridToWorldRatio: pRoom.VirtualGridToWorldRatio,
|
VirtualGridToWorldRatio: pRoom.VirtualGridToWorldRatio,
|
||||||
|
|
||||||
SpAtkLookupFrames: pRoom.SpAtkLookupFrames,
|
SpAtkLookupFrames: pRoom.SpAtkLookupFrames,
|
||||||
RenderCacheSize: pRoom.RenderCacheSize,
|
RenderCacheSize: pRoom.RenderCacheSize,
|
||||||
MeleeSkillConfig: pRoom.MeleeSkillConfig,
|
MeleeSkillConfig: pRoom.MeleeSkillConfig,
|
||||||
|
SnapIntoPlatformOverlap: pRoom.SnapIntoPlatformOverlap,
|
||||||
|
SnapIntoPlatformThreshold: pRoom.SnapIntoPlatformThreshold,
|
||||||
|
JumpingInitVelY: pRoom.JumpingInitVelY,
|
||||||
|
GravityX: pRoom.GravityX,
|
||||||
|
GravityY: pRoom.GravityY,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &pb.WsResp{
|
resp := &pb.WsResp{
|
||||||
@@ -365,7 +370,7 @@ func Serve(c *gin.Context) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tries to receive from client-side in a non-blocking manner.
|
// TODO: Is there any potential edge-trigger improvement like the epoll approach mentioned above for the following statement? See discussion in https://github.com/gorilla/websocket/issues/122
|
||||||
_, bytes, err := conn.ReadMessage()
|
_, bytes, err := conn.ReadMessage()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
Logger.Error("About to `signalToCloseConnOfThisPlayer`", zap.Any("roomId", pRoom.Id), zap.Any("playerId", playerId), zap.Error(err))
|
Logger.Error("About to `signalToCloseConnOfThisPlayer`", zap.Any("roomId", pRoom.Id), zap.Any("playerId", playerId), zap.Error(err))
|
||||||
|
BIN
charts/jump_sync_spedup.gif
Normal file
BIN
charts/jump_sync_spedup.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 MiB |
Binary file not shown.
Before Width: | Height: | Size: 5.7 MiB |
@@ -5,7 +5,7 @@ all: help
|
|||||||
GOPROXY=https://mirrors.aliyun.com/goproxy
|
GOPROXY=https://mirrors.aliyun.com/goproxy
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -o $(ROOT_DIR)/$(PROJECTNAME)
|
GOPROXY=$(GOPROXY) go build -o $(ROOT_DIR)/$(PROJECTNAME)
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
./$(PROJECTNAME)
|
./$(PROJECTNAME)
|
||||||
|
@@ -34,15 +34,19 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
|||||||
spaceOffsetX := float64(spaceW) * 0.5
|
spaceOffsetX := float64(spaceW) * 0.5
|
||||||
spaceOffsetY := float64(spaceH) * 0.5
|
spaceOffsetY := float64(spaceH) * 0.5
|
||||||
|
|
||||||
virtualGridToWorldRatio := 0.1
|
worldToVirtualGridRatio := float64(1000)
|
||||||
playerDefaultSpeed := 20
|
virtualGridToWorldRatio := float64(1) / worldToVirtualGridRatio
|
||||||
minStep := (int(float64(playerDefaultSpeed)*virtualGridToWorldRatio) << 2)
|
playerDefaultSpeed := 1 * worldToVirtualGridRatio
|
||||||
playerColliderRadius := float64(24)
|
minStep := (int(float64(playerDefaultSpeed)*virtualGridToWorldRatio) << 3)
|
||||||
|
playerColliderRadius := float64(12)
|
||||||
playerColliders := make([]*resolv.Object, len(playerPosList.Eles))
|
playerColliders := make([]*resolv.Object, len(playerPosList.Eles))
|
||||||
|
snapIntoPlatformOverlap := float64(0.1)
|
||||||
space := resolv.NewSpace(int(spaceW), int(spaceH), minStep, minStep)
|
space := resolv.NewSpace(int(spaceW), int(spaceH), minStep, minStep)
|
||||||
|
topPadding, bottomPadding, leftPadding, rightPadding := snapIntoPlatformOverlap, snapIntoPlatformOverlap, snapIntoPlatformOverlap, snapIntoPlatformOverlap
|
||||||
for i, playerPos := range playerPosList.Eles {
|
for i, playerPos := range playerPosList.Eles {
|
||||||
playerCollider := GenerateRectCollider(playerPos.X, playerPos.Y, playerColliderRadius*2, playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset"
|
colliderWidth, colliderHeight := playerColliderRadius*2, playerColliderRadius*4
|
||||||
Logger.Info(fmt.Sprintf("Player Collider#%d: player world pos =(%.2f, %.2f), shape=%v", i, playerPos.X, playerPos.Y, ConvexPolygonStr(playerCollider.Shape.(*resolv.ConvexPolygon))))
|
playerCollider := GenerateRectCollider(playerPos.X, playerPos.Y, colliderWidth, colliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset"
|
||||||
|
Logger.Info(fmt.Sprintf("Player Collider#%d: player world pos=(%.2f, %.2f), shape=%v", i, playerPos.X, playerPos.Y, ConvexPolygonStr(playerCollider.Shape.(*resolv.ConvexPolygon))))
|
||||||
playerColliders[i] = playerCollider
|
playerColliders[i] = playerCollider
|
||||||
space.Add(playerCollider)
|
space.Add(playerCollider)
|
||||||
}
|
}
|
||||||
@@ -50,33 +54,35 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
|||||||
barrierLocalId := 0
|
barrierLocalId := 0
|
||||||
for _, barrierUnaligned := range barrierList.Eles {
|
for _, barrierUnaligned := range barrierList.Eles {
|
||||||
barrierCollider := GenerateConvexPolygonCollider(barrierUnaligned, spaceOffsetX, spaceOffsetY, "Barrier")
|
barrierCollider := GenerateConvexPolygonCollider(barrierUnaligned, spaceOffsetX, spaceOffsetY, "Barrier")
|
||||||
Logger.Info(fmt.Sprintf("Added barrier: shape=%v", ConvexPolygonStr(barrierCollider.Shape.(*resolv.ConvexPolygon))))
|
Logger.Debug(fmt.Sprintf("Added barrier: shape=%v", ConvexPolygonStr(barrierCollider.Shape.(*resolv.ConvexPolygon))))
|
||||||
space.Add(barrierCollider)
|
space.Add(barrierCollider)
|
||||||
barrierLocalId++
|
barrierLocalId++
|
||||||
}
|
}
|
||||||
|
|
||||||
world.Space = space
|
world.Space = space
|
||||||
|
|
||||||
moveToCollide := false
|
moveToCollide := true
|
||||||
if moveToCollide {
|
if moveToCollide {
|
||||||
newVx, newVy := int32(-2959), int32(-2261)
|
|
||||||
effPushback := Vec2D{X: float64(0), Y: float64(0)}
|
effPushback := Vec2D{X: float64(0), Y: float64(0)}
|
||||||
toTestPlayerCollider := playerColliders[0]
|
toTestPlayerCollider := playerColliders[0]
|
||||||
toTestPlayerCollider.X, toTestPlayerCollider.Y = VirtualGridToPolygonColliderAnchorPos(newVx, newVy, playerColliderRadius, playerColliderRadius, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio)
|
//colliderWidth, colliderHeight := playerColliderRadius*2, playerColliderRadius*4
|
||||||
|
//newVx, newVy := int32(27999), int32(-420270)
|
||||||
|
//toTestPlayerCollider.X, toTestPlayerCollider.Y = VirtualGridToPolygonColliderBLPos(newVx, newVy, colliderWidth, colliderHeight, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, virtualGridToWorldRatio)
|
||||||
|
|
||||||
Logger.Info(fmt.Sprintf("Checking collision for virtual (%d, %d), now playerShape=%v", newVx, newVy, ConvexPolygonStr(toTestPlayerCollider.Shape.(*resolv.ConvexPolygon))))
|
Logger.Info(fmt.Sprintf("Checking collision for playerShape=%v", ConvexPolygonStr(toTestPlayerCollider.Shape.(*resolv.ConvexPolygon))))
|
||||||
|
|
||||||
toTestPlayerCollider.Update()
|
toTestPlayerCollider.Update()
|
||||||
if collision := toTestPlayerCollider.Check(0, 0); collision != nil {
|
if collision := toTestPlayerCollider.Check(0, 0); collision != nil {
|
||||||
playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon)
|
playerShape := toTestPlayerCollider.Shape.(*resolv.ConvexPolygon)
|
||||||
for _, obj := range collision.Objects {
|
for _, obj := range collision.Objects {
|
||||||
barrierShape := obj.Shape.(*resolv.ConvexPolygon)
|
bShape := obj.Shape.(*resolv.ConvexPolygon)
|
||||||
if overlapped, pushbackX, pushbackY, overlapResult := CalcPushbacks(0, 0, playerShape, barrierShape); overlapped {
|
Logger.Warn(fmt.Sprintf("Checking potential: a=%v, b=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(bShape)))
|
||||||
Logger.Warn(fmt.Sprintf("Overlapped: a=%v, b=%v, pushbackX=%v, pushbackY=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), pushbackX, pushbackY))
|
if overlapped, pushbackX, pushbackY, overlapResult := CalcPushbacks(0, 0, playerShape, bShape); overlapped {
|
||||||
|
Logger.Warn(fmt.Sprintf("Overlapped: a=%v, b=%v, pushbackX=%v, pushbackY=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(bShape), pushbackX, pushbackY))
|
||||||
effPushback.X += pushbackX
|
effPushback.X += pushbackX
|
||||||
effPushback.Y += pushbackY
|
effPushback.Y += pushbackY
|
||||||
} else {
|
} else {
|
||||||
Logger.Warn(fmt.Sprintf("Collided BUT not overlapped: a=%v, b=%v, overlapResult=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(barrierShape), overlapResult))
|
Logger.Warn(fmt.Sprintf("Collided BUT not overlapped: a=%v, b=%v, overlapResult=%v", ConvexPolygonStr(playerShape), ConvexPolygonStr(bShape), overlapResult))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toTestPlayerCollider.X -= effPushback.X
|
toTestPlayerCollider.X -= effPushback.X
|
||||||
@@ -109,13 +115,12 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
|||||||
ReleaseTriggerType: int32(1), // 1: rising-edge, 2: falling-edge
|
ReleaseTriggerType: int32(1), // 1: rising-edge, 2: falling-edge
|
||||||
Damage: int32(5),
|
Damage: int32(5),
|
||||||
}
|
}
|
||||||
bulletLeftToRight := true
|
bulletLeftToRight := false
|
||||||
if bulletLeftToRight {
|
if bulletLeftToRight {
|
||||||
xfac := float64(1.0)
|
xfac := float64(1.0)
|
||||||
offenderWx, offenderWy := playerPosList.Eles[0].X, playerPosList.Eles[0].Y
|
offenderWx, offenderWy := playerPosList.Eles[0].X, playerPosList.Eles[0].Y
|
||||||
bulletWx, bulletWy := offenderWx+xfac*meleeBullet.HitboxOffset, offenderWy
|
bulletWx, bulletWy := offenderWx+xfac*meleeBullet.HitboxOffset, offenderWy
|
||||||
|
newBulletCollider := GenerateRectCollider(bulletWx, bulletWy, meleeBullet.HitboxSize.X, meleeBullet.HitboxSize.Y, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, "MeleeBullet")
|
||||||
newBulletCollider := GenerateRectCollider(bulletWx, bulletWy, meleeBullet.HitboxSize.X, meleeBullet.HitboxSize.Y, spaceOffsetX, spaceOffsetY, "MeleeBullet")
|
|
||||||
space.Add(newBulletCollider)
|
space.Add(newBulletCollider)
|
||||||
bulletShape := newBulletCollider.Shape.(*resolv.ConvexPolygon)
|
bulletShape := newBulletCollider.Shape.(*resolv.ConvexPolygon)
|
||||||
Logger.Warn(fmt.Sprintf("bullet ->: Added bullet collider to space: a=%v", ConvexPolygonStr(bulletShape)))
|
Logger.Warn(fmt.Sprintf("bullet ->: Added bullet collider to space: a=%v", ConvexPolygonStr(bulletShape)))
|
||||||
@@ -132,13 +137,13 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bulletRightToLeft := true
|
bulletRightToLeft := false
|
||||||
if bulletRightToLeft {
|
if bulletRightToLeft {
|
||||||
xfac := float64(-1.0)
|
xfac := float64(-1.0)
|
||||||
offenderWx, offenderWy := playerPosList.Eles[1].X, playerPosList.Eles[1].Y
|
offenderWx, offenderWy := playerPosList.Eles[1].X, playerPosList.Eles[1].Y
|
||||||
bulletWx, bulletWy := offenderWx+xfac*meleeBullet.HitboxOffset, offenderWy
|
bulletWx, bulletWy := offenderWx+xfac*meleeBullet.HitboxOffset, offenderWy
|
||||||
|
|
||||||
newBulletCollider := GenerateRectCollider(bulletWx, bulletWy, meleeBullet.HitboxSize.X, meleeBullet.HitboxSize.Y, spaceOffsetX, spaceOffsetY, "MeleeBullet")
|
newBulletCollider := GenerateRectCollider(bulletWx, bulletWy, meleeBullet.HitboxSize.X, meleeBullet.HitboxSize.Y, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY, "MeleeBullet")
|
||||||
space.Add(newBulletCollider)
|
space.Add(newBulletCollider)
|
||||||
bulletShape := newBulletCollider.Shape.(*resolv.ConvexPolygon)
|
bulletShape := newBulletCollider.Shape.(*resolv.ConvexPolygon)
|
||||||
Logger.Warn(fmt.Sprintf("bullet <-: Added bullet collider to space: a=%v", ConvexPolygonStr(bulletShape)))
|
Logger.Warn(fmt.Sprintf("bullet <-: Added bullet collider to space: a=%v", ConvexPolygonStr(bulletShape)))
|
||||||
@@ -177,7 +182,7 @@ func (world *WorldColliderDisplay) Draw(screen *ebiten.Image) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
world.Game.DebugDraw(screen, world.Space)
|
//world.Game.DebugDraw(screen, world.Space)
|
||||||
|
|
||||||
if world.Game.ShowHelpText {
|
if world.Game.ShowHelpText {
|
||||||
|
|
||||||
|
@@ -10,33 +10,33 @@ func NormVec2D(dx, dy float64) Vec2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D {
|
func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D {
|
||||||
// Transform again to put "anchor" at the top-left point of the bounding box for "resolv"
|
// Transform again to put "anchor" at the "bottom-left point (w.r.t. world space)" of the bounding box for "resolv"
|
||||||
boundingBoxTL := &Vec2D{
|
boundingBoxBL := &Vec2D{
|
||||||
X: math.MaxFloat64,
|
X: math.MaxFloat64,
|
||||||
Y: math.MaxFloat64,
|
Y: math.MaxFloat64,
|
||||||
}
|
}
|
||||||
for _, p := range input.Points {
|
for _, p := range input.Points {
|
||||||
if p.X < boundingBoxTL.X {
|
if p.X < boundingBoxBL.X {
|
||||||
boundingBoxTL.X = p.X
|
boundingBoxBL.X = p.X
|
||||||
}
|
}
|
||||||
if p.Y < boundingBoxTL.Y {
|
if p.Y < boundingBoxBL.Y {
|
||||||
boundingBoxTL.Y = p.Y
|
boundingBoxBL.Y = p.Y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now "input.Anchor" should move to "input.Anchor+boundingBoxTL", thus "boundingBoxTL" is also the value of the negative diff for all "input.Points"
|
// Now "input.Anchor" should move to "input.Anchor+boundingBoxBL", thus "boundingBoxBL" is also the value of the negative diff for all "input.Points"
|
||||||
output := &Polygon2D{
|
output := &Polygon2D{
|
||||||
Anchor: &Vec2D{
|
Anchor: &Vec2D{
|
||||||
X: input.Anchor.X + boundingBoxTL.X,
|
X: input.Anchor.X + boundingBoxBL.X,
|
||||||
Y: input.Anchor.Y + boundingBoxTL.Y,
|
Y: input.Anchor.Y + boundingBoxBL.Y,
|
||||||
},
|
},
|
||||||
Points: make([]*Vec2D, len(input.Points)),
|
Points: make([]*Vec2D, len(input.Points)),
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, p := range input.Points {
|
for i, p := range input.Points {
|
||||||
output.Points[i] = &Vec2D{
|
output.Points[i] = &Vec2D{
|
||||||
X: p.X - boundingBoxTL.X,
|
X: p.X - boundingBoxBL.X,
|
||||||
Y: p.Y - boundingBoxTL.Y,
|
Y: p.Y - boundingBoxBL.Y,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,13 +18,17 @@ func ConvexPolygonStr(body *resolv.ConvexPolygon) string {
|
|||||||
return fmt.Sprintf("{\n%s\n}", strings.Join(s, ",\n"))
|
return fmt.Sprintf("{\n%s\n}", strings.Join(s, ",\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateRectCollider(origX, origY, w, h, spaceOffsetX, spaceOffsetY float64, tag string) *resolv.Object {
|
func RectCenterStr(body *resolv.Object, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY float64) string {
|
||||||
cx, cy := WorldToPolygonColliderAnchorPos(origX, origY, w*0.5, h*0.5, spaceOffsetX, spaceOffsetY)
|
return fmt.Sprintf("{%.2f, %.2f}", body.X + leftPadding + halfBoundingW - spaceOffsetX, body.Y + bottomPadding + halfBoundingH - spaceOffsetY)
|
||||||
return GenerateRectColliderInCollisionSpace(cx, cy, w, h, tag)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateRectColliderInCollisionSpace(cx, cy, w, h float64, tag string) *resolv.Object {
|
func GenerateRectCollider(wx, wy, w, h, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY float64, tag string) *resolv.Object {
|
||||||
collider := resolv.NewObject(cx, cy, w, h, tag)
|
blX, blY := WorldToPolygonColliderBLPos(wx, wy, w*0.5, h*0.5, topPadding, bottomPadding, leftPadding, rightPadding, spaceOffsetX, spaceOffsetY)
|
||||||
|
return generateRectColliderInCollisionSpace(blX, blY, leftPadding+w+rightPadding, bottomPadding+h+topPadding, tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateRectColliderInCollisionSpace(blX, blY, w, h float64, tag string) *resolv.Object {
|
||||||
|
collider := resolv.NewObject(blX, blY, w, h, tag) // Unlike its frontend counter part, the position of a "resolv.Object" must be specified by "bottom-left point" because "w" and "h" must be positive, see "resolv.Object.BoundsToSpace" for details
|
||||||
shape := resolv.NewRectangle(0, 0, w, h)
|
shape := resolv.NewRectangle(0, 0, w, h)
|
||||||
collider.SetShape(shape)
|
collider.SetShape(shape)
|
||||||
return collider
|
return collider
|
||||||
@@ -66,6 +70,7 @@ func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.Conve
|
|||||||
playerShape.SetPosition(origX, origY)
|
playerShape.SetPosition(origX, origY)
|
||||||
}()
|
}()
|
||||||
playerShape.SetPosition(origX+oldDx, origY+oldDy)
|
playerShape.SetPosition(origX+oldDx, origY+oldDy)
|
||||||
|
|
||||||
overlapResult := &SatResult{
|
overlapResult := &SatResult{
|
||||||
Overlap: 0,
|
Overlap: 0,
|
||||||
OverlapX: 0,
|
OverlapX: 0,
|
||||||
@@ -74,7 +79,7 @@ func CalcPushbacks(oldDx, oldDy float64, playerShape, barrierShape *resolv.Conve
|
|||||||
BContainedInA: true,
|
BContainedInA: true,
|
||||||
Axis: vector.Vector{0, 0},
|
Axis: vector.Vector{0, 0},
|
||||||
}
|
}
|
||||||
if overlapped := IsPolygonPairOverlapped(playerShape, barrierShape, overlapResult); overlapped {
|
if overlapped := isPolygonPairOverlapped(playerShape, barrierShape, overlapResult); overlapped {
|
||||||
pushbackX, pushbackY := overlapResult.Overlap*overlapResult.OverlapX, overlapResult.Overlap*overlapResult.OverlapY
|
pushbackX, pushbackY := overlapResult.Overlap*overlapResult.OverlapX, overlapResult.Overlap*overlapResult.OverlapY
|
||||||
return true, pushbackX, pushbackY, overlapResult
|
return true, pushbackX, pushbackY, overlapResult
|
||||||
} else {
|
} else {
|
||||||
@@ -91,16 +96,17 @@ type SatResult struct {
|
|||||||
Axis vector.Vector
|
Axis vector.Vector
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsPolygonPairOverlapped(a, b *resolv.ConvexPolygon, result *SatResult) bool {
|
func isPolygonPairOverlapped(a, b *resolv.ConvexPolygon, result *SatResult) bool {
|
||||||
aCnt, bCnt := len(a.Points), len(b.Points)
|
aCnt, bCnt := len(a.Points), len(b.Points)
|
||||||
// Single point case
|
// Single point case
|
||||||
if 1 == aCnt && 1 == bCnt {
|
if 1 == aCnt && 1 == bCnt {
|
||||||
if nil != result {
|
if nil != result {
|
||||||
result.Overlap = 0
|
result.Overlap = 0
|
||||||
}
|
}
|
||||||
return a.Points[0].X() == b.Points[0].X() && a.Points[0].Y() == b.Points[0].Y()
|
return a.Points[0][0] == b.Points[0][0] && a.Points[0][1] == b.Points[0][1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Logger.Info(fmt.Sprintf("Checking collision between a=%v, b=%v", ConvexPolygonStr(a), ConvexPolygonStr(b)))
|
||||||
if 1 < aCnt {
|
if 1 < aCnt {
|
||||||
for _, axis := range a.SATAxes() {
|
for _, axis := range a.SATAxes() {
|
||||||
if isPolygonPairSeparatedByDir(a, b, axis.Unit(), result) {
|
if isPolygonPairSeparatedByDir(a, b, axis.Unit(), result) {
|
||||||
@@ -116,6 +122,7 @@ func IsPolygonPairOverlapped(a, b *resolv.ConvexPolygon, result *SatResult) bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Logger.Info(fmt.Sprintf("a=%v and b=%v are overlapped", ConvexPolygonStr(a), ConvexPolygonStr(b)))
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -137,9 +144,10 @@ func isPolygonPairSeparatedByDir(a, b *resolv.ConvexPolygon, e vector.Vector, re
|
|||||||
e = (-2.98, 1.49).Unit()
|
e = (-2.98, 1.49).Unit()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//Logger.Info(fmt.Sprintf("Checking separation between a=%v, b=%v along axis e={%.3f, %.3f}#1", ConvexPolygonStr(a), ConvexPolygonStr(b), e[0], e[1]))
|
||||||
var aStart, aEnd, bStart, bEnd float64 = math.MaxFloat64, -math.MaxFloat64, math.MaxFloat64, -math.MaxFloat64
|
var aStart, aEnd, bStart, bEnd float64 = math.MaxFloat64, -math.MaxFloat64, math.MaxFloat64, -math.MaxFloat64
|
||||||
for _, p := range a.Points {
|
for _, p := range a.Points {
|
||||||
dot := (p.X()+a.X)*e.X() + (p.Y()+a.Y)*e.Y()
|
dot := (p[0]+a.X)*e[0] + (p[1]+a.Y)*e[1]
|
||||||
|
|
||||||
if aStart > dot {
|
if aStart > dot {
|
||||||
aStart = dot
|
aStart = dot
|
||||||
@@ -151,7 +159,7 @@ func isPolygonPairSeparatedByDir(a, b *resolv.ConvexPolygon, e vector.Vector, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range b.Points {
|
for _, p := range b.Points {
|
||||||
dot := (p.X()+b.X)*e.X() + (p.Y()+b.Y)*e.Y()
|
dot := (p[0]+b.X)*e[0] + (p[1]+b.Y)*e[1]
|
||||||
|
|
||||||
if bStart > dot {
|
if bStart > dot {
|
||||||
bStart = dot
|
bStart = dot
|
||||||
@@ -168,7 +176,6 @@ func isPolygonPairSeparatedByDir(a, b *resolv.ConvexPolygon, e vector.Vector, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
if nil != result {
|
if nil != result {
|
||||||
result.Axis = e
|
|
||||||
overlap := float64(0)
|
overlap := float64(0)
|
||||||
|
|
||||||
if aStart < bStart {
|
if aStart < bStart {
|
||||||
@@ -209,16 +216,19 @@ func isPolygonPairSeparatedByDir(a, b *resolv.ConvexPolygon, e vector.Vector, re
|
|||||||
absoluteOverlap = -overlap
|
absoluteOverlap = -overlap
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == currentOverlap || currentOverlap > absoluteOverlap {
|
if (0 == result.Axis[0] && 0 == result.Axis[1]) || currentOverlap > absoluteOverlap {
|
||||||
var sign float64 = 1
|
var sign float64 = 1
|
||||||
if overlap < 0 {
|
if overlap < 0 {
|
||||||
sign = -1
|
sign = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Overlap = absoluteOverlap
|
result.Overlap = absoluteOverlap
|
||||||
result.OverlapX = e.X() * sign
|
result.OverlapX = e[0] * sign
|
||||||
result.OverlapY = e.Y() * sign
|
result.OverlapY = e[1] * sign
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.Axis = e
|
||||||
|
//Logger.Info(fmt.Sprintf("Checking separation between a=%v, b=%v along axis e={%.3f, %.3f}#2: aStart=%.3f, aEnd=%.3f, bStart=%.3f, bEnd=%.3f, overlap=%.3f, currentOverlap=%.3f, absoluteOverlap=%.3f, result=%v", ConvexPolygonStr(a), ConvexPolygonStr(b), e[0], e[1], aStart, aEnd, bStart, bEnd, overlap, currentOverlap, absoluteOverlap, result))
|
||||||
}
|
}
|
||||||
|
|
||||||
// the specified unit vector "e" doesn't separate "a" and "b", overlap result is generated
|
// the specified unit vector "e" doesn't separate "a" and "b", overlap result is generated
|
||||||
@@ -240,20 +250,20 @@ func VirtualGridToWorldPos(vx, vy int32, virtualGridToWorldRatio float64) (float
|
|||||||
return wx, wy
|
return wx, wy
|
||||||
}
|
}
|
||||||
|
|
||||||
func WorldToPolygonColliderAnchorPos(wx, wy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) {
|
func WorldToPolygonColliderBLPos(wx, wy, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) {
|
||||||
return wx - halfBoundingW + collisionSpaceOffsetX, wy - halfBoundingH + collisionSpaceOffsetY
|
return wx - halfBoundingW - leftPadding + collisionSpaceOffsetX, wy - halfBoundingH - bottomPadding + collisionSpaceOffsetY
|
||||||
}
|
}
|
||||||
|
|
||||||
func PolygonColliderAnchorToWorldPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) {
|
func PolygonColliderBLToWorldPos(cx, cy, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY float64) (float64, float64) {
|
||||||
return cx + halfBoundingW - collisionSpaceOffsetX, cy + halfBoundingH - collisionSpaceOffsetY
|
return cx + halfBoundingW + leftPadding - collisionSpaceOffsetX, cy + halfBoundingH + bottomPadding - collisionSpaceOffsetY
|
||||||
}
|
}
|
||||||
|
|
||||||
func PolygonColliderAnchorToVirtualGridPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64, worldToVirtualGridRatio float64) (int32, int32) {
|
func PolygonColliderBLToVirtualGridPos(cx, cy, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY float64, worldToVirtualGridRatio float64) (int32, int32) {
|
||||||
wx, wy := PolygonColliderAnchorToWorldPos(cx, cy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY)
|
wx, wy := PolygonColliderBLToWorldPos(cx, cy, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY)
|
||||||
return WorldToVirtualGridPos(wx, wy, worldToVirtualGridRatio)
|
return WorldToVirtualGridPos(wx, wy, worldToVirtualGridRatio)
|
||||||
}
|
}
|
||||||
|
|
||||||
func VirtualGridToPolygonColliderAnchorPos(vx, vy int32, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY float64, virtualGridToWorldRatio float64) (float64, float64) {
|
func VirtualGridToPolygonColliderBLPos(vx, vy int32, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY float64, virtualGridToWorldRatio float64) (float64, float64) {
|
||||||
wx, wy := VirtualGridToWorldPos(vx, vy, virtualGridToWorldRatio)
|
wx, wy := VirtualGridToWorldPos(vx, vy, virtualGridToWorldRatio)
|
||||||
return WorldToPolygonColliderAnchorPos(wx, wy, halfBoundingW, halfBoundingH, collisionSpaceOffsetX, collisionSpaceOffsetY)
|
return WorldToPolygonColliderBLPos(wx, wy, halfBoundingW, halfBoundingH, topPadding, bottomPadding, leftPadding, rightPadding, collisionSpaceOffsetX, collisionSpaceOffsetY)
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
@@ -43,13 +44,13 @@ type TmxOrTsxPolyline struct {
|
|||||||
|
|
||||||
type TmxOrTsxObject struct {
|
type TmxOrTsxObject struct {
|
||||||
Id int `xml:"id,attr"`
|
Id int `xml:"id,attr"`
|
||||||
Gid *int `xml:"gid,attr"`
|
Gid int `xml:"gid,attr"`
|
||||||
X float64 `xml:"x,attr"`
|
X float64 `xml:"x,attr"`
|
||||||
Y float64 `xml:"y,attr"`
|
Y float64 `xml:"y,attr"`
|
||||||
Properties *TmxOrTsxProperties `xml:"properties"`
|
Properties *TmxOrTsxProperties `xml:"properties"`
|
||||||
Polyline *TmxOrTsxPolyline `xml:"polyline"`
|
Polyline *TmxOrTsxPolyline `xml:"polyline"`
|
||||||
Width *float64 `xml:"width,attr"`
|
Width float64 `xml:"width,attr"`
|
||||||
Height *float64 `xml:"height,attr"`
|
Height float64 `xml:"height,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TmxOrTsxObjectGroup struct {
|
type TmxOrTsxObjectGroup struct {
|
||||||
@@ -376,13 +377,37 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, singleObjInTmxFile := range objGroup.Objects {
|
for _, singleObjInTmxFile := range objGroup.Objects {
|
||||||
if nil == singleObjInTmxFile.Polyline {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if nil == singleObjInTmxFile.Properties.Property || "boundary_type" != singleObjInTmxFile.Properties.Property[0].Name || "barrier" != singleObjInTmxFile.Properties.Property[0].Value {
|
if nil == singleObjInTmxFile.Properties.Property || "boundary_type" != singleObjInTmxFile.Properties.Property[0].Name || "barrier" != singleObjInTmxFile.Properties.Property[0].Value {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if nil == singleObjInTmxFile.Polyline {
|
||||||
|
pts := make([]*Vec2D, 4)
|
||||||
|
s := make([]string, 0)
|
||||||
|
pts[0] = &Vec2D{
|
||||||
|
X: float64(0),
|
||||||
|
Y: float64(0),
|
||||||
|
}
|
||||||
|
pts[1] = &Vec2D{
|
||||||
|
X: float64(0),
|
||||||
|
Y: singleObjInTmxFile.Height,
|
||||||
|
}
|
||||||
|
pts[2] = &Vec2D{
|
||||||
|
X: singleObjInTmxFile.Width,
|
||||||
|
Y: singleObjInTmxFile.Height,
|
||||||
|
}
|
||||||
|
pts[3] = &Vec2D{
|
||||||
|
X: singleObjInTmxFile.Width,
|
||||||
|
Y: float64(0),
|
||||||
|
}
|
||||||
|
for _, pt := range pts {
|
||||||
|
s = append(s, fmt.Sprintf("%v,%v", pt.X, pt.Y))
|
||||||
|
}
|
||||||
|
singleObjInTmxFile.Polyline = &TmxOrTsxPolyline{
|
||||||
|
Points: strings.Join(s, " "),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
thePolygon2DInWorld, err := tmxPolylineToPolygon2D(pTmxMapIns, singleObjInTmxFile, singleObjInTmxFile.Polyline)
|
thePolygon2DInWorld, err := tmxPolylineToPolygon2D(pTmxMapIns, singleObjInTmxFile, singleObjInTmxFile.Polyline)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{"width":64,"imagePath":"SoldierFireGhost_tex.png","SubTexture":[{"frameWidth":12,"y":42,"frameHeight":11,"width":11,"frameX":-1,"height":11,"name":"biu","frameY":0,"x":16},{"width":5,"y":42,"height":7,"name":"rightArm","x":29},{"frameWidth":15,"y":27,"frameHeight":16,"width":13,"frameX":-1,"height":16,"name":"yinmoqe00","frameY":0,"x":1},{"width":17,"y":1,"height":21,"name":"body","x":28},{"width":5,"y":42,"height":7,"name":"rightShoulder","x":36},{"width":10,"y":45,"height":9,"name":"rightFrontArm","x":1},{"width":7,"y":56,"height":7,"name":"rightHand","x":1},{"width":6,"y":55,"height":6,"name":"leftArm","x":32},{"width":7,"y":55,"height":6,"name":"leftShoulder","x":23},{"width":10,"y":27,"height":11,"name":"leftFrontArm","x":16},{"width":17,"y":24,"height":16,"name":"head","x":28},{"width":25,"y":1,"height":24,"name":"head2","x":1},{"width":8,"y":55,"height":7,"name":"leftHand","x":13},{"frameWidth":4,"y":51,"frameHeight":4,"width":2,"frameX":-1,"height":2,"name":"huomiao01","frameY":-1,"x":29}],"height":64,"name":"SoldierFireGhost"}
|
{"imagePath":"SoldierFireGhost_tex.png","width":64,"height":64,"name":"SoldierFireGhost","SubTexture":[{"frameY":0,"y":42,"frameWidth":12,"frameHeight":11,"width":11,"height":11,"name":"biu","frameX":-1,"x":16},{"width":5,"y":42,"height":7,"name":"rightArm","x":29},{"frameY":0,"y":27,"frameWidth":15,"frameHeight":16,"width":13,"height":16,"name":"yinmoqe00","frameX":-1,"x":1},{"width":17,"y":1,"height":21,"name":"body","x":28},{"width":5,"y":42,"height":7,"name":"rightShoulder","x":36},{"width":10,"y":45,"height":9,"name":"rightFrontArm","x":1},{"width":7,"y":56,"height":7,"name":"rightHand","x":1},{"width":6,"y":55,"height":6,"name":"leftArm","x":32},{"width":7,"y":55,"height":6,"name":"leftShoulder","x":23},{"width":10,"y":27,"height":11,"name":"leftFrontArm","x":16},{"width":25,"y":1,"height":24,"name":"head2","x":1},{"width":17,"y":24,"height":16,"name":"head","x":28},{"width":8,"y":55,"height":7,"name":"leftHand","x":13},{"frameY":-1,"y":51,"frameWidth":4,"frameHeight":4,"width":2,"height":2,"name":"huomiao01","frameX":-1,"x":29}]}
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ver": "1.0.0",
|
"ver": "1.0.0",
|
||||||
"uuid": "4a9187d5-a9ad-4464-a03c-d2f3cc277051",
|
"uuid": "4a9187d5-a9ad-4464-a03c-d2f3cc277051",
|
||||||
"atlasJson": "{\"width\":64,\"imagePath\":\"SoldierFireGhost_tex.png\",\"SubTexture\":[{\"frameWidth\":12,\"y\":42,\"frameHeight\":11,\"width\":11,\"frameX\":-1,\"height\":11,\"name\":\"biu\",\"frameY\":0,\"x\":16},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightArm\",\"x\":29},{\"frameWidth\":15,\"y\":27,\"frameHeight\":16,\"width\":13,\"frameX\":-1,\"height\":16,\"name\":\"yinmoqe00\",\"frameY\":0,\"x\":1},{\"width\":17,\"y\":1,\"height\":21,\"name\":\"body\",\"x\":28},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightShoulder\",\"x\":36},{\"width\":10,\"y\":45,\"height\":9,\"name\":\"rightFrontArm\",\"x\":1},{\"width\":7,\"y\":56,\"height\":7,\"name\":\"rightHand\",\"x\":1},{\"width\":6,\"y\":55,\"height\":6,\"name\":\"leftArm\",\"x\":32},{\"width\":7,\"y\":55,\"height\":6,\"name\":\"leftShoulder\",\"x\":23},{\"width\":10,\"y\":27,\"height\":11,\"name\":\"leftFrontArm\",\"x\":16},{\"width\":17,\"y\":24,\"height\":16,\"name\":\"head\",\"x\":28},{\"width\":25,\"y\":1,\"height\":24,\"name\":\"head2\",\"x\":1},{\"width\":8,\"y\":55,\"height\":7,\"name\":\"leftHand\",\"x\":13},{\"frameWidth\":4,\"y\":51,\"frameHeight\":4,\"width\":2,\"frameX\":-1,\"height\":2,\"name\":\"huomiao01\",\"frameY\":-1,\"x\":29}],\"height\":64,\"name\":\"SoldierFireGhost\"}",
|
"atlasJson": "{\"imagePath\":\"SoldierFireGhost_tex.png\",\"width\":64,\"height\":64,\"name\":\"SoldierFireGhost\",\"SubTexture\":[{\"frameY\":0,\"y\":42,\"frameWidth\":12,\"frameHeight\":11,\"width\":11,\"height\":11,\"name\":\"biu\",\"frameX\":-1,\"x\":16},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightArm\",\"x\":29},{\"frameY\":0,\"y\":27,\"frameWidth\":15,\"frameHeight\":16,\"width\":13,\"height\":16,\"name\":\"yinmoqe00\",\"frameX\":-1,\"x\":1},{\"width\":17,\"y\":1,\"height\":21,\"name\":\"body\",\"x\":28},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightShoulder\",\"x\":36},{\"width\":10,\"y\":45,\"height\":9,\"name\":\"rightFrontArm\",\"x\":1},{\"width\":7,\"y\":56,\"height\":7,\"name\":\"rightHand\",\"x\":1},{\"width\":6,\"y\":55,\"height\":6,\"name\":\"leftArm\",\"x\":32},{\"width\":7,\"y\":55,\"height\":6,\"name\":\"leftShoulder\",\"x\":23},{\"width\":10,\"y\":27,\"height\":11,\"name\":\"leftFrontArm\",\"x\":16},{\"width\":25,\"y\":1,\"height\":24,\"name\":\"head2\",\"x\":1},{\"width\":17,\"y\":24,\"height\":16,\"name\":\"head\",\"x\":28},{\"width\":8,\"y\":55,\"height\":7,\"name\":\"leftHand\",\"x\":13},{\"frameY\":-1,\"y\":51,\"frameWidth\":4,\"frameHeight\":4,\"width\":2,\"height\":2,\"name\":\"huomiao01\",\"frameX\":-1,\"x\":29}]}",
|
||||||
"texture": "700d963b-2192-4219-a066-8be5b3db7453",
|
"texture": "700d963b-2192-4219-a066-8be5b3db7453",
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
}
|
}
|
@@ -0,0 +1,205 @@
|
|||||||
|
{
|
||||||
|
"__type__": "cc.AnimationClip",
|
||||||
|
"_name": "InAirIdle1",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_native": "",
|
||||||
|
"_duration": 0.5166666666666667,
|
||||||
|
"sample": 60,
|
||||||
|
"speed": 1,
|
||||||
|
"wrapMode": 2,
|
||||||
|
"curveData": {
|
||||||
|
"comps": {
|
||||||
|
"cc.Sprite": {
|
||||||
|
"spriteFrame": [
|
||||||
|
{
|
||||||
|
"frame": 0,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "dd02916e-9ac8-4fe7-a944-d6082eb9007a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.016666666666666666,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "1906b14b-f3a2-4dc9-9e0d-99e3b334e67b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.03333333333333333,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "1b4f284c-be67-403b-9f5d-59aa641d3c92"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.05,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "6feb197e-2013-48fd-bbbb-3d2809cb1d63"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.06666666666666667,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "2db4e807-a5d2-4c09-b033-a0ae97e5d0bf"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.08333333333333333,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "73958a6b-31a7-4bb8-babd-1aefba55a793"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.1,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "9545ca77-8002-4ad1-a91e-1e343cdf0e0b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.11666666666666667,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "581e4c15-9de3-4b72-a91a-2e82ac6b092c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.13333333333333333,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "4af94082-f36b-4b9e-9077-bd458fd0b188"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.15,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "5463290d-7b25-4625-8be5-1a16dbe3bd83"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.16666666666666666,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "e507775a-1009-47a8-b1a8-8ade0104e4c2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.18333333333333332,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "6583a9e1-92fb-4db2-9437-9d2b26bc5920"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.2,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "b07e2da2-d1f2-4ec8-acdf-92706d0be9e0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.21666666666666667,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "dd60bf4f-6b5f-4385-9e46-1e49e6a7cfbe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.23333333333333334,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "46811e43-c874-41d5-8799-6fafc904cd5a"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.25,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "0a370e7e-e25f-4faf-9a76-73b246338a4d"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.26666666666666666,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "1f003135-e929-4a05-9029-76e7cb8c76ef"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.2833333333333333,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "b78015ba-98e4-4ccd-9852-a7ec053a0ba4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.3,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "0589abef-dc0d-4d33-a084-25b273ca1368"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.31666666666666665,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "20542755-bbfa-43cd-b593-e73d121b5ed6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.3333333333333333,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "5d5ac5af-3da7-4b22-9183-5885736e2ca7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.35,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "47bbe2a2-a983-4aca-8a3e-6cd6df5eee03"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.36666666666666664,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "6d3fb572-d6af-4b7e-9350-9ff482569127"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.38333333333333336,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "573cfba0-4534-4886-849a-61f4f2cbd349"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.4,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "0b4ebd8a-6316-4802-aa24-49ab08e6a75b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.4166666666666667,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "5b7fff7b-5818-4be8-b65d-c212d15e6e71"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.43333333333333335,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "f964ec77-c016-44fa-8f55-3e59ae30283d"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.45,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "679a79eb-85c6-4445-8517-36465c57c6da"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.4666666666666667,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "8764bb9b-4b08-4bc5-b9e5-93af39321c70"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.48333333333333334,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "f291785e-2685-4ba0-b38b-9607972ce6f0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frame": 0.5,
|
||||||
|
"value": {
|
||||||
|
"__uuid__": "a4e84eb9-b866-4cdc-8925-a5d29c65aea5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"events": []
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ver": "2.1.0",
|
||||||
|
"uuid": "43dbf141-be76-48c3-bdef-29233ccbe30d",
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 238 KiB |
@@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="128" height="128" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="39">
|
<map version="1.2" tiledversion="1.2.3" orientation="orthogonal" renderorder="right-down" width="128" height="128" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="87">
|
||||||
<tileset firstgid="1" source="tiles0.tsx"/>
|
<tileset firstgid="1" source="tiles0.tsx"/>
|
||||||
<tileset firstgid="65" source="tiles1.tsx"/>
|
<tileset firstgid="65" source="tiles1.tsx"/>
|
||||||
<tileset firstgid="129" source="tiles2.tsx"/>
|
<tileset firstgid="129" source="tiles2.tsx"/>
|
||||||
<layer id="2" name="Ground" width="128" height="128">
|
<layer id="2" name="Ground" width="128" height="128">
|
||||||
<data encoding="base64" compression="zlib">
|
<data encoding="base64" compression="zlib">
|
||||||
eJzt2q1u22AYhuEo1UhBtYFWKh/bmRRMRYNFPZPxwcKi7jznSInkWk7teG5ex88FLhQD570d5/PP1WazuQIAAAAAAAAAAAAAAAAAgAmu96r3g/N5bjn0fw5U3aGy/3bv0P+p8XDEdoX0f9//GP3Xp93/YaD/9QJa6f95/fvov26773671zeb7jmhupX+5+2fQH/9qztU9v8yQXUz/fXXX3/9a/ovgf7666+//vrrf1n9/4zc7tue/uvq/9Z4PfLZ7vnz38ZP/cv7T53p4Z7i7/+kv/7667/bl/sO/dff/77T3+9ff/3r+38dMGf/Nv1r+w917+v/0vh1okN/67/l9B/b/nFj/X8pxvYf236r/0UZ6t/X+Efj5kj7bv+uxxPpX9e/r/1NS7f7Z/S/a3zXfzH9Pzrvt/vPTf/l9p+yRjyV/ufvP+YY6M5yzr5D5uy/XUCLJfafa8YfmdJe//X0r6Z/9jGgv/7661/doqp/9fyrpV//Vc+/mv7Z9M+mfzb9s+mfTf9s+mfTP5v+2fTPpn82/bPpn03/bPpn0z+b/tn0z6Z/Nv2z6Z/N+9/Z9M+mfzb//9n0z6Z/Nv2z6Z9N/2z6Z9M/m/7Z0vtT3wEAAAAAAAAAAAAAAAA4v39IY4NC
|
eJzt3DFq3EAUgOFlTRoXJiEkkNQpAr5EyuDKVdKl8k1yh9wg94wMK1DEaqXVjvRGel/xgXFh7PnfSBqx+O5wONwBAAAAAAAAAAAAAAAAAMAM9yfRvwfreelo+78kFN0hsv/xpO3/q/E04LhD+v/ff4j++9Pt/zTS/76CVvov1/8c/fft9W//cHJubfrXhOhW+q/bPwP99Y/uENn//QzRzfSP7b+nGdBf/+gOW+xfE/1z9rf/c/cvMQP6b5f9r7/+efuXmAH9y69t+07x942W3vv666//Nvp/OtE/T/9u7+7X+uuvf1z/tyNK9u/SP7b/WPdz/f80flyp7e/5r57+U9s/Hzz/b8XU/lPbH/XflLH+5xo/Nh4G2vf79z1fSf+4/ufaP3T0uy/R/2Pji/7V9L903e/2L03/evvPeUa8lv7r958yA/21LNl3TMn+xwpa1Ni/1BpfMqe9/vvpf82MLPGz9d/GDCxF/9wzoL/+mftHr3+07Oe/6PWPpn9u+uemf27656Z/bvrnpn9u+uemf27656Z/bvrnpn9u+uemf276z7eHzwnpX0//dyPeDNB/H/3t/7r77/Fzovrnpv+6hu7tkf2PFbSouf/Pk/71vv1+9B7Wf9n+l+75+m/XlP5DZ65XY+e1yOv6Nf2jO9Tav+389Qa3ns/1j93/tyrxjkb/5fqXfp821L/WGcjef63936rtPZH+6/ZvZyDq/73oP96/5PP8pfPDEP3r2f+3zsGc/mveJ/SfZu4cfJ7Z/2/ju/7V9J+r6f9tbv/WknOQvT/xHQAAAAAAAAAAAAAAAID1/QPUuKyX
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup id="1" name="PlayerStartingPos">
|
<objectgroup id="1" name="PlayerStartingPos">
|
||||||
<object id="135" x="1090" y="833.667">
|
<object id="135" x="1010" y="1432">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
<object id="137" x="1215" y="830.5">
|
<object id="137" x="950" y="1432">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
@@ -20,149 +20,112 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<property name="type" value="barrier_and_shelter"/>
|
<property name="type" value="barrier_and_shelter"/>
|
||||||
</properties>
|
</properties>
|
||||||
<object id="8" x="648.242" y="480.606">
|
<object id="54" x="656" y="1504" width="80" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,18.6667 1041.33,21.3333 1041.33,-1.33333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="9" x="650.667" y="1604.67">
|
<object id="55" x="735" y="1552" width="113.5" height="15.5">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,18.6667 1041.33,21.3333 1041.33,-1.33333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="10" x="634.485" y="505.455">
|
<object id="57" x="768" y="1472" width="32" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 4,1110 24,1110 24,-8"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="11" x="1677.64" y="501.333">
|
<object id="58" x="1040" y="1536" width="80" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 4,1110 24,1110 24,-8"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="14" x="688.667" y="464">
|
<object id="59" x="1040" y="1568" width="224" height="48">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -0.666667,78 33.3333,78 32,-0.666667"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="15" x="833.333" y="495.333">
|
<object id="60" x="1216" y="1344" width="224" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -112,1.33333 -111.333,44.6667 -1.33333,44.6667"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="17" x="832" y="574">
|
<object id="62" x="1040" y="1552" width="208" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -67.3333,0 -67.3333,-76.6667 0.666667,-76"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="18" x="865.333" y="606.667">
|
<object id="63" x="1040" y="1504" width="48" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -210,-0.666667 -210,143.333 0,142.667"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="19" x="754.667" y="1055.33">
|
<object id="64" x="1040" y="1520" width="64" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="-2,1.33333 -100,0.666667 -97.3333,-454 -9.33333,-451.333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="20" x="769.333" y="747.333">
|
<object id="65" x="1040" y="1488" width="32" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -115.333,0.666667 -114.667,160.667 -2,162"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="21" x="768" y="960.667">
|
<object id="66" x="1040" y="1472" width="16" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -18,0.666667 -18.6667,95.3333 0,95.3333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="23" x="786" y="1058.67">
|
<object id="67" x="784" y="1456" width="256" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,-52.6667 -20,-52 -19.3333,-1.33333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="24" x="1118.67" y="749.333">
|
<object id="73" x="783.75" y="1567.5" width="96.25" height="15.5">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -0.666667,-94 -254,-93.3333 -256.667,1.33333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="25" x="1168" y="975.333">
|
<object id="74" x="815.75" y="1583.75" width="96.25" height="15.5">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,16.6667 224.667,17.3333 225.333,-2"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="28" x="1394.67" y="958">
|
<object id="79" x="640" y="1616" width="1056" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -210.667,1.33333 -210.667,17.3333 -2,18"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="29" x="1119" y="654.5">
|
<object id="80" x="1296" y="1600">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,63.5 272.5,65 273,-1"/>
|
<polyline points="0,0 -32.5,0 -32.25,-16.5 -16.5,-16.5"/>
|
||||||
</object>
|
</object>
|
||||||
<object id="30" x="1136.5" y="717.5">
|
<object id="82" x="1328" y="1616">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -0.5,17 255,17.5 255,1.5"/>
|
<polyline points="0,0 -64.5,0 -64.0038,-15.75 -16.4734,-15.75"/>
|
||||||
</object>
|
</object>
|
||||||
<object id="31" x="1152" y="735.667">
|
<object id="83" x="640" y="480" width="1056" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 0,15 80.3333,15.3333 80.3333,-2"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="32" x="1280.67" y="734.667">
|
<object id="84" x="640" y="480" width="16" height="1152">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -0.666667,64.3333 48,65 48,0"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="34" x="1329" y="783">
|
<object id="85" x="1680" y="480" width="16" height="1152">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 63.3333,0.333333 63,-48.3333 -0.666667,-48.3333"/>
|
|
||||||
</object>
|
</object>
|
||||||
<object id="35" x="1296.67" y="799">
|
<object id="86" x="1104" y="1408" width="96" height="16">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="boundary_type" value="barrier"/>
|
<property name="boundary_type" value="barrier"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="0,0 -0.666667,31.3333 31.3333,31.6667 31.3333,-0.333333"/>
|
|
||||||
</object>
|
|
||||||
<object id="36" x="1280" y="848">
|
|
||||||
<properties>
|
|
||||||
<property name="boundary_type" value="barrier"/>
|
|
||||||
</properties>
|
|
||||||
<polyline points="0,0 0.333333,62 112,63 111.667,-1.33333"/>
|
|
||||||
</object>
|
|
||||||
<object id="37" x="1392.33" y="911.333">
|
|
||||||
<properties>
|
|
||||||
<property name="boundary_type" value="barrier"/>
|
|
||||||
</properties>
|
|
||||||
<polyline points="0,0 -81.3333,-0.666667 -81,45 -0.666667,46.3333"/>
|
|
||||||
</object>
|
|
||||||
<object id="38" x="1344.33" y="800.667">
|
|
||||||
<properties>
|
|
||||||
<property name="boundary_type" value="barrier"/>
|
|
||||||
</properties>
|
|
||||||
<polyline points="0,0 0,46.3333 47,46.3333 47,-1"/>
|
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
||||||
|
@@ -9,28 +9,32 @@ message PlayerDownsync {
|
|||||||
int32 virtualGridX = 2;
|
int32 virtualGridX = 2;
|
||||||
int32 virtualGridY = 3;
|
int32 virtualGridY = 3;
|
||||||
int32 dirX = 4;
|
int32 dirX = 4;
|
||||||
int32 dirY = 5;
|
int32 dirY = 5; // "dirX" and "dirY" determines character facing
|
||||||
int32 speed = 6; // in terms of virtual grid units
|
int32 velX = 6;
|
||||||
int32 battleState = 7;
|
int32 velY = 7; // "velX" and "velY" is used to record the accumulated effect by accelerations (including gravity)
|
||||||
int32 joinIndex = 8;
|
int32 speed = 8; // this is the instantaneous scalar attribute of a character, different from but will be accounted in "velX" and "velY"
|
||||||
double colliderRadius = 9;
|
int32 battleState = 9;
|
||||||
bool removed = 10;
|
int32 joinIndex = 10;
|
||||||
int32 score = 11;
|
double colliderRadius = 11;
|
||||||
int32 lastMoveGmtMillis = 12;
|
bool removed = 12;
|
||||||
int32 framesToRecover = 13;
|
int32 score = 13;
|
||||||
int32 hp = 14;
|
int32 lastMoveGmtMillis = 14;
|
||||||
int32 maxHp = 15;
|
int32 framesToRecover = 15;
|
||||||
int32 characterState = 16;
|
int32 hp = 16;
|
||||||
|
int32 maxHp = 17;
|
||||||
|
int32 characterState = 18;
|
||||||
|
bool inAir = 19; // by design a standalone field only inferred by the collision result of "applyInputFrameDownsyncDynamicsOnSingleRenderFrame" instead of "characterState", because we need check the transition for "characterState" from this field, i.e. "inAir (prev -> curr)"
|
||||||
|
|
||||||
string name = 17;
|
string name = 20;
|
||||||
string displayName = 18;
|
string displayName = 21;
|
||||||
string avatar = 19;
|
string avatar = 22;
|
||||||
}
|
}
|
||||||
|
|
||||||
message InputFrameDecoded {
|
message InputFrameDecoded {
|
||||||
int32 dx = 1;
|
int32 dx = 1;
|
||||||
int32 dy = 2;
|
int32 dy = 2;
|
||||||
int32 btnALevel = 3;
|
int32 btnALevel = 3;
|
||||||
|
int32 btnBLevel = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message InputFrameUpsync {
|
message InputFrameUpsync {
|
||||||
@@ -68,6 +72,13 @@ message WsResp {
|
|||||||
BattleColliderInfo bciFrame = 6;
|
BattleColliderInfo bciFrame = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message InputsBufferSnapshot {
|
||||||
|
int32 refRenderFrameId = 1;
|
||||||
|
uint64 unconfirmedMask = 2;
|
||||||
|
repeated InputFrameDownsync toSendInputFrameDownsyncs = 3;
|
||||||
|
bool shouldForceResync = 4;
|
||||||
|
}
|
||||||
|
|
||||||
message MeleeBullet {
|
message MeleeBullet {
|
||||||
// Jargon reference https://www.thegamer.com/fighting-games-frame-data-explained/
|
// Jargon reference https://www.thegamer.com/fighting-games-frame-data-explained/
|
||||||
// ALL lengths are in world coordinate
|
// ALL lengths are in world coordinate
|
||||||
@@ -127,6 +138,12 @@ message BattleColliderInfo {
|
|||||||
int32 renderCacheSize = 26;
|
int32 renderCacheSize = 26;
|
||||||
|
|
||||||
map<int32, MeleeBullet> meleeSkillConfig = 27; // skillId -> skill
|
map<int32, MeleeBullet> meleeSkillConfig = 27; // skillId -> skill
|
||||||
|
|
||||||
|
double snapIntoPlatformOverlap = 28;
|
||||||
|
double snapIntoPlatformThreshold = 29;
|
||||||
|
int32 jumpingInitVelY = 30;
|
||||||
|
int32 gravityX = 31;
|
||||||
|
int32 gravityY = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RoomDownsyncFrame {
|
message RoomDownsyncFrame {
|
||||||
@@ -134,4 +151,6 @@ message RoomDownsyncFrame {
|
|||||||
map<int32, PlayerDownsync> players = 2;
|
map<int32, PlayerDownsync> players = 2;
|
||||||
int64 countdownNanos = 3;
|
int64 countdownNanos = 3;
|
||||||
repeated MeleeBullet meleeBullets = 4; // I don't know how to mimic inheritance/composition in protobuf by far, thus using an array for each type of bullet as a compromise
|
repeated MeleeBullet meleeBullets = 4; // I don't know how to mimic inheritance/composition in protobuf by far, thus using an array for each type of bullet as a compromise
|
||||||
|
uint64 backendUnconfirmedMask = 5; // Indexed by "joinIndex", same compression concern as stated in InputFrameDownsync
|
||||||
|
bool shouldForceResync = 6;
|
||||||
}
|
}
|
||||||
|
@@ -33,14 +33,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 20
|
"__id__": 23
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 21
|
"__id__": 24
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 22
|
"__id__": 25
|
||||||
},
|
},
|
||||||
"_opacity": 255,
|
"_opacity": 255,
|
||||||
"_color": {
|
"_color": {
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
3,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -116,8 +116,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 46.68,
|
"width": 28.01,
|
||||||
"height": 27.72
|
"height": 15.12
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -128,8 +128,8 @@
|
|||||||
"__type__": "TypedArray",
|
"__type__": "TypedArray",
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
-5,
|
0,
|
||||||
50,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -169,8 +169,8 @@
|
|||||||
"_useOriginalSize": false,
|
"_useOriginalSize": false,
|
||||||
"_string": "(0, 0)",
|
"_string": "(0, 0)",
|
||||||
"_N$string": "(0, 0)",
|
"_N$string": "(0, 0)",
|
||||||
"_fontSize": 20,
|
"_fontSize": 12,
|
||||||
"_lineHeight": 22,
|
"_lineHeight": 12,
|
||||||
"_enableWrapText": true,
|
"_enableWrapText": true,
|
||||||
"_N$file": null,
|
"_N$file": null,
|
||||||
"_isSystemFontUsed": true,
|
"_isSystemFontUsed": true,
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
"__uuid__": "472df5d3-35e7-4184-9e6c-7f41bee65ee3"
|
"__uuid__": "472df5d3-35e7-4184-9e6c-7f41bee65ee3"
|
||||||
},
|
},
|
||||||
"_texture": null,
|
"_texture": null,
|
||||||
"_stopped": false,
|
"_stopped": true,
|
||||||
"playOnLoad": true,
|
"playOnLoad": true,
|
||||||
"autoRemoveOnFinish": false,
|
"autoRemoveOnFinish": false,
|
||||||
"totalParticles": 200,
|
"totalParticles": 200,
|
||||||
@@ -395,8 +395,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 76,
|
"width": 24,
|
||||||
"height": 84
|
"height": 24
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -408,7 +408,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
3,
|
3,
|
||||||
182,
|
60,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -451,7 +451,7 @@
|
|||||||
"__uuid__": "a2170e4c-df31-41ef-be73-f4f605e75821"
|
"__uuid__": "a2170e4c-df31-41ef-be73-f4f605e75821"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 0,
|
||||||
"_sizeMode": 1,
|
"_sizeMode": 0,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_fillCenter": {
|
"_fillCenter": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -490,12 +490,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 15
|
"__id__": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 18
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [],
|
"_components": [],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 19
|
"__id__": 22
|
||||||
},
|
},
|
||||||
"_opacity": 255,
|
"_opacity": 255,
|
||||||
"_color": {
|
"_color": {
|
||||||
@@ -584,7 +587,7 @@
|
|||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
-24,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@@ -671,13 +674,128 @@
|
|||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 16
|
"__id__": 16
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 17
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 18
|
"__id__": 17
|
||||||
|
},
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_trs": {
|
||||||
|
"__type__": "TypedArray",
|
||||||
|
"ctor": "Float64Array",
|
||||||
|
"array": [
|
||||||
|
0,
|
||||||
|
-24,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"_eulerAngles": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_skewX": 0,
|
||||||
|
"_skewY": 0,
|
||||||
|
"_is3DNode": false,
|
||||||
|
"_groupIndex": 0,
|
||||||
|
"groupIndex": 0,
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "dragonBones.ArmatureDisplay",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 15
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"_materials": [
|
||||||
|
{
|
||||||
|
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_armatureName": "SoldierFireGhost",
|
||||||
|
"_animationName": "Idle1",
|
||||||
|
"_preCacheMode": 0,
|
||||||
|
"_cacheMode": 0,
|
||||||
|
"playTimes": -1,
|
||||||
|
"premultipliedAlpha": false,
|
||||||
|
"_armatureKey": "36230012-8df3-4e85-afad-76ec47d0e4d7#4a9187d5-a9ad-4464-a03c-d2f3cc277051",
|
||||||
|
"_accTime": 0,
|
||||||
|
"_playCount": 0,
|
||||||
|
"_frameCache": null,
|
||||||
|
"_curFrame": null,
|
||||||
|
"_playing": false,
|
||||||
|
"_armatureCache": null,
|
||||||
|
"_N$dragonAsset": {
|
||||||
|
"__uuid__": "36230012-8df3-4e85-afad-76ec47d0e4d7"
|
||||||
|
},
|
||||||
|
"_N$dragonAtlasAsset": {
|
||||||
|
"__uuid__": "4a9187d5-a9ad-4464-a03c-d2f3cc277051"
|
||||||
|
},
|
||||||
|
"_N$_defaultArmatureIndex": 0,
|
||||||
|
"_N$_animationIndex": 8,
|
||||||
|
"_N$_defaultCacheMode": 0,
|
||||||
|
"_N$timeScale": 1,
|
||||||
|
"_N$debugBones": false,
|
||||||
|
"_N$enableBatch": false,
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
|
||||||
|
},
|
||||||
|
"fileId": "3b2LJFABVL7ozO2U81FC4U",
|
||||||
|
"sync": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "SoldierFireGhostFrameAnim",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 11
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": false,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 19
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 20
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 21
|
||||||
},
|
},
|
||||||
"_opacity": 255,
|
"_opacity": 255,
|
||||||
"_color": {
|
"_color": {
|
||||||
@@ -731,7 +849,7 @@
|
|||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 15
|
"__id__": 18
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_defaultClip": null,
|
"_defaultClip": null,
|
||||||
@@ -745,6 +863,15 @@
|
|||||||
{
|
{
|
||||||
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
|
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "43dbf141-be76-48c3-bdef-29233ccbe30d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
|
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
|
||||||
}
|
}
|
||||||
@@ -757,7 +884,7 @@
|
|||||||
"_name": "",
|
"_name": "",
|
||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 15
|
"__id__": 18
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"_materials": [
|
"_materials": [
|
||||||
|
@@ -1,151 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"__type__": "cc.Prefab",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_native": "",
|
|
||||||
"data": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"optimizationPolicy": 0,
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"readonly": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Node",
|
|
||||||
"_name": "SoldierFireGhost",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"_parent": null,
|
|
||||||
"_children": [],
|
|
||||||
"_active": true,
|
|
||||||
"_components": [
|
|
||||||
{
|
|
||||||
"__id__": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_prefab": {
|
|
||||||
"__id__": 4
|
|
||||||
},
|
|
||||||
"_opacity": 255,
|
|
||||||
"_color": {
|
|
||||||
"__type__": "cc.Color",
|
|
||||||
"r": 255,
|
|
||||||
"g": 255,
|
|
||||||
"b": 255,
|
|
||||||
"a": 255
|
|
||||||
},
|
|
||||||
"_contentSize": {
|
|
||||||
"__type__": "cc.Size",
|
|
||||||
"width": 1425,
|
|
||||||
"height": 1024
|
|
||||||
},
|
|
||||||
"_anchorPoint": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0.5,
|
|
||||||
"y": 0.5
|
|
||||||
},
|
|
||||||
"_trs": {
|
|
||||||
"__type__": "TypedArray",
|
|
||||||
"ctor": "Float64Array",
|
|
||||||
"array": [
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"_eulerAngles": {
|
|
||||||
"__type__": "cc.Vec3",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"_skewX": 0,
|
|
||||||
"_skewY": 0,
|
|
||||||
"_is3DNode": false,
|
|
||||||
"_groupIndex": 0,
|
|
||||||
"groupIndex": 0,
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Animation",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_defaultClip": null,
|
|
||||||
"_clips": [
|
|
||||||
{
|
|
||||||
"__uuid__": "252b321f-81f4-485c-85bd-ea44d298cb76"
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__uuid__": "f51bb583-0010-48f3-a6a1-451a78ac2d65"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"playOnLoad": false,
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.Sprite",
|
|
||||||
"_name": "",
|
|
||||||
"_objFlags": 0,
|
|
||||||
"node": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"_enabled": true,
|
|
||||||
"_materials": [
|
|
||||||
{
|
|
||||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_srcBlendFactor": 770,
|
|
||||||
"_dstBlendFactor": 771,
|
|
||||||
"_spriteFrame": null,
|
|
||||||
"_type": 0,
|
|
||||||
"_sizeMode": 1,
|
|
||||||
"_fillType": 0,
|
|
||||||
"_fillCenter": {
|
|
||||||
"__type__": "cc.Vec2",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"_fillStart": 0,
|
|
||||||
"_fillRange": 0,
|
|
||||||
"_isTrimmedMode": true,
|
|
||||||
"_atlas": {
|
|
||||||
"__uuid__": "145769c8-a259-42bc-8cce-6e035f493c70"
|
|
||||||
},
|
|
||||||
"_id": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__type__": "cc.PrefabInfo",
|
|
||||||
"root": {
|
|
||||||
"__id__": 1
|
|
||||||
},
|
|
||||||
"asset": {
|
|
||||||
"__id__": 0
|
|
||||||
},
|
|
||||||
"fileId": "44k8wsxglPsJSrMCX58Yve",
|
|
||||||
"sync": false
|
|
||||||
}
|
|
||||||
]
|
|
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"ver": "1.2.5",
|
|
||||||
"uuid": "e3fc2487-17d1-4ff9-ae1f-38e974509077",
|
|
||||||
"optimizationPolicy": "AUTO",
|
|
||||||
"asyncLoadAssets": false,
|
|
||||||
"readonly": false,
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
@@ -440,7 +440,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
210.5241291124452,
|
216.05530045313827,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@@ -172,8 +172,8 @@
|
|||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 3200,
|
"width": 2048,
|
||||||
"height": 3200
|
"height": 2048
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -191,8 +191,8 @@
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
2,
|
1.5,
|
||||||
2,
|
1.5,
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -454,7 +454,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
210.5241291124452,
|
209.73151519075364,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@@ -5,8 +5,33 @@ window.ATK_CHARACTER_STATE = {
|
|||||||
Walking: [1, "Walking"],
|
Walking: [1, "Walking"],
|
||||||
Atk1: [2, "Atk1"],
|
Atk1: [2, "Atk1"],
|
||||||
Atked1: [3, "Atked1"],
|
Atked1: [3, "Atked1"],
|
||||||
|
InAirIdle1: [4, "InAirIdle1"],
|
||||||
|
InAirAtk1: [5, "Atk1"],
|
||||||
|
InAirAtked1: [6, "Atked1"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.toInAirConjugate = function(foo) {
|
||||||
|
switch (foo) {
|
||||||
|
case window.ATK_CHARACTER_STATE.Idle1[0]:
|
||||||
|
case window.ATK_CHARACTER_STATE.Walking[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.InAirIdle1[0];
|
||||||
|
case window.ATK_CHARACTER_STATE.Atk1[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.InAirAtk1[0];
|
||||||
|
case window.ATK_CHARACTER_STATE.Atked1[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.InAirAtked1[0];
|
||||||
|
|
||||||
|
case window.ATK_CHARACTER_STATE.InAirIdle1[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.Idle1[0];
|
||||||
|
case window.ATK_CHARACTER_STATE.InAirAtk1[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.Atk1[0];
|
||||||
|
case window.ATK_CHARACTER_STATE.InAirAtked1[0]:
|
||||||
|
return window.ATK_CHARACTER_STATE.Atked1[0];
|
||||||
|
default:
|
||||||
|
console.warn(`Invalid characterState ${foo} received, no in air conjugate is available!`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window.ATK_CHARACTER_STATE_ARR = [];
|
window.ATK_CHARACTER_STATE_ARR = [];
|
||||||
for (let k in window.ATK_CHARACTER_STATE) {
|
for (let k in window.ATK_CHARACTER_STATE) {
|
||||||
window.ATK_CHARACTER_STATE_ARR.push(window.ATK_CHARACTER_STATE[k]);
|
window.ATK_CHARACTER_STATE_ARR.push(window.ATK_CHARACTER_STATE[k]);
|
||||||
@@ -15,6 +40,12 @@ for (let k in window.ATK_CHARACTER_STATE) {
|
|||||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET = new Set();
|
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET = new Set();
|
||||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.Idle1[0]);
|
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.Idle1[0]);
|
||||||
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.Walking[0]);
|
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.Walking[0]);
|
||||||
|
window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.add(window.ATK_CHARACTER_STATE.InAirIdle1[0]);
|
||||||
|
|
||||||
|
window.ATK_CHARACTER_STATE_IN_AIR_SET = new Set();
|
||||||
|
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirIdle1[0]);
|
||||||
|
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirAtk1[0]);
|
||||||
|
window.ATK_CHARACTER_STATE_IN_AIR_SET.add(window.ATK_CHARACTER_STATE.InAirAtked1[0]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Kindly note that the use of dragonBones anim is an informed choice for the feasibility of "gotoAndPlayByFrame", which is a required feature by "Map.rollbackAndChase". You might find that "cc.Animation" -- the traditional frame anim -- can also suffice this requirement, yet if we want to develop 3D frontend in the future, working with skeletal anim will make a smoother transition.
|
Kindly note that the use of dragonBones anim is an informed choice for the feasibility of "gotoAndPlayByFrame", which is a required feature by "Map.rollbackAndChase". You might find that "cc.Animation" -- the traditional frame anim -- can also suffice this requirement, yet if we want to develop 3D frontend in the future, working with skeletal anim will make a smoother transition.
|
||||||
@@ -37,6 +68,7 @@ cc.Class({
|
|||||||
this.hp = 100;
|
this.hp = 100;
|
||||||
this.maxHp = 100;
|
this.maxHp = 100;
|
||||||
this.framesToRecover = 0;
|
this.framesToRecover = 0;
|
||||||
|
this.inAir = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSpecies(speciesName) {
|
setSpecies(speciesName) {
|
||||||
@@ -49,8 +81,7 @@ cc.Class({
|
|||||||
this.animComp = this.effAnimNode.getComponent(dragonBones.ArmatureDisplay);
|
this.animComp = this.effAnimNode.getComponent(dragonBones.ArmatureDisplay);
|
||||||
if (!this.animComp) {
|
if (!this.animComp) {
|
||||||
this.animComp = this.effAnimNode.getComponent(cc.Animation);
|
this.animComp = this.effAnimNode.getComponent(cc.Animation);
|
||||||
this.effAnimNode.anchorY = 0.0; // Otherwise the frame anim will show with an incorrect y-offset even if the collider boundaries are all correct!
|
}
|
||||||
}
|
|
||||||
this.effAnimNode.active = true;
|
this.effAnimNode.active = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -82,21 +113,21 @@ cc.Class({
|
|||||||
// It turns out that "prevRdfPlayer.characterState" is not useful in this function :)
|
// It turns out that "prevRdfPlayer.characterState" is not useful in this function :)
|
||||||
if (newAnimName == playingAnimName && window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
if (newAnimName == playingAnimName && window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
||||||
// No need to interrupt
|
// No need to interrupt
|
||||||
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, not interrupting ${newAnimName} while the playing anim is also ${playingAnimName}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, , to: ${JSON.stringify(rdfPlayer)}`);
|
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, not interrupting ${newAnimName} while the playing anim is also ${playingAnimName}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, to: ${JSON.stringify(rdfPlayer)}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.animComp instanceof dragonBones.ArmatureDisplay) {
|
if (this.animComp instanceof dragonBones.ArmatureDisplay) {
|
||||||
this._interruptPlayingAnimAndPlayNewAnimDragonBones(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, underlyingAnimationCtrl);
|
this._interruptPlayingAnimAndPlayNewAnimDragonBones(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, underlyingAnimationCtrl, playingAnimName);
|
||||||
} else {
|
} else {
|
||||||
this._interruptPlayingAnimAndPlayNewAnimFrameAnim(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName);
|
this._interruptPlayingAnimAndPlayNewAnimFrameAnim(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, playingAnimName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_interruptPlayingAnimAndPlayNewAnimDragonBones(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, underlyingAnimationCtrl) {
|
_interruptPlayingAnimAndPlayNewAnimDragonBones(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, underlyingAnimationCtrl, playingAnimName) {
|
||||||
if (ATK_CHARACTER_STATE.Idle1[0] == newCharacterState || ATK_CHARACTER_STATE.Walking[0] == newCharacterState) {
|
if (window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
||||||
// No "framesToRecover"
|
// No "framesToRecover"
|
||||||
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, playing new ${newAnimName} from the beginning: while the playing anim is ${playAnimation}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, , to: ${JSON.stringify(rdfPlayer)}`);
|
// console.warn(`#DragonBones JoinIndex=${rdfPlayer.joinIndex}, ${playingAnimName} -> ${newAnimName}`);
|
||||||
underlyingAnimationCtrl.gotoAndPlayByFrame(newAnimName, 0, -1);
|
underlyingAnimationCtrl.gotoAndPlayByFrame(newAnimName, 0, -1);
|
||||||
} else {
|
} else {
|
||||||
const animationData = underlyingAnimationCtrl._animations[newAnimName];
|
const animationData = underlyingAnimationCtrl._animations[newAnimName];
|
||||||
@@ -109,10 +140,10 @@ cc.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_interruptPlayingAnimAndPlayNewAnimFrameAnim(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName) {
|
_interruptPlayingAnimAndPlayNewAnimFrameAnim(rdfPlayer, prevRdfPlayer, newCharacterState, newAnimName, playingAnimName) {
|
||||||
if (window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
if (window.ATK_CHARACTER_STATE_INTERRUPT_WAIVE_SET.has(newCharacterState)) {
|
||||||
// No "framesToRecover"
|
// No "framesToRecover"
|
||||||
// console.warn(`JoinIndex=${rdfPlayer.joinIndex}, playing new ${newAnimName} from the beginning: while the playing anim is ${playAnimation}, player rdf changed from: ${null == prevRdfPlayer ? null : JSON.stringify(prevRdfPlayer)}, , to: ${JSON.stringify(rdfPlayer)}`);
|
//console.warn(`#FrameAnim JoinIndex=${rdfPlayer.joinIndex}, ${playingAnimName} -> ${newAnimName}`);
|
||||||
this.animComp.play(newAnimName, 0);
|
this.animComp.play(newAnimName, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,7 @@ cc.Class({
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
const self = this;
|
const self = this;
|
||||||
window.mapIns = self;
|
window.mapIns = self;
|
||||||
|
self.showCriticalCoordinateLabels = true;
|
||||||
|
|
||||||
cc.director.getCollisionManager().enabled = false;
|
cc.director.getCollisionManager().enabled = false;
|
||||||
|
|
||||||
@@ -33,9 +34,12 @@ cc.Class({
|
|||||||
self.inputScaleFrames = 2;
|
self.inputScaleFrames = 2;
|
||||||
self.inputFrameUpsyncDelayTolerance = 2;
|
self.inputFrameUpsyncDelayTolerance = 2;
|
||||||
|
|
||||||
|
self.renderCacheSize = 1024;
|
||||||
|
self.serverFps = 60;
|
||||||
self.rollbackEstimatedDt = 0.016667;
|
self.rollbackEstimatedDt = 0.016667;
|
||||||
self.rollbackEstimatedDtMillis = 16.667;
|
self.rollbackEstimatedDtMillis = 16.667;
|
||||||
self.rollbackEstimatedDtNanos = 16666666;
|
self.rollbackEstimatedDtNanos = 16666666;
|
||||||
|
self.tooFastDtIntervalMillis = 0.5 * self.rollbackEstimatedDtMillis;
|
||||||
|
|
||||||
self.worldToVirtualGridRatio = 1000;
|
self.worldToVirtualGridRatio = 1000;
|
||||||
self.virtualGridToWorldRatio = 1.0 / self.worldToVirtualGridRatio;
|
self.virtualGridToWorldRatio = 1.0 / self.worldToVirtualGridRatio;
|
||||||
@@ -66,6 +70,16 @@ cc.Class({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
[WARNING] As when a character is standing on a barrier, if not carefully curated there MIGHT BE a bouncing sequence of "[(inAir -> dropIntoBarrier ->), (notInAir -> pushedOutOfBarrier ->)], [(inAir -> ..."
|
||||||
|
|
||||||
|
Moreover, "snapIntoPlatformOverlap" should be small enough such that the walking "velX" or jumping initial "velY" can escape from it by 1 renderFrame (when jumping is triggered, the character is waived from snappig for 1 renderFrame).
|
||||||
|
*/
|
||||||
|
self.snapIntoPlatformOverlap = 0.1;
|
||||||
|
self.snapIntoPlatformThreshold = 0.5; // a platform must be "horizontal enough" for a character to "stand on"
|
||||||
|
self.jumpingInitVelY = 7 * self.worldToVirtualGridRatio; // unit: (virtual grid length/renderFrame)
|
||||||
|
[self.gravityX, self.gravityY] = [0, -0.5*self.worldToVirtualGridRatio]; // unit: (virtual grid length/renderFrame^2)
|
||||||
|
|
||||||
const tiledMapIns = self.node.getComponent(cc.TiledMap);
|
const tiledMapIns = self.node.getComponent(cc.TiledMap);
|
||||||
|
|
||||||
const fullPathOfTmxFile = cc.js.formatStr("map/%s/map", "dungeon");
|
const fullPathOfTmxFile = cc.js.formatStr("map/%s/map", "dungeon");
|
||||||
@@ -79,6 +93,17 @@ cc.Class({
|
|||||||
mapNode.removeAllChildren();
|
mapNode.removeAllChildren();
|
||||||
self._resetCurrentMatch();
|
self._resetCurrentMatch();
|
||||||
|
|
||||||
|
if (self.showCriticalCoordinateLabels) {
|
||||||
|
const drawer = new cc.Node();
|
||||||
|
drawer.setPosition(cc.v2(0, 0))
|
||||||
|
safelyAddChild(self.node, drawer);
|
||||||
|
setLocalZOrder(drawer, 999);
|
||||||
|
const g = drawer.addComponent(cc.Graphics);
|
||||||
|
g.lineWidth = 2;
|
||||||
|
self.g = g;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
tiledMapIns.tmxAsset = tmxAsset;
|
tiledMapIns.tmxAsset = tmxAsset;
|
||||||
const newMapSize = tiledMapIns.getMapSize();
|
const newMapSize = tiledMapIns.getMapSize();
|
||||||
const newTileSize = tiledMapIns.getTileSize();
|
const newTileSize = tiledMapIns.getTileSize();
|
||||||
@@ -94,8 +119,11 @@ cc.Class({
|
|||||||
const newBarrier = self.collisionSys.createPolygon(x0, y0, Array.from(boundaryObj, p => {
|
const newBarrier = self.collisionSys.createPolygon(x0, y0, Array.from(boundaryObj, p => {
|
||||||
return [p.x, p.y];
|
return [p.x, p.y];
|
||||||
}));
|
}));
|
||||||
|
newBarrier.data = {
|
||||||
|
hardPushback: true
|
||||||
|
};
|
||||||
|
|
||||||
if (self.showCriticalCoordinateLabels) {
|
if (false && self.showCriticalCoordinateLabels) {
|
||||||
for (let i = 0; i < boundaryObj.length; ++i) {
|
for (let i = 0; i < boundaryObj.length; ++i) {
|
||||||
const barrierVertLabelNode = new cc.Node();
|
const barrierVertLabelNode = new cc.Node();
|
||||||
switch (i % 4) {
|
switch (i % 4) {
|
||||||
@@ -135,34 +163,40 @@ cc.Class({
|
|||||||
const startRdf = window.pb.protos.RoomDownsyncFrame.create({
|
const startRdf = window.pb.protos.RoomDownsyncFrame.create({
|
||||||
id: window.MAGIC_ROOM_DOWNSYNC_FRAME_ID.BATTLE_START,
|
id: window.MAGIC_ROOM_DOWNSYNC_FRAME_ID.BATTLE_START,
|
||||||
players: {
|
players: {
|
||||||
10: {
|
10: window.pb.protos.PlayerDownsync.create({
|
||||||
id: 10,
|
id: 10,
|
||||||
joinIndex: 1,
|
joinIndex: 1,
|
||||||
virtualGridX: 0,
|
virtualGridX: self.worldToVirtualGridPos(boundaryObjs.playerStartingPositions[0].x, boundaryObjs.playerStartingPositions[0].y)[0],
|
||||||
virtualGridY: 0,
|
virtualGridY: self.worldToVirtualGridPos(boundaryObjs.playerStartingPositions[0].x, boundaryObjs.playerStartingPositions[0].y)[1],
|
||||||
speed: 1 * self.worldToVirtualGridRatio,
|
speed: 1 * self.worldToVirtualGridRatio,
|
||||||
colliderRadius: 12,
|
colliderRadius: 12,
|
||||||
characterState: window.ATK_CHARACTER_STATE.Idle1[0],
|
characterState: window.ATK_CHARACTER_STATE.InAirIdle1[0],
|
||||||
framesToRecover: 0,
|
framesToRecover: 0,
|
||||||
dirX: 0,
|
dirX: 0,
|
||||||
dirY: 0,
|
dirY: 0,
|
||||||
},
|
velX: 0,
|
||||||
11: {
|
velY: 0,
|
||||||
|
inAir: true,
|
||||||
|
}),
|
||||||
|
11: window.pb.protos.PlayerDownsync.create({
|
||||||
id: 11,
|
id: 11,
|
||||||
joinIndex: 2,
|
joinIndex: 2,
|
||||||
virtualGridX: 80 * self.worldToVirtualGridRatio,
|
virtualGridX: self.worldToVirtualGridPos(boundaryObjs.playerStartingPositions[1].x, boundaryObjs.playerStartingPositions[1].y)[0],
|
||||||
virtualGridY: 0 * self.worldToVirtualGridRatio,
|
virtualGridY: self.worldToVirtualGridPos(boundaryObjs.playerStartingPositions[1].x, boundaryObjs.playerStartingPositions[1].y)[1],
|
||||||
speed: 1 * self.worldToVirtualGridRatio,
|
speed: 1 * self.worldToVirtualGridRatio,
|
||||||
colliderRadius: 12,
|
colliderRadius: 12,
|
||||||
characterState: window.ATK_CHARACTER_STATE.Idle1[0],
|
characterState: window.ATK_CHARACTER_STATE.InAirIdle1[0],
|
||||||
framesToRecover: 0,
|
framesToRecover: 0,
|
||||||
dirX: 0,
|
dirX: 0,
|
||||||
dirY: 0,
|
dirY: 0,
|
||||||
},
|
velX: 0,
|
||||||
|
velY: 0,
|
||||||
|
inAir: true,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.selfPlayerInfo = {
|
self.selfPlayerInfo = {
|
||||||
id: 11
|
id: 10
|
||||||
};
|
};
|
||||||
self._initPlayerRichInfoDict(startRdf.players);
|
self._initPlayerRichInfoDict(startRdf.players);
|
||||||
self.onRoomDownsyncFrame(startRdf);
|
self.onRoomDownsyncFrame(startRdf);
|
||||||
@@ -176,7 +210,8 @@ cc.Class({
|
|||||||
const self = this;
|
const self = this;
|
||||||
if (ALL_BATTLE_STATES.IN_BATTLE == self.battleState) {
|
if (ALL_BATTLE_STATES.IN_BATTLE == self.battleState) {
|
||||||
const elapsedMillisSinceLastFrameIdTriggered = performance.now() - self.lastRenderFrameIdTriggeredAt;
|
const elapsedMillisSinceLastFrameIdTriggered = performance.now() - self.lastRenderFrameIdTriggeredAt;
|
||||||
if (elapsedMillisSinceLastFrameIdTriggered < (self.rollbackEstimatedDtMillis)) {
|
if (elapsedMillisSinceLastFrameIdTriggered < self.tooFastDtIntervalMillis) {
|
||||||
|
// [WARNING] We should avoid a frontend ticking too fast to prevent cheating, as well as ticking too slow to cause a "resync avalanche" that impacts user experience!
|
||||||
// console.debug("Avoiding too fast frame@renderFrameId=", self.renderFrameId, ": elapsedMillisSinceLastFrameIdTriggered=", elapsedMillisSinceLastFrameIdTriggered);
|
// console.debug("Avoiding too fast frame@renderFrameId=", self.renderFrameId, ": elapsedMillisSinceLastFrameIdTriggered=", elapsedMillisSinceLastFrameIdTriggered);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -193,11 +228,12 @@ cc.Class({
|
|||||||
|
|
||||||
const [prevRdf, rdf] = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.collisionSys, self.collisionSysMap, false);
|
const [prevRdf, rdf] = self.rollbackAndChase(self.renderFrameId, self.renderFrameId + 1, self.collisionSys, self.collisionSysMap, false);
|
||||||
self.applyRoomDownsyncFrameDynamics(rdf, prevRdf);
|
self.applyRoomDownsyncFrameDynamics(rdf, prevRdf);
|
||||||
|
self.showDebugBoundaries(rdf);
|
||||||
|
++self.renderFrameId;
|
||||||
|
self.lastRenderFrameIdTriggeredAt = performance.now();
|
||||||
let t3 = performance.now();
|
let t3 = performance.now();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error during Map.update", err);
|
console.error("Error during Map.update", err);
|
||||||
} finally {
|
|
||||||
++self.renderFrameId; // [WARNING] It's important to increment the renderFrameId AFTER all the operations above!!!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -13,6 +13,10 @@ var RingBuffer = function(capacity) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RingBuffer.prototype.put = function(item) {
|
RingBuffer.prototype.put = function(item) {
|
||||||
|
while (0 < this.cnt && this.cnt >= this.n) {
|
||||||
|
// Make room for the new element
|
||||||
|
this.pop();
|
||||||
|
}
|
||||||
this.eles[this.ed] = item
|
this.eles[this.ed] = item
|
||||||
this.edFrameId++;
|
this.edFrameId++;
|
||||||
this.cnt++;
|
this.cnt++;
|
||||||
@@ -61,40 +65,41 @@ RingBuffer.prototype.getArrIdxByOffset = function(offsetFromSt) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
RingBuffer.prototype.getByFrameId = function(frameId) {
|
RingBuffer.prototype.getByFrameId = function(frameId) {
|
||||||
|
if (frameId >= this.edFrameId || frameId < this.stFrameId) return null;
|
||||||
const arrIdx = this.getArrIdxByOffset(frameId - this.stFrameId);
|
const arrIdx = this.getArrIdxByOffset(frameId - this.stFrameId);
|
||||||
return (null == arrIdx ? null : this.eles[arrIdx]);
|
return (null == arrIdx ? null : this.eles[arrIdx]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// [WARNING] During a battle, frontend could receive non-consecutive frames (either renderFrame or inputFrame) due to resync, the buffer should handle these frames properly.
|
// [WARNING] During a battle, frontend could receive non-consecutive frames (either renderFrame or inputFrame) due to resync, the buffer should handle these frames properly.
|
||||||
RingBuffer.prototype.setByFrameId = function(item, frameId) {
|
RingBuffer.prototype.setByFrameId = function(item, frameId) {
|
||||||
if (frameId < this.stFrameId) {
|
const oldStFrameId = this.stFrameId,
|
||||||
console.error("Invalid putByFrameId#1: stFrameId=", this.stFrameId, ", edFrameId=", this.edFrameId, ", incoming item=", item);
|
oldEdFrameId = this.edFrameId;
|
||||||
return window.RING_BUFF_FAILED_TO_SET;
|
if (frameId < oldStFrameId) {
|
||||||
|
return [window.RING_BUFF_FAILED_TO_SET, oldStFrameId, oldEdFrameId];
|
||||||
}
|
}
|
||||||
const arrIdx = this.getArrIdxByOffset(frameId - this.stFrameId);
|
// By now "this.stFrameId <= frameId"
|
||||||
if (null != arrIdx) {
|
|
||||||
this.eles[arrIdx] = item;
|
if (oldEdFrameId > frameId) {
|
||||||
return window.RING_BUFF_CONSECUTIVE_SET;
|
const arrIdx = this.getArrIdxByOffset(frameId - this.stFrameId);
|
||||||
|
if (null != arrIdx) {
|
||||||
|
this.eles[arrIdx] = item;
|
||||||
|
return [window.RING_BUFF_CONSECUTIVE_SET, oldStFrameId, oldEdFrameId];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When "null == arrIdx", should it still be deemed consecutive if "frameId == edFrameId" prior to the reset?
|
// By now "this.edFrameId <= frameId"
|
||||||
let ret = window.RING_BUFF_CONSECUTIVE_SET;
|
let ret = window.RING_BUFF_CONSECUTIVE_SET;
|
||||||
if (this.edFrameId < frameId) {
|
if (oldEdFrameId < frameId) {
|
||||||
this.st = this.ed = 0;
|
this.st = this.ed = 0;
|
||||||
this.stFrameId = this.edFrameId = frameId;
|
this.stFrameId = this.edFrameId = frameId;
|
||||||
this.cnt = 0;
|
this.cnt = 0;
|
||||||
ret = window.RING_BUFF_NON_CONSECUTIVE_SET;
|
ret = window.RING_BUFF_NON_CONSECUTIVE_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eles[this.ed] = item
|
// By now "this.edFrameId == frameId"
|
||||||
this.edFrameId++;
|
this.put(item);
|
||||||
this.cnt++;
|
|
||||||
this.ed++;
|
|
||||||
if (this.ed >= this.n) {
|
|
||||||
this.ed -= this.n; // Deliberately not using "%" operator for performance concern
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return [ret, oldStFrameId, oldEdFrameId];
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = RingBuffer;
|
module.exports = RingBuffer;
|
||||||
|
@@ -108,6 +108,7 @@ TileCollisionManager.prototype.continuousMapNodePosToContinuousObjLayerOffset =
|
|||||||
window.battleEntityTypeNameToGlobalGid = {};
|
window.battleEntityTypeNameToGlobalGid = {};
|
||||||
TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNode) {
|
TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNode) {
|
||||||
let toRet = {
|
let toRet = {
|
||||||
|
playerStartingPositions: [],
|
||||||
barriers: [],
|
barriers: [],
|
||||||
};
|
};
|
||||||
const tiledMapIns = withTiledMapNode.getComponent(cc.TiledMap); // This is a magic name.
|
const tiledMapIns = withTiledMapNode.getComponent(cc.TiledMap); // This is a magic name.
|
||||||
@@ -115,6 +116,18 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
|||||||
const allObjectGroups = tiledMapIns.getObjectGroups();
|
const allObjectGroups = tiledMapIns.getObjectGroups();
|
||||||
for (let i = 0; i < allObjectGroups.length; ++i) {
|
for (let i = 0; i < allObjectGroups.length; ++i) {
|
||||||
var objectGroup = allObjectGroups[i];
|
var objectGroup = allObjectGroups[i];
|
||||||
|
if ("PlayerStartingPos" == objectGroup.getGroupName()) {
|
||||||
|
var allObjects = objectGroup.getObjects();
|
||||||
|
for (let j = 0; j < allObjects.length; ++j) {
|
||||||
|
const cccMaskedX = allObjects[j].x,
|
||||||
|
cccMaskedY = allObjects[j].y;
|
||||||
|
const origX = cccMaskedX,
|
||||||
|
origY = withTiledMapNode.getContentSize().height - cccMaskedY; // FIXME: I don't know why CocosCreator did this, it's stupid and MIGHT NOT WORK IN ISOMETRIC orientation!
|
||||||
|
let wpos = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, cc.v2(origX, origY));
|
||||||
|
toRet.playerStartingPositions.push(wpos);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ("barrier_and_shelter" != objectGroup.getProperty("type")) continue;
|
if ("barrier_and_shelter" != objectGroup.getProperty("type")) continue;
|
||||||
var allObjects = objectGroup.getObjects();
|
var allObjects = objectGroup.getObjects();
|
||||||
for (let j = 0; j < allObjects.length; ++j) {
|
for (let j = 0; j < allObjects.length; ++j) {
|
||||||
@@ -123,21 +136,33 @@ TileCollisionManager.prototype.extractBoundaryObjects = function(withTiledMapNod
|
|||||||
if (0 < gid) {
|
if (0 < gid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const polylinePoints = object.polylinePoints;
|
|
||||||
if (null == polylinePoints) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
const boundaryType = object.boundary_type;
|
const boundaryType = object.boundary_type;
|
||||||
let toPushBarriers = [];
|
let toPushBarrier = [];
|
||||||
toPushBarriers.boundaryType = boundaryType;
|
toPushBarrier.boundaryType = boundaryType;
|
||||||
switch (boundaryType) {
|
switch (boundaryType) {
|
||||||
case "barrier":
|
case "barrier":
|
||||||
|
let polylinePoints = object.polylinePoints;
|
||||||
|
if (null == polylinePoints) {
|
||||||
|
polylinePoints = [{
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
}, {
|
||||||
|
x: object.width,
|
||||||
|
y: 0
|
||||||
|
}, {
|
||||||
|
x: object.width,
|
||||||
|
y: -object.height
|
||||||
|
}, {
|
||||||
|
x: 0,
|
||||||
|
y: -object.height
|
||||||
|
}];
|
||||||
|
}
|
||||||
for (let k = 0; k < polylinePoints.length; ++k) {
|
for (let k = 0; k < polylinePoints.length; ++k) {
|
||||||
/* Since CocosCreatorv2.1.3, the Y-coord of object polylines is inverted compared to that of the tmx file. */
|
/* Since CocosCreatorv2.1.3, the Y-coord of object polylines is inverted compared to that of the tmx file. */
|
||||||
toPushBarriers.push(this.continuousObjLayerVecToContinuousMapNodeVec(withTiledMapNode, cc.v2(polylinePoints[k].x, -polylinePoints[k].y)));
|
toPushBarrier.push(this.continuousObjLayerVecToContinuousMapNodeVec(withTiledMapNode, cc.v2(polylinePoints[k].x, -polylinePoints[k].y)));
|
||||||
}
|
}
|
||||||
toPushBarriers.anchor = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset); // DON'T use "(object.x, object.y)" which are wrong/meaningless!
|
toPushBarrier.anchor = this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset); // DON'T use "(object.x, object.y)" which are wrong/meaningless!
|
||||||
toRet.barriers.push(toPushBarriers);
|
toRet.barriers.push(toPushBarrier);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -99,6 +99,7 @@ cc.Class({
|
|||||||
this.cachedBtnLeftLevel = 0;
|
this.cachedBtnLeftLevel = 0;
|
||||||
this.cachedBtnRightLevel = 0;
|
this.cachedBtnRightLevel = 0;
|
||||||
this.cachedBtnALevel = 0;
|
this.cachedBtnALevel = 0;
|
||||||
|
this.cachedBtnBLevel = 0;
|
||||||
|
|
||||||
this.canvasNode = this.mapNode.parent;
|
this.canvasNode = this.mapNode.parent;
|
||||||
this.mainCameraNode = this.canvasNode.getChildByName("Main Camera"); // Cannot drag and assign the `mainCameraNode` from CocosCreator EDITOR directly, otherwise it'll cause an infinite loading time, till v2.1.0.
|
this.mainCameraNode = this.canvasNode.getChildByName("Main Camera"); // Cannot drag and assign the `mainCameraNode` from CocosCreator EDITOR directly, otherwise it'll cause an infinite loading time, till v2.1.0.
|
||||||
@@ -168,6 +169,9 @@ cc.Class({
|
|||||||
case cc.macro.KEY.h:
|
case cc.macro.KEY.h:
|
||||||
self.cachedBtnALevel = 1;
|
self.cachedBtnALevel = 1;
|
||||||
break;
|
break;
|
||||||
|
case cc.macro.KEY.j:
|
||||||
|
self.cachedBtnBLevel = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -190,6 +194,9 @@ cc.Class({
|
|||||||
case cc.macro.KEY.h:
|
case cc.macro.KEY.h:
|
||||||
self.cachedBtnALevel = 0;
|
self.cachedBtnALevel = 0;
|
||||||
break;
|
break;
|
||||||
|
case cc.macro.KEY.j:
|
||||||
|
self.cachedBtnBLevel = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -400,7 +407,8 @@ cc.Class({
|
|||||||
getEncodedInput() {
|
getEncodedInput() {
|
||||||
const discretizedDir = this.discretizeDirection(this.stickhead.x, this.stickhead.y, this.joyStickEps).encodedIdx; // There're only 9 dirs, thus using only the lower 4-bits
|
const discretizedDir = this.discretizeDirection(this.stickhead.x, this.stickhead.y, this.joyStickEps).encodedIdx; // There're only 9 dirs, thus using only the lower 4-bits
|
||||||
const btnALevel = (this.cachedBtnALevel << 4);
|
const btnALevel = (this.cachedBtnALevel << 4);
|
||||||
return (btnALevel + discretizedDir);
|
const btnBLevel = (this.cachedBtnBLevel << 5);
|
||||||
|
return (btnBLevel + btnALevel + discretizedDir);
|
||||||
},
|
},
|
||||||
|
|
||||||
decodeInput(encodedInput) {
|
decodeInput(encodedInput) {
|
||||||
@@ -410,10 +418,12 @@ cc.Class({
|
|||||||
console.error("Unexpected encodedDirection = ", encodedDirection);
|
console.error("Unexpected encodedDirection = ", encodedDirection);
|
||||||
}
|
}
|
||||||
const btnALevel = ((encodedInput >> 4) & 1);
|
const btnALevel = ((encodedInput >> 4) & 1);
|
||||||
|
const btnBLevel = ((encodedInput >> 5) & 1);
|
||||||
return window.pb.protos.InputFrameDecoded.create({
|
return window.pb.protos.InputFrameDecoded.create({
|
||||||
dx: mappedDirection[0],
|
dx: mappedDirection[0],
|
||||||
dy: mappedDirection[1],
|
dy: mappedDirection[1],
|
||||||
btnALevel: btnALevel,
|
btnALevel: btnALevel,
|
||||||
|
btnBLevel: btnBLevel,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@@ -5,7 +5,6 @@ window.UPSYNC_MSG_ACT_PLAYER_CMD = 2;
|
|||||||
window.UPSYNC_MSG_ACT_PLAYER_COLLIDER_ACK = 3;
|
window.UPSYNC_MSG_ACT_PLAYER_COLLIDER_ACK = 3;
|
||||||
|
|
||||||
window.DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED = -98;
|
window.DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED = -98;
|
||||||
window.DOWNSYNC_MSG_ACT_PLAYER_READDED_AND_ACKED = -97;
|
|
||||||
window.DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START = -1;
|
window.DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START = -1;
|
||||||
window.DOWNSYNC_MSG_ACT_BATTLE_START = 0;
|
window.DOWNSYNC_MSG_ACT_BATTLE_START = 0;
|
||||||
window.DOWNSYNC_MSG_ACT_HB_REQ = 1;
|
window.DOWNSYNC_MSG_ACT_HB_REQ = 1;
|
||||||
@@ -135,7 +134,7 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
|||||||
clientSession.binaryType = 'arraybuffer'; // Make 'event.data' of 'onmessage' an "ArrayBuffer" instead of a "Blob"
|
clientSession.binaryType = 'arraybuffer'; // Make 'event.data' of 'onmessage' an "ArrayBuffer" instead of a "Blob"
|
||||||
|
|
||||||
clientSession.onopen = function(evt) {
|
clientSession.onopen = function(evt) {
|
||||||
console.log("The WS clientSession is opened. clientSession.id=", clientSession.id);
|
console.log("The WS clientSession is opened.");
|
||||||
window.clientSession = clientSession;
|
window.clientSession = clientSession;
|
||||||
if (null == onopenCb) return;
|
if (null == onopenCb) return;
|
||||||
onopenCb();
|
onopenCb();
|
||||||
@@ -147,17 +146,14 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const resp = window.pb.protos.WsResp.decode(new Uint8Array(evt.data));
|
const resp = window.pb.protos.WsResp.decode(new Uint8Array(evt.data));
|
||||||
|
// console.log(`Got non-empty onmessage decoded: resp.act=${resp.act}`);
|
||||||
switch (resp.act) {
|
switch (resp.act) {
|
||||||
case window.DOWNSYNC_MSG_ACT_HB_REQ:
|
case window.DOWNSYNC_MSG_ACT_HB_REQ:
|
||||||
window.handleHbRequirements(resp); // 获取boundRoomId并存储到localStorage
|
window.handleHbRequirements(resp);
|
||||||
break;
|
break;
|
||||||
case window.DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED:
|
case window.DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED:
|
||||||
mapIns.onPlayerAdded(resp.rdf);
|
mapIns.onPlayerAdded(resp.rdf);
|
||||||
break;
|
break;
|
||||||
case window.DOWNSYNC_MSG_ACT_PLAYER_READDED_AND_ACKED:
|
|
||||||
// Deliberately left blank for now
|
|
||||||
mapIns.hideFindingPlayersGUI(resp.rdf);
|
|
||||||
break;
|
|
||||||
case window.DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START:
|
case window.DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START:
|
||||||
mapIns.onBattleReadyToStart(resp.rdf);
|
mapIns.onBattleReadyToStart(resp.rdf);
|
||||||
break;
|
break;
|
||||||
@@ -172,16 +168,10 @@ window.initPersistentSessionClient = function(onopenCb, expectedRoomId) {
|
|||||||
break;
|
break;
|
||||||
case window.DOWNSYNC_MSG_ACT_FORCED_RESYNC:
|
case window.DOWNSYNC_MSG_ACT_FORCED_RESYNC:
|
||||||
if (null == resp.inputFrameDownsyncBatch || 0 >= resp.inputFrameDownsyncBatch.length) {
|
if (null == resp.inputFrameDownsyncBatch || 0 >= resp.inputFrameDownsyncBatch.length) {
|
||||||
console.error(`Got empty inputFrameDownsyncBatch upon resync@localRenderFrameId=${mapIns.renderFrameId}, @lastAllConfirmedRenderFrameId=${mapIns.lastAllConfirmedRenderFrameId}, @lastAllConfirmedInputFrameId=${mapIns.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${mapIns.chaserRenderFrameId}, @localRecentInputCache=${mapIns._stringifyRecentInputCache(false)}, the incoming resp=
|
console.error(`Got empty inputFrameDownsyncBatch upon resync@localRenderFrameId=${mapIns.renderFrameId}, @lastAllConfirmedRenderFrameId=${mapIns.lastAllConfirmedRenderFrameId}, @lastAllConfirmedInputFrameId=${mapIns.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${mapIns.chaserRenderFrameId}, @localRecentInputCache=${mapIns._stringifyRecentInputCache(false)}, the incoming resp=${JSON.stringify(resp, null, 2)}`);
|
||||||
${JSON.stringify(resp, null, 2)}`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const inputFrameIdConsecutive = (resp.inputFrameDownsyncBatch[0].inputFrameId == mapIns.lastAllConfirmedInputFrameId + 1);
|
mapIns.onRoomDownsyncFrame(resp.rdf, resp.inputFrameDownsyncBatch);
|
||||||
const renderFrameIdConsecutive = (resp.rdf.id <= mapIns.renderFrameId + mapIns.renderFrameIdLagTolerance);
|
|
||||||
console.warn(`Got resync@localRenderFrameId=${mapIns.renderFrameId}, @lastAllConfirmedRenderFrameId=${mapIns.lastAllConfirmedRenderFrameId}, @lastAllConfirmedInputFrameId=${mapIns.lastAllConfirmedInputFrameId}, @chaserRenderFrameId=${mapIns.chaserRenderFrameId}, @localRecentInputCache=${mapIns._stringifyRecentInputCache(false)}, inputFrameIdConsecutive=${inputFrameIdConsecutive}, renderFrameIdConsecutive=${renderFrameIdConsecutive}`);
|
|
||||||
// The following order of execution is important
|
|
||||||
mapIns.onRoomDownsyncFrame(resp.rdf);
|
|
||||||
mapIns.onInputFrameDownsyncBatch(resp.inputFrameDownsyncBatch);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -1196,6 +1196,8 @@ $root.protos = (function() {
|
|||||||
* @property {number|null} [virtualGridY] PlayerDownsync virtualGridY
|
* @property {number|null} [virtualGridY] PlayerDownsync virtualGridY
|
||||||
* @property {number|null} [dirX] PlayerDownsync dirX
|
* @property {number|null} [dirX] PlayerDownsync dirX
|
||||||
* @property {number|null} [dirY] PlayerDownsync dirY
|
* @property {number|null} [dirY] PlayerDownsync dirY
|
||||||
|
* @property {number|null} [velX] PlayerDownsync velX
|
||||||
|
* @property {number|null} [velY] PlayerDownsync velY
|
||||||
* @property {number|null} [speed] PlayerDownsync speed
|
* @property {number|null} [speed] PlayerDownsync speed
|
||||||
* @property {number|null} [battleState] PlayerDownsync battleState
|
* @property {number|null} [battleState] PlayerDownsync battleState
|
||||||
* @property {number|null} [joinIndex] PlayerDownsync joinIndex
|
* @property {number|null} [joinIndex] PlayerDownsync joinIndex
|
||||||
@@ -1207,6 +1209,7 @@ $root.protos = (function() {
|
|||||||
* @property {number|null} [hp] PlayerDownsync hp
|
* @property {number|null} [hp] PlayerDownsync hp
|
||||||
* @property {number|null} [maxHp] PlayerDownsync maxHp
|
* @property {number|null} [maxHp] PlayerDownsync maxHp
|
||||||
* @property {number|null} [characterState] PlayerDownsync characterState
|
* @property {number|null} [characterState] PlayerDownsync characterState
|
||||||
|
* @property {boolean|null} [inAir] PlayerDownsync inAir
|
||||||
* @property {string|null} [name] PlayerDownsync name
|
* @property {string|null} [name] PlayerDownsync name
|
||||||
* @property {string|null} [displayName] PlayerDownsync displayName
|
* @property {string|null} [displayName] PlayerDownsync displayName
|
||||||
* @property {string|null} [avatar] PlayerDownsync avatar
|
* @property {string|null} [avatar] PlayerDownsync avatar
|
||||||
@@ -1267,6 +1270,22 @@ $root.protos = (function() {
|
|||||||
*/
|
*/
|
||||||
PlayerDownsync.prototype.dirY = 0;
|
PlayerDownsync.prototype.dirY = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayerDownsync velX.
|
||||||
|
* @member {number} velX
|
||||||
|
* @memberof protos.PlayerDownsync
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
PlayerDownsync.prototype.velX = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayerDownsync velY.
|
||||||
|
* @member {number} velY
|
||||||
|
* @memberof protos.PlayerDownsync
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
PlayerDownsync.prototype.velY = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerDownsync speed.
|
* PlayerDownsync speed.
|
||||||
* @member {number} speed
|
* @member {number} speed
|
||||||
@@ -1355,6 +1374,14 @@ $root.protos = (function() {
|
|||||||
*/
|
*/
|
||||||
PlayerDownsync.prototype.characterState = 0;
|
PlayerDownsync.prototype.characterState = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PlayerDownsync inAir.
|
||||||
|
* @member {boolean} inAir
|
||||||
|
* @memberof protos.PlayerDownsync
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
PlayerDownsync.prototype.inAir = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerDownsync name.
|
* PlayerDownsync name.
|
||||||
* @member {string} name
|
* @member {string} name
|
||||||
@@ -1413,34 +1440,40 @@ $root.protos = (function() {
|
|||||||
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.dirX);
|
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.dirX);
|
||||||
if (message.dirY != null && Object.hasOwnProperty.call(message, "dirY"))
|
if (message.dirY != null && Object.hasOwnProperty.call(message, "dirY"))
|
||||||
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.dirY);
|
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.dirY);
|
||||||
|
if (message.velX != null && Object.hasOwnProperty.call(message, "velX"))
|
||||||
|
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.velX);
|
||||||
|
if (message.velY != null && Object.hasOwnProperty.call(message, "velY"))
|
||||||
|
writer.uint32(/* id 7, wireType 0 =*/56).int32(message.velY);
|
||||||
if (message.speed != null && Object.hasOwnProperty.call(message, "speed"))
|
if (message.speed != null && Object.hasOwnProperty.call(message, "speed"))
|
||||||
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.speed);
|
writer.uint32(/* id 8, wireType 0 =*/64).int32(message.speed);
|
||||||
if (message.battleState != null && Object.hasOwnProperty.call(message, "battleState"))
|
if (message.battleState != null && Object.hasOwnProperty.call(message, "battleState"))
|
||||||
writer.uint32(/* id 7, wireType 0 =*/56).int32(message.battleState);
|
writer.uint32(/* id 9, wireType 0 =*/72).int32(message.battleState);
|
||||||
if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex"))
|
if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex"))
|
||||||
writer.uint32(/* id 8, wireType 0 =*/64).int32(message.joinIndex);
|
writer.uint32(/* id 10, wireType 0 =*/80).int32(message.joinIndex);
|
||||||
if (message.colliderRadius != null && Object.hasOwnProperty.call(message, "colliderRadius"))
|
if (message.colliderRadius != null && Object.hasOwnProperty.call(message, "colliderRadius"))
|
||||||
writer.uint32(/* id 9, wireType 1 =*/73).double(message.colliderRadius);
|
writer.uint32(/* id 11, wireType 1 =*/89).double(message.colliderRadius);
|
||||||
if (message.removed != null && Object.hasOwnProperty.call(message, "removed"))
|
if (message.removed != null && Object.hasOwnProperty.call(message, "removed"))
|
||||||
writer.uint32(/* id 10, wireType 0 =*/80).bool(message.removed);
|
writer.uint32(/* id 12, wireType 0 =*/96).bool(message.removed);
|
||||||
if (message.score != null && Object.hasOwnProperty.call(message, "score"))
|
if (message.score != null && Object.hasOwnProperty.call(message, "score"))
|
||||||
writer.uint32(/* id 11, wireType 0 =*/88).int32(message.score);
|
writer.uint32(/* id 13, wireType 0 =*/104).int32(message.score);
|
||||||
if (message.lastMoveGmtMillis != null && Object.hasOwnProperty.call(message, "lastMoveGmtMillis"))
|
if (message.lastMoveGmtMillis != null && Object.hasOwnProperty.call(message, "lastMoveGmtMillis"))
|
||||||
writer.uint32(/* id 12, wireType 0 =*/96).int32(message.lastMoveGmtMillis);
|
writer.uint32(/* id 14, wireType 0 =*/112).int32(message.lastMoveGmtMillis);
|
||||||
if (message.framesToRecover != null && Object.hasOwnProperty.call(message, "framesToRecover"))
|
if (message.framesToRecover != null && Object.hasOwnProperty.call(message, "framesToRecover"))
|
||||||
writer.uint32(/* id 13, wireType 0 =*/104).int32(message.framesToRecover);
|
writer.uint32(/* id 15, wireType 0 =*/120).int32(message.framesToRecover);
|
||||||
if (message.hp != null && Object.hasOwnProperty.call(message, "hp"))
|
if (message.hp != null && Object.hasOwnProperty.call(message, "hp"))
|
||||||
writer.uint32(/* id 14, wireType 0 =*/112).int32(message.hp);
|
writer.uint32(/* id 16, wireType 0 =*/128).int32(message.hp);
|
||||||
if (message.maxHp != null && Object.hasOwnProperty.call(message, "maxHp"))
|
if (message.maxHp != null && Object.hasOwnProperty.call(message, "maxHp"))
|
||||||
writer.uint32(/* id 15, wireType 0 =*/120).int32(message.maxHp);
|
writer.uint32(/* id 17, wireType 0 =*/136).int32(message.maxHp);
|
||||||
if (message.characterState != null && Object.hasOwnProperty.call(message, "characterState"))
|
if (message.characterState != null && Object.hasOwnProperty.call(message, "characterState"))
|
||||||
writer.uint32(/* id 16, wireType 0 =*/128).int32(message.characterState);
|
writer.uint32(/* id 18, wireType 0 =*/144).int32(message.characterState);
|
||||||
|
if (message.inAir != null && Object.hasOwnProperty.call(message, "inAir"))
|
||||||
|
writer.uint32(/* id 19, wireType 0 =*/152).bool(message.inAir);
|
||||||
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
|
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
|
||||||
writer.uint32(/* id 17, wireType 2 =*/138).string(message.name);
|
writer.uint32(/* id 20, wireType 2 =*/162).string(message.name);
|
||||||
if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName"))
|
if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName"))
|
||||||
writer.uint32(/* id 18, wireType 2 =*/146).string(message.displayName);
|
writer.uint32(/* id 21, wireType 2 =*/170).string(message.displayName);
|
||||||
if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar"))
|
if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar"))
|
||||||
writer.uint32(/* id 19, wireType 2 =*/154).string(message.avatar);
|
writer.uint32(/* id 22, wireType 2 =*/178).string(message.avatar);
|
||||||
return writer;
|
return writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1496,58 +1529,70 @@ $root.protos = (function() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
message.speed = reader.int32();
|
message.velX = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7: {
|
||||||
message.battleState = reader.int32();
|
message.velY = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: {
|
case 8: {
|
||||||
message.joinIndex = reader.int32();
|
message.speed = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: {
|
case 9: {
|
||||||
message.colliderRadius = reader.double();
|
message.battleState = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10: {
|
case 10: {
|
||||||
message.removed = reader.bool();
|
message.joinIndex = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 11: {
|
case 11: {
|
||||||
message.score = reader.int32();
|
message.colliderRadius = reader.double();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 12: {
|
case 12: {
|
||||||
message.lastMoveGmtMillis = reader.int32();
|
message.removed = reader.bool();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 13: {
|
case 13: {
|
||||||
message.framesToRecover = reader.int32();
|
message.score = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 14: {
|
case 14: {
|
||||||
message.hp = reader.int32();
|
message.lastMoveGmtMillis = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 15: {
|
case 15: {
|
||||||
message.maxHp = reader.int32();
|
message.framesToRecover = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 16: {
|
case 16: {
|
||||||
message.characterState = reader.int32();
|
message.hp = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 17: {
|
case 17: {
|
||||||
message.name = reader.string();
|
message.maxHp = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
message.displayName = reader.string();
|
message.characterState = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 19: {
|
case 19: {
|
||||||
|
message.inAir = reader.bool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 20: {
|
||||||
|
message.name = reader.string();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 21: {
|
||||||
|
message.displayName = reader.string();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 22: {
|
||||||
message.avatar = reader.string();
|
message.avatar = reader.string();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1601,6 +1646,12 @@ $root.protos = (function() {
|
|||||||
if (message.dirY != null && message.hasOwnProperty("dirY"))
|
if (message.dirY != null && message.hasOwnProperty("dirY"))
|
||||||
if (!$util.isInteger(message.dirY))
|
if (!$util.isInteger(message.dirY))
|
||||||
return "dirY: integer expected";
|
return "dirY: integer expected";
|
||||||
|
if (message.velX != null && message.hasOwnProperty("velX"))
|
||||||
|
if (!$util.isInteger(message.velX))
|
||||||
|
return "velX: integer expected";
|
||||||
|
if (message.velY != null && message.hasOwnProperty("velY"))
|
||||||
|
if (!$util.isInteger(message.velY))
|
||||||
|
return "velY: integer expected";
|
||||||
if (message.speed != null && message.hasOwnProperty("speed"))
|
if (message.speed != null && message.hasOwnProperty("speed"))
|
||||||
if (!$util.isInteger(message.speed))
|
if (!$util.isInteger(message.speed))
|
||||||
return "speed: integer expected";
|
return "speed: integer expected";
|
||||||
@@ -1634,6 +1685,9 @@ $root.protos = (function() {
|
|||||||
if (message.characterState != null && message.hasOwnProperty("characterState"))
|
if (message.characterState != null && message.hasOwnProperty("characterState"))
|
||||||
if (!$util.isInteger(message.characterState))
|
if (!$util.isInteger(message.characterState))
|
||||||
return "characterState: integer expected";
|
return "characterState: integer expected";
|
||||||
|
if (message.inAir != null && message.hasOwnProperty("inAir"))
|
||||||
|
if (typeof message.inAir !== "boolean")
|
||||||
|
return "inAir: boolean expected";
|
||||||
if (message.name != null && message.hasOwnProperty("name"))
|
if (message.name != null && message.hasOwnProperty("name"))
|
||||||
if (!$util.isString(message.name))
|
if (!$util.isString(message.name))
|
||||||
return "name: string expected";
|
return "name: string expected";
|
||||||
@@ -1668,6 +1722,10 @@ $root.protos = (function() {
|
|||||||
message.dirX = object.dirX | 0;
|
message.dirX = object.dirX | 0;
|
||||||
if (object.dirY != null)
|
if (object.dirY != null)
|
||||||
message.dirY = object.dirY | 0;
|
message.dirY = object.dirY | 0;
|
||||||
|
if (object.velX != null)
|
||||||
|
message.velX = object.velX | 0;
|
||||||
|
if (object.velY != null)
|
||||||
|
message.velY = object.velY | 0;
|
||||||
if (object.speed != null)
|
if (object.speed != null)
|
||||||
message.speed = object.speed | 0;
|
message.speed = object.speed | 0;
|
||||||
if (object.battleState != null)
|
if (object.battleState != null)
|
||||||
@@ -1690,6 +1748,8 @@ $root.protos = (function() {
|
|||||||
message.maxHp = object.maxHp | 0;
|
message.maxHp = object.maxHp | 0;
|
||||||
if (object.characterState != null)
|
if (object.characterState != null)
|
||||||
message.characterState = object.characterState | 0;
|
message.characterState = object.characterState | 0;
|
||||||
|
if (object.inAir != null)
|
||||||
|
message.inAir = Boolean(object.inAir);
|
||||||
if (object.name != null)
|
if (object.name != null)
|
||||||
message.name = String(object.name);
|
message.name = String(object.name);
|
||||||
if (object.displayName != null)
|
if (object.displayName != null)
|
||||||
@@ -1718,6 +1778,8 @@ $root.protos = (function() {
|
|||||||
object.virtualGridY = 0;
|
object.virtualGridY = 0;
|
||||||
object.dirX = 0;
|
object.dirX = 0;
|
||||||
object.dirY = 0;
|
object.dirY = 0;
|
||||||
|
object.velX = 0;
|
||||||
|
object.velY = 0;
|
||||||
object.speed = 0;
|
object.speed = 0;
|
||||||
object.battleState = 0;
|
object.battleState = 0;
|
||||||
object.joinIndex = 0;
|
object.joinIndex = 0;
|
||||||
@@ -1729,6 +1791,7 @@ $root.protos = (function() {
|
|||||||
object.hp = 0;
|
object.hp = 0;
|
||||||
object.maxHp = 0;
|
object.maxHp = 0;
|
||||||
object.characterState = 0;
|
object.characterState = 0;
|
||||||
|
object.inAir = false;
|
||||||
object.name = "";
|
object.name = "";
|
||||||
object.displayName = "";
|
object.displayName = "";
|
||||||
object.avatar = "";
|
object.avatar = "";
|
||||||
@@ -1743,6 +1806,10 @@ $root.protos = (function() {
|
|||||||
object.dirX = message.dirX;
|
object.dirX = message.dirX;
|
||||||
if (message.dirY != null && message.hasOwnProperty("dirY"))
|
if (message.dirY != null && message.hasOwnProperty("dirY"))
|
||||||
object.dirY = message.dirY;
|
object.dirY = message.dirY;
|
||||||
|
if (message.velX != null && message.hasOwnProperty("velX"))
|
||||||
|
object.velX = message.velX;
|
||||||
|
if (message.velY != null && message.hasOwnProperty("velY"))
|
||||||
|
object.velY = message.velY;
|
||||||
if (message.speed != null && message.hasOwnProperty("speed"))
|
if (message.speed != null && message.hasOwnProperty("speed"))
|
||||||
object.speed = message.speed;
|
object.speed = message.speed;
|
||||||
if (message.battleState != null && message.hasOwnProperty("battleState"))
|
if (message.battleState != null && message.hasOwnProperty("battleState"))
|
||||||
@@ -1765,6 +1832,8 @@ $root.protos = (function() {
|
|||||||
object.maxHp = message.maxHp;
|
object.maxHp = message.maxHp;
|
||||||
if (message.characterState != null && message.hasOwnProperty("characterState"))
|
if (message.characterState != null && message.hasOwnProperty("characterState"))
|
||||||
object.characterState = message.characterState;
|
object.characterState = message.characterState;
|
||||||
|
if (message.inAir != null && message.hasOwnProperty("inAir"))
|
||||||
|
object.inAir = message.inAir;
|
||||||
if (message.name != null && message.hasOwnProperty("name"))
|
if (message.name != null && message.hasOwnProperty("name"))
|
||||||
object.name = message.name;
|
object.name = message.name;
|
||||||
if (message.displayName != null && message.hasOwnProperty("displayName"))
|
if (message.displayName != null && message.hasOwnProperty("displayName"))
|
||||||
@@ -1812,6 +1881,7 @@ $root.protos = (function() {
|
|||||||
* @property {number|null} [dx] InputFrameDecoded dx
|
* @property {number|null} [dx] InputFrameDecoded dx
|
||||||
* @property {number|null} [dy] InputFrameDecoded dy
|
* @property {number|null} [dy] InputFrameDecoded dy
|
||||||
* @property {number|null} [btnALevel] InputFrameDecoded btnALevel
|
* @property {number|null} [btnALevel] InputFrameDecoded btnALevel
|
||||||
|
* @property {number|null} [btnBLevel] InputFrameDecoded btnBLevel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1853,6 +1923,14 @@ $root.protos = (function() {
|
|||||||
*/
|
*/
|
||||||
InputFrameDecoded.prototype.btnALevel = 0;
|
InputFrameDecoded.prototype.btnALevel = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputFrameDecoded btnBLevel.
|
||||||
|
* @member {number} btnBLevel
|
||||||
|
* @memberof protos.InputFrameDecoded
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
InputFrameDecoded.prototype.btnBLevel = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new InputFrameDecoded instance using the specified properties.
|
* Creates a new InputFrameDecoded instance using the specified properties.
|
||||||
* @function create
|
* @function create
|
||||||
@@ -1883,6 +1961,8 @@ $root.protos = (function() {
|
|||||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dy);
|
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dy);
|
||||||
if (message.btnALevel != null && Object.hasOwnProperty.call(message, "btnALevel"))
|
if (message.btnALevel != null && Object.hasOwnProperty.call(message, "btnALevel"))
|
||||||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.btnALevel);
|
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.btnALevel);
|
||||||
|
if (message.btnBLevel != null && Object.hasOwnProperty.call(message, "btnBLevel"))
|
||||||
|
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.btnBLevel);
|
||||||
return writer;
|
return writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1929,6 +2009,10 @@ $root.protos = (function() {
|
|||||||
message.btnALevel = reader.int32();
|
message.btnALevel = reader.int32();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 4: {
|
||||||
|
message.btnBLevel = reader.int32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7);
|
||||||
break;
|
break;
|
||||||
@@ -1973,6 +2057,9 @@ $root.protos = (function() {
|
|||||||
if (message.btnALevel != null && message.hasOwnProperty("btnALevel"))
|
if (message.btnALevel != null && message.hasOwnProperty("btnALevel"))
|
||||||
if (!$util.isInteger(message.btnALevel))
|
if (!$util.isInteger(message.btnALevel))
|
||||||
return "btnALevel: integer expected";
|
return "btnALevel: integer expected";
|
||||||
|
if (message.btnBLevel != null && message.hasOwnProperty("btnBLevel"))
|
||||||
|
if (!$util.isInteger(message.btnBLevel))
|
||||||
|
return "btnBLevel: integer expected";
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1994,6 +2081,8 @@ $root.protos = (function() {
|
|||||||
message.dy = object.dy | 0;
|
message.dy = object.dy | 0;
|
||||||
if (object.btnALevel != null)
|
if (object.btnALevel != null)
|
||||||
message.btnALevel = object.btnALevel | 0;
|
message.btnALevel = object.btnALevel | 0;
|
||||||
|
if (object.btnBLevel != null)
|
||||||
|
message.btnBLevel = object.btnBLevel | 0;
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2014,6 +2103,7 @@ $root.protos = (function() {
|
|||||||
object.dx = 0;
|
object.dx = 0;
|
||||||
object.dy = 0;
|
object.dy = 0;
|
||||||
object.btnALevel = 0;
|
object.btnALevel = 0;
|
||||||
|
object.btnBLevel = 0;
|
||||||
}
|
}
|
||||||
if (message.dx != null && message.hasOwnProperty("dx"))
|
if (message.dx != null && message.hasOwnProperty("dx"))
|
||||||
object.dx = message.dx;
|
object.dx = message.dx;
|
||||||
@@ -2021,6 +2111,8 @@ $root.protos = (function() {
|
|||||||
object.dy = message.dy;
|
object.dy = message.dy;
|
||||||
if (message.btnALevel != null && message.hasOwnProperty("btnALevel"))
|
if (message.btnALevel != null && message.hasOwnProperty("btnALevel"))
|
||||||
object.btnALevel = message.btnALevel;
|
object.btnALevel = message.btnALevel;
|
||||||
|
if (message.btnBLevel != null && message.hasOwnProperty("btnBLevel"))
|
||||||
|
object.btnBLevel = message.btnBLevel;
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3553,6 +3645,315 @@ $root.protos = (function() {
|
|||||||
return WsResp;
|
return WsResp;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
protos.InputsBufferSnapshot = (function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of an InputsBufferSnapshot.
|
||||||
|
* @memberof protos
|
||||||
|
* @interface IInputsBufferSnapshot
|
||||||
|
* @property {number|null} [refRenderFrameId] InputsBufferSnapshot refRenderFrameId
|
||||||
|
* @property {number|Long|null} [unconfirmedMask] InputsBufferSnapshot unconfirmedMask
|
||||||
|
* @property {Array.<protos.InputFrameDownsync>|null} [toSendInputFrameDownsyncs] InputsBufferSnapshot toSendInputFrameDownsyncs
|
||||||
|
* @property {boolean|null} [shouldForceResync] InputsBufferSnapshot shouldForceResync
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new InputsBufferSnapshot.
|
||||||
|
* @memberof protos
|
||||||
|
* @classdesc Represents an InputsBufferSnapshot.
|
||||||
|
* @implements IInputsBufferSnapshot
|
||||||
|
* @constructor
|
||||||
|
* @param {protos.IInputsBufferSnapshot=} [properties] Properties to set
|
||||||
|
*/
|
||||||
|
function InputsBufferSnapshot(properties) {
|
||||||
|
this.toSendInputFrameDownsyncs = [];
|
||||||
|
if (properties)
|
||||||
|
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
||||||
|
if (properties[keys[i]] != null)
|
||||||
|
this[keys[i]] = properties[keys[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputsBufferSnapshot refRenderFrameId.
|
||||||
|
* @member {number} refRenderFrameId
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.prototype.refRenderFrameId = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputsBufferSnapshot unconfirmedMask.
|
||||||
|
* @member {number|Long} unconfirmedMask
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.prototype.unconfirmedMask = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputsBufferSnapshot toSendInputFrameDownsyncs.
|
||||||
|
* @member {Array.<protos.InputFrameDownsync>} toSendInputFrameDownsyncs
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.prototype.toSendInputFrameDownsyncs = $util.emptyArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InputsBufferSnapshot shouldForceResync.
|
||||||
|
* @member {boolean} shouldForceResync
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.prototype.shouldForceResync = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new InputsBufferSnapshot instance using the specified properties.
|
||||||
|
* @function create
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {protos.IInputsBufferSnapshot=} [properties] Properties to set
|
||||||
|
* @returns {protos.InputsBufferSnapshot} InputsBufferSnapshot instance
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.create = function create(properties) {
|
||||||
|
return new InputsBufferSnapshot(properties);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes the specified InputsBufferSnapshot message. Does not implicitly {@link protos.InputsBufferSnapshot.verify|verify} messages.
|
||||||
|
* @function encode
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {protos.InputsBufferSnapshot} message InputsBufferSnapshot message or plain object to encode
|
||||||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||||
|
* @returns {$protobuf.Writer} Writer
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.encode = function encode(message, writer) {
|
||||||
|
if (!writer)
|
||||||
|
writer = $Writer.create();
|
||||||
|
if (message.refRenderFrameId != null && Object.hasOwnProperty.call(message, "refRenderFrameId"))
|
||||||
|
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.refRenderFrameId);
|
||||||
|
if (message.unconfirmedMask != null && Object.hasOwnProperty.call(message, "unconfirmedMask"))
|
||||||
|
writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.unconfirmedMask);
|
||||||
|
if (message.toSendInputFrameDownsyncs != null && message.toSendInputFrameDownsyncs.length)
|
||||||
|
for (var i = 0; i < message.toSendInputFrameDownsyncs.length; ++i)
|
||||||
|
$root.protos.InputFrameDownsync.encode(message.toSendInputFrameDownsyncs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
|
||||||
|
if (message.shouldForceResync != null && Object.hasOwnProperty.call(message, "shouldForceResync"))
|
||||||
|
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.shouldForceResync);
|
||||||
|
return writer;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes the specified InputsBufferSnapshot message, length delimited. Does not implicitly {@link protos.InputsBufferSnapshot.verify|verify} messages.
|
||||||
|
* @function encodeDelimited
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {protos.InputsBufferSnapshot} message InputsBufferSnapshot message or plain object to encode
|
||||||
|
* @param {$protobuf.Writer} [writer] Writer to encode to
|
||||||
|
* @returns {$protobuf.Writer} Writer
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.encodeDelimited = function encodeDelimited(message, writer) {
|
||||||
|
return this.encode(message, writer).ldelim();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes an InputsBufferSnapshot message from the specified reader or buffer.
|
||||||
|
* @function decode
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||||
|
* @param {number} [length] Message length if known beforehand
|
||||||
|
* @returns {protos.InputsBufferSnapshot} InputsBufferSnapshot
|
||||||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.decode = function decode(reader, length) {
|
||||||
|
if (!(reader instanceof $Reader))
|
||||||
|
reader = $Reader.create(reader);
|
||||||
|
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.InputsBufferSnapshot();
|
||||||
|
while (reader.pos < end) {
|
||||||
|
var tag = reader.uint32();
|
||||||
|
switch (tag >>> 3) {
|
||||||
|
case 1: {
|
||||||
|
message.refRenderFrameId = reader.int32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
message.unconfirmedMask = reader.uint64();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
if (!(message.toSendInputFrameDownsyncs && message.toSendInputFrameDownsyncs.length))
|
||||||
|
message.toSendInputFrameDownsyncs = [];
|
||||||
|
message.toSendInputFrameDownsyncs.push($root.protos.InputFrameDownsync.decode(reader, reader.uint32()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
message.shouldForceResync = reader.bool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
reader.skipType(tag & 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decodes an InputsBufferSnapshot message from the specified reader or buffer, length delimited.
|
||||||
|
* @function decodeDelimited
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
||||||
|
* @returns {protos.InputsBufferSnapshot} InputsBufferSnapshot
|
||||||
|
* @throws {Error} If the payload is not a reader or valid buffer
|
||||||
|
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.decodeDelimited = function decodeDelimited(reader) {
|
||||||
|
if (!(reader instanceof $Reader))
|
||||||
|
reader = new $Reader(reader);
|
||||||
|
return this.decode(reader, reader.uint32());
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies an InputsBufferSnapshot message.
|
||||||
|
* @function verify
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {Object.<string,*>} message Plain object to verify
|
||||||
|
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.verify = function verify(message) {
|
||||||
|
if (typeof message !== "object" || message === null)
|
||||||
|
return "object expected";
|
||||||
|
if (message.refRenderFrameId != null && message.hasOwnProperty("refRenderFrameId"))
|
||||||
|
if (!$util.isInteger(message.refRenderFrameId))
|
||||||
|
return "refRenderFrameId: integer expected";
|
||||||
|
if (message.unconfirmedMask != null && message.hasOwnProperty("unconfirmedMask"))
|
||||||
|
if (!$util.isInteger(message.unconfirmedMask) && !(message.unconfirmedMask && $util.isInteger(message.unconfirmedMask.low) && $util.isInteger(message.unconfirmedMask.high)))
|
||||||
|
return "unconfirmedMask: integer|Long expected";
|
||||||
|
if (message.toSendInputFrameDownsyncs != null && message.hasOwnProperty("toSendInputFrameDownsyncs")) {
|
||||||
|
if (!Array.isArray(message.toSendInputFrameDownsyncs))
|
||||||
|
return "toSendInputFrameDownsyncs: array expected";
|
||||||
|
for (var i = 0; i < message.toSendInputFrameDownsyncs.length; ++i) {
|
||||||
|
var error = $root.protos.InputFrameDownsync.verify(message.toSendInputFrameDownsyncs[i]);
|
||||||
|
if (error)
|
||||||
|
return "toSendInputFrameDownsyncs." + error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (message.shouldForceResync != null && message.hasOwnProperty("shouldForceResync"))
|
||||||
|
if (typeof message.shouldForceResync !== "boolean")
|
||||||
|
return "shouldForceResync: boolean expected";
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an InputsBufferSnapshot message from a plain object. Also converts values to their respective internal types.
|
||||||
|
* @function fromObject
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {Object.<string,*>} object Plain object
|
||||||
|
* @returns {protos.InputsBufferSnapshot} InputsBufferSnapshot
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.fromObject = function fromObject(object) {
|
||||||
|
if (object instanceof $root.protos.InputsBufferSnapshot)
|
||||||
|
return object;
|
||||||
|
var message = new $root.protos.InputsBufferSnapshot();
|
||||||
|
if (object.refRenderFrameId != null)
|
||||||
|
message.refRenderFrameId = object.refRenderFrameId | 0;
|
||||||
|
if (object.unconfirmedMask != null)
|
||||||
|
if ($util.Long)
|
||||||
|
(message.unconfirmedMask = $util.Long.fromValue(object.unconfirmedMask)).unsigned = true;
|
||||||
|
else if (typeof object.unconfirmedMask === "string")
|
||||||
|
message.unconfirmedMask = parseInt(object.unconfirmedMask, 10);
|
||||||
|
else if (typeof object.unconfirmedMask === "number")
|
||||||
|
message.unconfirmedMask = object.unconfirmedMask;
|
||||||
|
else if (typeof object.unconfirmedMask === "object")
|
||||||
|
message.unconfirmedMask = new $util.LongBits(object.unconfirmedMask.low >>> 0, object.unconfirmedMask.high >>> 0).toNumber(true);
|
||||||
|
if (object.toSendInputFrameDownsyncs) {
|
||||||
|
if (!Array.isArray(object.toSendInputFrameDownsyncs))
|
||||||
|
throw TypeError(".protos.InputsBufferSnapshot.toSendInputFrameDownsyncs: array expected");
|
||||||
|
message.toSendInputFrameDownsyncs = [];
|
||||||
|
for (var i = 0; i < object.toSendInputFrameDownsyncs.length; ++i) {
|
||||||
|
if (typeof object.toSendInputFrameDownsyncs[i] !== "object")
|
||||||
|
throw TypeError(".protos.InputsBufferSnapshot.toSendInputFrameDownsyncs: object expected");
|
||||||
|
message.toSendInputFrameDownsyncs[i] = $root.protos.InputFrameDownsync.fromObject(object.toSendInputFrameDownsyncs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object.shouldForceResync != null)
|
||||||
|
message.shouldForceResync = Boolean(object.shouldForceResync);
|
||||||
|
return message;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a plain object from an InputsBufferSnapshot message. Also converts values to other types if specified.
|
||||||
|
* @function toObject
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {protos.InputsBufferSnapshot} message InputsBufferSnapshot
|
||||||
|
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
||||||
|
* @returns {Object.<string,*>} Plain object
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.toObject = function toObject(message, options) {
|
||||||
|
if (!options)
|
||||||
|
options = {};
|
||||||
|
var object = {};
|
||||||
|
if (options.arrays || options.defaults)
|
||||||
|
object.toSendInputFrameDownsyncs = [];
|
||||||
|
if (options.defaults) {
|
||||||
|
object.refRenderFrameId = 0;
|
||||||
|
if ($util.Long) {
|
||||||
|
var long = new $util.Long(0, 0, true);
|
||||||
|
object.unconfirmedMask = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
||||||
|
} else
|
||||||
|
object.unconfirmedMask = options.longs === String ? "0" : 0;
|
||||||
|
object.shouldForceResync = false;
|
||||||
|
}
|
||||||
|
if (message.refRenderFrameId != null && message.hasOwnProperty("refRenderFrameId"))
|
||||||
|
object.refRenderFrameId = message.refRenderFrameId;
|
||||||
|
if (message.unconfirmedMask != null && message.hasOwnProperty("unconfirmedMask"))
|
||||||
|
if (typeof message.unconfirmedMask === "number")
|
||||||
|
object.unconfirmedMask = options.longs === String ? String(message.unconfirmedMask) : message.unconfirmedMask;
|
||||||
|
else
|
||||||
|
object.unconfirmedMask = options.longs === String ? $util.Long.prototype.toString.call(message.unconfirmedMask) : options.longs === Number ? new $util.LongBits(message.unconfirmedMask.low >>> 0, message.unconfirmedMask.high >>> 0).toNumber(true) : message.unconfirmedMask;
|
||||||
|
if (message.toSendInputFrameDownsyncs && message.toSendInputFrameDownsyncs.length) {
|
||||||
|
object.toSendInputFrameDownsyncs = [];
|
||||||
|
for (var j = 0; j < message.toSendInputFrameDownsyncs.length; ++j)
|
||||||
|
object.toSendInputFrameDownsyncs[j] = $root.protos.InputFrameDownsync.toObject(message.toSendInputFrameDownsyncs[j], options);
|
||||||
|
}
|
||||||
|
if (message.shouldForceResync != null && message.hasOwnProperty("shouldForceResync"))
|
||||||
|
object.shouldForceResync = message.shouldForceResync;
|
||||||
|
return object;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts this InputsBufferSnapshot to JSON.
|
||||||
|
* @function toJSON
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @instance
|
||||||
|
* @returns {Object.<string,*>} JSON object
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.prototype.toJSON = function toJSON() {
|
||||||
|
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default type url for InputsBufferSnapshot
|
||||||
|
* @function getTypeUrl
|
||||||
|
* @memberof protos.InputsBufferSnapshot
|
||||||
|
* @static
|
||||||
|
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
||||||
|
* @returns {string} The default type url
|
||||||
|
*/
|
||||||
|
InputsBufferSnapshot.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
||||||
|
if (typeUrlPrefix === undefined) {
|
||||||
|
typeUrlPrefix = "type.googleapis.com";
|
||||||
|
}
|
||||||
|
return typeUrlPrefix + "/protos.InputsBufferSnapshot";
|
||||||
|
};
|
||||||
|
|
||||||
|
return InputsBufferSnapshot;
|
||||||
|
})();
|
||||||
|
|
||||||
protos.MeleeBullet = (function() {
|
protos.MeleeBullet = (function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4167,6 +4568,11 @@ $root.protos = (function() {
|
|||||||
* @property {number|null} [spAtkLookupFrames] BattleColliderInfo spAtkLookupFrames
|
* @property {number|null} [spAtkLookupFrames] BattleColliderInfo spAtkLookupFrames
|
||||||
* @property {number|null} [renderCacheSize] BattleColliderInfo renderCacheSize
|
* @property {number|null} [renderCacheSize] BattleColliderInfo renderCacheSize
|
||||||
* @property {Object.<string,protos.MeleeBullet>|null} [meleeSkillConfig] BattleColliderInfo meleeSkillConfig
|
* @property {Object.<string,protos.MeleeBullet>|null} [meleeSkillConfig] BattleColliderInfo meleeSkillConfig
|
||||||
|
* @property {number|null} [snapIntoPlatformOverlap] BattleColliderInfo snapIntoPlatformOverlap
|
||||||
|
* @property {number|null} [snapIntoPlatformThreshold] BattleColliderInfo snapIntoPlatformThreshold
|
||||||
|
* @property {number|null} [jumpingInitVelY] BattleColliderInfo jumpingInitVelY
|
||||||
|
* @property {number|null} [gravityX] BattleColliderInfo gravityX
|
||||||
|
* @property {number|null} [gravityY] BattleColliderInfo gravityY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4395,6 +4801,46 @@ $root.protos = (function() {
|
|||||||
*/
|
*/
|
||||||
BattleColliderInfo.prototype.meleeSkillConfig = $util.emptyObject;
|
BattleColliderInfo.prototype.meleeSkillConfig = $util.emptyObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BattleColliderInfo snapIntoPlatformOverlap.
|
||||||
|
* @member {number} snapIntoPlatformOverlap
|
||||||
|
* @memberof protos.BattleColliderInfo
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
BattleColliderInfo.prototype.snapIntoPlatformOverlap = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BattleColliderInfo snapIntoPlatformThreshold.
|
||||||
|
* @member {number} snapIntoPlatformThreshold
|
||||||
|
* @memberof protos.BattleColliderInfo
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
BattleColliderInfo.prototype.snapIntoPlatformThreshold = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BattleColliderInfo jumpingInitVelY.
|
||||||
|
* @member {number} jumpingInitVelY
|
||||||
|
* @memberof protos.BattleColliderInfo
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
BattleColliderInfo.prototype.jumpingInitVelY = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BattleColliderInfo gravityX.
|
||||||
|
* @member {number} gravityX
|
||||||
|
* @memberof protos.BattleColliderInfo
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
BattleColliderInfo.prototype.gravityX = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BattleColliderInfo gravityY.
|
||||||
|
* @member {number} gravityY
|
||||||
|
* @memberof protos.BattleColliderInfo
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
BattleColliderInfo.prototype.gravityY = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new BattleColliderInfo instance using the specified properties.
|
* Creates a new BattleColliderInfo instance using the specified properties.
|
||||||
* @function create
|
* @function create
|
||||||
@@ -4480,6 +4926,16 @@ $root.protos = (function() {
|
|||||||
writer.uint32(/* id 27, wireType 2 =*/218).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]);
|
writer.uint32(/* id 27, wireType 2 =*/218).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]);
|
||||||
$root.protos.MeleeBullet.encode(message.meleeSkillConfig[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
$root.protos.MeleeBullet.encode(message.meleeSkillConfig[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
|
||||||
}
|
}
|
||||||
|
if (message.snapIntoPlatformOverlap != null && Object.hasOwnProperty.call(message, "snapIntoPlatformOverlap"))
|
||||||
|
writer.uint32(/* id 28, wireType 1 =*/225).double(message.snapIntoPlatformOverlap);
|
||||||
|
if (message.snapIntoPlatformThreshold != null && Object.hasOwnProperty.call(message, "snapIntoPlatformThreshold"))
|
||||||
|
writer.uint32(/* id 29, wireType 1 =*/233).double(message.snapIntoPlatformThreshold);
|
||||||
|
if (message.jumpingInitVelY != null && Object.hasOwnProperty.call(message, "jumpingInitVelY"))
|
||||||
|
writer.uint32(/* id 30, wireType 0 =*/240).int32(message.jumpingInitVelY);
|
||||||
|
if (message.gravityX != null && Object.hasOwnProperty.call(message, "gravityX"))
|
||||||
|
writer.uint32(/* id 31, wireType 0 =*/248).int32(message.gravityX);
|
||||||
|
if (message.gravityY != null && Object.hasOwnProperty.call(message, "gravityY"))
|
||||||
|
writer.uint32(/* id 32, wireType 0 =*/256).int32(message.gravityY);
|
||||||
return writer;
|
return writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4675,6 +5131,26 @@ $root.protos = (function() {
|
|||||||
message.meleeSkillConfig[key] = value;
|
message.meleeSkillConfig[key] = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 28: {
|
||||||
|
message.snapIntoPlatformOverlap = reader.double();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 29: {
|
||||||
|
message.snapIntoPlatformThreshold = reader.double();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 30: {
|
||||||
|
message.jumpingInitVelY = reader.int32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 31: {
|
||||||
|
message.gravityX = reader.int32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 32: {
|
||||||
|
message.gravityY = reader.int32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7);
|
||||||
break;
|
break;
|
||||||
@@ -4813,6 +5289,21 @@ $root.protos = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (message.snapIntoPlatformOverlap != null && message.hasOwnProperty("snapIntoPlatformOverlap"))
|
||||||
|
if (typeof message.snapIntoPlatformOverlap !== "number")
|
||||||
|
return "snapIntoPlatformOverlap: number expected";
|
||||||
|
if (message.snapIntoPlatformThreshold != null && message.hasOwnProperty("snapIntoPlatformThreshold"))
|
||||||
|
if (typeof message.snapIntoPlatformThreshold !== "number")
|
||||||
|
return "snapIntoPlatformThreshold: number expected";
|
||||||
|
if (message.jumpingInitVelY != null && message.hasOwnProperty("jumpingInitVelY"))
|
||||||
|
if (!$util.isInteger(message.jumpingInitVelY))
|
||||||
|
return "jumpingInitVelY: integer expected";
|
||||||
|
if (message.gravityX != null && message.hasOwnProperty("gravityX"))
|
||||||
|
if (!$util.isInteger(message.gravityX))
|
||||||
|
return "gravityX: integer expected";
|
||||||
|
if (message.gravityY != null && message.hasOwnProperty("gravityY"))
|
||||||
|
if (!$util.isInteger(message.gravityY))
|
||||||
|
return "gravityY: integer expected";
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4918,6 +5409,16 @@ $root.protos = (function() {
|
|||||||
message.meleeSkillConfig[keys[i]] = $root.protos.MeleeBullet.fromObject(object.meleeSkillConfig[keys[i]]);
|
message.meleeSkillConfig[keys[i]] = $root.protos.MeleeBullet.fromObject(object.meleeSkillConfig[keys[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (object.snapIntoPlatformOverlap != null)
|
||||||
|
message.snapIntoPlatformOverlap = Number(object.snapIntoPlatformOverlap);
|
||||||
|
if (object.snapIntoPlatformThreshold != null)
|
||||||
|
message.snapIntoPlatformThreshold = Number(object.snapIntoPlatformThreshold);
|
||||||
|
if (object.jumpingInitVelY != null)
|
||||||
|
message.jumpingInitVelY = object.jumpingInitVelY | 0;
|
||||||
|
if (object.gravityX != null)
|
||||||
|
message.gravityX = object.gravityX | 0;
|
||||||
|
if (object.gravityY != null)
|
||||||
|
message.gravityY = object.gravityY | 0;
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4971,6 +5472,11 @@ $root.protos = (function() {
|
|||||||
object.virtualGridToWorldRatio = 0;
|
object.virtualGridToWorldRatio = 0;
|
||||||
object.spAtkLookupFrames = 0;
|
object.spAtkLookupFrames = 0;
|
||||||
object.renderCacheSize = 0;
|
object.renderCacheSize = 0;
|
||||||
|
object.snapIntoPlatformOverlap = 0;
|
||||||
|
object.snapIntoPlatformThreshold = 0;
|
||||||
|
object.jumpingInitVelY = 0;
|
||||||
|
object.gravityX = 0;
|
||||||
|
object.gravityY = 0;
|
||||||
}
|
}
|
||||||
if (message.stageName != null && message.hasOwnProperty("stageName"))
|
if (message.stageName != null && message.hasOwnProperty("stageName"))
|
||||||
object.stageName = message.stageName;
|
object.stageName = message.stageName;
|
||||||
@@ -5040,6 +5546,16 @@ $root.protos = (function() {
|
|||||||
for (var j = 0; j < keys2.length; ++j)
|
for (var j = 0; j < keys2.length; ++j)
|
||||||
object.meleeSkillConfig[keys2[j]] = $root.protos.MeleeBullet.toObject(message.meleeSkillConfig[keys2[j]], options);
|
object.meleeSkillConfig[keys2[j]] = $root.protos.MeleeBullet.toObject(message.meleeSkillConfig[keys2[j]], options);
|
||||||
}
|
}
|
||||||
|
if (message.snapIntoPlatformOverlap != null && message.hasOwnProperty("snapIntoPlatformOverlap"))
|
||||||
|
object.snapIntoPlatformOverlap = options.json && !isFinite(message.snapIntoPlatformOverlap) ? String(message.snapIntoPlatformOverlap) : message.snapIntoPlatformOverlap;
|
||||||
|
if (message.snapIntoPlatformThreshold != null && message.hasOwnProperty("snapIntoPlatformThreshold"))
|
||||||
|
object.snapIntoPlatformThreshold = options.json && !isFinite(message.snapIntoPlatformThreshold) ? String(message.snapIntoPlatformThreshold) : message.snapIntoPlatformThreshold;
|
||||||
|
if (message.jumpingInitVelY != null && message.hasOwnProperty("jumpingInitVelY"))
|
||||||
|
object.jumpingInitVelY = message.jumpingInitVelY;
|
||||||
|
if (message.gravityX != null && message.hasOwnProperty("gravityX"))
|
||||||
|
object.gravityX = message.gravityX;
|
||||||
|
if (message.gravityY != null && message.hasOwnProperty("gravityY"))
|
||||||
|
object.gravityY = message.gravityY;
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5082,6 +5598,8 @@ $root.protos = (function() {
|
|||||||
* @property {Object.<string,protos.PlayerDownsync>|null} [players] RoomDownsyncFrame players
|
* @property {Object.<string,protos.PlayerDownsync>|null} [players] RoomDownsyncFrame players
|
||||||
* @property {number|Long|null} [countdownNanos] RoomDownsyncFrame countdownNanos
|
* @property {number|Long|null} [countdownNanos] RoomDownsyncFrame countdownNanos
|
||||||
* @property {Array.<protos.MeleeBullet>|null} [meleeBullets] RoomDownsyncFrame meleeBullets
|
* @property {Array.<protos.MeleeBullet>|null} [meleeBullets] RoomDownsyncFrame meleeBullets
|
||||||
|
* @property {number|Long|null} [backendUnconfirmedMask] RoomDownsyncFrame backendUnconfirmedMask
|
||||||
|
* @property {boolean|null} [shouldForceResync] RoomDownsyncFrame shouldForceResync
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5133,6 +5651,22 @@ $root.protos = (function() {
|
|||||||
*/
|
*/
|
||||||
RoomDownsyncFrame.prototype.meleeBullets = $util.emptyArray;
|
RoomDownsyncFrame.prototype.meleeBullets = $util.emptyArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomDownsyncFrame backendUnconfirmedMask.
|
||||||
|
* @member {number|Long} backendUnconfirmedMask
|
||||||
|
* @memberof protos.RoomDownsyncFrame
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
RoomDownsyncFrame.prototype.backendUnconfirmedMask = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomDownsyncFrame shouldForceResync.
|
||||||
|
* @member {boolean} shouldForceResync
|
||||||
|
* @memberof protos.RoomDownsyncFrame
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
|
RoomDownsyncFrame.prototype.shouldForceResync = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new RoomDownsyncFrame instance using the specified properties.
|
* Creates a new RoomDownsyncFrame instance using the specified properties.
|
||||||
* @function create
|
* @function create
|
||||||
@@ -5169,6 +5703,10 @@ $root.protos = (function() {
|
|||||||
if (message.meleeBullets != null && message.meleeBullets.length)
|
if (message.meleeBullets != null && message.meleeBullets.length)
|
||||||
for (var i = 0; i < message.meleeBullets.length; ++i)
|
for (var i = 0; i < message.meleeBullets.length; ++i)
|
||||||
$root.protos.MeleeBullet.encode(message.meleeBullets[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
$root.protos.MeleeBullet.encode(message.meleeBullets[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
|
||||||
|
if (message.backendUnconfirmedMask != null && Object.hasOwnProperty.call(message, "backendUnconfirmedMask"))
|
||||||
|
writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.backendUnconfirmedMask);
|
||||||
|
if (message.shouldForceResync != null && Object.hasOwnProperty.call(message, "shouldForceResync"))
|
||||||
|
writer.uint32(/* id 6, wireType 0 =*/48).bool(message.shouldForceResync);
|
||||||
return writer;
|
return writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5240,6 +5778,14 @@ $root.protos = (function() {
|
|||||||
message.meleeBullets.push($root.protos.MeleeBullet.decode(reader, reader.uint32()));
|
message.meleeBullets.push($root.protos.MeleeBullet.decode(reader, reader.uint32()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 5: {
|
||||||
|
message.backendUnconfirmedMask = reader.uint64();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 6: {
|
||||||
|
message.shouldForceResync = reader.bool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
reader.skipType(tag & 7);
|
reader.skipType(tag & 7);
|
||||||
break;
|
break;
|
||||||
@@ -5304,6 +5850,12 @@ $root.protos = (function() {
|
|||||||
return "meleeBullets." + error;
|
return "meleeBullets." + error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (message.backendUnconfirmedMask != null && message.hasOwnProperty("backendUnconfirmedMask"))
|
||||||
|
if (!$util.isInteger(message.backendUnconfirmedMask) && !(message.backendUnconfirmedMask && $util.isInteger(message.backendUnconfirmedMask.low) && $util.isInteger(message.backendUnconfirmedMask.high)))
|
||||||
|
return "backendUnconfirmedMask: integer|Long expected";
|
||||||
|
if (message.shouldForceResync != null && message.hasOwnProperty("shouldForceResync"))
|
||||||
|
if (typeof message.shouldForceResync !== "boolean")
|
||||||
|
return "shouldForceResync: boolean expected";
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5350,6 +5902,17 @@ $root.protos = (function() {
|
|||||||
message.meleeBullets[i] = $root.protos.MeleeBullet.fromObject(object.meleeBullets[i]);
|
message.meleeBullets[i] = $root.protos.MeleeBullet.fromObject(object.meleeBullets[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (object.backendUnconfirmedMask != null)
|
||||||
|
if ($util.Long)
|
||||||
|
(message.backendUnconfirmedMask = $util.Long.fromValue(object.backendUnconfirmedMask)).unsigned = true;
|
||||||
|
else if (typeof object.backendUnconfirmedMask === "string")
|
||||||
|
message.backendUnconfirmedMask = parseInt(object.backendUnconfirmedMask, 10);
|
||||||
|
else if (typeof object.backendUnconfirmedMask === "number")
|
||||||
|
message.backendUnconfirmedMask = object.backendUnconfirmedMask;
|
||||||
|
else if (typeof object.backendUnconfirmedMask === "object")
|
||||||
|
message.backendUnconfirmedMask = new $util.LongBits(object.backendUnconfirmedMask.low >>> 0, object.backendUnconfirmedMask.high >>> 0).toNumber(true);
|
||||||
|
if (object.shouldForceResync != null)
|
||||||
|
message.shouldForceResync = Boolean(object.shouldForceResync);
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5377,6 +5940,12 @@ $root.protos = (function() {
|
|||||||
object.countdownNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
object.countdownNanos = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
||||||
} else
|
} else
|
||||||
object.countdownNanos = options.longs === String ? "0" : 0;
|
object.countdownNanos = options.longs === String ? "0" : 0;
|
||||||
|
if ($util.Long) {
|
||||||
|
var long = new $util.Long(0, 0, true);
|
||||||
|
object.backendUnconfirmedMask = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
||||||
|
} else
|
||||||
|
object.backendUnconfirmedMask = options.longs === String ? "0" : 0;
|
||||||
|
object.shouldForceResync = false;
|
||||||
}
|
}
|
||||||
if (message.id != null && message.hasOwnProperty("id"))
|
if (message.id != null && message.hasOwnProperty("id"))
|
||||||
object.id = message.id;
|
object.id = message.id;
|
||||||
@@ -5396,6 +5965,13 @@ $root.protos = (function() {
|
|||||||
for (var j = 0; j < message.meleeBullets.length; ++j)
|
for (var j = 0; j < message.meleeBullets.length; ++j)
|
||||||
object.meleeBullets[j] = $root.protos.MeleeBullet.toObject(message.meleeBullets[j], options);
|
object.meleeBullets[j] = $root.protos.MeleeBullet.toObject(message.meleeBullets[j], options);
|
||||||
}
|
}
|
||||||
|
if (message.backendUnconfirmedMask != null && message.hasOwnProperty("backendUnconfirmedMask"))
|
||||||
|
if (typeof message.backendUnconfirmedMask === "number")
|
||||||
|
object.backendUnconfirmedMask = options.longs === String ? String(message.backendUnconfirmedMask) : message.backendUnconfirmedMask;
|
||||||
|
else
|
||||||
|
object.backendUnconfirmedMask = options.longs === String ? $util.Long.prototype.toString.call(message.backendUnconfirmedMask) : options.longs === Number ? new $util.LongBits(message.backendUnconfirmedMask.low >>> 0, message.backendUnconfirmedMask.high >>> 0).toNumber(true) : message.backendUnconfirmedMask;
|
||||||
|
if (message.shouldForceResync != null && message.hasOwnProperty("shouldForceResync"))
|
||||||
|
object.shouldForceResync = message.shouldForceResync;
|
||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -11,24 +11,28 @@ function polygonStr(body) {
|
|||||||
return JSON.stringify(coords);
|
return JSON.stringify(coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
const playerCollider = collisionSys.createPolygon(1269.665, 1353.335, [[0, 0], [64, 0], [64, 64], [0, 64]]);
|
const playerCollider1 = collisionSys.createPolygon(944.000, 676.000, [[0, 0], [24, 0], [24, 48], [0, 48]]);
|
||||||
|
playerCollider1.data = {isPlayer: true};
|
||||||
|
const playerCollider2 = collisionSys.createPolygon(958.000, 724.000, [[0, 0], [24, 0], [24, 48], [0, 48]]);
|
||||||
|
playerCollider2.data = {isPlayer: true};
|
||||||
|
|
||||||
const barrierCollider1 = collisionSys.createPolygon(1277.7159000000001, 1570.5575, [[642.5696, 319.159], [0, 319.15680000000003], [5.7286, 0], [643.7451, 0.9014999999999986]]);
|
const barrierCollider1 = collisionSys.createPolygon(1277.7159000000001, 1570.5575, [[642.5696, 319.159], [0, 319.15680000000003], [5.7286, 0], [643.7451, 0.9014999999999986]]);
|
||||||
const barrierCollider2 = collisionSys.createPolygon(1289.039, 1318.0805, [[628.626, 54.254500000000064], [0, 56.03250000000003], [0.42449999999999477, 1.1229999999999905], [625.9715000000001, 0]]);
|
const barrierCollider2 = collisionSys.createPolygon(1289.039, 1318.0805, [[628.626, 54.254500000000064], [0, 56.03250000000003], [0.42449999999999477, 1.1229999999999905], [625.9715000000001, 0]]);
|
||||||
const barrierCollider3 = collisionSys.createPolygon(1207, 1310, [[69, 581], [0, 579], [8, 3], [79, 0]]);
|
const barrierCollider3 = collisionSys.createPolygon(1207, 1310, [[69, 581], [0, 579], [8, 3], [79, 0]]);
|
||||||
|
|
||||||
playerCollider.x += -2.98;
|
|
||||||
playerCollider.y += -50.0;
|
|
||||||
collisionSys.update();
|
collisionSys.update();
|
||||||
|
|
||||||
const effPushback = [0.0, 0.0];
|
const effPushback = [0.0, 0.0];
|
||||||
|
|
||||||
const result = collisionSys.createResult();
|
const result = collisionSys.createResult();
|
||||||
|
|
||||||
const potentials = playerCollider.potentials();
|
// Check collision for player1
|
||||||
|
const potentials = playerCollider1.potentials();
|
||||||
for (const barrier of potentials) {
|
for (const potential of potentials) {
|
||||||
if (!playerCollider.collides(barrier, result)) continue;
|
if (null == potential.data || true != potential.data.isPlayer) continue;
|
||||||
|
console.log(`Collided player potential of a=${polygonStr(playerCollider1)}: b=${polygonStr(potential)}`);
|
||||||
|
if (!playerCollider1.collides(potential, result)) continue;
|
||||||
|
console.log(`Collided player of a=${polygonStr(playerCollider1)}: b=${polygonStr(potential)}`);
|
||||||
const pushbackX = result.overlap * result.overlap_x;
|
const pushbackX = result.overlap * result.overlap_x;
|
||||||
const pushbackY = result.overlap * result.overlap_y;
|
const pushbackY = result.overlap * result.overlap_y;
|
||||||
console.log(`Overlapped: a=${polygonStr(result.a)}, b=${polygonStr(result.b)}, pushbackX=${pushbackX}, pushbackY=${pushbackY}`);
|
console.log(`Overlapped: a=${polygonStr(result.a)}, b=${polygonStr(result.b)}, pushbackX=${pushbackX}, pushbackY=${pushbackY}`);
|
||||||
|
Reference in New Issue
Block a user