예제 #1
0
        public void testCallPendingOnUserRetrieve()
        {
            CStateMachine call = this.makeOutgoingCall();

            call.getState().holdCall(call.Session);
            call.getState().onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, call.getStateId());

            CStateMachine inccall = this.makeIncomingCallWithAnswer(2);

            Assert.AreEqual(EStateId.ACTIVE, inccall.getStateId());

            // retrieve 1st call (HOLDING)
            _manager.onUserHoldRetrieve(call.Session);
            Assert.AreEqual(EStateId.HOLDING, call.getStateId());
            Assert.AreEqual(EStateId.ACTIVE, inccall.getStateId());

            // hold conf
            inccall.getState().onHoldConfirm();
            // states changed
            Assert.AreEqual(EStateId.ACTIVE, call.getStateId());
            Assert.AreEqual(EStateId.HOLDING, inccall.getStateId());

            call.destroy();
            inccall.destroy();
        }
예제 #2
0
    public void Init(CTRoomCoordinate _spawnCoord)
    {
        m_RoomCoord = new CTRoomCoordinate(_spawnCoord);

        m_EnemyStats = new CStats();
        SetStats(25,           //lvl
                 100, 1250, 0, //exp,maxExp,expBoost
                 1000, 1000,   //HP
                 100, 100,     //SP
                 250,          //atk
                 250,          //def
                 3,            //playrate
                 2);           //movespeed
        m_IsImmortal  = false;
        m_EnemySprite = GetComponent <SpriteRenderer>().sprite;

        m_SM = new CStateMachine();
        m_SM.AddState(new CStateBossIdle(this.gameObject, transform.position));
        m_SM.AddState(new CStateBossChase(this.gameObject));
        m_SM.AddState(new CStateBossTeleport(this.gameObject, CTDungeon.Instance.Floors[CTDungeon.Instance.currentFloor].Rooms[1]));
        m_SM.AddState(new CStateBossAttack(this.gameObject));
        m_SM.AddState(new CStateDead(this.gameObject));

        m_SM.SetNextState("StateIdle");
    }
예제 #3
0
        public void testCallMulticallLogicRetrieve2nd()
        {
            Assert.AreEqual(0, _manager.Count);

            CStateMachine smOut = makeOutgoingCall();
            CStateMachine smInc = makeIncomingCall(2); // 1st call reserve sessionId 1 (nullproxy)

            // accept incoming
            _manager.onUserAnswer(smInc.Session);
            smOut.getState().onHoldConfirm();

            Assert.AreEqual(EStateId.ACTIVE, smInc.getStateId());
            Assert.AreEqual(EStateId.HOLDING, smOut.getStateId());

            // Retrieve
            _manager.onUserHoldRetrieve(smOut.Session);
            smInc.getState().onHoldConfirm();

            Assert.AreEqual(EStateId.HOLDING, smInc.getStateId());
            Assert.AreEqual(EStateId.ACTIVE, smOut.getStateId());

            smOut.getState().endCall(smOut.Session);
            Assert.AreEqual(EStateId.IDLE, smOut.getStateId());
            smInc.getState().endCall(smInc.Session);
            Assert.AreEqual(EStateId.IDLE, smInc.getStateId());

            Assert.AreEqual(0, CCallManager.getInstance().Count);
        }
    public EMouseState EOldState;        // 前の状態を保持

    // Start is called before the first frame update
    void Start()
    {
        var StateMachine = new CStateMachine <MouseStateManager>();

        m_cStateMachineList.Add(StateMachine);

        var Normal     = new MNormalManager(this);
        var SlowDown   = new MSlowDownManager(this);
        var Door       = new MDoorManager(this);
        var Up         = new MUpManager(this);
        var Pipe       = new MPipeMoveManager(this);
        var Catch      = new MCatchManager(this);
        var Rail       = new MRailManager(this);
        var ForcedWait = new MForcedWaitManager(this);

        m_cStateList.Add(Normal);
        m_cStateList.Add(SlowDown);
        m_cStateList.Add(Door);
        m_cStateList.Add(Up);
        m_cStateList.Add(Pipe);
        m_cStateList.Add(Catch);
        m_cStateList.Add(Rail);
        m_cStateList.Add(ForcedWait);

        m_cStateMachineList[0].ChangeState(m_cStateList[(int)EMouseState.ForcedWait]);
        EOldState = EMouseState.ForcedWait;
    }
