コード例 #1
0
        private void FixedUpdate()
        {
            var direction = Vector2.zero;

            if (RawKeyInput.IsKeyDown(_Up))
            {
                direction += new Vector2(0, 1);
            }
            if (RawKeyInput.IsKeyDown(_Down))
            {
                direction += new Vector2(0, -1);
            }
            if (RawKeyInput.IsKeyDown(_Right))
            {
                direction += new Vector2(1, 0);
            }
            if (RawKeyInput.IsKeyDown(_Left))
            {
                direction += new Vector2(-1, 0);
            }
            direction = direction.normalized;

            DashingUpdate();
            var isDashing = (_CurrentDashDuration > 0.0f);

            if (isDashing)
            {
                Move(direction * _DashSpeed * Time.fixedDeltaTime);
            }
            else
            {
                Move(direction * _Speed * Time.fixedDeltaTime);
            }
        }
コード例 #2
0
ファイル: App.cs プロジェクト: musickgm/Productivity-Analysis
 private void Start()
 {
     RawKeyInput.Start(true);
     timelineSection.color   = appColor;
     timelineSection.appName = appName;
     timelineSection.appType = appType;
 }
コード例 #3
0
    public static string Show(string title, string message, string iconPath)
    {
        bool shouldRestartKeyInput = RawKeyInput.IsRunning;

        RawKeyInput.Stop();

        var input = new TextInput(title, message, iconPath);

        input.textInput.Focus();

        string result = "";

        if (input.ShowDialog() == DialogResult.OK)
        {
            result = input.textInput.Text;
        }

        input.Dispose();
        if (shouldRestartKeyInput)
        {
            RawKeyInput.Start(true);
        }

        return(result);
    }
コード例 #4
0
        public void Load(Vector2Int levelId)
        {
            Debug.Log($"load stage: {levelId}");

            /* cleanup */
            Release();

            /* load */
            var stage = _Parser.World.Stage(levelId);

            for (int x = 0; x < stage.Size.x; ++x)
            {
                for (int y = 0; y < stage.Size.y; ++y)
                {
                    if (stage[x][y].Discarded)
                    {
                        continue;
                    }

                    AddActor(stage[x][y], new Vector2Int(x, y), stage.Size);
                }
            }
            _CurrentStageId = levelId;

            /* force clean input */
            RawKeyInput.HandleKeyUp(RawKey.Left);
            RawKeyInput.HandleKeyUp(RawKey.Right);
            RawKeyInput.HandleKeyUp(RawKey.Up);
            RawKeyInput.HandleKeyUp(RawKey.Down);

            LevelChanged?.Invoke(levelId);
        }
コード例 #5
0
        private void OnDestroy()
        {
            RawKeyInput.Stop();
            FrameworkEx.Cleanup();

            RestoreItems();
            RestoreDesktop();
        }
コード例 #6
0
ファイル: ShortcutController.cs プロジェクト: teambluboy/AMG
        void Start()
        {
#if UNITY_STANDALONE_WIN
            RawKeyInput.Start(true);
            hookEnabled            = true;
            RawKeyInput.OnKeyUp   += HandleKeyUp;
            RawKeyInput.OnKeyDown += HandleKeyDown;
#endif
        }
コード例 #7
0
ファイル: AppManager.cs プロジェクト: Elle199/StreamCounter
    private void OnApplicationQuit()
    {
        SaveSettings();

        RawKeyInput.OnKeyDown -= HandleKeyDown;
        RawKeyInput.OnKeyUp   -= HandleKeyUp;

        RawKeyInput.Stop();
    }
コード例 #8
0
ファイル: EventManager.cs プロジェクト: Kayupon1102/YOUJO
 public void ToggleRawKey(bool t)
 {
     if (t)
     {
         RawKeyInput.Start(true);
     }
     else
     {
         RawKeyInput.Stop();
     }
 }
コード例 #9
0
    private void Init()
    {
        _mainCamera         = Helper.GetMainCamera();
        _hoverWindow        = GameObject.Find("HoverWindow");
        _clickMeHoverWindow = GameObject.Find("ClickMeHoverWindow");
        _hasInit            = true;
        _abjectAudioInputs  = GameObject.Find(Constants.AbjectAudioInputs).GetComponent <AbjectAudioInputs>();

        RawKeyInput.Start(workInBackround: true);
        RawKeyInput.OnKeyDown += HandleKeyDown;
    }
