Skip to content

Commit cfd6966

Browse files
author
kbengine
committed
up
1 parent d861252 commit cfd6966

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

Entity.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ public virtual void set_position(object old)
304304
if(isPlayer())
305305
KBEngineApp.app.entityServerPos(position);
306306

307-
Event.fireOut("set_position", new object[]{this});
307+
if(inWorld)
308+
Event.fireOut("set_position", new object[]{this});
308309
}
309310

310311
public virtual void onUpdateVolatileData()
@@ -322,7 +323,9 @@ public virtual void set_direction(object old)
322323
direction = v;
323324

324325
//Dbg.DEBUG_MSG(className + "::set_direction: " + old + " => " + v);
325-
Event.fireOut("set_direction", new object[]{this});
326+
327+
if(inWorld)
328+
Event.fireOut("set_direction", new object[]{this});
326329
}
327330
}
328331

KBEngine.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public enum CLIENT_TYPE
8383

8484
// 服务端与客户端的版本号以及协议MD5
8585
public string serverVersion = "";
86-
public string clientVersion = "0.6.0";
86+
public string clientVersion = "0.6.1";
8787
public string serverScriptVersion = "";
8888
public string clientScriptVersion = "0.1.0";
8989
public string serverProtocolMD5 = "";
@@ -807,6 +807,7 @@ public void onImportClientEntityDef(MemoryStream stream)
807807
propertysize--;
808808

809809
UInt16 properUtype = stream.readUint16();
810+
UInt32 properFlags = stream.readUint32();
810811
Int16 ialiasID = stream.readInt16();
811812
string name = stream.readString();
812813
string defaultValStr = stream.readString();
@@ -1502,7 +1503,8 @@ public void onUpdatePropertys_(Int32 eid, MemoryStream stream)
15021503
entity.setDefinedProptertyByUType(utype, val);
15031504
if(setmethod != null)
15041505
{
1505-
setmethod.Invoke(entity, new object[]{oldval});
1506+
if(propertydata.isBase() || entity.inWorld)
1507+
setmethod.Invoke(entity, new object[]{oldval});
15061508
}
15071509
}
15081510
}
@@ -1629,11 +1631,11 @@ public void Client_onEntityEnterWorld(MemoryStream stream)
16291631
_bufferedCreateEntityMessage.Remove(eid);
16301632

16311633
entity.isOnGound = isOnGound > 0;
1632-
entity.__init__();
1633-
entity.enterWorld();
1634-
16351634
entity.set_direction(entity.getDefinedPropterty("direction"));
16361635
entity.set_position(entity.getDefinedPropterty("position"));
1636+
1637+
entity.__init__();
1638+
entity.enterWorld();
16371639
}
16381640
else
16391641
{
@@ -1651,6 +1653,9 @@ public void Client_onEntityEnterWorld(MemoryStream stream)
16511653
entity.cellMailbox.className = entityType;
16521654
entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;
16531655

1656+
entity.set_direction(entity.getDefinedPropterty("direction"));
1657+
entity.set_position(entity.getDefinedPropterty("position"));
1658+
16541659
_entityServerPos = entity.position;
16551660
entity.isOnGound = isOnGound > 0;
16561661
entity.enterWorld();

Property.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@
99
*/
1010
public class Property
1111
{
12+
public enum EntityDataFlags
13+
{
14+
ED_FLAG_UNKOWN = 0x00000000, // 未定义
15+
ED_FLAG_CELL_PUBLIC = 0x00000001, // 相关所有cell广播
16+
ED_FLAG_CELL_PRIVATE = 0x00000002, // 当前cell
17+
ED_FLAG_ALL_CLIENTS = 0x00000004, // cell广播与所有客户端
18+
ED_FLAG_CELL_PUBLIC_AND_OWN = 0x00000008, // cell广播与自己的客户端
19+
ED_FLAG_OWN_CLIENT = 0x00000010, // 当前cell和客户端
20+
ED_FLAG_BASE_AND_CLIENT = 0x00000020, // base和客户端
21+
ED_FLAG_BASE = 0x00000040, // 当前base
22+
ED_FLAG_OTHER_CLIENTS = 0x00000080, // cell广播和其他客户端
23+
};
24+
1225
public string name = "";
1326
public KBEDATATYPE_BASE utype = null;
1427
public UInt16 properUtype = 0;
28+
public UInt32 properFlags = 0;
1529
public Int16 aliasID = -1;
1630

1731
public string defaultValStr = "";
@@ -23,6 +37,12 @@ public Property()
2337
{
2438

2539
}
40+
41+
public bool isBase()
42+
{
43+
return properFlags == (UInt32)EntityDataFlags.ED_FLAG_BASE_AND_CLIENT ||
44+
properFlags == (UInt32)EntityDataFlags.ED_FLAG_BASE;
45+
}
2646
}
2747

2848
}

0 commit comments

Comments
 (0)