// Use this for initialization void Start() { initialOffsetPosition = transform.position - player.position; initialOffsetRotation = transform.rotation.eulerAngles.z; initialOffsetScale = Camera.main.orthographicSize; playerInput = player.GetComponent <InputManagerBase>(); }
public virtual float GetValue(InputManagerBase manager) { float negativeValue = ((NegativeButton != null) ? NegativeButton.GetValue(manager) : 0.0f); float positiveValue = (PositiveButton != null) ? PositiveButton.GetValue(manager) : 0.0f; return(positiveValue - negativeValue); }
public virtual void Create() { if (InputManagerScript == null) { InputManagerScript = Main.input; } enabled = false; Valid = false; }
protected void Start() { resource = GetComponent <EnergyController>(); input = GetComponentInChildren <InputManagerBase>(); animator = GetComponent <Animator>(); movement = GetComponent <PlayerMovement>(); body = GetComponent <Rigidbody2D>(); indicators = GetComponentInChildren <CharacterUiIndicator>(); //InitDagger(); }
public override void Initialize() { base.Initialize(); input = Services.GetServiceAs <InputManager>(); Enabled = true; Visible = false; if (Game != null) // thumbnail system has no game { Game.Activated += OnApplicationResumed; Game.Deactivated += OnApplicationPaused; } }
public override void Initialize() { base.Initialize(); input = Services.GetServiceAs<InputManager>(); Enabled = true; Visible = false; if (Game != null) // thumbnail system has no game { Game.Activated += OnApplicationResumed; Game.Deactivated += OnApplicationPaused; } }
public override void Initialize() { base.Initialize(); input = Services.GetSafeServiceAs <InputManager>(); VirtualResolution = new Vector3(GraphicsDevice.BackBuffer.ViewWidth, GraphicsDevice.BackBuffer.ViewHeight, 1000); Enabled = true; Visible = true; Game.Window.ClientSizeChanged += WindowOnClientSizeChanged; Game.Activated += OnApplicationResumed; Game.Deactivated += OnApplicationPaused; }
private void StartModules(StartOptions args, ISServerDependencies dependencies) { cbManager = args.HasArg(StartArguments.NoClipboard) ? new NullClipboardManager() : dependencies.ClipboardManager; dragDropMan = args.HasArg(StartArguments.NoDragDrop) ? new NullDragDropManager() : dependencies.DragDropManager; inputMan = dependencies.InputManager; outMan = dependencies.OutputManager; displayMan = dependencies.DisplayManager; cbController = new GlobalClipboardController(cbManager, clientMan); ddController = new GlobalDragDropController(dragDropMan, clientMan); fileController = new FileAccessController(); inputController = new GlobalInputController(clientMan, inputMan, udpHost); cbManager.Start(); dragDropMan.Start(); inputMan.Start(); outMan.Start(); displayMan.Start(); }
public override float GetValue(InputManagerBase manager) { int index = (Id & TypeIdMask); if (index < 5) { if (manager.IsMouseButtonDown((MouseButton)index)) { return 1.0f; } } else if (index == 5) { return manager.MousePosition.X; } else if (index == 6) { return manager.MousePosition.Y; } return 0.0f; }
/// <summary> /// Starts swap animation before getting server response /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="direction"></param> private void PreAnimateSwap(int x, int y, BlockSwipeDirection direction) { Block blockFrom = mainField.Blocks[x, y]; Vector2Int newXY = InputManagerBase.GetPosition(x, y, direction); Block blockTo = mainField.Blocks[newXY.x, newXY.y]; int w = mainField.Blocks.GetLength(0); int h = mainField.Blocks.GetLength(1); Vector2 oldPosition = blockFrom.transform.position; float newx = PlayerFieldCenter.position.x + (newXY.x - w / 2F + 0.5F) * PlayerFieldScale; float newy = PlayerFieldCenter.position.y + (newXY.y - h / 2F + 0.5F) * PlayerFieldScale; blockFrom.transform.position = new Vector3(newx, newy); blockFrom.AnimateSwap(oldPosition); oldPosition = blockTo.transform.position; newx = PlayerFieldCenter.position.x + (x - w / 2F + 0.5F) * PlayerFieldScale; newy = PlayerFieldCenter.position.y + (y - h / 2F + 0.5F) * PlayerFieldScale; blockFrom.transform.position = new Vector3(newx, newy); blockFrom.AnimateSwap(oldPosition); }
public override float GetValue(InputManagerBase manager) { var state = manager.GetGamePad(PadIndex); var index = (int)(Id & TypeIdMask); if (index <= 15) { if ((state.Buttons & (GamePadButton)(1 << index)) != 0) { return(1.0f); } } else { switch (index) { case 16: return(state.LeftThumb.X); case 17: return(state.LeftThumb.Y); case 18: return(state.RightThumb.X); case 19: return(state.RightThumb.Y); case 20: return(state.LeftTrigger); case 21: return(state.RightTrigger); } } return(0.0f); }
public override float GetValue(InputManagerBase manager) { int index = (Id & TypeIdMask); if (index < 5) { if (manager.IsMouseButtonDown((MouseButton)index)) { return(1.0f); } } else if (index == 5) { return(manager.MousePosition.X); } else if (index == 6) { return(manager.MousePosition.Y); } return(0.0f); }
public abstract float GetValue(InputManagerBase manager);
public override float GetValue(InputManagerBase manager) { var index = Id & TypeIdMask; return manager.IsKeyDown((Keys)index) ? 1.0f : 0.0f; }
private void InterpretKey(Keys key, InputManagerBase input) { // delete and back space have same behavior when there is a selection if (SelectionLength > 0 && (key == Keys.Delete || key == Keys.Back)) { SelectedText = ""; return; } // backspace with caret if (key == Keys.Back) { selectionStart = Math.Max(0, selectionStart - 1); SelectedText = ""; return; } // delete with caret if (key == Keys.Delete) { SelectionLength = 1; SelectedText = ""; return; } // select backward if (key == Keys.Left && (input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift))) { if (caretAtStart || selectionStart == selectionStop) { Select(selectionStart - 1, SelectionLength + 1, true); } else { Select(selectionStart, SelectionLength - 1); } return; } // select forward if (key == Keys.Right && (input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift))) { if (caretAtStart && selectionStart != selectionStop) { Select(selectionStart + 1, SelectionLength - 1, true); } else { Select(selectionStart, SelectionLength + 1); } return; } // move backward if (key == Keys.Left) { CaretPosition = CaretPosition - 1; return; } // move forward if (key == Keys.Right) { CaretPosition = CaretPosition + 1; return; } // validate the text with "enter" or "escape" if (key == Keys.Enter || key == Keys.Escape) { IsSelectionActive = false; return; } // try to convert the key to character and insert it at the caret position or replace the current selection var character = '\0'; if (TryConvertKeyToCharacter(key, input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift), ref character)) { SelectedText = new string(character, 1); } }
public GlobalInputController(ClientManager clientManager, InputManagerBase inputManager, ISUdpServer udp) { udpHost = udp; inputMan = inputManager; clientMan = clientManager; }
/// <summary> /// Gets the value for a particular binding. /// </summary> /// <returns>Value of the binding</returns> public virtual float GetValue(InputManagerBase manager) { return Button != null ? Button.GetValue(manager) : 0.0f; }
private void InterpretKey(Keys key, InputManagerBase input) { // delete and back space have same behavior when there is a selection if (SelectionLength > 0 && (key == Keys.Delete || key == Keys.Back)) { SelectedText = ""; return; } // backspace with caret if (key == Keys.Back) { selectionStart = Math.Max(0, selectionStart - 1); SelectedText = ""; return; } // delete with caret if (key == Keys.Delete) { SelectionLength = 1; SelectedText = ""; return; } // select backward if (key == Keys.Left && (input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift))) { if (caretAtStart || selectionStart == selectionStop) Select(selectionStart - 1, SelectionLength + 1, true); else Select(selectionStart, SelectionLength - 1); return; } // select forward if (key == Keys.Right && (input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift))) { if (caretAtStart && selectionStart != selectionStop) Select(selectionStart + 1, SelectionLength - 1, true); else Select(selectionStart, SelectionLength + 1); return; } // move backward if (key == Keys.Left) { CaretPosition = CaretPosition - 1; return; } // move forward if (key == Keys.Right) { CaretPosition = CaretPosition + 1; return; } // validate the text with "enter" or "escape" if (key == Keys.Enter || key == Keys.Escape) { IsSelectionActive = false; return; } // try to convert the key to character and insert it at the caret position or replace the current selection var character = '\0'; if (TryConvertKeyToCharacter(key, input.IsKeyDown(Keys.LeftShift) || input.IsKeyDown(Keys.RightShift), ref character)) SelectedText = new string(character, 1); }
public override float GetValue(InputManagerBase manager) { var index = Id & TypeIdMask; return(manager.IsKeyDown((Keys)index) ? 1.0f : 0.0f); }
public override float GetValue(InputManagerBase manager) { var state = manager.GetGamePad(PadIndex); var index = (int)(Id & TypeIdMask); if (index <= 15) { if ((state.Buttons & (GamePadButton)(1 << index)) != 0) { return 1.0f; } } else { switch (index) { case 16: return state.LeftThumb.X; case 17: return state.LeftThumb.Y; case 18: return state.RightThumb.X; case 19: return state.RightThumb.Y; case 20: return state.LeftTrigger; case 21: return state.RightTrigger; } } return 0.0f; }
/// <summary> /// Gets the value for a particular binding. /// </summary> /// <returns>Value of the binding</returns> public virtual float GetValue(InputManagerBase manager) { return(Button != null?Button.GetValue(manager) : 0.0f); }
public virtual float GetValue(InputManagerBase manager) { float negativeValue = ((NegativeButton != null) ? NegativeButton.GetValue(manager) : 0.0f); float positiveValue = (PositiveButton != null) ? PositiveButton.GetValue(manager) : 0.0f; return positiveValue - negativeValue; }