public Paddle(ContentManager theContent, string theAssetName, Input theInput, PaddlePosition thePosition) : base(theContent, theAssetName) { SourceRectangle = new Rectangle(0, 0, 1, 1); Scale = new Vector2(10.0f, 100.0f); mColor = Color.SlateBlue; mPaddlePosition = thePosition; switch (thePosition) { case PaddlePosition.Left: { Boundary = new Rectangle(140, 185, 10, 833); break; } case PaddlePosition.Right: { Boundary = new Rectangle(1130, 185, 10, 833); break; } } Position = Center(Boundary); mInput = theInput; }
protected override void Update(TimeSpan gameTime) { input = WaveServices.Input; if (input.KeyboardState.IsConnected) { keyboardState = input.KeyboardState; if (keyboardState.W == ButtonState.Pressed) { MoveCamera(ref forward); } if (keyboardState.S == ButtonState.Pressed) { MoveCamera(ref back); } if (keyboardState.A == ButtonState.Pressed) { MoveCamera(ref left); } if (keyboardState.D == ButtonState.Pressed) { MoveCamera(ref right); } } var rotationMatrix = (Matrix.CreateRotationX(MathHelper.ToRadians(45.0f)) * Matrix.CreateRotationY(MathHelper.ToRadians(30.0f))); Vector3 transformedReference = Vector3.Transform(Vector3.Down, rotationMatrix); Vector3 cameraLookat = Camera.Position + transformedReference; var width = WaveServices.Platform.ScreenWidth / 24; var height = WaveServices.Platform.ScreenHeight / 24; //camera.Projection = Matrix.CreateOrthographic(width, height, camera.NearPlane, camera.FarPlane); Camera.LookAt = cameraLookat; }
public Level(Input input, TextureManager textureManager, PersistantGameData gameData) { _input = input; _gameData = gameData; _textureManager = textureManager; _effectsManager = new EffectsManager(_textureManager); _playerCharacter = new PlayerCharacter(_textureManager, _bulletManager); // -1300 is bad for two reasons // 1. It's a magic number in the middle of the code // 2. It's based on the size of the form but doesn't directly reference the size of the form // this means duplication and two places to edit the code if the form size changes. // The form size and the enemy manager play area size should both get their value // from one central place. _enemyManager = new EnemyManager(_textureManager, _effectsManager, _bulletManager, _playerCharacter, -1300); _background = new ScrollingBackground(textureManager.Get("background")); _background.SetScale(2, 2); _background.Speed = 0.15f; _backgroundLayer = new ScrollingBackground(textureManager.Get("background_layer_1")); _backgroundLayer.Speed = 0.1f; _backgroundLayer.SetScale(2.0, 2.0); }
public bool OnRaycastHitchanged(Input input, QbMatrix matrix, RaycastHit hit, ref Colort color, MouseButtonEventArgs e) { if ((e != null && e.IsPressed && e.Button == MouseButton.Left) || (e == null && input.mousedown(MouseButton.Left))) { QbMatrix mat = Singleton<QbManager>.INSTANCE.ActiveModel.matrices[hit.matrixIndex]; if (mat != null) { Voxel voxel; if (mat.voxels.TryGetValue(mat.GetHash(hit.x, hit.y, hit.z), out voxel)) { for (int i = 0; i < 10; i++) { var colorpal = Singleton<GUI>.INSTANCE.Get<EmptyWidget>(GUIID.START_COLOR_SELECTORS + i); if ((bool)colorpal.customData["active"]) { colorpal.appearence.Get<PlainBackground>("background").color = mat.colors[voxel.colorindex]; Singleton<GUI>.INSTANCE.Dirty = true; Singleton<BrushManager>.INSTANCE.brushColor = mat.colors[voxel.colorindex]; Color4 colorr = mat.colors[voxel.colorindex]; Singleton<Broadcaster>.INSTANCE.Broadcast(Message.ColorSelectionChanged, colorpal, colorr); } } } } return true; } return false; }
public override void HandleInput(Input input) { if (input.IsKeyDown(Keys.Q)) { move(8); } }
protected override void Update(TimeSpan gameTime) { inputService = WaveServices.Input; if (inputService.KeyboardState.IsConnected) { if (inputService.KeyboardState.D1 == ButtonState.Pressed && beforeKeyboardState.D1 != ButtonState.Pressed && state != State.PICK) { Entity e = EntityManager.Find("MainCamera"); LaunchBehavior behavior = e.FindComponent<LaunchBehavior>(); if (behavior != null) { behavior.Reset(); e.RemoveComponent<LaunchBehavior>(); } e.AddComponent(new PickingBehavior()); state = State.PICK; } else if (inputService.KeyboardState.D2 == ButtonState.Pressed && beforeKeyboardState.D2 != ButtonState.Pressed && state != State.LAUNCH) { Entity e = EntityManager.Find("MainCamera"); e.RemoveComponent<PickingBehavior>(); e.AddComponent(new LaunchBehavior()); state = State.LAUNCH; } Labels.Add("CameraState", this.state.ToString()); } beforeKeyboardState = inputService.KeyboardState; }
public override void OnInputChange(Input input) { if (input == Inputs[0] && input.Value != null) { Values.Push(input.Value); Outputs[1].Value = Values.Count.ToString(); UpdateMeInDb(); } if (input == Inputs[1] && input.Value =="1") { LogInfo($"{ Outputs[0].Name}: [{ input.Value ?? "NULL"}]"); Outputs[0].Value = Values.Any()? Values.Pop():null; Outputs[1].Value = Values.Count.ToString(); UpdateMeInDb(); } if (input == Inputs[2] && input.Value == "1") { LogInfo($"Clear"); Values.Clear(); Outputs[1].Value = Values.Count.ToString(); UpdateMeInDb(); } }
void Handle(Input.Buy input) { var order = new Billing.Order(); order.Offer = (Billing.Offer)this.Data; order.DateTime = DateTime.Now; Transaction.Commit(); }
public PlayerCharacter(TextureManager textureManager, Input input, bool current) { _input = input; _current = current; _sprite.Texture = textureManager.Get("phagocyte"); _sprite.SetScale(_scale, _scale); }
public WeatherReport(Input userInput, MeteoData meteoData) { this.userInput = userInput; this.meteoData = meteoData; this.meteoData.addObserver(this); showWeatherReport(); }
public ByAttribute(By by, string attributeName, string attributeValue, Func<string, string, bool> attrComparisonMethod, Input input = Input.Type, bool visibleOnly = true) : base(by, input, visibleOnly) { Attributes = new Dictionary<string, string>(); Attributes.Add(attributeName, attributeValue); ComparisonMethod = attrComparisonMethod; }
// OnProcessInput protected override void OnProcessInput(Input input) { if (input.ButtonJustPressed((int)E_UiButton.A)) { if (Menu.GetByValue() == 0) { NugettaHandler connection = MyNugettaHandler.getInstance(); connection.FindGames((GetGamesResponse response) => { List<NGame> list = response.getGames(); _UI.Screen.AddScreen(new JoinGame(list)); }); //_UI.Screen.AddScreen(new Screen_Popup(E_PopupType.NewGame)); } else if (Menu.GetByValue() == 1) { _UI.Screen.SetNextScreen(null); } else if (Menu.GetByValue() == 2) { _UI.Screen.SetNextScreen(new Screen_Options()); } else if (Menu.GetByValue() == 3) { _UI.Screen.AddScreen(new Screen_Popup(E_PopupType.Quit)); } } else if (input.ButtonJustPressed((int)E_UiButton.B)) { SetScreenTimers(0.0f, 0.5f); _G.UI.SS_FromMainMenu = true; _UI.Screen.SetNextScreen(new Screen_Start()); } }
/// <summary> /// Update Method /// </summary> /// <param name="gameTime"></param> protected override void Update(TimeSpan gameTime) { this.input = WaveServices.Input; // if (this.input.KeyboardState.IsConnected) { this.keyboardState = this.input.KeyboardState; if (revoluteJoint != null) { // A, D, S Keyboard Control (left, right, stop motor) if (this.keyboardState.A == ButtonState.Pressed) { if (revoluteJoint.MotorSpeed + motorSpeed <= maxSpeed) { revoluteJoint.MotorSpeed += motorSpeed; } } else if (this.keyboardState.D == ButtonState.Pressed) { if (revoluteJoint.MotorSpeed - motorSpeed >= -maxSpeed) { revoluteJoint.MotorSpeed -= motorSpeed; } } else if (this.keyboardState.S == ButtonState.Pressed) { revoluteJoint.MotorSpeed = 0.0f; } } } }
public override void OnInputChange(Input input) { var r = (int) double.Parse(Inputs[0].Value); var g = (int) double.Parse(Inputs[1].Value); var b = (int) double.Parse(Inputs[2].Value); if (r < 0 || r > 255) { LogIncorrectInputValueError(Inputs[0]); ResetOutputs(); return; } if (g < 0 || g > 255) { LogIncorrectInputValueError(Inputs[1]); ResetOutputs(); return; } if (b < 0 || b > 255) { LogIncorrectInputValueError(Inputs[2]); ResetOutputs(); return; } var result = r.ToString("X2") + g.ToString("X2") + b.ToString("X2"); Outputs[0].Value = result; }
public void InputsOnDifferentStrings_AtTheSamePosition_AreNotEqual() { var p = 2; var i1 = new Input("Algo", p); var i2 = new Input("Nada", p); Assert.AreNotEqual(i1, i2); }
public void InputsOnTheSameString_AtDifferentPositions_AreNotEqual() { var s = "Nada"; var i1 = new Input(s, 1); var i2 = new Input(s, 2); Assert.AreNotEqual(i1, i2); }
public MainScene(ContentManager content, GraphicsDeviceManager graphicsManager) { Stuff.Initialize(content, graphicsManager); graphics = graphicsManager; onScreenMessages = new OnScreenMessages(); Camera2d.Position = Stuff.ScreenCenter; input = new Input(); characters = new List<Character>(); player = new Player(characters); debugTiles = new List<Sprite>(); for (int i = -10; i < 30; i++) { Sprite s = new Sprite("SpriteSheet"); s.Source = new Rectangle(1 * 150, 9 * 150, 150, 150); s.Position = new Vector2(i * 150, 400); debugTiles.Add(s); } for (int i = 0; i < 100; i++) { Sprite tempSprite = new Sprite("SpriteSheet"); tempSprite.Source = new Rectangle(11 * 150, 9 * 150, 150, 150); tempSprite.Position = new Vector2(150*i, 250 + (-150*i)); debugTiles.Add(tempSprite); } }
public void AdvancingInputAtEOL_ResetsColumnNumber() { var i = new Input("\nabc"); var j = i.Advance(); Assert.AreEqual(2, j.Line); Assert.AreEqual(1, j.Column); }
public Transaction(int version, Input[] inputs, Output[] outputs, uint lockTime) { Version = version; Inputs = inputs; Outputs = outputs; LockTime = lockTime; }
void Handle(Input.Clear Action) { Cleaner cleaner = new Cleaner(); string[] tables = this.Tables.Where(x => x.Selected).Select(x => x.FullName).ToArray(); cleaner.Clear(tables); }
// ProcessInput public void ProcessInput( Input input ) { for ( int i = 0; i < Widgets.Count; ++i ) Widgets[ i ].ProcessInput( input ); OnProcessInput( input ); }
public override void OnInputChange(Input input) { var a = double.Parse(Inputs[0].Value); var b = double.Parse(Inputs[1].Value); Outputs[0].Value = a < b ? "1" : "0"; }
protected override void Initialize() { input = new Input(); // State input.AddKeyBinding("quit", Keys.Escape); // Camera input.AddKeyBinding("zoom_out", Keys.Q); input.AddKeyBinding("zoom_in", Keys.E); input.AddKeyBinding("pan_up", Keys.W); input.AddKeyBinding("pan_down", Keys.S); input.AddKeyBinding("pan_left", Keys.A); input.AddKeyBinding("pan_right", Keys.D); // ColorMaps input.AddKeyBinding("toggle_coloring", Keys.Tab); input.AddKeyBinding("cycle_map", Keys.Tab, Modifier.Shift); input.AddKeyBinding("generate_random_map", Keys.Space); // Pen input.AddKeyBinding("pen_add", MouseButton.Left); input.AddKeyBinding("pen_sub", MouseButton.Right); input.AddKeyBinding("pen_size_inc", Keys.Up); input.AddKeyBinding("pen_size_dec", Keys.Down); input.AddKeyBinding("pen_pressure_inc", Keys.Right); input.AddKeyBinding("pen_pressure_dec", Keys.Left); //Map Size input.AddKeyBinding("map_size_inc", Keys.OemCloseBrackets); input.AddKeyBinding("map_size_dec", Keys.OemOpenBrackets); base.Initialize(); }
public override void Update(GameTime gameTime, Input input) { time += (float)gameTime.ElapsedGameTime.TotalMilliseconds; //Input handling doorgeven aan PlayingGrid if (input.KeyDown(Keys.Left)) grid.MoveTetrominoLeft(); if (input.KeyDown(Keys.Right)) grid.MoveTetrominoRight(); if (input.KeyDown(Keys.Up)) grid.RotateTetromino(); if (input.KeyDown(Keys.Down)) updateTime /= 10; else if (input.KeyUp(Keys.Down)) updateTime *= 10; //Als genoeg tijd verstreken is, wordt de PlayingGrid geupdated if (time >= updateTime) { grid.Update(input); time = 0; } if (input.KeyDown(Keys.Escape)) TetrisGame.currentState = new PauseState(this); }
/// <summary> /// Performs mouse move /// </summary> /// <param name="x"></param> /// <param name="y"></param> public void SimulateMouseMove(int x, int y) { Input[] MouseEvent = new Input[1]; MouseEvent[0].Type = 0; MouseEvent[0].Data = CreateMouseInput(x, y, 0, 0, MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE); SendInput((uint)MouseEvent.Length, MouseEvent, Marshal.SizeOf(MouseEvent[0].GetType())); }
protected static Int32 GetDigitalState(Input.InputFrame inputFrame, DigitalControlIdentifier identifier) { return inputFrame.DigitalControlStates.ContainsKey (identifier) ? inputFrame.DigitalControlStates [identifier] : 0; }
// OnProcessInput protected override void OnProcessInput(Input input) { if (LeftBar.ChildrenWidget.Count > 0) { if (input.ButtonJustPressed((int)E_UiButton.Down)) { LeftBar.IncreaseCurrent(); } else if (input.ButtonJustPressed((int)E_UiButton.Up)) { LeftBar.DecreaseCurrent(); } } if (RightBar.ChildrenWidget.Count > 0) { if (input.ButtonJustPressed((int)E_UiButton.Back)) { RightBar.DecreaseCurrent(); } else if (input.ButtonJustPressed((int)E_UiButton.Enter)) { RightBar.IncreaseCurrent(); } } }
protected static Single GetAnalogState(Input.InputFrame inputFrame, AnalogControlIdentifier identifier) { return inputFrame.AnalogControlStates.ContainsKey (identifier) ? inputFrame.AnalogControlStates [identifier] : 0.0f; }
protected static ButtonState GetButtonState(Input.InputFrame inputFrame, BinaryControlIdentifier identifier) { return inputFrame.BinaryControlStates.Contains (identifier) ? ButtonState.Pressed : ButtonState.Released; }
protected override void OnMouseLeftButtonUp(Input.MouseButtonEventArgs e) { base.OnMouseLeftButtonUp(e); startTracking = false; Mouse.Capture(this, CaptureMode.None); }
/// <summary> /// Get an existing ParameterGroup resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="state">Any extra arguments used during the lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static ParameterGroup Get(string name, Input <string> id, ParameterGroupState?state = null, CustomResourceOptions?options = null) { return(new ParameterGroup(name, id, state, options)); }
private RouteTableAttachment(string name, Input<string> id, RouteTableAttachmentState? state = null, CustomResourceOptions? options = null) : base("alicloud:vpc/routeTableAttachment:RouteTableAttachment", name, state, MakeResourceOptions(options, id)) { }
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions?options, Input <string>?id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return(merged); }
private SecretScope(string name, Input <string> id, SecretScopeState?state = null, CustomResourceOptions?options = null) : base("vault:kmip/secretScope:SecretScope", name, state, MakeResourceOptions(options, id)) { }
/// <summary> /// Get an existing SecretScope resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="state">Any extra arguments used during the lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static SecretScope Get(string name, Input <string> id, SecretScopeState?state = null, CustomResourceOptions?options = null) { return(new SecretScope(name, id, state, options)); }
void FixedUpdate() { inputY = Input.GetAxis("Vertical"); inputX = Input.GetAxis("Horizontal"); runSpeed = Input.GetAxis("Run"); if (Input.GetButton("Vertical")) YSpeed += inputY / 10; else if (YSpeed > 0) { if (YSpeed > .1f) YSpeed -= .1f; else YSpeed = 0; } else if (YSpeed < 0) { if (YSpeed < -.1f) YSpeed += .1f; else YSpeed = 0; } YSpeed = Mathf.Clamp(YSpeed, -1, 1); YSpeed = (float)Math.Round(YSpeed, 2); if (Input.GetButton("Horizontal")) XSpeed += inputX / 10; else if (XSpeed > 0) { //Debug.Log("zmiejszanie predkosci"); if (XSpeed > .1f) XSpeed -= .1f; else XSpeed = 0; } else if (XSpeed < 0) { if (XSpeed < -.1f) XSpeed += .1f; else XSpeed = 0; } if (Input.GetButton("Run") && (YSpeed >= .9f || XSpeed >= .9f || XSpeed <= -.9f)) RSpeed += runSpeed / 10; else if (RSpeed > 0) { if (RSpeed > .1f) RSpeed -= .1f; else RSpeed = 0; } RSpeed = Mathf.Clamp(RSpeed, 0, 1); RSpeed = (float)Math.Round(RSpeed, 2); XSpeed = Mathf.Clamp(XSpeed, -1, 1); XSpeed = (float)Math.Round(XSpeed, 2); if (YSpeed >= .9f && Input.GetButton("Vertical")) { //Debug.Log("Bieganie do przodu"); YSpeed += RSpeed; } if (XSpeed >= .9f && Input.GetButton("Horizontal")) { //Debug.Log("Bieganie w prawo"); XSpeed += RSpeed; } if (XSpeed <= -.9f && Input.GetButton("Horizontal")) { //Debug.Log("Bieganie w lewo"); XSpeed -= RSpeed; } animator.SetFloat("InputY", YSpeed); animator.SetFloat("InputX", XSpeed); if (Input.GetButtonDown("Jump") && YSpeed >= .1) { animator.SetTrigger("RunJump"); /*Debug.Log("anim run");*/ } else if (Input.GetButtonDown("Jump")){ animator.SetTrigger("Jump"); /*Debug.Log("anim non");*/ } if (Input.GetButton("Crouch")) animator.SetBool("IsCrouching", true); else animator.SetBool("IsCrouching", false); if (InterfaceManager.instance.DrawSword) { if (!InterfaceManager.instance.isAnyActiveInterface) { if (Input.GetMouseButtonDown(0)) // Do refaktoryzacji to gowno xd /jk { int xd = Random.Range(0, 2);// Dodac funkcje RandomAnimation() i przepisac ten kod dam if (xd == 1) xd = 2; animator.SetInteger("AttackNumber", xd); animator.SetTrigger("BaseAttack"); } if (Input.GetMouseButton(1)) animator.SetBool("ShieldBlock", true); else animator.SetBool("ShieldBlock", false); } } }
public void Receive(Variable _value, Input _input) { }
void Update() { if(panelDepthTracker.Count == 0) return; #if UNITY_EDITOR if(Input.GetKeyUp(KeyCode.Escape)) { GoBackToPreviousPanel(); } #endif if(Input.touchCount != 1) return; Touch t = Input.GetTouch(0); if(panelDepthTracker.Count > 1) goto DetectSwipeBack; var result = new List<RaycastResult>(); PointerEventData ped = new PointerEventData(null); ped.position = t.position; graphicRaycaster.Raycast(ped, result); if(result.Count == 0) { Debug.Log("Tapped On Blank"); GoBackToPreviousPanel(); return; } DetectSwipeBack: if(t.fingerId != flickFingerId && t.phase == TouchPhase.Began) { flickFingerId = t.fingerId; touchDownCoordinate = t.position; return; } if(t.fingerId == flickFingerId) { Vector2 distance; switch(t.phase) { case TouchPhase.Moved: distance = t.position - touchDownCoordinate; if(Mathf.Abs(Vector2.Angle(distance, Vector2.right)) >= 25) goto TouchCanceled; break; case TouchPhase.Ended: distance = t.position - touchDownCoordinate; bool isSwipeLeft = Mathf.Abs(distance.x / Screen.width) > 0.2f && Mathf.Abs(Vector2.Angle(distance, Vector2.right)) < 10; if(isSwipeLeft) GoBackToPreviousPanel(); goto TouchCanceled; case TouchPhase.Canceled: TouchCanceled: flickFingerId = -1; timer = 0; break; } } }
/// <summary> /// Update mouse input. /// </summary> public void ProcessMouse () { bool updateRaycast = (useMouse && Time.timeScale < 0.9f); if (!updateRaycast) { for (int i = 0; i < 3; ++i) { if (Input.GetMouseButton(i) || Input.GetMouseButtonUp(i)) { updateRaycast = true; break; } } } // Update the position and delta mMouse[0].pos = Input.mousePosition; mMouse[0].delta = mMouse[0].pos - lastTouchPosition; bool posChanged = (mMouse[0].pos != lastTouchPosition); lastTouchPosition = mMouse[0].pos; // Update the object under the mouse if (updateRaycast) { hoveredObject = Raycast(Input.mousePosition, out lastHit) ? lastHit.collider.gameObject : fallThrough; if (hoveredObject == null) hoveredObject = genericEventHandler; mMouse[0].current = hoveredObject; } // Propagate the updates to the other mouse buttons for (int i = 1; i < 3; ++i) { mMouse[i].pos = mMouse[0].pos; mMouse[i].delta = mMouse[0].delta; mMouse[i].current = mMouse[0].current; } // Is any button currently pressed? bool isPressed = false; for (int i = 0; i < 3; ++i) { if (Input.GetMouseButton(i)) { isPressed = true; break; } } if (isPressed) { // A button was pressed -- cancel the tooltip mTooltipTime = 0f; } else if (useMouse && posChanged && (!stickyTooltip || mHover != mMouse[0].current)) { if (mTooltipTime != 0f) { // Delay the tooltip mTooltipTime = Time.realtimeSinceStartup + tooltipDelay; } else if (mTooltip != null) { // Hide the tooltip ShowTooltip(false); } } // The button was released over a different object -- remove the highlight from the previous if (useMouse && !isPressed && mHover != null && mHover != mMouse[0].current) { if (mTooltip != null) ShowTooltip(false); Highlight(mHover, false); mHover = null; } // Process all 3 mouse buttons as individual touches if (useMouse) { for (int i = 0; i < 3; ++i) { bool pressed = Input.GetMouseButtonDown(i); bool unpressed = Input.GetMouseButtonUp(i); currentTouch = mMouse[i]; currentTouchID = -1 - i; // We don't want to update the last camera while there is a touch happening if (pressed) currentTouch.pressedCam = currentCamera; else if (currentTouch.pressed != null) currentCamera = currentTouch.pressedCam; // Process the mouse events ProcessTouch(pressed, unpressed); } currentTouch = null; } // If nothing is pressed and there is an object under the touch, highlight it if (useMouse && !isPressed && mHover != mMouse[0].current) { mTooltipTime = Time.realtimeSinceStartup + tooltipDelay; mHover = mMouse[0].current; Highlight(mHover, true); } }
/// <summary> /// Get an existing RouteTableAttachment resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="state">Any extra arguments used during the lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static RouteTableAttachment Get(string name, Input<string> id, RouteTableAttachmentState? state = null, CustomResourceOptions? options = null) { return new RouteTableAttachment(name, id, state, options); }
/// <summary> /// Using the keyboard will result in 1 or -1, depending on whether up or down keys have been pressed. /// </summary> static int GetDirection (KeyCode up, KeyCode down) { if (Input.GetKeyDown(up)) return 1; if (Input.GetKeyDown(down)) return -1; return 0; }
/// <summary> /// Using the keyboard will result in 1 or -1, depending on whether up or down keys have been pressed. /// </summary> static int GetDirection (KeyCode up0, KeyCode up1, KeyCode down0, KeyCode down1) { if (Input.GetKeyDown(up0) || Input.GetKeyDown(up1)) return 1; if (Input.GetKeyDown(down0) || Input.GetKeyDown(down1)) return -1; return 0; }
protected override void WindowGUI(int windowID) { MechJebModuleCustomWindowEditor ed = core.GetComputerModule <MechJebModuleCustomWindowEditor>(); bool alt = Input.GetKey(KeyCode.LeftAlt); if (GUI.Button(new Rect(windowPos.width - 48, 0, 13, 20), "?", GuiUtils.yellowOnHover)) { var help = core.GetComputerModule <MechJebModuleWaypointHelpWindow>(); help.selTopic = ((IList)help.topics).IndexOf("Controller"); help.enabled = help.selTopic > -1 || help.enabled; } ed.registry.Find(i => i.id == "Toggle:RoverController.ControlHeading").DrawItem(); ed.registry.Find(i => i.id == "Editable:RoverController.heading").DrawItem(); ed.registry.Find(i => i.id == "Value:RoverController.headingErr").DrawItem(); ed.registry.Find(i => i.id == "Toggle:RoverController.ControlSpeed").DrawItem(); ed.registry.Find(i => i.id == "Editable:RoverController.speed").DrawItem(); ed.registry.Find(i => i.id == "Value:RoverController.speedErr").DrawItem(); ed.registry.Find(i => i.id == "Toggle:RoverController.StabilityControl").DrawItem(); if (!core.GetComputerModule <MechJebModuleSettings>().hideBrakeOnEject) { ed.registry.Find(i => i.id == "Toggle:RoverController.BrakeOnEject").DrawItem(); } ed.registry.Find(i => i.id == "Toggle:RoverController.BrakeOnEnergyDepletion").DrawItem(); if (autopilot.BrakeOnEnergyDepletion) { ed.registry.Find(i => i.id == "Toggle:RoverController.WarpToDaylight").DrawItem(); } GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Target Speed", GUILayout.ExpandWidth(true)); GUILayout.Label(autopilot.tgtSpeed.ToString("F1"), GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Waypoints", GUILayout.ExpandWidth(true)); GUILayout.Label("Index " + (autopilot.WaypointIndex + 1).ToString() + " of " + autopilot.Waypoints.Count.ToString(), GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); // GUILayout.Label("Debug1: " + autopilot.debug1.ToString("F3")); GUILayout.BeginHorizontal(); if (core.target != null && core.target.Target != null) // && (core.target.targetBody == orbit.referenceBody || (core.target.Orbit != null ? core.target.Orbit.referenceBody == orbit.referenceBody : false))) { { var vssl = core.target.Target.GetVessel(); if (GUILayout.Button("To Target")) { core.GetComputerModule <MechJebModuleWaypointWindow>().selIndex = -1; autopilot.WaypointIndex = 0; autopilot.Waypoints.Clear(); if (vssl != null) { autopilot.Waypoints.Add(new MechJebWaypoint(vssl, 25f)); } else { autopilot.Waypoints.Add(new MechJebWaypoint(core.target.GetPositionTargetPosition())); } autopilot.ControlHeading = autopilot.ControlSpeed = true; vessel.ActionGroups.SetGroup(KSPActionGroup.Brakes, false); autopilot.LoopWaypoints = alt; } if (GUILayout.Button("Add Target")) { if (vssl != null) { autopilot.Waypoints.Add(new MechJebWaypoint(vssl, 25f)); } else { autopilot.Waypoints.Add(new MechJebWaypoint(core.target.GetPositionTargetPosition())); } // if (autopilot.WaypointIndex < 0) { autopilot.WaypointIndex = autopilot.Waypoints.Count - 1; } } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (autopilot.WaypointIndex == -1) { if (autopilot.Waypoints.Count > 0) { if (GUILayout.Button("Follow")) { autopilot.WaypointIndex = 0; autopilot.ControlHeading = autopilot.ControlSpeed = true; autopilot.LoopWaypoints = alt; } } else { // if (GUILayout.Button("No Waypoints")) { // } } } else { if (GUILayout.Button("Stop")) { autopilot.WaypointIndex = -1; autopilot.ControlHeading = autopilot.ControlSpeed = autopilot.LoopWaypoints = false; } } if (GUILayout.Button("Waypoints")) { var waypoints = core.GetComputerModule <MechJebModuleWaypointWindow>(); waypoints.enabled = !waypoints.enabled; if (waypoints.enabled) { waypoints.Mode = MechJebModuleWaypointWindow.WaypointMode.Rover; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); base.WindowGUI(windowID); }
/// <summary> /// Process keyboard and joystick events. /// </summary> public void ProcessOthers () { currentTouchID = -100; currentTouch = mController; // If this is an input field, ignore WASD and Space key presses inputHasFocus = (mSel != null && mSel.GetComponent<UIInput>() != null); bool submitKeyDown = (submitKey0 != KeyCode.None && Input.GetKeyDown(submitKey0)) || (submitKey1 != KeyCode.None && Input.GetKeyDown(submitKey1)); bool submitKeyUp = (submitKey0 != KeyCode.None && Input.GetKeyUp(submitKey0)) || (submitKey1 != KeyCode.None && Input.GetKeyUp(submitKey1)); if (submitKeyDown || submitKeyUp) { currentTouch.current = mSel; ProcessTouch(submitKeyDown, submitKeyUp); currentTouch.current = null; } int vertical = 0; int horizontal = 0; if (useKeyboard) { if (inputHasFocus) { vertical += GetDirection(KeyCode.UpArrow, KeyCode.DownArrow); horizontal += GetDirection(KeyCode.RightArrow, KeyCode.LeftArrow); } else { vertical += GetDirection(KeyCode.W, KeyCode.UpArrow, KeyCode.S, KeyCode.DownArrow); horizontal += GetDirection(KeyCode.D, KeyCode.RightArrow, KeyCode.A, KeyCode.LeftArrow); } } if (useController) { if (!string.IsNullOrEmpty(verticalAxisName)) vertical += GetDirection(verticalAxisName); if (!string.IsNullOrEmpty(horizontalAxisName)) horizontal += GetDirection(horizontalAxisName); } // Send out key notifications if (vertical != 0) Notify(mSel, "OnKey", vertical > 0 ? KeyCode.UpArrow : KeyCode.DownArrow); if (horizontal != 0) Notify(mSel, "OnKey", horizontal > 0 ? KeyCode.RightArrow : KeyCode.LeftArrow); if (useKeyboard && Input.GetKeyDown(KeyCode.Tab)) Notify(mSel, "OnKey", KeyCode.Tab); // Send out the cancel key notification if (cancelKey0 != KeyCode.None && Input.GetKeyDown(cancelKey0)) Notify(mSel, "OnKey", KeyCode.Escape); if (cancelKey1 != KeyCode.None && Input.GetKeyDown(cancelKey1)) Notify(mSel, "OnKey", KeyCode.Escape); currentTouch = null; }
private HostedPrivateVirtualInterfaceAccepter(string name, Input <string> id, HostedPrivateVirtualInterfaceAccepterState?state = null, CustomResourceOptions?options = null) : base("aws:directconnect/hostedPrivateVirtualInterfaceAccepter:HostedPrivateVirtualInterfaceAccepter", name, state, MakeResourceOptions(options, id)) { }
// Mouse movement for debug void DebugInput() { float mouseScroll = Input.GetAxis("Mouse ScrollWheel"); desiredPos.y += mouseScroll * 5.0f; }
public void clickOnHex() { Hex clickedHex = GraphicalMap.getHexUnderMouse(Input.mousePosition).hex; if (Input.GetKey(KeyCode.LeftControl)) { GraphicalMap.selectedSelectable = null; GraphicalMap.selectedHex = clickedHex; world.audioStore.playClick(); return; } world.ui.checkData(); if (clickedHex.location != null) { List <object> selectables = new List <object>(); foreach (object o in clickedHex.location.units) { selectables.Add(o); } foreach (object o in clickedHex.location.properties) { selectables.Add(o); } int index = -1; if (GraphicalMap.selectedSelectable != null) { index = selectables.IndexOf(GraphicalMap.selectedSelectable); } if (index == -1)//Nothing from this loc selected yet { index = 0; } else { index += 1; } //See if we're out of selectables (including if there were none) if (index >= selectables.Count) { GraphicalMap.selectedSelectable = null; GraphicalMap.selectedHex = clickedHex; world.audioStore.playClick(); world.ui.checkData(); return; } else { GraphicalMap.selectedSelectable = selectables[index]; GraphicalMap.selectedHex = clickedHex; world.audioStore.playClick(); world.ui.checkData(); return; } } GraphicalMap.selectedSelectable = null; GraphicalMap.selectedHex = clickedHex; world.audioStore.playClick(); world.ui.checkData(); }
/// <summary> /// Get an existing HostedPrivateVirtualInterfaceAccepter resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="state">Any extra arguments used during the lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static HostedPrivateVirtualInterfaceAccepter Get(string name, Input <string> id, HostedPrivateVirtualInterfaceAccepterState?state = null, CustomResourceOptions?options = null) { return(new HostedPrivateVirtualInterfaceAccepter(name, id, state, options)); }
public void scrollKeys() { if (world.map.param.option_edgeScroll == 1) { if (Input.mousePosition.y >= Screen.height - 5) { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.y -= scrollSpeed; if (GraphicalMap.y < 0) { GraphicalMap.y = 0; } } else if (Input.mousePosition.y <= 2) { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.y += scrollSpeed; if (GraphicalMap.y > world.map.sy) { GraphicalMap.y = world.map.sy; } } if (Input.mousePosition.x <= 0) { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.x += scrollSpeed; if (GraphicalMap.x > world.map.sx) { GraphicalMap.x = world.map.sx; } } else if (Input.mousePosition.x >= Screen.width - 5) { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.x -= scrollSpeed; if (GraphicalMap.x < 0) { GraphicalMap.x = 0; } } } if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) { if (world.ui.state == UIMaster.uiState.SOCIETY) { if (GraphicalSociety.focus != null) { GraphicalSociety.offY -= socScrollSpeed; GraphicalSociety.refreshOffset(); } } else { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.y -= scrollSpeed; if (GraphicalMap.y < 0) { GraphicalMap.y = 0; } } } else if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) { if (world.ui.state == UIMaster.uiState.SOCIETY) { if (GraphicalSociety.focus != null) { GraphicalSociety.offY += socScrollSpeed; GraphicalSociety.refreshOffset(); } } else { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.y += scrollSpeed; if (GraphicalMap.y > world.map.sy) { GraphicalMap.y = world.map.sy; } } } if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) { if (world.ui.state == UIMaster.uiState.SOCIETY) { if (GraphicalSociety.focus != null) { GraphicalSociety.offX += socScrollSpeed; GraphicalSociety.refreshOffset(); } } else { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.x += scrollSpeed; if (GraphicalMap.x > world.map.sx) { GraphicalMap.x = world.map.sx; } } } else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) { if (world.ui.state == UIMaster.uiState.SOCIETY) { if (GraphicalSociety.focus != null) { GraphicalSociety.offX -= socScrollSpeed; GraphicalSociety.refreshOffset(); } } else { //GraphicalMap.panStepsToTake = 0; GraphicalMap.lastMapChange += 1; GraphicalMap.x -= scrollSpeed; if (GraphicalMap.x < 0) { GraphicalMap.x = 0; } } } }
public void hotkeys() { if (Input.GetKeyDown(KeyCode.Backspace) && Input.GetKey(KeyCode.LeftControl)) { world.ui.uiMidTop.cheatField.gameObject.SetActive(!world.ui.uiMidTop.cheatField.gameObject.activeSelf); } if (world.ui.blocker != null) { return; } if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.Tab)) { } else if (Input.GetKeyDown(KeyCode.LeftControl)) { } else if (Input.GetKeyDown(KeyCode.Q)) { } else if (Input.GetKeyDown(KeyCode.Escape)) { if (world.ui.state == UIMaster.uiState.VOTING) { world.ui.uiVoting.bDismiss(); } world.ui.setToMainMenu(); } if (world.ui.state == UIMaster.uiState.WORLD || world.ui.state == UIMaster.uiState.BACKGROUND) { if (Input.GetKey(KeyCode.Alpha0)) { world.map.masker.mask = MapMaskManager.maskType.NONE; GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha1)) { if (world.map.masker.mask == MapMaskManager.maskType.NATION) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { World.log("Set to nation"); world.map.masker.mask = MapMaskManager.maskType.NATION; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { if (world.map.masker.mask == MapMaskManager.maskType.PROVINCE) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.PROVINCE; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { if (world.map.masker.mask == MapMaskManager.maskType.VOTE_EFFECT) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.VOTE_EFFECT; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { if (world.map.masker.mask == MapMaskManager.maskType.THREAT) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.THREAT; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha5)) { if (world.map.masker.mask == MapMaskManager.maskType.LIKING_ME) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.LIKING_ME; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha6)) { if (world.map.masker.mask == MapMaskManager.maskType.LIKING_THEM) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.LIKING_THEM; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha7)) { if (world.map.masker.mask == MapMaskManager.maskType.AWARENESS) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.AWARENESS; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha8)) { if (world.map.masker.mask == MapMaskManager.maskType.SUSPICION) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.SUSPICION; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.Alpha9)) { if (world.map.masker.mask == MapMaskManager.maskType.SUSPICION_FROM) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.SUSPICION_FROM; } GraphicalMap.checkData(); } else if (Input.GetKeyDown(KeyCode.End)) { if (world.map.masker.mask == MapMaskManager.maskType.TESTING) { world.map.masker.mask = MapMaskManager.maskType.NONE; } else { world.map.masker.mask = MapMaskManager.maskType.TESTING; } GraphicalMap.checkData(); } } }
/// <summary> /// Get an existing DataPool resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static DataPool Get(string name, Input <string> id, CustomResourceOptions?options = null) { return(new DataPool(name, id, options)); }
private DataPool(string name, Input <string> id, CustomResourceOptions?options = null) : base("azure-nextgen:autonomousdevelopmentplatform/v20200701preview:DataPool", name, null, MakeResourceOptions(options, id)) { }
private void Update() { if (allowMovement) { bool lastMoving = moving; Vector3 deltaPosition = Vector3.zero; if (moving) { currentSpeed += increaseSpeed * Time.deltaTime; } moving = false; CheckMove(forwardButton, ref deltaPosition, transform.forward); CheckMove(backwardButton, ref deltaPosition, -transform.forward); CheckMove(rightButton, ref deltaPosition, transform.right); CheckMove(leftButton, ref deltaPosition, -transform.right); CheckMove(upButton, ref deltaPosition, transform.up); CheckMove(downButton, ref deltaPosition, -transform.up); if (moving) { if (moving != lastMoving) { currentSpeed = initialSpeed; } transform.position += deltaPosition * currentSpeed * Time.deltaTime; } else { currentSpeed = 0f; } } if (Input.GetMouseButton(1)) { Vector3 eulerAngles = transform.eulerAngles; eulerAngles.x += -Input.GetAxis("Mouse Y") * 359f * cursorSensitivity; eulerAngles.y += Input.GetAxis("Mouse X") * 359f * cursorSensitivity; transform.eulerAngles = eulerAngles; } if (cursorToggleAllowed) { if (Input.GetKey(cursorToggleButton)) { if (!togglePressed) { togglePressed = true; Screen.lockCursor = !Screen.lockCursor; Cursor.visible = !Cursor.visible; } } else { togglePressed = false; } } else { togglePressed = false; Cursor.visible = false; } }
/// <summary> /// Update the camera parameters. /// </summary> protected virtual void UpdateCamera() { // Capture/release mouse when the button is pressed/released if (Input.IsMouseButtonPressed(MouseButton.Right)) { Input.LockMousePosition(); Game.IsMouseVisible = false; } else if (Input.IsMouseButtonReleased(MouseButton.Right)) { Input.UnlockMousePosition(); Game.IsMouseVisible = true; } // Update rotation according to mouse deltas var rotationDelta = Vector2.Zero; if (Input.IsMouseButtonDown(MouseButton.Right)) { rotationDelta = Input.MouseDelta; } var doubleTapped = false; foreach (var gestureEvent in Input.GestureEvents) { switch (gestureEvent.Type) { case GestureType.Drag: { var drag = (GestureEventDrag)gestureEvent; rotationDelta = drag.DeltaTranslation; } break; case GestureType.Flick: break; case GestureType.LongPress: break; case GestureType.Composite: break; case GestureType.Tap: { doubleTapped = true; } break; default: throw new ArgumentOutOfRangeException(); } } // Change rotation only if changed at least once (try to keep original one) if (rotationDelta != Vector2.Zero) { applyRotation = true; } // Compute translation speed according to framerate and modifiers var translationSpeed = MoveSpeed * (float)Game.UpdateTime.Elapsed.TotalSeconds; if (Input.IsKeyDown(Keys.LeftShift)) { translationSpeed *= 3.0f; } var oldPitch = Pitch; // Take shortest path var deltaPitch = desiredPitch - Pitch; var deltaYaw = (desiredYaw - Yaw) % MathUtil.TwoPi; if (deltaYaw < 0) { deltaYaw += MathUtil.TwoPi; } if (deltaYaw > MathUtil.Pi) { deltaYaw -= MathUtil.TwoPi; } desiredYaw = Yaw + deltaYaw; // Perform orientation transition var rotationAdaptation = (float)Game.UpdateTime.Elapsed.TotalSeconds * RotationAdaptationSpeed; Yaw = Math.Abs(deltaYaw) < rotationAdaptation ? desiredYaw : Yaw + rotationAdaptation * Math.Sign(deltaYaw); Pitch = Math.Abs(deltaPitch) < rotationAdaptation ? desiredPitch : Pitch + rotationAdaptation * Math.Sign(deltaPitch); desiredYaw = Yaw -= 1.333f * rotationDelta.X * RotationSpeed; // we want to rotate faster Horizontally and Vertically desiredPitch = Pitch = MathUtil.Clamp(Pitch - rotationDelta.Y * RotationSpeed, -MathUtil.PiOverTwo, MathUtil.PiOverTwo); if (!RotationOnly) { // Compute base vectors for camera movement var rotation = Matrix.RotationYawPitchRoll(Yaw, Pitch, 0); var forward = Vector3.TransformNormal(ForwardVector, rotation); var up = Vector3.TransformNormal(UpVector, rotation); var right = Vector3.Cross(forward, up); // Update camera move: Dolly (WADS model/arrow keys) var movePosition = Vector3.Zero; if (Input.IsKeyDown(Keys.A) || Input.IsKeyDown(Keys.Left)) { movePosition += -right; } if (Input.IsKeyDown(Keys.D) || Input.IsKeyDown(Keys.Right)) { movePosition += right; } if (Input.IsKeyDown(Keys.S) || Input.IsKeyDown(Keys.Down)) { movePosition += Component.Projection == CameraProjectionMode.Perspective ? -forward : -up; } if (Input.IsKeyDown(Keys.W) || Input.IsKeyDown(Keys.Up) || doubleTapped) { movePosition += Component.Projection == CameraProjectionMode.Perspective ? forward : up; } if (Input.IsKeyDown(Keys.Q)) { movePosition += Component.Projection == CameraProjectionMode.Perspective ? -up : -forward; } if (Input.IsKeyDown(Keys.E)) { movePosition += Component.Projection == CameraProjectionMode.Perspective ? up : forward; } position += (Vector3.Normalize(movePosition) * translationSpeed); if (doubleTapped) { desiredPitch = Pitch = oldPitch; desiredYaw = Yaw; forward = -Vector3.Transform(ForwardVector, Quaternion.RotationYawPitchRoll(Yaw, Pitch, 0)); var projectedForward = Vector3.Normalize(new Vector3(forward.X, 0, forward.Z)); position -= projectedForward * translationSpeed * MouseMoveSpeedFactor; } } // Update the camera view matrix UpdateViewMatrix(); }
private ApplicationGroup(string name, Input<string> id, CustomResourceOptions? options = null) : base("azure-nextgen:desktopvirtualization/v20201019preview:ApplicationGroup", name, null, MakeResourceOptions(options, id)) { }
// Update is called once per frame void Update() { //check who's gold it needs to grab if (myTeam.Equals(Team.Purple)) { myCurrentGoldAmount = myEcon.getLeftGold(); } else if (myTeam.Equals(Team.Yellow)) { myCurrentGoldAmount = myEcon.getRightGold(); } //update the visual gold amount displayOwnGold.text = string.Format(string.Format("Gold: ${0}", myCurrentGoldAmount)); if (myCurrentGoldAmount < warningGoldAmount) { displayOwnGold.color = Color.red; } else { displayOwnGold.color = Color.white; } //Debug.Log("State: " + state); if (enableMouseClick) { if (Input.GetMouseButtonDown (0)) { mouseClickTest (); } else if(Input.GetMouseButton(1)){ //get the vector movement of when right click is down and moving Vector2 mousePos = new Vector2 (Input.GetAxis ("Mouse X"), Input.GetAxis ("Mouse Y")); this.setBuilderPosition(mousePos); transform.Translate (-this.builderPositionTanslationX * mouseScrollSpeed, -this.builderPositionTanslationY * mouseScrollSpeed, 0); } } else if (!enableMouseClick) { //detect if we got any touches if (Input.touchCount > 0) { //get the touch Touch touch = Input.GetTouch (0); //if the count is 2, we are going to do swiping if (Input.touchCount == 2) { didSwipe = true; if (debugTouchMessages) { Debug.Log ("Going into swipe state"); } } //state machine switch (state) { //ready state case TouchState.Ready: switch (touch.phase) { case TouchPhase.Began: if (isTouchingBuilderUITouch (touch)) { Debug.Log ("Doing Nothing"); } //if we have two fingers down else if (didSwipe) { if (debugTouchMessages) { Debug.Log ("Going to swipe"); } //go to swipe state state = TouchState.ScreenSwipe; } //two touches may have not happened right away else { if (debugTouchMessages) { Debug.Log ("Detected 1 finger. going to make decision"); } //go to decision state to make sure what state we need to be in state = TouchState.Decision; prevTouchID = currTouchID; } break; } break; case TouchState.Decision: switch (touch.phase) { case TouchPhase.Moved: //we have two fingers down and are moving if (didSwipe) { if (debugTouchMessages) { Debug.Log ("Detected 2 fingers. going to swipe"); } //we know its a two finger touch since the touch id changed state = TouchState.ScreenSwipe; } break; //else we only had 1 finger down and lifted, meaning we are placing a block case TouchPhase.Ended: if (debugTouchMessages) { Debug.Log ("Detected 1 fingers. going to block placement"); } //the touch never changed so its just one finger doTouchPlacement (touch); didSwipe = false; state = TouchState.Ready; break; } break; //Swipe state case TouchState.ScreenSwipe: switch (touch.phase) { case TouchPhase.Moved: this.setBuilderPosition (Input.GetTouch (0).deltaPosition); transform.Translate (-this.builderPositionTanslationX * scrollSpeed, -this.builderPositionTanslationY * scrollSpeed, 0); break; //ended swipe, go back to ready state case TouchPhase.Ended: didSwipe = false; state = TouchState.Ready; break; } break; //dummy states, future implementation possibly case TouchState.TrapPlacement: break; case TouchState.BlockChoosing: break; } } } }
/// <summary> /// Get an existing ApplicationGroup resource's state with the given name, ID, and optional extra /// properties used to qualify the lookup. /// </summary> /// /// <param name="name">The unique name of the resulting resource.</param> /// <param name="id">The unique provider ID of the resource to lookup.</param> /// <param name="options">A bag of options that control this resource's behavior</param> public static ApplicationGroup Get(string name, Input<string> id, CustomResourceOptions? options = null) { return new ApplicationGroup(name, id, options); }
private ParameterGroup(string name, Input <string> id, ParameterGroupState?state = null, CustomResourceOptions?options = null) : base("aws:dax/parameterGroup:ParameterGroup", name, state, MakeResourceOptions(options, id)) { }
// Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadScene("Test"); } }
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id) { var defaultOptions = new CustomResourceOptions { Version = Utilities.Version, Aliases = { new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20190123preview:ApplicationGroup"}, new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20190924preview:ApplicationGroup"}, new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20191210preview:ApplicationGroup"}, new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20200921preview:ApplicationGroup"}, new Pulumi.Alias { Type = "azure-nextgen:desktopvirtualization/v20201102preview:ApplicationGroup"}, }, }; var merged = CustomResourceOptions.Merge(defaultOptions, options); // Override the ID if one was specified for consistency with other language SDKs. merged.Id = id ?? merged.Id; return merged; }