コード例 #1
0
        private void handleCallEntityMethodOnClient(Packet pkt)
        {
            string entityID = pkt.ReadEntityID();
            string method   = pkt.ReadVarStr();

            object[] args = pkt.ReadArgs();
            GoWorldLogger.Debug("GameClient", "Handle Call Entity Method On Client: {0}.{1}({2})", entityID, method, args);
            if (OnCallEntityMethodOnClient != null)
            {
                this.OnCallEntityMethodOnClient(entityID, method, args);
            }
            //manager.OnCallEntityMethod(entityID, method, args);
        }
コード例 #2
0
        internal void DestroyEntity(string entityID)
        {
            GoWorldLogger.Debug("EntityManager", "Destroy Entity {0}", entityID);
            ClientEntity entity;

            if (this.entities.TryGetValue(entityID, out entity))
            {
                entity.Destroy();
            }
            else
            {
                GoWorldLogger.Error("EntityManager", "Destroy Entity {0} Failed: Entity Not Found", entityID);
            }
        }
コード例 #3
0
        internal void CallEntity(string entityID, string method, object[] args)
        {
            ClientEntity entity;

            if (this.entities.TryGetValue(entityID, out entity))
            {
                System.Reflection.MethodInfo methodInfo = entity.GetType().GetMethod(method);
                if (methodInfo == null)
                {
                    GoWorldLogger.Error("EntityManager", "Call Entity {0}.{1}({2} Args) Failed: Public Method Not Found", entity, method, args.Length);
                    return;
                }

                GoWorldLogger.Debug("EntityManager", "Call Entity {0}: {1}({2} Args)", entity, method, args.Length);
                methodInfo.Invoke(entity, args);
            }
            else
            {
                // entity not found
                GoWorldLogger.Error("EntityManager", "Call Entity {0}.{1}({2} Args) Failed: Entity Not Found", entityID, method, args.Length);
            }
        }
コード例 #4
0
        internal object getAttrByPath(ListAttr path)
        {
            object attr = this.Attrs;

            if (path == null)
            {
                return(attr);
            }

            foreach (object key in path)
            {
                if (key.GetType() == typeof(string))
                {
                    attr = (attr as MapAttr).get((string)key);
                }
                else
                {
                    attr = (attr as ListAttr).get((int)key);
                }
            }

            GoWorldLogger.Debug(this.ToString(), "Get Attr By Path: {0} = {1}", path.ToString(), attr);
            return(attr);
        }
コード例 #5
0
ファイル: GoWorld.cs プロジェクト: zealass/GoWorldUnity3D
 private static void OnCreateEntityOnClient(string typeName, string entityID, bool isClientOwner, float x, float y, float z, float yaw, MapAttr attrs)
 {
     GoWorldLogger.Debug("GoWorld", "OnCreateEntityOnClient {0}<{1}>, IsClientOwner={2}, Attrs={3}, Position={4},{5},{6} ...", typeName, entityID, isClientOwner, attrs, x, y, z);
     ClientEntity e = EntityManager.CreateEntity(typeName, entityID, isClientOwner, x, y, z, yaw, attrs);
 }