Пример #1
0
 void KeeperAction()
 {
     mStateCere = new StateArray();
     mRotSpeed  = 1.2f;
     mStateCere.AddAMember("Init", 4f);
     mStateCere.AddExitCondition(() => {
         return(Mathf.Abs(mCerCamAxis.transform.rotation.y) < 0.7f);
     });
     mStateCere.AddAMember("Clock", 0.5f);
     mStateCere.AddEntryAction(() => {
         mRotSpeed = 1.2f;
     });
     mStateCere.AddExitCondition(() => {
         return(Mathf.Abs(mCerCamAxis.transform.rotation.y) < 0.7f);
     });
     mStateCere.AddAMember("Counter", 0.5f);
     mStateCere.AddEntryAction(() => {
         mRotSpeed = -0.85f;
     });
     mStateCere.AddExitCondition(() => {
         return(Mathf.Abs(mCerCamAxis.transform.rotation.y) < 0.7f);
     });
     mStateCere.SetNextStateOf("Init", "Counter");
     mStateCere.SetNextStateOf("Clock", "Counter");
     mStateCere.SetNextStateOf("Counter", "Clock");
     mStateCere.SetStateWithNameOf("Init");
 }
    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
    }
Пример #3
0
    //  ////////////////////////////////////////////////     State Array Setting...
    void SetStateArray()
    {
        mSttArr = new StateArray();

        mSttArr.AddAMember("InitPurchase", 5f);
        mSttArr.AddEntryAction(() => {
            mCount = 1;
        });
        mSttArr.AddExitCondition(() => {
            return(true);
        }); // !AgStt.mIAP.mIsUiLocked; });
        mSttArr.AddTimeOutProcess(100f, () => {
            Application.LoadLevel("menu");
        });

        mSttArr.AddAMember("Purchasing", 3f);
//        mSttArr.AddExitCondition (() => {
//            //return !AgStt.mIAP.mSendPackBool.mIsStarted;
//        });
        mSttArr.AddExitAction(() => {
            mCount = 1;
        });
        mSttArr.AddTimeOutProcess(50f, () => {
            Application.LoadLevel("menu");
        });

        //mSttArr.AddAMember ("CheckFile", 2f);

        mSttArr.AddAMember("Rest", 0f);
        mSttArr.AddExitCondition(() => {
            return(false);
        });

        mSttArr.SetSerialExitMember(pClose: false);
        mSttArr.SetStateWithNameOf("Rest");
    }
    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();
    }
Пример #5
0
    //  ////////////////////////////////////////////////     State Array Setting...
    void SetStateArray()
    {
        mSttArr = new StateArray();

        mSttArr.AddAMember("InitPurchase", 3f);
        mSttArr.AddExitCondition( ()=> {
            return !Ag.mIAP.mIsUiLocked; });
        mSttArr.AddTimeOutProcess(20f, ()=> { // Go to Next Stage..
        });

        mSttArr.AddAMember("CheckFile", 5f);
        mSttArr.AddEntryAction( ()=>{
            Ag.mIAP.CheckUnsentTransaction();
        });
        mSttArr.AddExitCondition( ()=>{
            if (Ag.mIAP.mIsUiLocked) Application.LoadLevel("menu");
            return true;
        } );

        mSttArr.AddAMember("Rest", 0f);
        mSttArr.AddExitCondition( ()=> { return false; } );

        mSttArr.SetSerialExitMember( pClose:false );
        mSttArr.SetStateWithNameOf("Rest");
    }
Пример #6
0
 void KeeperAction() {
      mStateCere = new StateArray();
      mRotSpeed = 1.2f;
      
      mStateCere.AddAMember("Init", 4f);
      mStateCere.AddExitCondition( ()=> { return Mathf.Abs (mCerCamAxis.transform.rotation.y) < 0.7f; } );
      
      mStateCere.AddAMember("Clock", 0.5f);
      mStateCere.AddEntryAction( ()=> { mRotSpeed = 1.2f; } );
      mStateCere.AddExitCondition( ()=> { return Mathf.Abs (mCerCamAxis.transform.rotation.y) < 0.7f; } );
     
      mStateCere.AddAMember("Counter", 0.5f);
      mStateCere.AddEntryAction( ()=> { mRotSpeed = -0.85f; } );
      mStateCere.AddExitCondition( ()=> { return Mathf.Abs (mCerCamAxis.transform.rotation.y) < 0.7f; } );;
      
      mStateCere.SetNextStateOf("Init", "Counter");
      mStateCere.SetNextStateOf("Clock", "Counter");
      mStateCere.SetNextStateOf("Counter", "Clock");
      
      mStateCere.SetStateWithNameOf("Init");
  }