Drafted hp handling.

This commit is contained in:
genxium
2023-02-08 16:15:05 +08:00
parent a762c563d9
commit 38149279bd
18 changed files with 943 additions and 562 deletions

View File

@@ -3,7 +3,7 @@
"_name": "Fireball1Explosion",
"_objFlags": 0,
"_native": "",
"_duration": 0.5166666666666667,
"_duration": 0.5,
"sample": 60,
"speed": 1,
"wrapMode": 1,
@@ -18,31 +18,31 @@
}
},
{
"frame": 0.11666666666666667,
"frame": 0.05,
"value": {
"__uuid__": "c6a5994f-251d-4191-a550-dfef979bab59"
}
},
{
"frame": 0.23333333333333334,
"frame": 0.11666666666666667,
"value": {
"__uuid__": "417e58d9-e364-47f7-9364-f31ad3452adc"
}
},
{
"frame": 0.38333333333333336,
"frame": 0.16666666666666666,
"value": {
"__uuid__": "8b566f26-b34d-4da6-bdaa-078358a5b685"
}
},
{
"frame": 0.45,
"frame": 0.31666666666666665,
"value": {
"__uuid__": "6ec5f75d-307e-4292-b667-cbbb5a52c2f6"
}
},
{
"frame": 0.5,
"frame": 0.48333333333333334,
"value": {
"__uuid__": "d89977f1-d927-4a08-9591-9feb1daf68c8"
}

View File

@@ -3,7 +3,7 @@
"_name": "Fireball3Explosion",
"_objFlags": 0,
"_native": "",
"_duration": 0.48333333333333334,
"_duration": 0.5,
"sample": 60,
"speed": 1,
"wrapMode": 1,
@@ -30,43 +30,43 @@
}
},
{
"frame": 0.16666666666666666,
"frame": 0.2,
"value": {
"__uuid__": "0735a7ff-0e50-472a-b0f9-8e2cc97be7e7"
}
},
{
"frame": 0.23333333333333334,
"frame": 0.2833333333333333,
"value": {
"__uuid__": "993199a8-54a9-40d1-8d2f-12bf16af934c"
}
},
{
"frame": 0.2833333333333333,
"frame": 0.35,
"value": {
"__uuid__": "5d8d9ffc-b4d6-4518-9946-953929ec055c"
}
},
{
"frame": 0.3333333333333333,
"frame": 0.38333333333333336,
"value": {
"__uuid__": "6501ae08-b0ff-43ad-b5c5-cb6dc67f989d"
}
},
{
"frame": 0.38333333333333336,
"frame": 0.4166666666666667,
"value": {
"__uuid__": "616cfa00-1dba-4a71-8141-36774933b6a9"
}
},
{
"frame": 0.43333333333333335,
"frame": 0.45,
"value": {
"__uuid__": "4b296e86-2e96-4276-b6de-6a6b22530344"
}
},
{
"frame": 0.4666666666666667,
"frame": 0.48333333333333334,
"value": {
"__uuid__": "f9cc8e37-c9c2-4f20-9d7e-4533c4e859fe"
}

View File

@@ -37,6 +37,8 @@ message PlayerDownsync {
int32 onWallNormY = 28;
bool capturedByInertia = 29; // like "inAir", its by design a standalone field only inferred by the calc result of "applyInputFrameDownsyncDynamicsOnSingleRenderFrame" instead of "characterState"
int32 revivalVirtualGridX = 30;
int32 revivalVirtualGridY = 31;
string name = 997;
string displayName = 998;

View File

@@ -25,16 +25,19 @@
},
{
"__id__": 8
},
{
"__id__": 22
}
],
"_active": true,
"_components": [
{
"__id__": 22
"__id__": 29
}
],
"_prefab": {
"__id__": 23
"__id__": 30
},
"_opacity": 255,
"_color": {
@@ -554,7 +557,7 @@
"__id__": 8
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 14
@@ -911,6 +914,244 @@
"fileId": "7aN7Gcc/tBw5EGlTJVBj2+",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "HpBar",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 23
}
],
"_active": true,
"_components": [
{
"__id__": 26
},
{
"__id__": 27
}
],
"_prefab": {
"__id__": 28
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
42.256,
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.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 24
}
],
"_prefab": {
"__id__": 25
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 10,
"g": 252,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-25,
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.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
},
"fileId": "1b5Rz5KABPK5Nv1wogghs6",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "88e79fd5-96b4-4a77-a1f4-312467171014"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.ProgressBar",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_N$totalLength": 50,
"_N$barSprite": {
"__id__": 24
},
"_N$mode": 0,
"_N$progress": 1,
"_N$reverse": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "59bff7a2-23e1-4d69-bce7-afb37eae196a"
},
"fileId": "1cDdFO9Z5KYIcRR52ZmtqO",
"sync": false
},
{
"__type__": "b74b05YDqZFRo4OkZRFZX8k",
"_name": "",
@@ -929,6 +1170,9 @@
"coordLabel": {
"__id__": 3
},
"hpBar": {
"__id__": 27
},
"_id": ""
},
{

View File

@@ -461,7 +461,7 @@
"array": [
0,
0,
210.4441731196186,
216.50635094610968,
0,
0,
0,

View File

@@ -547,7 +547,7 @@
"array": [
0,
0,
210.4441731196186,
216.50635094610968,
0,
0,
0,

View File

@@ -10,7 +10,11 @@ cc.Class({
coordLabel: {
type: cc.Label,
default: null
}
},
hpBar: {
type: cc.ProgressBar,
default: null
},
},
onLoad() {

View File

@@ -658,7 +658,7 @@ cc.Class({
const jsPlayersArr = new Array(pbRdf.playersArr.length).fill(null);
for (let k = 0; k < pbRdf.playersArr.length; ++k) {
const pbPlayer = pbRdf.playersArr[k];
const jsPlayer = gopkgs.NewPlayerDownsyncJs(pbPlayer.id, pbPlayer.virtualGridX, pbPlayer.virtualGridY, pbPlayer.dirX, pbPlayer.dirY, pbPlayer.velX, pbPlayer.velY, pbPlayer.framesToRecover, pbPlayer.framesInChState, pbPlayer.activeSkillId, pbPlayer.activeSkillHit, pbPlayer.framesInvinsible, pbPlayer.speed, pbPlayer.battleState, pbPlayer.characterState, pbPlayer.joinIndex, pbPlayer.hp, pbPlayer.maxHp, pbPlayer.colliderRadius, pbPlayer.inAir, pbPlayer.onWall, pbPlayer.onWallNormX, pbPlayer.onWallNormY, pbPlayer.capturedByInertia, pbPlayer.bulletTeamId, pbPlayer.chCollisionTeamId);
const jsPlayer = gopkgs.NewPlayerDownsyncJs(pbPlayer.id, pbPlayer.virtualGridX, pbPlayer.virtualGridY, pbPlayer.dirX, pbPlayer.dirY, pbPlayer.velX, pbPlayer.velY, pbPlayer.framesToRecover, pbPlayer.framesInChState, pbPlayer.activeSkillId, pbPlayer.activeSkillHit, pbPlayer.framesInvinsible, pbPlayer.speed, pbPlayer.battleState, pbPlayer.characterState, pbPlayer.joinIndex, pbPlayer.hp, pbPlayer.maxHp, pbPlayer.colliderRadius, pbPlayer.inAir, pbPlayer.onWall, pbPlayer.onWallNormX, pbPlayer.onWallNormY, pbPlayer.capturedByInertia, pbPlayer.bulletTeamId, pbPlayer.chCollisionTeamId, pbPlayer.revivalVirtualGridX, pbPlayer.revivalVirtualGridY);
jsPlayersArr[k] = jsPlayer;
}
const jsMeleeBulletsArr = new Array(pbRdf.meleeBullets.length).fill(null);
@@ -1292,6 +1292,7 @@ othersForcedDownsyncRenderFrame=${JSON.stringify(othersForcedDownsyncRenderFrame
playerRichInfo.node.setPosition(wx, wy);
playerRichInfo.scriptIns.updateSpeed(currPlayerDownsync.Speed);
playerRichInfo.scriptIns.updateCharacterAnim(currPlayerDownsync, prevRdfPlayer, false, chConfig);
playerRichInfo.scriptIns.hpBar.progress = (currPlayerDownsync.Hp * 1.0) / currPlayerDownsync.MaxHp;
}
// Move all to infinitely far away first

View File

@@ -109,6 +109,8 @@ cc.Class({
joinIndex: 1,
virtualGridX: p1Vpos[0],
virtualGridY: p1Vpos[1],
revivalVirtualGridX: p1Vpos[0],
revivalVirtualGridY: p1Vpos[1],
speed: chConfigsOrderedByJoinIndex[0].Speed,
colliderRadius: colliderRadiusV[0],
characterState: window.ATK_CHARACTER_STATE.InAirIdle1NoJump[0],
@@ -119,12 +121,16 @@ cc.Class({
velY: 0,
inAir: true,
onWall: false,
hp: 100,
maxHp: 100,
}),
window.pb.protos.PlayerDownsync.create({
id: 11,
joinIndex: 2,
virtualGridX: p2Vpos[0],
virtualGridY: p2Vpos[1],
revivalVirtualGridX: p2Vpos[0],
revivalVirtualGridY: p2Vpos[1],
speed: chConfigsOrderedByJoinIndex[1].Speed,
colliderRadius: colliderRadiusV[0],
characterState: window.ATK_CHARACTER_STATE.InAirIdle1NoJump[0],
@@ -135,6 +141,8 @@ cc.Class({
velY: 0,
inAir: true,
onWall: false,
hp: 100,
maxHp: 100,
}),
],
speciesIdList: speciesIdList,

File diff suppressed because one or more lines are too long

View File

@@ -1220,6 +1220,8 @@ $root.protos = (function() {
* @property {number|null} [onWallNormX] PlayerDownsync onWallNormX
* @property {number|null} [onWallNormY] PlayerDownsync onWallNormY
* @property {boolean|null} [capturedByInertia] PlayerDownsync capturedByInertia
* @property {number|null} [revivalVirtualGridX] PlayerDownsync revivalVirtualGridX
* @property {number|null} [revivalVirtualGridY] PlayerDownsync revivalVirtualGridY
* @property {string|null} [name] PlayerDownsync name
* @property {string|null} [displayName] PlayerDownsync displayName
* @property {string|null} [avatar] PlayerDownsync avatar
@@ -1472,6 +1474,22 @@ $root.protos = (function() {
*/
PlayerDownsync.prototype.capturedByInertia = false;
/**
* PlayerDownsync revivalVirtualGridX.
* @member {number} revivalVirtualGridX
* @memberof protos.PlayerDownsync
* @instance
*/
PlayerDownsync.prototype.revivalVirtualGridX = 0;
/**
* PlayerDownsync revivalVirtualGridY.
* @member {number} revivalVirtualGridY
* @memberof protos.PlayerDownsync
* @instance
*/
PlayerDownsync.prototype.revivalVirtualGridY = 0;
/**
* PlayerDownsync name.
* @member {string} name
@@ -1578,6 +1596,10 @@ $root.protos = (function() {
writer.uint32(/* id 28, wireType 0 =*/224).int32(message.onWallNormY);
if (message.capturedByInertia != null && Object.hasOwnProperty.call(message, "capturedByInertia"))
writer.uint32(/* id 29, wireType 0 =*/232).bool(message.capturedByInertia);
if (message.revivalVirtualGridX != null && Object.hasOwnProperty.call(message, "revivalVirtualGridX"))
writer.uint32(/* id 30, wireType 0 =*/240).int32(message.revivalVirtualGridX);
if (message.revivalVirtualGridY != null && Object.hasOwnProperty.call(message, "revivalVirtualGridY"))
writer.uint32(/* id 31, wireType 0 =*/248).int32(message.revivalVirtualGridY);
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
writer.uint32(/* id 997, wireType 2 =*/7978).string(message.name);
if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName"))
@@ -1734,6 +1756,14 @@ $root.protos = (function() {
message.capturedByInertia = reader.bool();
break;
}
case 30: {
message.revivalVirtualGridX = reader.int32();
break;
}
case 31: {
message.revivalVirtualGridY = reader.int32();
break;
}
case 997: {
message.name = reader.string();
break;
@@ -1868,6 +1898,12 @@ $root.protos = (function() {
if (message.capturedByInertia != null && message.hasOwnProperty("capturedByInertia"))
if (typeof message.capturedByInertia !== "boolean")
return "capturedByInertia: boolean expected";
if (message.revivalVirtualGridX != null && message.hasOwnProperty("revivalVirtualGridX"))
if (!$util.isInteger(message.revivalVirtualGridX))
return "revivalVirtualGridX: integer expected";
if (message.revivalVirtualGridY != null && message.hasOwnProperty("revivalVirtualGridY"))
if (!$util.isInteger(message.revivalVirtualGridY))
return "revivalVirtualGridY: integer expected";
if (message.name != null && message.hasOwnProperty("name"))
if (!$util.isString(message.name))
return "name: string expected";
@@ -1950,6 +1986,10 @@ $root.protos = (function() {
message.onWallNormY = object.onWallNormY | 0;
if (object.capturedByInertia != null)
message.capturedByInertia = Boolean(object.capturedByInertia);
if (object.revivalVirtualGridX != null)
message.revivalVirtualGridX = object.revivalVirtualGridX | 0;
if (object.revivalVirtualGridY != null)
message.revivalVirtualGridY = object.revivalVirtualGridY | 0;
if (object.name != null)
message.name = String(object.name);
if (object.displayName != null)
@@ -2002,6 +2042,8 @@ $root.protos = (function() {
object.onWallNormX = 0;
object.onWallNormY = 0;
object.capturedByInertia = false;
object.revivalVirtualGridX = 0;
object.revivalVirtualGridY = 0;
object.name = "";
object.displayName = "";
object.avatar = "";
@@ -2064,6 +2106,10 @@ $root.protos = (function() {
object.onWallNormY = message.onWallNormY;
if (message.capturedByInertia != null && message.hasOwnProperty("capturedByInertia"))
object.capturedByInertia = message.capturedByInertia;
if (message.revivalVirtualGridX != null && message.hasOwnProperty("revivalVirtualGridX"))
object.revivalVirtualGridX = message.revivalVirtualGridX;
if (message.revivalVirtualGridY != null && message.hasOwnProperty("revivalVirtualGridY"))
object.revivalVirtualGridY = message.revivalVirtualGridY;
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.displayName != null && message.hasOwnProperty("displayName"))