コード例 #10
0
ファイル: test.cs プロジェクト: Takomonake/test
 private void OnKeyUp(RawKey key)
 {
     a = (int)key - 112;//入力キーの番号識別(F1=112)細かいのはRawKey.cs(16進)かKeycord等参照
     //想定しているF1~F6以外だと異常値が出てUnityが強制終了するので対策としてtry,catchの実装。
     try{
         if (!(RawKeyInput.IsKeyDown(key)))//通常ifは使われてなかったので削除
         {
             off[a].SetActive(true);
             on[a].SetActive(false);
         }
     }
     catch {}
 }
コード例 #11
0
ファイル: EventManager.cs プロジェクト: Kayupon1102/YOUJO
    void Start()
    {
        //Main();
        var watch = Stopwatch.StartNew();

        EnumWindows(new EnumWindowsDelegate(EnumWindowCallBack), IntPtr.Zero);
        watch.Stop();
        UnityEngine.Debug.Log($"process time {watch.ElapsedMilliseconds} msec");
        //ModuleName();
        user = userObj.GetComponent <User>().user;
        RawKeyInput.Start(true);
        RawKeyInput.OnKeyDown += OnKeyDown;
    }
コード例 #12
0
    void OnDestroy()
    {
        m_PVACtrl.endBall();
        m_PVACtrl.term();
        RawKeyInput.Stop();

        if (m_bPortInit)
        {
            Port_DataSend("T");             /*Motor OFF*/
            Port_Close();
            m_bPortInit = false;
        }
    }
コード例 #13
0
ファイル: test.cs プロジェクト: Takomonake/test
 private void OnKeyDown(RawKey key)
 {
     a = (int)key - 112;
     try{
         if (RawKeyInput.IsKeyDown(key))
         {
             //Debug.Log("Key Down: "+(key-112)+a);
             on[a].SetActive(true);
             off[a].SetActive(false);
         }
     }
     catch {}
 }
コード例 #14
0
        public void Awake()
        {
            Application.runInBackground = true;

            FrameworkEx.Initialize();

            RawKeyInput.Start(true);
            RawKeyInput.InterceptMessages = !Config.SaveInput;
            RawKeyInput.OnKeyUp          += OnExitKey;

            SetupDesktop();
            SetupItems();

            Minimize();
        }
コード例 #15
0
        private void DashingUpdate()
        {
            _CurrentDashCooldown -= Time.fixedDeltaTime;
            _CurrentDashDuration -= Time.fixedDeltaTime;

            if (_CurrentDashCooldown > 0)
            {
                return;
            }
            if (RawKeyInput.IsKeyDown(_Dash))
            {
                _CurrentDashCooldown = _DashCooldown;
                _CurrentDashDuration = _DashDuration;
            }
        }
コード例 #16
0
ファイル: AppManager.cs プロジェクト: Elle199/StreamCounter
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(this);
        }

        RawKeyInput.Start(captureKeyInBackground);

        RawKeyInput.OnKeyDown += HandleKeyDown;
        RawKeyInput.OnKeyUp   += HandleKeyUp;

        keybindKeys     = new List <RawKey>();
        inputKeyStrokes = new List <RawKey>();

        if (PlayerPrefs.HasKey(keybindSaveKey))
        {
            keybind = PlayerPrefs.GetString(keybindSaveKey);
        }
    }
コード例 #17
0
ファイル: ShortcutController.cs プロジェクト: teambluboy/AMG
        private void OnApplicationQuit()
        {
#if UNITY_STANDALONE_WIN
            RawKeyInput.Stop();
#endif
        }
