Пример #1
0
    protected IEnumerator CoDelayAction(System.Action OnAfterDelayAction, float fDelaySec)
    {
        yield return(YieldManager.GetWaitForSecond(fDelaySec));

        OnAfterDelayAction();
        _mapCoroutinePlaying.Remove(OnAfterDelayAction);
    }
Пример #2
0
    // ========================================================================== //

    #region Private

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoUpdateRandomAnimation()
    {
        yield return(null);

        if (_listRandomAnimation.Count == 0)
        {
            _pSpineController.DoPlayAnimation_Loop(strDefaultAnimationName);
        }
        else
        {
            while (true)
            {
                SAnimation pCurrentRandomAnimation;
                if (string.IsNullOrEmpty(_strLastPlayAnimation))
                {
                    pCurrentRandomAnimation = CManagerRandomTable <SAnimation> .instance.GetRandomItem();
                }
                else
                {
                    if (_mapRandomAnimation.ContainsKey(_strLastPlayAnimation))
                    {
                        pCurrentRandomAnimation = _mapRandomAnimation[_strLastPlayAnimation].GetRandomItem();
                    }
                    else
                    {
                        pCurrentRandomAnimation = CManagerRandomTable <SAnimation> .instance.GetRandomItem();
                    }
                }

                _pSpineController.DoPlayAnimation(pCurrentRandomAnimation.strAnimation);

                yield return(YieldManager.GetWaitForSecond(pCurrentRandomAnimation.GetRandomDuration()));
            }
        }
    }
Пример #3
0
        public IEnumerator Local_UDP_ReliablePacket_Test()
        {
            Network_UDP_Test.EventMakeSingleton();
            Network_UDP_Test.instance.DoStartListen_UDP(iTestPort);

            iReliableRecvCount      = 0;
            bIsRecievePacket_OnFail = false;
            SPacketTest_ReliableSend pSendPacket = new SPacketTest_ReliableSend();

            Network_UDP_Test.instance.DoSendPacket(strTestTargetIP, iTestPort, pSendPacket);

            yield return(YieldManager.GetWaitForSecond(0.1f));

            STestSession pSesion = Network_UDP_Test.instance.p_mapNetworkSession.Values.First();

            Assert.IsTrue(pSesion.CheckIsRequire_ReliablePacket());

            // 릴라이어블 패킷은 정해진 시간동안 기다렸다가 설정한 응답 패킷이 오지 않으면 재전송을 한다.
            // 테스트 케이스의 경우 0.1초마다 재전송을 한다.
            while (pSesion.CheckIsRequire_ReliablePacket())
            {
                yield return(YieldManager.GetWaitForSecond(0.1f));
            }
            Assert.IsTrue(iReliableRecvCount >= 3); // 릴라이어블 패킷 Send를 받으면 ++이 된다.
            Debug.Log(" Finsih - iReliableRecvCount  : " + iReliableRecvCount);

            yield break;
        }
        public IEnumerator ManagerPanel_Test()
        {
            GameObject pObjectManager = new GameObject();
            패널테스트_1    pPanelTest     = new GameObject(typeof(패널테스트_1).ToString()).AddComponent <패널테스트_1>();
            패널테스트_2    pPanelTest2    = new GameObject(typeof(패널테스트_2).ToString()).AddComponent <패널테스트_2>();

            pPanelTest.transform.SetParent(pObjectManager.transform);
            pPanelTest2.transform.SetParent(pObjectManager.transform);

            CManagerUGUIBase_Test pManager = pObjectManager.AddComponent <CManagerUGUIBase_Test>();

            yield return(null);

            Assert.AreEqual(pPanelTest.gameObject.activeSelf, true);
            Assert.AreEqual(pPanelTest2.gameObject.activeSelf, false);
            Assert.AreEqual(pPanelTest.transform.GetSiblingIndex(), pManager.transform.childCount - 1);

            Assert.AreEqual(pPanelTest.p_bIsPlaying_Show_Animation, true);
            yield return(YieldManager.GetWaitForSecond(const_fShowAnimation_DurationSec)); yield return(null);

            Assert.AreEqual(pPanelTest.p_bIsPlaying_Show_Animation, false);

            pManager.DoShowHide_Panel(EUIPanel.패널테스트_1, false); yield return(null);

            Assert.AreEqual(pPanelTest.gameObject.activeSelf, false);

            pManager.DoShowHide_Panel(EUIPanel.패널테스트_2, true); yield return(null);

            Assert.AreEqual(pPanelTest2.gameObject.activeSelf, true);
            Assert.AreEqual(pPanelTest2.transform.GetSiblingIndex(), pManager.transform.childCount - 1);
        }
            protected override IEnumerator OnShowPanel_PlayingAnimation(int iSortOrder)
            {
                p_bIsPlaying_Show_Animation = true;
                yield return(YieldManager.GetWaitForSecond(const_fShowAnimation_DurationSec));

                p_bIsPlaying_Show_Animation = false;
            }
