示例#1
0
        /// <summary>
        ///     Allows the game to run logic such as updating the world,
        ///     checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (!IsReadyToUpdate)
            {
                return;
            }

            // Update the time since the last frame and the game's clock.
            TimeSinceLastFrame  = gameTime.ElapsedGameTime.TotalMilliseconds;
            TimeRunningPrecise += gameTime.ElapsedGameTime.TotalMilliseconds;

            Drawable.ResetTotalDrawnCount();

            // Keep the window updated with the current resolution.
            WindowManager.Update();
            MouseManager.Update();
            KeyboardManager.Update();
            JoystickManager.Update();
            ScreenManager.Update(gameTime);
            AudioManager.Update(gameTime);

            // Update the global sprite container
            GlobalUserInterface.Update(gameTime);

            // Keep the RPC client up-to-date.
            DiscordManager.Client?.Invoke();
            LogManager.Update(gameTime);
            Logger.Update();

            base.Update(gameTime);
        }
示例#2
0
        public async Task GetAllJoysticks()
        {
            var rep  = CreateMock <IDynItemController>();
            var ctrl = new JoystickManager(rep);

            rep.GetAll(typeof(Joystick)).Returns(
                new[]
            {
                new DynItem {
                    ItemId = 1, Name = "Entry1"
                }
            });
            rep.Create(1).Returns(new Joystick {
                SerialServer = "Entry1", Id = 1, SerialServerUser = "******"
            });

            var all = (await ctrl.GetAll()).ToList();

            all.Should().HaveCount(1);

            var first = all.First();

            first.Id.Should().Be(1);
            first.SerialServer.Should().Be("Entry1");
            first.SerialServerUser.Should().Be("HA");
        }
示例#3
0
 private void Start()
 {
     characterController = GetComponent <CharacterController>();
     _joyManager         = new JoystickManager(PlayerNumber);
     _animator           = GetComponent <Animator>();
     _playerLayer        = LayerMask.NameToLayer("Player");
 }
示例#4
0
 private void Awake()
 {
     m_ARPlacementManager = GetComponent <ARPlacementManager>();
     m_ARPlaneManager     = GetComponent <ARPlaneManager>();
     m_basicClickDropTest = GetComponent <BasicClickDropTest>();
     m_basicSpawnManager  = GetComponent <BasicSpawnManager>();
     m_JoystickManager    = wheelSelector.GetComponent <JoystickManager>();
 }
示例#5
0
        public bool IsDown()
        {
            float Axis = JoystickManager.GetAxis(JoystickNumber, AxisNumber);

            //Ensure that it is the same sign as the threshold, and beyond it.
            return((Math.Abs(Axis) >= Math.Abs(Threshold)) &&
                   (Math.Sign(Axis) == Math.Sign(Threshold)));
        }
示例#6
0
 private void Awake()
 {
     if (instance && instance != this)
     {
         Destroy(gameObject); return;
     }
     instance = this;
 }
示例#7
0
    void Start()
    {
        jm = JoystickManager.Instance;

        Frecce_Curve_Starting_Position = Frecce_Curve.transform.position;
        Frecce_Curve_Starting_Scale    = Frecce_Curve.transform.localScale;
        Frecce_Quad_Starting_Position  = Frecce_Quad.transform.position;
        Frecce_Quad_Starting_Scale     = Frecce_Quad.transform.localScale;

        StartingMaterial = Freccia_Nord_Curve.GetComponent <Renderer>().material;
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#9
0
 void Awake()
 {
     if (_sSingleton != null && _sSingleton != this)
     {
         Destroy(this);
     }
     else
     {
         _sSingleton = this;
     }
 }
示例#10
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
 }
