Skip to content

Commit

Permalink
12
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxq committed Mar 11, 2016
1 parent 0dd9ba2 commit edbb92f
Show file tree
Hide file tree
Showing 63 changed files with 243 additions and 233 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/IGSoft_Resources/Scripts/Unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/IGSoft_Resources/Scripts/User.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 0 additions & 73 deletions Assets/MrRabZ/models/RabbitActionController.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Assets/MrRabZ/models/RabbitActionController.cs.meta

This file was deleted.

Binary file removed Assets/MrRabZ/models/snowBall.controller
Binary file not shown.
8 changes: 0 additions & 8 deletions Assets/MrRabZ/models/snowBall.controller.meta

This file was deleted.

Binary file modified Assets/createAvatar.unity
Binary file not shown.
9 changes: 9 additions & 0 deletions Assets/kbengine_unity3d_plugins-0.8.2.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ public class Entity
public Mailbox baseMailbox = null;
public Mailbox cellMailbox = null;

// enterworld之后设置为true
public bool inWorld = false;

// __init__调用之后设置为true
public bool inited = false;

// entityDef属性,服务端同步过来后存储在这里
private Dictionary<string, Property> defpropertys_ =
new Dictionary<string, Property>();

private Dictionary<UInt16, Property> iddefpropertys_ =
new Dictionary<UInt16, Property>();

public static void clear()
{
}

public Entity()
{
foreach(Property e in EntityDef.moduledefs[GetType().Name].propertys.Values)
Expand All @@ -63,7 +67,7 @@ public bool isPlayer()
return id == KBEngineApp.app.entity_id;
}

public void addDefinedPropterty(string name, object v)
public void addDefinedProperty(string name, object v)
{
Property newp = new Property();
newp.name = name;
Expand All @@ -72,8 +76,8 @@ public void addDefinedPropterty(string name, object v)
newp.setmethod = null;
defpropertys_.Add(name, newp);
}
public object getDefinedPropterty(string name)

public object getDefinedProperty(string name)
{
Property obj = null;
if(!defpropertys_.TryGetValue(name, out obj))
Expand All @@ -84,12 +88,12 @@ public object getDefinedPropterty(string name)
return defpropertys_[name].val;
}

public void setDefinedPropterty(string name, object val)
public void setDefinedProperty(string name, object val)
{
defpropertys_[name].val = val;
}

public object getDefinedProptertyByUType(UInt16 utype)
public object getDefinedPropertyByUType(UInt16 utype)
{
Property obj = null;
if(!iddefpropertys_.TryGetValue(utype, out obj))
Expand All @@ -100,15 +104,52 @@ public object getDefinedProptertyByUType(UInt16 utype)
return iddefpropertys_[utype].val;
}

public void setDefinedProptertyByUType(UInt16 utype, object val)
public void setDefinedPropertyByUType(UInt16 utype, object val)
{
iddefpropertys_[utype].val = val;
}

/*
KBEngine的实体构造函数,与服务器脚本对应。
存在于这样的构造函数是因为KBE需要创建好实体并将属性等数据填充好才能告诉脚本层初始化
*/
public virtual void __init__()
{
}


public virtual void callPropertysSetMethods()
{
foreach(Property prop in iddefpropertys_.Values)
{
object oldval = getDefinedPropertyByUType(prop.properUtype);
System.Reflection.MethodInfo setmethod = prop.setmethod;

if(setmethod != null)
{
if(prop.isBase())
{
if(inited && !inWorld)
{
//Dbg.DEBUG_MSG(className + "::callPropertysSetMethods(" + prop.name + ")");
setmethod.Invoke(this, new object[]{oldval});
}
}
else
{
if(inWorld)
{
//Dbg.DEBUG_MSG(className + "::callPropertysSetMethods(" + prop.name + ")");
setmethod.Invoke(this, new object[]{oldval});
}
}
}
else
{
//Dbg.DEBUG_MSG(className + "::callPropertysSetMethods(" + prop.name + ") not found set_*");
}
}
}

public void baseCall(string methodname, params object[] arguments)
{
if(KBEngineApp.app.currserver == "loginapp")
Expand Down Expand Up @@ -217,7 +258,7 @@ public void cellCall(string methodname, params object[] arguments)

public void enterWorld()
{
// Dbg.DEBUG_MSG(className + "::enterWorld(" + getDefinedPropterty("uid") + "): " + id);
// Dbg.DEBUG_MSG(className + "::enterWorld(" + getDefinedProperty("uid") + "): " + id);
inWorld = true;

try{
Expand Down Expand Up @@ -257,7 +298,7 @@ public virtual void onLeaveWorld()

public virtual void enterSpace()
{
// Dbg.DEBUG_MSG(className + "::enterSpace(" + getDefinedPropterty("uid") + "): " + id);
// Dbg.DEBUG_MSG(className + "::enterSpace(" + getDefinedProperty("uid") + "): " + id);
inWorld = true;

try{
Expand Down Expand Up @@ -297,7 +338,7 @@ public virtual void onLeaveSpace()

public virtual void set_position(object old)
{
Vector3 v = (Vector3)getDefinedPropterty("position");
Vector3 v = (Vector3)getDefinedProperty("position");
position = v;
//Dbg.DEBUG_MSG(className + "::set_position: " + old + " => " + v);

Expand All @@ -314,7 +355,7 @@ public virtual void onUpdateVolatileData()

public virtual void set_direction(object old)
{
Vector3 v = (Vector3)getDefinedPropterty("direction");
Vector3 v = (Vector3)getDefinedProperty("direction");

v.x = v.x * 360 / ((float)System.Math.PI * 2);
v.y = v.y * 360 / ((float)System.Math.PI * 2);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class KBEMain : MonoBehaviour
public int SEND_BUFFER_MAX = (int)KBEngine.NetworkInterface.TCP_PACKET_MAX;
public int RECV_BUFFER_MAX = (int)KBEngine.NetworkInterface.TCP_PACKET_MAX;
public bool useAliasEntityID = true;

public bool isOnInitCallPropertysSetMethods = true;

void Awake()
{
DontDestroyOnLoad(transform.gameObject);
Expand Down Expand Up @@ -62,7 +63,8 @@ public virtual void initKBEngine()
args.syncPlayer = syncPlayer;
args.threadUpdateHZ = threadUpdateHZ;
args.useAliasEntityID = useAliasEntityID;

args.isOnInitCallPropertysSetMethods = isOnInitCallPropertysSetMethods;

args.SEND_BUFFER_MAX = (UInt32)SEND_BUFFER_MAX;
args.RECV_BUFFER_MAX = (UInt32)RECV_BUFFER_MAX;

Expand All @@ -80,6 +82,7 @@ void OnDestroy()
if (KBEngineApp.app != null)
{
KBEngineApp.app.destroy();
KBEngineApp.app = null;
}
MonoBehaviour.print("clientapp::OnDestroy(): end");
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit edbb92f

Please sign in to comment.