public virtual void GenState() { mStt = new StateArray(); mStt.AddAMember("Online", 0); mStt.AddEntryAction(() => { mInterbal = INT_REST; }); mStt.AddDuringAction(() => { if (arrJobs.Count > 0) { SetState("PacketSend"); // Change State } }); mStt.AddAMember("PacketSend", 0); mStt.AddEntryAction(() => { SendPacket(); mInterbal = waitMSec [0]; }); mStt.AddAMember("Receive", 0); mStt.AddDuringAction(() => { if (CurJob.dlgtJobCompleted()) { PrepareNextJob(); } else { RetryJob(); } }); mStt.AddAMember("ERROR", 0); mStt.AddEntryAction(() => { mInterbal = INT_REST; }); SetState("Online"); // Set Initial State.. StartThread(); // Start Thread }
public virtual void GenState() { Ag.LogIntenseWord(" NetworkManagerMono :: GenState "); mStt = new StateArray(); mStt.AddAMember("Online", 0); mStt.AddEntryAction(() => { mInEverySomeFrame = 5; }); mStt.AddDuringAction(() => { if (arrJobs.Count > 0) { SetState("PacketSend"); // Change State } else { mInEverySomeFrame = 100; } }); mStt.AddExitCondition(() => { return(false); }); mStt.AddAMember("PacketSend", 0); mStt.AddEntryAction(() => { //SendWaitingCount = 0; SendPacket(); }); mStt.AddDuringAction(() => { SendWaitingCount++; Ag.LogDouble(" :: PacketSend >>> SendWaitingCount : " + SendWaitingCount); if (SendWaitingCount > 5) { arrJobs.Remove(CurJob); //Ag.NetExcpt.DisconnectedWith (was: true); SetState("Online"); } }); mStt.AddAMember("Receive", 0); mStt.AddDuringAction(() => { SendWaitingCount = 0; if (CurJob.dlgtJobCompleted()) { PrepareNextJob(); } else { arrJobs.Remove(CurJob); SetState("Online"); // Change State return; // if (NetworkFailedJob != null) // NetworkFailedJob (); // RetryJob (); //Ag.HttpNetworkFailure = true; } }); mStt.AddAMember("ERROR", 0); mStt.AddEntryAction(() => { mInEverySomeFrame = 150; }); SetState("Online"); // Set Initial State.. mStt.DoAction(); }