コード例 #18
0
    // Update is called once per frame
    void Update()
    {
        PVAResult status = m_PVACtrl.getCamraStatus();

        if (m_status != status)
        {
            m_status = status;

            if (m_bPhaseLog)
            {
                string text;
                switch (m_status)
                {
                case PVAResult.OK:
                    text = "OK"; break;

                case PVAResult.Uninitialize:
                    text = "Uninitialize"; break;

                case PVAResult.NotConnect:
                    text = "NotConnect"; break;

                case PVAResult.AlreadyRegist:
                    text = "AlreadyRegist"; break;

                case PVAResult.RegistNotFound:
                    text = "RegistNotFound"; break;

                case PVAResult.DongleNotFound:
                    text = "DongleNotFound"; break;

                case PVAResult.NoFPS:
                    text = "NoFPS"; break;

                case PVAResult.NoData:
                    text = "NoData"; break;

                default:
                    text = "Unknown"; break;
                }
                GigaTrax.Debug.Log("CamraStatus:" + text);
            }
        }
        if (m_status != PVAResult.OK)
        {
            return;
        }

        if (!m_bPortInit)
        {
            Port_Open();
            Port_DataSend("Y");             /*Motor ON*/
            Port_DataSend("SU23");          /*Upper Wheel*/
            Port_DataSend("SD23");          /*Lower Wheel*/
            m_bPortInit = true;
        }
        switch (m_nSensorPhase)
        {
        case SensorPhase_Busy: {
            int busy;
            busy = m_PVACtrl.getSysInt("Busy");
            if (busy == 0)
            {
                setSensorPhase(SensorPhase_Ready);
            }
            break;
        }

        case SensorPhase_Start: {
            PVAResult ret = m_PVACtrl.getDetect(ref m_detect);
            if (ret == PVAResult.OK)
            {
                m_PVACtrl.endBall();
                setSensorPhase(SensorPhase_Busy);

                HitRecord record = addHitRecord();
                record.strikePosX = m_detect.strike_pos.x;
                record.strikePosY = m_detect.strike_pos.y;

                m_StrikeZoneSize.x = m_PVACtrl.getSysFloat("StrikeZoneWidth");
                m_StrikeZoneSize.y = m_PVACtrl.getSysFloat("StrikeZoneHeight");

                IntPtr pData;
                if ((m_detect.flags & (int)PVAFlg.Hit) != 0)
                {
                    pData = m_detect.hit_path.data;

                    PVADetectData first = (PVADetectData)Marshal.PtrToStructure(pData, typeof(PVADetectData));
                    pData = new IntPtr(pData.ToInt64() + Marshal.SizeOf(typeof(PVADetectData)));
                    PVADetectData last = (PVADetectData)Marshal.PtrToStructure(pData, typeof(PVADetectData));

                    uint  send_time = last.time - first.time;
                    float t         = (float)1000 / (float)send_time;

                    Vector3 dir = new Vector3();
                    dir.x = last.pos.x - first.pos.x;
                    dir.y = last.pos.y - first.pos.y;
                    dir.z = last.pos.z - first.pos.z;
                    float speed = dir.magnitude * t;
                    dir.Normalize();
                    dir.z = -dir.z;

                    Vector3 pos = new Vector3(first.pos.x, first.pos.y, -first.pos.z);

                    record.result = Result_Hit;
                    record.speed  = speed * MPS2KPH;
                    record.ball   = startHit(pos, dir, speed);
                }
                else
                {
                    float half_width  = m_StrikeZoneSize.x * 0.5f;
                    float half_height = m_StrikeZoneSize.y * 0.5f;
                    if (record.strikePosX >= -half_width && record.strikePosX <= half_width &&
                        record.strikePosY >= -half_height && record.strikePosY <= half_height)
                    {
                        record.result = Result_Strike;
                    }
                    else
                    {
                        record.result = Result_Ball;
                    }
                }
                updateStrikeMark();
                updateHitRecord();
            }
            else
            {
                /*if( Input.GetMouseButtonDown(0) ){
                 *      m_PVACtrl.endBall();
                 *      setSensorPhase(SensorPhase_Busy);
                 *
                 *      startHit2();
                 * }*/
            }
            break;
        }
        }

        switch (m_nGamePhase)
        {
        case GamePhase_Busy:
            m_objCamera.fieldOfView = 54;
            m_objPitcher.setAnim(PitcherAnim.Pitcher_Idle);
            if (m_nSensorPhase == SensorPhase_Ready)
            {
                setGamePhase(GamePhase_Ready);
                m_objReady.SetActive(true);
            }
            break;

        case GamePhase_Ready:
            int nBatterSide = m_PVACtrl.getSysInt("BatterSide");
            //int nBatterSide = 1;
            m_objBatter.setBatterSide(nBatterSide);

            if (RawKeyInput.IsKeyDown(RawKey.M))
            {
                if (RawKeyInput.IsKeyDown(RawKey.RightControl) || RawKeyInput.IsKeyDown(RawKey.LeftControl))
                {
                    setGamePhase(GamePhase_CountDonw);
                    //m_objCamera.fieldOfView = 8;
                    m_objCamera.fieldOfView = 9;
                    m_objReady.SetActive(false);
                    m_objGage.SetActive(true);
                    m_bPush        = false;
                    m_bSensorStart = false;
                    m_bPitchMotion = false;
                }
            }
            break;

        case GamePhase_CountDonw: {
            m_dTime -= Time.deltaTime;

            if (!m_bPitchMotion)
            {
                if (m_dTime < PitchMotionTime)
                {
                    m_objPitcher.setAnim(PitcherAnim.Pitcher_Pitch);
                    m_bPitchMotion = true;
                }
            }
            if (!m_bSensorStart)
            {
                if (m_dTime < SensorStartTime)
                {
                    m_PVACtrl.startBall();
                    setSensorPhase(SensorPhase_Start);
                    m_bSensorStart = true;
                }
            }
            if (!m_bPush)
            {
                if (m_dTime < PushTime)
                {
                    Port_DataSend("G");                     /*Push*/
                    m_bPush = true;
                }
            }

            float ratio = m_dTime / CountDonwDuration;
            UnityEngine.UI.Image image = m_objGage.GetComponent <UnityEngine.UI.Image>();
            if (ratio < 0)
            {
                ratio = 0;
            }
            image.fillAmount = ratio;
            //prefabSpeed.text = "ratio: " + ratio.ToString("f2");

            if (ratio == 0)
            {
                //m_PVACtrl.startBall();
                //setSensorPhase( SensorPhase_Start );
                setGamePhase(GamePhase_Start);
                m_objGage.SetActive(false);
            }

            break;
        }

        case GamePhase_Start:
            m_dTime -= Time.deltaTime;

            if (m_dTime <= 0)
            {
                m_PVACtrl.endBall();
                setSensorPhase(SensorPhase_Busy);
                setGamePhase(GamePhase_Busy);
            }
            break;
        }

        int num_hit = m_HitArray.Count;

        if (num_hit != 0)
        {
            m_topView.clearNewTrail();
            m_sideView.clearNewTrail();

            int i = 0;
            while (i < num_hit)
            {
                bool    remove = false;
                HitBall hit    = m_HitArray[i];
                if (hit.ground)
                {
                    hit.dTime -= Time.deltaTime;
                    if (hit.dTime <= 0)
                    {
                        Destroy(hit.obj, 1.0f);
                        remove = true;

                        if (m_lastHit == hit)
                        {
                            if (m_smoothFollow)
                            {
                                m_smoothFollow.setTarget(null);
                            }
                            m_lastHit = null;

                            //resetView();
                            //setGamePhase( GamePhase_Busy );
                        }
                    }
                }
                else
                {
                    Vector3 pos = hit.obj.transform.localPosition;
                    hit.posArray.Add(pos);
                }
                if (remove)
                {
                    m_topView.addOldTrail(hit.posArray);
                    m_sideView.addOldTrail(hit.posArray);

                    m_HitArray.RemoveAt(i);
                    num_hit--;
                }
                else
                {
                    m_topView.addNewTrail(hit.posArray);
                    m_sideView.addNewTrail(hit.posArray);

                    i++;
                }
            }
            if (num_hit == 0)
            {
                resetView();
                setGamePhase(GamePhase_Busy);
                m_objBatter.setAnim(BatterAnim.BatterAnim_Idle);
            }
        }

        int num_info = m_HitInfoArray.Count;

        for (int i = 0; i < num_info; i++)
        {
            HitInfo info = m_HitInfoArray[i];
            updateHitInfo(info);

            info.dTime += Time.deltaTime;
            GameObject objInfo = info.objInfo;

            float ratio = info.dTime / MainSpeedLife;
            float value = 1.0f + (MainSpeedScale - 1.0f) * ratio;
            objInfo.transform.localScale = new Vector3(value, value, value);

            Vector3 pos = objInfo.transform.localPosition;
            pos.y += 0.1f;
            objInfo.transform.localPosition = pos;
        }

        if (m_smoothFollow)
        {
            if (m_smoothFollow.getTarget())
            {
                m_smoothFollow.update();
            }
        }
    }
