/// <summary> /// 创建脚本命令,传入命令号,传入参数个数可以进行更好的优化处理 /// </summary> /// <param name="CMD_ID">CM d I.</param> /// <param name="argCount">Argument count.</param> public static ScriptCommand Create(int CMD_ID, int argcount = -1) { ScriptCommand cmd = KObjectPool.mIns.Pop <ScriptCommand>(); if (cmd == null) { cmd = new ScriptCommand(); } cmd._CMD = CMD_ID; if (!cmd.HasCallParams) { if (argcount > 0 && argcount < 4) { cmd._Gparams = SimpleParams.Create(argcount); } else if (argcount > 3) { cmd._Gparams = GenericParams.Create(argcount); } } return(cmd); }
public void MergeFrom(PayloadConfig other) { if (other == null) { return; } switch (other.PayloadCase) { case PayloadOneofCase.BytebufParams: if (BytebufParams == null) { BytebufParams = new global::Grpc.Testing.ByteBufferParams(); } BytebufParams.MergeFrom(other.BytebufParams); break; case PayloadOneofCase.SimpleParams: if (SimpleParams == null) { SimpleParams = new global::Grpc.Testing.SimpleProtoParams(); } SimpleParams.MergeFrom(other.SimpleParams); break; case PayloadOneofCase.ComplexParams: if (ComplexParams == null) { ComplexParams = new global::Grpc.Testing.ComplexProtoParams(); } ComplexParams.MergeFrom(other.ComplexParams); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public static ScriptPkg CreateLua(object attvalue) { ScriptPkg pkg = null; if (KObjectPool.mIns != null) { pkg = KObjectPool.mIns.Pop <ScriptPkg>(); } if (pkg == null) { pkg = new ScriptPkg(); } pkg._script = new LuaScriptLoader(); if (LuaClient.Instance != null) { SimpleParams InitParams = SimpleParams.Create(1); Script_LuaLogicAttribute luaAttribute = attvalue as Script_LuaLogicAttribute; InitParams.WriteObject(luaAttribute); pkg.Name = luaAttribute.luapath; pkg.Loader.Init(InitParams); } else { LogMgr.Log("场景中未包含LuaClient,但是程序集中包含了带有lua目标的函数的注册"); } return(pkg); }
public static ScriptPkg CreateSharp(MethodInfo method, string methodname, object instance = null) { ScriptPkg pkg = null; if (KObjectPool.mIns != null) { pkg = KObjectPool.mIns.Pop <ScriptPkg>(); } if (pkg == null) { pkg = new ScriptPkg(); } pkg._script = new SharpScriptLoader(); SimpleParams InitParams = SimpleParams.Create(4); if (instance != null) { InitParams.WriteObject(instance); ParameterInfo[] passes = method.GetParameters(); if (passes != null && passes.Length == 1 && passes[0].ParameterType.IsSubclassOf(typeof(AbstractParams))) { throw new FrameWorkException("method mismatching "); } InitParams.WriteObject(method); } else { Type RetTp = method.ReturnType; if (RetTp == typeof(void)) { InitParams.WriteObject(Delegate.CreateDelegate(typeof(Action <AbstractParams>), method)); } else { InitParams.WriteObject(Delegate.CreateDelegate(typeof(Func <AbstractParams, AbstractParams>), method)); } InitParams.WriteObject(RetTp); InitParams.WriteString(methodname); } pkg.Loader.Init(InitParams); pkg.Name = method.DeclaringType.Name; return(pkg); }
public override int GetHashCode() { int hash = 1; if (payloadCase_ == PayloadOneofCase.BytebufParams) { hash ^= BytebufParams.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.SimpleParams) { hash ^= SimpleParams.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.ComplexParams) { hash ^= ComplexParams.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (payloadCase_ == PayloadOneofCase.BytebufParams) { hash ^= BytebufParams.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.SimpleParams) { hash ^= SimpleParams.GetHashCode(); } if (payloadCase_ == PayloadOneofCase.ComplexParams) { hash ^= ComplexParams.GetHashCode(); } hash ^= (int)payloadCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
protected bool Equals(SimpleParams other) { return X == other.X && Math.Abs(Y - other.Y) < 0.001 && string.Equals(Message, other.Message); }
private static AbstractParams getobstacles(AbstractParams p) { p = SimpleParams.Create(1); p.InsertObject(0, instance_.obstacles_); return(p); }
private static AbstractParams getkdtree(AbstractParams p) { p = SimpleParams.Create(1); p.InsertObject(0, instance_.kdTree_); return(p); }
protected bool Equals(SimpleParams other) { return(X == other.X && Math.Abs(Y - other.Y) < 0.001 && string.Equals(Message, other.Message)); }