示例#11
0
 static public int GetInstance_s(IntPtr l)
 {
     try {
         var ret = JoystickManager.GetInstance();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#12
0
    void Start()
    {
        m_JoystickManager = wheelSelector.GetComponent <JoystickManager>();

        // GameObject avatar = PhotonNetwork.Instantiate("AR_Avatar_BasicCube", ARCam.transform.position + new Vector3(0f, 1f, 0f), Quaternion.identity);
        // avatar.transform.parent = ARCam.transform.parent;
        //not getting the floor plan offset... //i dont need to? why did i write that? ah well i don't need to if they have the same floor plan location/rotation... i think
        // if (PhotonNetwork.CurrentRoom.PlayerCount == 1)
        //     wasFirst = true;
        // else
        //     Debug.Log(PhotonNetwork.CurrentRoom.PlayerCount);
        // Debug.Log(selectedFurniture);
    }
示例#13
0
        public async Task GetJoystickNull()
        {
            var rep  = CreateMock <IDynItemController>();
            var ctrl = new JoystickManager(rep);

            rep.Create(1).Returns(new Joystick {
                SerialServer = "Entry1", Id = 1, SerialServerUser = "******"
            });

            var all = await ctrl.Get(2);

            all.Should().BeNull();
        }
示例#14
0
        public async Task DeleteJoystick()
        {
            var rep  = CreateMock <IDynItemController>();
            var ctrl = new JoystickManager(rep);

            var joystick = new Joystick {
                SerialServer = "Entry1", Id = 1, SerialServerUser = "******"
            };

            await ctrl.Delete(joystick).ConfigureAwait(false);

            await rep.Received().Delete(Arg.Is <int>(x => x == 1));
        }
示例#15
0
        public async Task UpdateJoystick()
        {
            var rep  = CreateMock <IDynItemController>();
            var ctrl = new JoystickManager(rep);

            var joystick = new Joystick {
                SerialServer = "Entry1", Id = 1, SerialServerUser = "******"
            };

            await ctrl.Update(joystick);

            await rep.Received().Save(Arg.Is <int>(x => x == 1), Arg.Is <string>(x => x == "Joystick1"), Arg.Is <Joystick>(x => x.SerialServer == "Entry1" && x.SerialServerUser == "HA"));
        }
    // ========================================================
    // Input
    // ========================================================

    void InitJoystickManager()
    {
        // NOTE: We could do it using Kichen events, but prefer a dependency-free implementation since is already done
        JoystickManager joystickManager = FindObjectOfType <JoystickManager>();

        joystickManager.onDirection   += SetDirection;
        joystickManager.onButtonADown += SetButtonADown;
        joystickManager.onButtonBDown += SetButtonBDown;
        joystickManager.onButtonCDown += SetButtonCDown;
        joystickManager.onButtonAUp   += SetButtonAUp;
        joystickManager.onButtonBUp   += SetButtonBUp;
        joystickManager.onButtonCUp   += SetButtonCUp;
    }
示例#17
0
 static public int constructor(IntPtr l)
 {
     try {
         JoystickManager o;
         o = new JoystickManager();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#18
0
 static public int DeleteKeyEvent(IntPtr l)
 {
     try {
         JoystickManager     self = (JoystickManager)checkSelf(l);
         UnityEngine.KeyCode a1;
         checkEnum(l, 2, out a1);
         self.DeleteKeyEvent(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#19
0
 static public int AddKeyEvent(IntPtr l)
 {
     try {
         JoystickManager     self = (JoystickManager)checkSelf(l);
         UnityEngine.KeyCode a1;
         checkEnum(l, 2, out a1);
         SLua.LuaFunction a2;
         checkType(l, 3, out a2);
         self.AddKeyEvent(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#20
0
    IEnumerator Start()
    {
        // 入力を受け付けるコントローラー情報をまとめて取得
        var joysticks = _joysticks.Select(i => JoystickManager.GetJoystick(i));

        // 最初のボタンのサイズを大きくしておく
        buttonIndex = 0;
        ChangeButtonState(buttonIndex, _buttonScale, _selected);

        // 直前フレームの入力を記憶
        int previousInput = 0;

        while (isActiveAndEnabled)
        {
            yield return(null);

            // 決定ボタンの状態を取得
            isPushApplyButton = IsPushApplyButton(joysticks);

            // 待機状態ならコントローラー入力を受け付けない
            if (isStop)
            {
                continue;
            }

            // 決定ボタンが押されたとき、イベント登録されたボタンなら実行
            if (isPushApplyButton && ExistCallBackEvents())
            {
                _buttons[buttonIndex].onClick.Invoke();
            }

            // いずれかのコントローラーからの入力を受け付けたら実行
            var currentInput = GetAxisToInt(joysticks);
            if (currentInput != 0 && previousInput == 0)
            {
                // 移動前のインデックスにあるボタンの状態を戻す
                ChangeButtonState(buttonIndex, 1f, _normal);

                // インデックスを移動、ボタンの状態を更新する
                buttonIndex = MoveIndex(currentInput);
                ChangeButtonState(buttonIndex, _buttonScale, _selected);
            }

            previousInput = currentInput;
        }
    }
示例#21
0
    void Update()
    {
        var rigidbody = GetComponent <Rigidbody>();
        var velocity  = rigidbody.velocity;

        //  Input.Axis
        var leftStick = JoystickManager.GetAxis();

        velocity.x = leftStick.x * moveSpeed * Time.deltaTime;

        //  Input.GetButton
        if (JoystickManager.GetButtonDown(0))
        {
            velocity.y = jumpVelocity;
        }

        rigidbody.velocity = velocity;
    }
示例#22
0
    // Use this for initialization
    public void Init()
    {
        UIPackage.AddPackage("FairyGUI/UIMain");
        UIObjectFactory.SetPackageItemExtension("ui://UIMain/BuildItem", typeof(BuildItem));
        UIObjectFactory.SetPackageItemExtension("ui://UIMain/SkillItem", typeof(SkillItem));

        UIObjectFactory.SetPackageItemExtension("ui://UIMain/DetailPanel", typeof(BuildDetail));

        UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerDamageItem", typeof(TowerDamageItem));
        UIObjectFactory.SetPackageItemExtension("ui://UIMain/TowerSkillItem", typeof(TowerSkillItem));
        _mainView = this.GetComponent <UIPanel> ().ui;
        _joystick = new JoystickManager(_mainView);
        _joystick.onMove.Add(handleMove);
        _joystick.onEnd.Add(handleMoveEnd);


        _skillView = new SkillView(_mainView);
        _buildBtn  = _mainView.GetChild("build").asCom;
        _buildWin  = new BuildWindow();
        _hp_bar    = _mainView.GetChild("hpBar").asCom;
        _buildBtn.onClick.Add(() => { _buildWin.Show(); });

        _potions [0] = _mainView.GetChild("potion_0").asCom;
        _potions [1] = _mainView.GetChild("potion_1").asCom;
        _potions [2] = _mainView.GetChild("potion_2").asCom;
        for (int i = 0; i < 3; i++)
        {
            int ii = i;
            _potions [i].onTouchBegin.Add(delegate() {
                BattleManager.getInstance().useItem(ii);
            });
        }
        _battleFinishWindow = new BattleFinishWindow();


        GRoot.inst.onSizeChanged.Add(onWindowResize);
        BuildButtonPosInScreen = GRoot.inst.LocalToGlobal(_buildBtn.position);

        _enemy_left = _mainView.GetChild("enemy_left").asTextField;

        _coins0 = _mainView.GetChild("coins0").asTextField;
        _coins1 = _mainView.GetChild("coins1").asTextField;
        _coins2 = _mainView.GetChild("coins2").asTextField;
    }
示例#23
0
    IEnumerator Start()
    {
        var joystick = JoystickManager.GetJoystick(_joystickIndex);
        var audio    = GetComponent <AudioClipPlayer>();

        isApply  = false;
        isCancel = false;

        // UI を初期化する
        var state = _joystickIndex.GetState();

        _ui.ChangePlayerState(state.isPlayer);
        _ui.SwitchState(isApply);

        while (isActiveAndEnabled)
        {
            yield return(null);

            if (isStop)
            {
                continue;
            }

            // キャンセルボタンの判定を取得
            isCancel = joystick.IsPush(Joystick.AxisType.Cancel);

            // 決定ボタンが押されていれば、状態切り替えをスキップ
            if (isApply)
            {
                // キャンセルボタンが押されたら、切り替え判定を再開
                if (isCancel)
                {
                    isApply  = false;
                    isCancel = false;
                    audio.Play(_seCancel);
                    _ui.SwitchState(isApply);
                }
                continue;
            }

            // 決定ボタンが押されていない状態でキャンセルボタンが押されたらスキップ
            if (isCancel)
            {
                audio.Play(_seCancel); continue;
            }

            // 決定ボタン
            if (joystick.IsPush(Joystick.AxisType.Attack))
            {
                isApply = true;
                audio.Play(_seApply);
                _ui.SwitchState(isApply);
                continue;
            }

            // X ボタンが押されたらプレイヤーの状態を切り替える
            if (joystick.IsPush(Joystick.AxisType.Super))
            {
                state.isPlayer = !state.isPlayer;
                _ui.ChangePlayerState(state.isPlayer);

                audio.Play(_seSelect);
            }
        }
    }
示例#24
0
 private void Start()
 {
     // PhotonNetwork.OfflineMode = true;
     controllerListener = GameObject.Find("ControllerListener").GetComponent <JoystickManager>();
 }
示例#25
0
 public bool IsUp()
 {
     return(JoystickManager.IsUp(JoystickNumber, ButtonNumber));
 }
示例#26
0
 public bool IsReleased()
 {
     return(JoystickManager.IsReleased(JoystickNumber, ButtonNumber));
 }
示例#27
0
 private static void ConsoleManagerOnConsoleClosing(object o, EventArgs args)
 {
     JoystickManager.Reset();
     GameManager.OverlayProcess.OverlayInterface.Disconnect();
 }
示例#28
0
        private static void Main()
        {
            Console.WriteAscii("ETS2 Brake Sys", Color.MediumSpringGreen);
            Console.WriteLine($"Version: {Assembly.GetEntryAssembly().GetName().Version}", Color.LimeGreen);

            if (!Settings.Load("config.json"))
            {
                Report.Info("Do you wish to generate a configuration file (config.json)?");

                while (true)
                {
                    var response = Console.ReadLine().ToLower();
                    if (response == "y" || response == "yes")
                    {
                        try
                        {
                            Settings.Save("config.json");
                        }
                        catch (Exception ex)
                        {
                            Report.Error($"Failed to save config file. {ex.Message}");
                        }
                        break;
                    }
                    if (response == "n" || response == "n")
                    {
                        Report.Error("Failed loading the configuration file. Using default instead (5)");
                        break;
                    }

                    Report.Error("Sorry, type (y)es/(n)o only");
                }
            }
            if (!JoystickManager.ValidateAndStart())
            {
                return;
            }

            Report.Success("Joystick have been acquired");

            JoystickManager.Reset();
            HotKeyManager.Loaded += HotKeyManagerOnLoaded;
            ConsoleManager.Enable();
            ConsoleManager.ConsoleClosing += ConsoleManagerOnConsoleClosing;
            UpdateManager.CheckForUpdates();
            GameManager.Settings = Settings;

            try
            {
                Settings.Save("config.json");
            }
            catch (Exception ex)
            {
                Report.Error($"Failed to save config file. {ex.Message}");
            }

            if (Settings.IsIncreaseRatioEnabled)
            {
                Settings.ResetIncreaseRatioTimeSpan = new TimeSpan(0, 0, 0, 1, 0);
            }

            GameManager.HookLoop();
        }
示例#29
0
 void Start()
 {
     joystickManager   = FindObjectOfType <JoystickManager>();
     joystickContainer = GetComponent <Image>();
     joystick          = transform.GetChild(0).GetComponent <Image>(); //this command is used because there is only one child in hierarchy
 }
示例#30
0
 void Start()
 {
     joystickManager = FindObjectOfType <JoystickManager>(); //Find("JoystickManager").GetComponent<JoystickManager>();
 }