예제 #5
0
        public void testOutgoingCall()
        {
            CStateMachine sm1 = new CStateMachine();

            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
            Assert.AreEqual(false, sm1.Incoming);
            sm1.ChangeState(EStateId.CONNECTING);
            Assert.AreEqual(EStateId.CONNECTING, sm1.StateId);
            Assert.AreEqual(false, sm1.Incoming);
            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.ChangeState(EStateId.ALERTING);
            Assert.AreEqual(EStateId.ALERTING, sm1.StateId);
            Assert.AreEqual(false, sm1.Incoming);
            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.ChangeState(EStateId.ACTIVE);
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual("ACTIVE", sm1.StateId.ToString());
            Assert.AreEqual(false, sm1.Incoming);
            Assert.AreEqual(true, sm1.Counting);
            Assert.AreNotSame(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.destroy();
        }
    // Start is called before the first frame update
    void Start()
    {
        var StateMachine = new CStateMachine <HumanStateManager>();

        m_cStateMachineList.Add(StateMachine);

        var Normal     = new HNormalManager(this);
        var SlowDown   = new HSlowDownManager(this);
        var Door       = new HDoorManager(this);
        var Up         = new HUpManager(this);
        var Rail       = new HRailManager(this);
        var ForcedWait = new HForcedWaitManager(this);

        m_cStateList.Add(Normal);
        m_cStateList.Add(SlowDown);
        m_cStateList.Add(Door);
        m_cStateList.Add(Up);
        m_cStateList.Add(Rail);
        m_cStateList.Add(ForcedWait);

        m_cStateMachineList[0].ChangeState(m_cStateList[(int)EHumanState.ForcedWait]);

        // 初期設定
        m_sItemData  = null;
        m_nInTrapCnt = 0;
        //
        m_cSetItemColliderObj = this.gameObject.transform.GetChild(2).gameObject;
    }
예제 #7
0
        public void testMultipleStateMachines()
        {
            CStateMachine sm1 = new CStateMachine();
            CStateMachine sm2 = new CStateMachine();
            CStateMachine sm3 = new CStateMachine();

            Assert.AreEqual(-1, sm1.Session);
            Assert.AreEqual(TimeSpan.Zero, sm1.Duration);
            Assert.AreEqual(EStateId.IDLE, sm1.StateId);

            Assert.AreEqual(-1, sm2.Session);
            Assert.AreEqual(TimeSpan.Zero, sm2.Duration);
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);

            Assert.AreEqual(-1, sm3.Session);
            Assert.AreEqual(TimeSpan.Zero, sm3.Duration);
            Assert.AreEqual(EStateId.IDLE, sm3.StateId);

            // changing state
            sm1.ChangeState(EStateId.INCOMING);
            Assert.AreEqual(EStateId.INCOMING, sm1.StateId);
            sm2.ChangeState(EStateId.ALERTING);
            Assert.AreEqual(EStateId.ALERTING, sm2.StateId);
            sm3.ChangeState(EStateId.CONNECTING);
            Assert.AreEqual(EStateId.CONNECTING, sm3.StateId);

            sm1.destroy();
            sm2.destroy();
            sm3.destroy();

            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);
            Assert.AreEqual(EStateId.IDLE, sm3.StateId);
        }
예제 #8
0
        public void testCallFeaturesCallHold()
        {
            CStateMachine sm1 = new CStateMachine();

            sm1.State.incomingCall("1234", "");
            Assert.AreEqual(EStateId.INCOMING, sm1.StateId);
            Assert.AreEqual(true, sm1.Incoming);
            Assert.AreEqual("1234", sm1.CallingNumber);
            Assert.AreEqual(sm1.RuntimeDuration.ToString(), TimeSpan.Zero.ToString());

            sm1.State.acceptCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual(true, sm1.Counting);

            sm1.State.holdCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId); // still ACTIVE (waiting confirmation)
            sm1.State.onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, sm1.StateId);
            // check twice hold
            sm1.State.holdCall();
            Assert.AreEqual(EStateId.HOLDING, sm1.StateId);

            sm1.State.retrieveCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);

            sm1.State.holdCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId); // still ACTIVE (waiting confirmation)
            sm1.State.onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, sm1.StateId);

            sm1.Destroy();
            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
        }
    public bool m_bCanDropItem;                     // アイテムを落とす判定

    // Start is called before the first frame update
    void Start()
    {
        var StateMachine = new CStateMachine <DroneStateManager>();

        m_cStateMachineList.Add(StateMachine);

        var Stay       = new DStayManager(this);
        var Move       = new DMoveManager(this);
        var TargetMove = new DTargetMoveManager(this);
        var Around     = new DAroundManager(this);
        var ItemDrop   = new DItemDropManager(this);

        m_cStateList.Add(Stay);
        m_cStateList.Add(Move);
        m_cStateList.Add(TargetMove);
        m_cStateList.Add(Around);
        m_cStateList.Add(ItemDrop);

        m_cStateMachineList[0].ChangeState(m_cStateList[(int)EDroneState.Stay]);

        StateTime        = 0f;
        NowState         = 0;
        NowPoint         = 0;
        m_fItemDropCount = 0f;

        m_vTargetPos = new Vector3(Random.Range(-100f, 100f), 0f, Random.Range(-100f, 100f));
    }
