// 执行命令 public void pushCommand(Command cmd, CommandReceiver cmdReceiver) { if (cmd == null || cmdReceiver == null) { UnityUtility.logError("cmd or receiver is null!"); return; } if (!cmd.isValid()) { UnityUtility.logError("cmd is invalid! make sure create cmd use CommandSystem.newCmd! pushCommand cmd type : " + cmd.GetType().ToString() + "cmd id : " + cmd.mAssignID); return; } if (cmd.isDelayCommand()) { UnityUtility.logError("cmd is a delay cmd! can not use pushCommand!" + cmd.mAssignID + ", " + cmd.showDebugInfo()); return; } cmd.setReceiver(cmdReceiver); if (cmd.getShowDebugInfo()) { UnityUtility.logInfo("CommandSystem : " + cmd.mAssignID + ", " + cmd.showDebugInfo() + ", receiver : " + cmdReceiver.getName(), LOG_LEVEL.LL_NORMAL); } cmdReceiver.receiveCommand(cmd); // 销毁回收命令 mCommandPool.destroyCmd(cmd); }
//执行命令 public void pushCommand(Command cmd, CommandReceiver cmdReceiver) { if (cmd == null || cmdReceiver == null) { UnityUtility.logError("cmd or receiver is null!"); return; } if (!cmd.isValid()) { UnityUtility.logError("cmd is invalid! make sure create cmd use CommandSystem.newCmd!"); return; } if (cmd.isDelayCommand()) { UnityUtility.logError("cmd is a delay cmd! can not use pushCommand!"); return; } cmd.setReceiver(cmdReceiver); if (mShowDebugInfo && cmd.getShowDebugInfo()) { UnityUtility.logInfo("CommandSystem : " + cmd.showDebugInfo() + ", receiver : " + cmdReceiver.getName()); } cmdReceiver.receiveCommand(cmd); // 销毁回收命令 mCommandPool.destroyCmd(cmd); }
// 执行命令 public new void pushCommand(Command cmd, CommandReceiver cmdReceiver) { if (cmd == null) { logError("cmd is null! receiver : " + (cmdReceiver != null ? cmdReceiver.getName() : "")); return; } if (cmdReceiver == null) { logError("receiver is null! cmd : " + (cmd != null ? cmd.getType().ToString() : "")); return; } if (!cmd.isValid()) { logError("cmd is invalid! make sure create cmd use CommandSystem.newCmd! pushCommand cmd type : " + cmd.GetType().ToString() + "cmd id : " + cmd.mAssignID); return; } if (cmd.isDelayCommand()) { logError("cmd is a delay cmd! can not use pushCommand!" + cmd.mAssignID + ", " + cmd.showDebugInfo()); return; } cmd.setReceiver(cmdReceiver); if (cmd.getShowDebugInfo()) { logConsole("CommandSystem : " + cmd.mAssignID + ", " + cmd.showDebugInfo() + ", receiver : " + cmdReceiver.getName()); } cmdReceiver.receiveCommand(cmd); // 销毁回收命令 mCommandPool.destroyCmd(cmd); }
// 执行命令 public new void pushCommand(Command cmd, CommandReceiver cmdReceiver) { // 如果命令系统已经销毁了,则不能再发送命令 if (mDestroy) { return; } if (cmd == null) { logError("cmd is null! receiver : " + (cmdReceiver != null ? cmdReceiver.getName() : EMPTY)); return; } if (cmdReceiver == null) { logError("receiver is null! cmd : " + (cmd != null ? cmd.GetType().ToString() : EMPTY)); return; } if (cmd.isDestroy()) { logError("cmd is invalid! make sure create cmd use CommandSystem.newCmd! pushCommand cmd type : " + Typeof(cmd) + "cmd id : " + cmd.getAssignID()); return; } if (cmd.isDelayCommand()) { logError("cmd is a delay cmd! can not use pushCommand!" + cmd.getAssignID() + ", " + cmd.showDebugInfo()); return; } cmd.setReceiver(cmdReceiver); if (cmd.isShowDebugInfo()) { #if UNITY_EDITOR || DEVELOPMENT_BUILD log("CMD : " + cmd.getAssignID() + ", " + cmd.showDebugInfo() + ", receiver : " + cmdReceiver.getName(), LOG_LEVEL.NORMAL); #endif } cmdReceiver.receiveCommand(cmd); // 销毁回收命令 mClassPoolThread?.destroyClass(cmd); }
// 执行命令 public new void pushCommand(Command cmd, CommandReceiver cmdReceiver) { // 如果命令系统已经销毁了,则不能再发送命令 if (mDestroy) { return; } if (cmd == null) { logError("cmd is null! receiver : " + (cmdReceiver != null ? cmdReceiver.getName() : EMPTY_STRING)); return; } if (cmdReceiver == null) { logError("receiver is null! cmd : " + (cmd != null ? cmd.getType().ToString() : EMPTY_STRING)); return; } if (!cmd.isValid()) { logError("cmd is invalid! make sure create cmd use CommandSystem.newCmd! pushCommand cmd type : " + cmd.GetType().ToString() + "cmd id : " + cmd.mAssignID); return; } if (cmd.isDelayCommand()) { logError("cmd is a delay cmd! can not use pushCommand!" + cmd.mAssignID + ", " + cmd.showDebugInfo()); return; } cmd.setReceiver(cmdReceiver); if (cmd.isShowDebugInfo()) { logInfo("CommandSystem : " + cmd.mAssignID + ", " + cmd.showDebugInfo() + ", receiver : " + cmdReceiver.getName(), LOG_LEVEL.LL_NORMAL); } cmdReceiver.receiveCommand(cmd); // 销毁回收命令 mCommandPool?.destroyCmd(cmd); }