Exemplo n.º 1
0
    private void UpdateDragging()
    {
        float dragDistance = (_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x;

        MovePanel(dragDistance);

        if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT))
        {
            _touchEndTime = TimeHelper.GetCurrentRealTimestamp();
            _touchEndPos  = _mouseStatus.GetMousePos();

            float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f;
            if (dragTime < 0.5f)
            {
                CreateEasingData(dragTime);
                TimerEx.Init("MouseControl", dragTime, EasingFinish);

                _state = STATE.EASING;
            }
            else
            {
                _state = STATE.IDLE;
            }
            return;
        }
    }
Exemplo n.º 2
0
    private void UpdateDragging()
    {
        Vector3 dragDistance = new Vector3((_mouseStatus.GetMousePos() - _mouseStatus.GetMouseLastPos()).x, 0, 0);

        _game.mapCamera.cManualMove.UpdateMovePos(dragDistance);

        if (_mouseStatus.GetMouseJustUp(MouseStatus.KEY.LEFT))
        {
            _touchEndTime = TimeHelper.GetCurrentRealTimestamp();
            _touchEndPos  = _mouseStatus.GetMousePos();

            float dragTime = (float)(_touchEndTime - _touchBeganTime) / 1000.0f;
            if (dragTime < 0.5f)
            {
                dragDistance = new Vector3((_touchBeganPos - _touchEndPos).x, 0, 0);
                _game.mapCamera.cManualMove.UpdateEasingPos(dragTime, dragDistance);
                TimerEx.Init("MouseControl", dragTime, EasingFinish);

                _state = STATE.EASING;
            }
            else
            {
                _state = STATE.IDLE;
            }

            return;
        }
    }
Exemplo n.º 3
0
 public void InitTimer()
 {
     productionTimer = TimerEx.Init("Production ", 1.0f, OnProductionTimer, true);
     if (productionTimer != null)
     {
         productionTimer.Pause();
     }
 }
Exemplo n.º 4
0
    public static TimerEx Init(string timerName, float interval, CALLBACK callback, bool loop = false, System.Object parameter = null)
    {
        if (_timerRoot == null)
        {
            _timerRoot = new GameObject("TimerSpawn");
            MonoBehaviour.DontDestroyOnLoad(_timerRoot);
        }

        GameObject gameObject = new GameObject(TIMEREX_NAME_PREFIX + timerName);

        MonoBehaviour.DontDestroyOnLoad(gameObject);
        gameObject.transform.parent = _timerRoot.transform;

        TimerEx t = gameObject.AddComponent <TimerEx>();

        if (t != null)
        {
            t.Init(interval, callback, loop, parameter);
            return(t);
        }
        return(null);
    }
Exemplo n.º 5
0
 private void InitTimer()
 {
     recoverEnergyTimer = TimerEx.Init("RecoverEnergy", 1.0f, OnRecoverEnergy, true);
     recoverEnergyTimer.Pause();
 }
Exemplo n.º 6
0
 private void InitFightTimer()
 {
     _fightTimer          = TimerEx.Init("fightTimer", 1.0f, FightTimerCallBack, true);
     _fightStartTimestamp = TimeHelper.GetCurrentRealTimestamp();
 }