예제 #10
0
 protected virtual void DoEnter(CStateMachine sm)
 {
     m_loadingTimeReg.Restart();
     // 1是加载的目标场景
     m_enterSceneAssetMaxNum += m_preCreatePrefabAddress.Count + 1;
     StartLoading();
 }
예제 #11
0
        public void testStateMachineEventHandlingOutgoing()
        {
            CStateMachine sm1 = new CStateMachine();

            sm1.State.makeCall("1234", 0);
            Assert.AreEqual(EStateId.CONNECTING, sm1.StateId);
            Assert.AreEqual(false, sm1.Incoming);
            Assert.AreEqual("1234", sm1.CallingNumber);
            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.State.onAlerting();
            Assert.AreEqual(EStateId.ALERTING, sm1.StateId);
            Assert.AreEqual(false, sm1.Counting);
            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.State.onConnect();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual(true, sm1.Counting);
            //Assert.AreNotEqual(sm1.RuntimeDuration.ToString(), TimeSpan.Zero.ToString());

            sm1.State.onReleased();
            Assert.AreEqual(EStateId.RELEASED, sm1.StateId);
            Assert.AreEqual(true, sm1.Counting);
            //Assert.AreNotEqual(sm1.RuntimeDuration.ToString(), TimeSpan.Zero.ToString());
        }
예제 #12
0
        public override void onEntry()
        {
            base.onEntry();

            // get current call instance
            //_currentCall = CCallManager.getInstance().getCurrentCall();
            _currentCall = CCallManager.getInstance()[CurrentCallIdx];

            if (_currentCall == null)
            {
                return;
            }

            // info...
            string sinfo = "" /*currentCall->GetCallInfo()*/;

            _info.Caption = sinfo;

            // digits...
            _digits.Caption = _currentCall.CallingNo;

            // get name from phonebook...
            //_id.Caption = currentCall.CallingNo;

            // call sessions...
            _sessions.Caption = CurrentCallIdx.ToString()
                                + "/" + _callManager.Count.ToString();
        }
예제 #13
0
    // Use this for initialization
    void Start()
    {
        m_showBuff      = 1;
        m_viewStatus    = GHOTS_VIEW_STATUS.INVISIBLE;
        m_pStateMachine = new CStateMachine <GhostMain>(this);
        m_animator      = this.GetComponent <Animator>();
        m_pStateMachine.SetCurrentState(CGhostState_Main.Instance());
        m_pStateMachine.SetGlobalStateState(CGhostState_Wait.Instance());
        m_nowDunmmyNum      = m_maxDunmmyNum;
        dGhost              = new GameObject[3];
        GhostScore          = new SGhostScore();
        GhostScore.hitCandy = 0;
        GhostScore.knockOut = 0;
        int count = 1;

        foreach (Transform i in this.transform)
        {
            if (i.name == ("ghostkodomo_" + count.ToString()))
            {
                dGhost[count - 1] = i.gameObject;
                count++;
            }
            if (i.name == "GhostMeshParticle")
            {
                m_movepatincle = i.GetComponent <ParticleSystem>();
            }
        }
    }
예제 #14
0
        private void attendedTransferToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listViewCallLines.SelectedItems.Count > 0)
            {
                ListViewItem  lvi  = listViewCallLines.SelectedItems[0];
                CStateMachine call = (CStateMachine)lvi.Tag;
                // check call states
                if (SipekResources.CallManager.Count >= 2)
                {
                    // get ACTIVE call
                    List <IStateMachine> activeCalls = SipekResources.CallManager[EStateId.ACTIVE];
                    if (activeCalls.Count == 0)
                    {
                        return;
                    }

                    // get HOLDING call
                    List <IStateMachine> holdingCalls = SipekResources.CallManager[EStateId.HOLDING];
                    if (holdingCalls.Count == 0)
                    {
                        return;
                    }

                    // transfer ACTIVE to HOLDING
                    SipekResources.CallManager.OnUserTransferAttendant(activeCalls[0].Session, holdingCalls[0].Session);
                }
            }
        }
