private static NetworkRoutine FetchIdleRoutine() { NetworkRoutine routine = null; if (bank.Count > 0) { routine = bank.Dequeue(); } else { routine = new NetworkRoutine(); } return(routine); }
public static void Request(uint id, NetworkArgument arg, Action <NetBaseMsg> successCallback, Action <NetMsg <string> > faillCallback, Func <NetMsg <string>, bool> exceptionCallback) { if (commandInfoTable.ContainsKey(id)) { NetworkCommandInfo cmd = commandInfoTable[id]; NetworkRoutine routine = FetchIdleRoutine(); routine.Init(cmd, arg, successCallback, faillCallback, exceptionCallback); willPostQueue.Enqueue(routine); if (routine.commandInfo.isBlock) { if (blockInputHandler != null) { blockInputHandler.Invoke(true); } } UpdateManager.Add(updateObj); } }