コード例 #19
0
    // Use this for initialization
    void Start()
    {
        m_PVACtrl = new PVACtrl();
        m_PVACtrl.init();

        m_Port = new SerialPort();

        //if( Display.displays.Length > 1 )
        //	Display.displays[1].Activate();

/*
 *              // Display.displays[0] は主要デフォルトディスプレイで、常に ON。
 *              // 追加ディスプレイが可能かを確認し、それぞれをアクティベートします。
 *              if( Display.displays.Length > 1 )
 *                      Display.displays[1].Activate();
 *              Display.displays[0].Activate();
 *              //if( Display.displays.Length > 2 )
 *              //	Display.displays[2].Activate();
 */
        m_objMainCanvas = GameObject.FindWithTag("MainCanvas");
        //m_objInfo1 = m_objMainCanvas.transform.Find("Info1").gameObject;
        m_objInfo2 = m_objMainCanvas.transform.Find("Info2").gameObject;
        m_objInfo3 = m_objMainCanvas.transform.Find("Info3").gameObject;

        GameObject objBatter = GameObject.FindWithTag("Batter");

        m_objBatter = objBatter.GetComponent <BatterAnim>();

        GameObject objPitcher = GameObject.FindWithTag("Pitcher");

        m_objPitcher = objPitcher.GetComponent <PitcherAnim>();

        m_objGage = Instantiate(prefabGage);
        m_objGage.transform.SetParent(m_objMainCanvas.transform, false);
        m_objGage.SetActive(false);

        m_objReady = Instantiate(prefabReady);
        m_objReady.transform.SetParent(m_objMainCanvas.transform, false);
        m_objReady.SetActive(false);

        initHitRecord();
        initStrikeMark();

        m_objCamera    = GetComponent <Camera>();
        m_smoothFollow = GetComponent <SmoothFollow>();

        GameObject objTopView = m_objMainCanvas.transform.Find("TopView").gameObject;

        m_topView = objTopView.GetComponent <TrailView>();
        //m_topView.drawPoint = true;
        //m_topView.drawGrid();

        GameObject objSideView = m_objMainCanvas.transform.Find("SideView").gameObject;

        m_sideView = objSideView.GetComponent <TrailView>();

        bool workInBackground = true;

        RawKeyInput.Start(workInBackground);

        setGamePhase(GamePhase_Busy);
        setSensorPhase(SensorPhase_Busy);
        //m_objBatter.setBatterSide( BatterSide_None );
    }
コード例 #20
0
 private void OnDestroy()
 {
     RawKeyInput.OnKeyDown -= HandleKeyDown;
     RawKeyInput.Stop();
 }
コード例 #21
0
 private void OnEnable()
 {
     RawKeyInput.Start(WorkInBackground);
     RawKeyInput.OnKeyUp   += LogKeyUp;
     RawKeyInput.OnKeyDown += LogKeyDown;
 }
コード例 #22
0
 // Start is called before the first frame update
 void Start()
 {
     RawKeyInput.Start(true);
     RawKeyInput.OnKeyDown += LogKeyDown;
     serifManager           = FindObjectOfType <SerifManager>();
 }
コード例 #23
0
 private void OnDisable()
 {
     RawKeyInput.Stop();
     RawKeyInput.OnKeyDown -= LogKeyDown;
 }
コード例 #24
0
ファイル: test.cs プロジェクト: Takomonake/test
    public int a;                               //配列番号取得?用変数

    private void OnEnable()
    {
        RawKeyInput.Start(true);
        RawKeyInput.OnKeyUp   += OnKeyUp;
        RawKeyInput.OnKeyDown += OnKeyDown;
    }