예제 #15
0
        public override void Exit(CStateMachine sm)
        {
            base.Exit(sm);

            //清理预加载资源
            m_preCreatePrefabAddress.Clear();
            CUIManager.Instance.DestroyAllUI();
        }
예제 #16
0
        public override void Execute(CStateMachine sm)
        {
            //重新计算v, 因为有可能会更改速度
            Vector3 v = m_velocity * Time.deltaTime;

            //坐标只在平面上移动, y轴的坐标由物理引擎来控制
            m_spacial.Translate(v);
        }
예제 #17
0
        public override void Execute(CStateMachine sm)
        {
            bool b = m_loadingTimeReg.Update();

            if (b)
            {
                CheckAllAssetsLoadComplete();
            }
        }
예제 #18
0
        public override void Update(float fDTime, CStateMachine _SM)
        {
            /* controller.update();

            handleControls(gameTime);
            player.update(gameTime);
            foreach (KeyValuePair<String, Layer> layer in layers)
            {
                layers[layer.Key].update(gameTime);
            }
            updateCamera(gameTime);*/
        }
예제 #19
0
 protected override void PreEnter(CStateMachine sm)
 {
     if (m_parser.HasInitMain)
     {
         base.PreEnter(sm);
     }
     else
     {
         m_parser.OnSingleParseComplete = OnMetaLoaded;
         m_parser.InitMain();
         m_enterSceneAssetMaxNum = m_parser.MainMetaNum;
     }
 }
예제 #20
0
        public void testCallFeaturesCallHoldMultiple()
        {
            CStateMachine sm1 = new CStateMachine();

            sm1.State.incomingCall("1234", "");
            Assert.AreEqual(EStateId.INCOMING, sm1.StateId);
            Assert.AreEqual(true, sm1.Incoming);
            Assert.AreEqual("1234", sm1.CallingNumber);
            Assert.AreEqual(sm1.RuntimeDuration.ToString(), TimeSpan.Zero.ToString());

            sm1.State.acceptCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual(true, sm1.Counting);

            sm1.State.holdCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId); // still ACTIVE (waiting confirmation)
            sm1.State.onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, sm1.StateId);

            // next call
            CStateMachine sm2 = new CStateMachine();

            sm2.State.makeCall("4444", 0);
            Assert.AreEqual(EStateId.CONNECTING, sm2.StateId);
            Assert.AreEqual(false, sm2.Incoming);
            Assert.AreEqual("4444", sm2.CallingNumber);

            sm2.State.onAlerting();
            Assert.AreEqual(EStateId.ALERTING, sm2.StateId);
            Assert.AreEqual(false, sm2.Counting);

            sm2.State.onConnect();
            Assert.AreEqual(EStateId.ACTIVE, sm2.StateId);
            Assert.AreEqual(true, sm2.Counting);

            sm2.State.holdCall();
            Assert.AreEqual(EStateId.ACTIVE, sm2.StateId); // still ACTIVE (waiting confirmation)
            sm2.State.onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, sm2.StateId);

            // release first
            sm1.State.onReleased();
            Assert.AreEqual(EStateId.RELEASED, sm1.StateId);
            sm2.State.onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, sm2.StateId);

            sm2.State.endCall();
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);
            sm2.State.onReleased();
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);
        }
예제 #21
0
        void Awake()
        {
            m_spacial = GetComponent <CUnitSpacialComp>();
            if (m_spacial == null)
            {
                m_spacial = gameObject.AddComponent <CUnitSpacialComp>();
            }

            //默认我们用外部的移动器
            m_sm = new CStateMachine();
            m_sm.RegisterState(new CPawnMovementUnknow(gameObject));
            m_sm.RegisterState(new CPawnMovementDirectly(gameObject));
            m_sm.ChangeState(CPawnMovementUnknow.STATE);
        }
예제 #22
0
        protected override void PreEnter(CStateMachine sm)
        {
            m_preCreatePrefabAddress.Add("UI_CharacterEntry");

            if (m_firstEnter)
            {
                m_parser.OnSingleParseComplete = OnMetaLoaded;
                Debug.Log("Enter Character Entry First Time");
                m_parser.InitLite();
                m_enterSceneAssetMaxNum = m_parser.MainMetaNum;
            }
            else
            {
                base.PreEnter(sm);
            }
        }