Пример #6
0
    private IEnumerator CoDelayActionEventTrigger(System.Action OnAfterDelayAction, float fDelaySec)
    {
        yield return(YieldManager.GetWaitForSecond(fDelaySec));

        yield return(new CYield_IsWaitingEventTrigger());

        OnAfterDelayAction();
    }
        protected override IEnumerator OnEnableObjectCoroutine()
        {
            yield return(YieldManager.GetWaitForSecond(2f));

            Debug.Log("OnEnableObjectCoroutine - After 2 Sec - And Disable Self");

            // gameObject.SetActive(false);
        }
Пример #8
0
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoRotateTransform(Vector3 vecAngularVelocity)
    {
        while (true)
        {
            transform.Rotate(vecAngularVelocity);

            yield return(YieldManager.GetWaitForSecond(0.02f));
        }
    }
Пример #9
0
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoDelayDisable()
    {
        yield return(YieldManager.GetWaitForSecond(fAutoDisableTime));

        gameObject.SetActive(false);
        if (_OnDisable != null)
        {
            _OnDisable(gameObject);
        }
    }
Пример #10
0
    private IEnumerator CoStartTween(bool bReset_Progress, ETweenDirection eTweenDirection, OnCreateYield OnCreatorYield, System.Func <float> OnGetDeltaTime)
    {
        if (p_fFirstDelaySec != 0f)
        {
            if (p_bIgnoreTimeScale)
            {
                yield return(new WaitForSecondsRealtime(p_fFirstDelaySec));
            }
            else
            {
                yield return(YieldManager.GetWaitForSecond(p_fFirstDelaySec));
            }
        }

        DoInitTween(eTweenDirection, bReset_Progress);

        if (p_Event_OnStartTween_InCludeArg != null)
        {
            p_Event_OnStartTween_InCludeArg(eTweenDirection, this);
        }

        while (_bIsFinishForward == _bIsFinishRevese)
        {
            DoSetTweening(OnGetDeltaTime());

            CustomYieldInstruction pYield;
            OnCreatorYield(out pYield);

            yield return(pYield);
        }

        if (p_fAfterDelaySec != 0f)
        {
            if (p_bIgnoreTimeScale)
            {
                yield return(new WaitForSecondsRealtime(p_fAfterDelaySec));
            }
            else
            {
                yield return(YieldManager.GetWaitForSecond(p_fAfterDelaySec));
            }
        }

        if (p_Event_OnFinishTween != null)
        {
            p_Event_OnFinishTween.Invoke();
        }

        if (p_Event_OnFinishTween_InCludeArg != null)
        {
            p_Event_OnFinishTween_InCludeArg(eTweenDirection, this);
        }

        _bIsPlayingTween = false;
    }
Пример #11
0
    // ========================================================================== //

    #region Private

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoUpdateTexture()
    {
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            System.IntPtr pTexturePointer = _pRenderTexture.GetNativeTexturePtr();
            _pTextureCopy.UpdateExternalTexture(pTexturePointer);

            yield return(YieldManager.GetWaitForSecond(p_fUpdateDelaySec));
        }
    }
Пример #12
0
    protected override IEnumerator OnEnableObjectCoroutine()
    {
        if (p_eConditionType.ContainEnumFlag(EConditionTypeFlags.OnUpdate) == false)
        {
            yield break;
        }

        while (true)
        {
            DoPlayEventTrigger();

            yield return(YieldManager.GetWaitForSecond(p_fUpdateTimeDelta));
        }
    }