예제 #23
0
        CStateMachine makeIncomingCall(int sessionId)
        {
            string number = "1234";
            //CStateMachine sm1 = new CStateMachine(null);
            CStateMachine sm1 = _manager.createSession(sessionId, number);

            sm1.getState().incomingCall(number, "");

            //sm1.changeState(EStateId.INCOMING);
            Assert.AreEqual(EStateId.INCOMING, sm1.getStateId());
            Assert.AreEqual(true, sm1.Incoming);

            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            return(sm1);
        }
    // Start is called before the first frame update
    public virtual void GeneralInit()
    {
        var StateMachine = new CStateMachine <GameManager>();

        m_cStateMachineList.Add(StateMachine);

        var Ready    = new ReadyManager(this);
        var GameMain = new GameMainManager(this);
        var End      = new EndManager(this);

        m_cStateList.Add(Ready);
        m_cStateList.Add(GameMain);
        m_cStateList.Add(End);



        m_cStateMachineList[0].ChangeState(m_cStateList[(int)NowManagerState]);
    }
예제 #25
0
 private void toolStripButtonCall_Click(object sender, EventArgs e)
 {
     // TODO check if incoming call!!!
     if (listViewCallLines.SelectedItems.Count > 0)
     {
         ListViewItem lvi = listViewCallLines.SelectedItems[0];
         CStateMachine call = (CStateMachine)lvi.Tag;
         if (call.Incoming)
         {
             SipekResources.CallManager.onUserAnswer(call.Session);
             return;
         }
     }
     if (toolStripComboDial.Text.Length > 0)
     {
         SipekResources.CallManager.createOutboundCall(toolStripComboDial.Text);
     }
 }
예제 #26
0
    }                                         //扉の閉フラグ


    // Start is called before the first frame update
    public virtual void Start()
    {
        isOpening  = false;
        isClosing  = false;
        StartAngle = this.gameObject.transform.rotation.eulerAngles;

        var StateMachine = new CStateMachine <Door>();

        m_cStateMachineList.Add(StateMachine);

        var DoorOpen  = new Door_Open(this);
        var DoorClose = new Door_Close(this);

        m_cStateList.Add(DoorOpen);
        m_cStateList.Add(DoorClose);

        m_cStateMachineList[0].ChangeState(m_cStateList[(int)EDoorState.eClose]);
    }
예제 #27
0
        public void testCallFeaturesCallWaiting()
        {
            // out call
            CStateMachine sm2 = new CStateMachine();

            sm2.State.makeCall("4444", 0);
            Assert.AreEqual(EStateId.CONNECTING, sm2.StateId);
            Assert.AreEqual(false, sm2.Incoming);
            Assert.AreEqual("4444", sm2.CallingNumber);

            sm2.State.onAlerting();
            Assert.AreEqual(EStateId.ALERTING, sm2.StateId);
            Assert.AreEqual(false, sm2.Counting);

            sm2.State.onConnect();
            Assert.AreEqual(EStateId.ACTIVE, sm2.StateId);
            Assert.AreEqual(true, sm2.Counting);

            // inc call
            CStateMachine sm1 = new CStateMachine();

            sm1.State.incomingCall("1234", "");
            Assert.AreEqual(EStateId.INCOMING, sm1.StateId);
            Assert.AreEqual(true, sm1.Incoming);
            Assert.AreEqual("1234", sm1.CallingNumber);
            Assert.AreEqual(sm1.RuntimeDuration.ToString(), TimeSpan.Zero.ToString());

            // check what happens here?
            sm1.State.acceptCall();
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual(true, sm1.Counting);
            // this should be done automatically by call manager
            // Here we do not test call manager
            //Assert.AreEqual(EStateId.HOLDING, sm2.StateId);

            sm1.State.endCall();
            sm2.State.endCall();
            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);
            sm1.State.onReleased();
            sm2.State.onReleased();
            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
            Assert.AreEqual(EStateId.IDLE, sm2.StateId);
        }
예제 #28
0
    public void Init(CTRoomCoordinate _spawnCoord)
    {
        m_RoomCoord = new CTRoomCoordinate(_spawnCoord);

        m_EnemyStats = new CStats();
        SetStatsByLevel(CTDungeon.Instance.currentFloor);
        m_IsImmortal  = false;
        m_EnemySprite = GetComponent <SpriteRenderer>().sprite;

        m_SM = new CStateMachine();
        m_SM.AddState(new CStateIdle(this.gameObject));
        m_SM.AddState(new CStatePatrol(this.gameObject));
        m_SM.AddState(new CStateChangeRoom(this.gameObject));
        m_SM.AddState(new CStateChaseRanged(this.gameObject));
        m_SM.AddState(new CStateAttackRanged(this.gameObject));
        m_SM.AddState(new CStateDead(this.gameObject));

        m_SM.SetNextState("StateIdle");
    }
예제 #29
0
        public void testCallFeaturesCallHoldConfirm()
        {
            CStateMachine inc = this.makeIncomingCallWithAnswer(1);

            // try hold confirmation without hold request
            inc.getState().onHoldConfirm();
            // no effect
            Assert.AreEqual(EStateId.ACTIVE, inc.getStateId());
            Assert.AreEqual(false, inc.HoldRequested);
            // hold request
            inc.getState().holdCall(inc.Session);
            Assert.AreEqual(true, inc.HoldRequested);
            // no effect
            Assert.AreEqual(EStateId.ACTIVE, inc.getStateId());
            inc.getState().onHoldConfirm();
            Assert.AreEqual(EStateId.HOLDING, inc.getStateId());

            inc.destroy();
        }
예제 #30
0
        public void testIncomingCall()
        {
            CStateMachine sm1 = new CStateMachine();

            Assert.AreEqual(EStateId.IDLE, sm1.StateId);
            Assert.AreEqual(false, sm1.Incoming);
            sm1.ChangeState(EStateId.INCOMING);
            Assert.AreEqual(EStateId.INCOMING, sm1.StateId);
            Assert.AreEqual(true, sm1.Incoming);

            Assert.AreEqual(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.ChangeState(EStateId.ACTIVE);
            Assert.AreEqual(EStateId.ACTIVE, sm1.StateId);
            Assert.AreEqual(true, sm1.Incoming);
            Assert.AreNotSame(sm1.RuntimeDuration, TimeSpan.Zero);

            sm1.destroy();
        }
예제 #31
0
        public void RefreshForm()
        {
            int currentSession = CCallManager.getInstance().getCurrentCallIndex();

            // get current session
            if (currentSession < 0)
            {
                // todo::: showHomePage
                CComponentController.getInstance().showPage(CComponentController.getInstance().HomePageId);
                return;
            }

            Dictionary <int, CStateMachine> calls = CCallManager.getInstance().CallList;
            CStateMachine call = CCallManager.getInstance().getCurrentCall();

            if (call != null)
            {
                int stateId = (int)call.getStateId();
                if (stateId == (int)EStateId.IDLE)
                {
                    if (CCallManager.getInstance().Count == 0)
                    {
                        CComponentController.getInstance().showPage(stateId);
                    }
                    else
                    {
                        calls.GetEnumerator().MoveNext();
                        currentSession = calls.GetEnumerator().Current.Key;

                        CStateMachine nextcall = CCallManager.getInstance().getCall(currentSession);
                        if (nextcall != null)
                        {
                            CComponentController.getInstance().showPage((int)nextcall.getStateId());
                        }
                    }
                }
                else
                {
                    CComponentController.getInstance().showPage(stateId);
                }
            }
        }
예제 #32
0
파일: Game1.cs 프로젝트: edibletoaster/Rain
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

              //  CMainMenuState _MainMenu = new CMainMenuState();
              //  _MainMenu.Enter();

            CGamePlayState _GamePlay = new CGamePlayState();
             _GamePlay.Enter();
            _StateMachine = new CStateMachine();
            _StateMachine.PushState(_GamePlay);
        }
예제 #33
0
 public override void Update(float fDTime, CStateMachine _SM)
 {
 }
예제 #34
0
 public abstract void Update(float fDTime, CStateMachine _SM);
예제 #35
0
        public override void onEntry()
        {
            base.onEntry();

              // get current call instance
              //_currentCall = CCallManager.getInstance().getCurrentCall();
              _currentCall = CCallManager.getInstance()[CurrentCallIdx];

              if (_currentCall == null) return;

            // info...
            string sinfo = ""/*currentCall->GetCallInfo()*/;
            _info.Caption = sinfo;

            // digits...
            _digits.Caption = _currentCall.CallingNo;

              // get name from phonebook...
              //_id.Caption = currentCall.CallingNo;

            // call sessions...
              _sessions.Caption = CurrentCallIdx.ToString()
            + "/" + _callManager.Count.ToString();
        }