Пример #13
0
    /* protected - [abstract & virtual]         */


    // ========================================================================== //

    #region Private

    IEnumerator CoTextAnimation()
    {
        do
        {
            _pStrBuilder.Length = 0;

            int iIndex = 0;
            while (iIndex < strAnimationText.Length)
            {
                _pStrBuilder.Append(strAnimationText[iIndex]);
                p_pTextComponent.text = _pStrBuilder.ToString();

                iIndex++;
                yield return(YieldManager.GetWaitForSecond(p_fDuration / strAnimationText.Length));
            }

            p_Event_OnFinishAnimation.DoNotify(this);
            yield return(null);
        } while (p_bIsLoop);
    }
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/


    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected override IEnumerator OnEnableObjectCoroutine()
    {
        yield return(null);

        while (true)
        {
            Vector3 vecCurrentPos = transform.position;
            if (vecCurrentPos.Equals(_vecPosPrev) == false)
            {
                if (CheckDebugFilter(EDebugFilter.Debug_Level_Core))
                {
                    Debug.Log(name + ConsoleProWrapper.ConvertLog_ToCore(name + " Excute Trigger "), this);
                }

                p_listEvent.Invoke();
            }

            _vecPosPrev = vecCurrentPos;
            yield return(YieldManager.GetWaitForSecond(p_fUpdateTimeDelta));
        }
    }
    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected IEnumerator PlaySpriteAnimation()
    {
        if (p_bIsPlay_OnEnable)
        {
            while (true)
            {
                while (true)
                {
                    bool bIsFinishAnimation = CalculateNextAnimation();

                    yield return(YieldManager.GetWaitForSecond(1 / p_fFPS));

                    if (bIsFinishAnimation && p_bIsLoop == false)
                    {
                        break;
                    }
                }

                OnFinishAnimation();
            }
        }
    }
Пример #16
0
        public IEnumerator Local_UDP_Connect_Session_Test()
        {
            Network_UDP_Test.EventMakeSingleton(true);
            Network_UDP_Test.instance.DoStartListen_UDP(iTestPort);

            // 세션이 하나도 없어야 한다.
            while (Network_UDP_Test.instance.p_mapNetworkSession.Count != 0)
            {
                yield return(YieldManager.GetWaitForSecond(.1f));
            }
            Assert.IsTrue(Network_UDP_Test.instance.p_mapNetworkSession.Count == 0, Network_UDP_Test.instance.p_mapNetworkSession.ToString());

            SPacketTest_Class pSendPacket = new SPacketTest_Class(2, "보냈다");

            Network_UDP_Test.instance.DoSendPacket(strTestTargetIP, iTestPort, pSendPacket);

            yield return(YieldManager.GetWaitForSecond(.05f));

            STestSession pSession = Network_UDP_Test.instance.p_mapNetworkSession.Values.First();

            DateTime pDateTime = DateTime.Now;
            float    fSecond   = pSession.GetLastConnectionTimeGap_Second(ref pDateTime);

            //Debug.Log("Last Connection Second :" + fSecond);

            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.새로접속 || pSession.p_eConnectionState == ENetworkConnectionState.연결중, pSession.p_eConnectionState.ToString());

            // 타임아웃보다 조금 더 기다린다.
            yield return(YieldManager.GetWaitForSecond(p_fTimeOutSecond + 0.5f));

            pDateTime = DateTime.Now;
            fSecond   = pSession.GetLastConnectionTimeGap_Second(ref pDateTime);
            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.연결잠시끊김, pSession.p_eConnectionState.ToString() + " Last Connection Second : " + fSecond);

            // 타임아웃에서 연결종료시간보다 조금 더 기다린다.
            yield return(YieldManager.GetWaitForSecond(p_fTimeDeleteSession - p_fTimeOutSecond + 0.5f));

            Assert.IsTrue(pSession.p_eConnectionState == ENetworkConnectionState.연결끊김, pSession.p_eConnectionState.ToString() + " Last Connection Second : " + fSecond);
        }
Пример #17
0
    // ===================================== //
    // private - [Other] Function            //
    // 찾기, 계산 등의 비교적 단순 로직      //
    // ===================================== //

    private IEnumerator CoPlayFadeInOut(bool bFadeOut)
    {
        float fDestVolume = bFadeOut ? 0f : _fVolume;

        _pAudioSource.volume = bFadeOut ? _fVolume : 0f;

        float fFadeProgress = 0f;

        while (fFadeProgress < 1f)
        {
            _pAudioSource.volume = Mathf.Lerp(_pAudioSource.volume, fDestVolume, fFadeProgress);
            fFadeProgress       += 0.1f;

            yield return(YieldManager.GetWaitForSecond(0.1f));
        }

        if (bFadeOut)
        {
            DoPlaySound(_pAudioClipNext, _fVolumeNext);
            DoSetFadeIn();
        }
    }
Пример #18
0
        IEnumerator CoUpdate_Enable_DisableTest()
        {
            bool bEnable = false;

            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(1f));

                for (int i = 0; i < _listMonobehaviour.Count; i++)
                {
                    _listMonobehaviour[i].SetActive(bEnable);
                }

                yield return(YieldManager.GetWaitForSecond(1f));

                for (int i = 0; i < _listUpdateAble.Count; i++)
                {
                    _listUpdateAble[i].SetActive(bEnable);
                }

                bEnable = !bEnable;
            }
        }
Пример #19
0
    protected override IEnumerator OnEnableObjectCoroutine()
    {
        if (_eColliderType == EColliderType.None)
        {
            yield break;
        }

        if (_bIs2D)
        {
            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(p_fPhysicsCheckDelay));

                if (_bIsLock_CalculatePhysics)
                {
                    continue;
                }

                CalculatePhysics_2D(_OnGetHit());
            }
        }
        else
        {
            while (true)
            {
                yield return(YieldManager.GetWaitForSecond(p_fPhysicsCheckDelay));

                if (_bIsLock_CalculatePhysics)
                {
                    continue;
                }

                CalculatePhysics_3D(_OnGetHit());
            }
        }
    }
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/


    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected override IEnumerator OnEnableObjectCoroutine()
    {
        for (int i = 0; i < iTestCube_Count; i++)
        {
            GameObject pObjectBox = null;
            if (bIs2D)
            {
                pObjectBox = new GameObject();
                SpriteRenderer pSpriteRenderer = pObjectBox.AddComponent <SpriteRenderer>();
                pSpriteRenderer.sprite = pSprite_For2D;
                pObjectBox.AddComponent <BoxCollider2D>();

                pObjectBox.transform.localScale = Vector3.one * Random.Range(5f, 15f);
            }
            else
            {
                pObjectBox = GameObject.CreatePrimitive(PrimitiveType.Cube);
            }

            float fX = Random.Range(-fRandomPosition_Range_X, fRandomPosition_Range_X);
            float fY = Random.Range(-fRandomPosition_Range_Y, fRandomPosition_Range_Y);
            float fZ = Random.Range(-fRandomPosition_Range_Z, fRandomPosition_Range_Z);

            pObjectBox.transform.position = new Vector3(fX, fY, fZ);
            pObjectBox.transform.SetParent(transform);

            pObjectBox.AddComponent <CheckVisible_IVisibleListener_Test>();
            pObjectBox.name = i.ToString();

            _listRenderer.Add(pObjectBox.GetComponent <Renderer>());
        }

        yield return(YieldManager.GetWaitForSecond(0.5f));

        Update_CheckInVisibleGizmo(false);


        while (true)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo(false);
            }

            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo_UsePhysics();
            }

            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                UpdateGizmo_Original();
                yield return(YieldManager.GetWaitForSecond(0.5f));

                Update_CheckInVisibleGizmo_UsePhysics_2D();
            }

            yield return(null);
        }
    }
    // ========================================================================== //

    /* private - [Proc] Function
     * 로직을 처리(Process Local logic)           */

    private IEnumerator CoDelayAction(SEnableComponentEvent pEvent)
    {
        yield return(YieldManager.GetWaitForSecond(pEvent.fDelayTimeSec));

        pEvent.pUnityComponent.enabled = pEvent.bEnable;
    }