private void LoadValues() { _mSensitivity.Text = Settings.Sensitivity.ToString(); UpdateHistory("msensitivity", Settings.Sensitivity.ToString()); _mInvert.Pressed = Settings.InvertedMouse; UpdateHistory("minvertmouse", Settings.InvertedMouse.ToString()); foreach (LineEdit le in _playerControls) { Godot.Collections.Array actionList = InputMap.GetActionList(le.Name); foreach (InputEvent ie in actionList) { if (ie is InputEventKey iek) { // FIXME - this only does 1 key per command string key = OS.GetScancodeString(iek.Scancode).ToLower(); le.Text = key; break; } else if (ie is InputEventMouseButton iem) { // FIXME - append mouse to index number, interpret it for save too le.Text = iem.ButtonIndex.ToString(); } } } }
/// <inheritdoc /> public IInput RegisterInput <T>(Func <T, bool> method, T key, Action command, InputLevel level, bool allowOtherKeys = true) { Logger.Info("Registering " + command.Method.Name + " as a new input on key " + key + ".", Logger.System.Input); if (command.Method.Name.Contains("Cmd") || command.Method.Name.Contains("Rpc")) { throw new ArgumentException("It is forbidden to bind network calls directly to the input system!", "command"); } var newInput = new InputMap <T>(method, key, level); ClearInputFromOtherCommands(newInput); if (!allowOtherKeys) { ClearOtherInputsForCommand(command, mCommands); } if (!mCommands.ContainsKey(command)) { mCommands[command] = new List <BaseInputMap>(); } mCommands[command].Add(newInput); return(this); }
public async Task FuncWithDictParamOutputWorks() { Func <string, Func <FuncWithDictParamInvokeArgs>, Task> check = ( (expected, args) => Assert .Output(() => FuncWithDictParam.Invoke(args()).Apply(x => x.R)) .ResolvesTo(expected) ); var map = new InputMap <string>(); map.Add("K1", Out("my-k1")); map.Add("K2", Out("my-k2")); // Omitted value defaults to null. await check("a=null b=null", () => new FuncWithDictParamInvokeArgs()); await check("a=[K1: my-k1, K2: my-k2] b=null", () => new FuncWithDictParamInvokeArgs() { A = map, }); await check("a=[K1: my-k1, K2: my-k2] b=my-b", () => new FuncWithDictParamInvokeArgs() { A = map, B = Out("my-b"), }); }
/// <summary> /// スプレッド通常入力設定処理 /// </summary> /// <param name="pspdObj">スプレッドシートインスタンス</param> /// <param name="EnterAction">Enterキー入力時の動作</param> /// <returns>true:正常終了 false:エラー</returns> /// <remark> /// 通常入力用初期処理を行います /// </remark> public static bool InitNormalInput(FpSpread pspdObj, object EnterAction) { try { // 通常入力用 初期処理 InputMap linpMap = pspdObj.GetInputMap(InputMapMode.WhenAncestorOfFocused); linpMap.Put(new Keystroke(Keys.Enter, Keys.None), EnterAction); //----------------------------------------------------------------------------- // ※ EditModeOn/EditModeOffのイベントは各自記述する必要があります // // [EditModeOn]の場合 // spdXXX.EditingControl.KeyDown += // new System.Windows.Forms.KeyEventHandler( this.spdXXX_KeyDown ); // [EditModeOff]の場合 // spdXXX.EditingControl.KeyDown -= // new System.Windows.Forms.KeyEventHandler( this.spdXXX_KeyDown ); //----------------------------------------------------------------------------- return(true); } catch (Exception) { return(false); } }
public Task MergeInputMaps() => RunInPreview(async() => { var map1 = new InputMap <string>(); map1.Add("K1", "V1"); map1.Add("K2", Output.Create("V2")); map1.Add("K3", Output.Create("V3_wrong")); var map2 = new InputMap <string>(); map2.Add("K3", Output.Create("V3")); map2.Add("K4", "V4"); var result = InputMap <string> .Merge(map1, map2); // Check the merged map var data = await result.ToOutput().DataTask.ConfigureAwait(false); Assert.True(data.IsKnown); Assert.Equal(4, data.Value.Count); for (int i = 1; i <= 4; i++) { Assert.True(data.Value.Contains($"K{i}", $"V{i}")); } // Check that the input maps haven't changed var map1Data = await map1.ToOutput().DataTask.ConfigureAwait(false); Assert.Equal(3, map1Data.Value.Count); Assert.True(map1Data.Value.ContainsValue("V3_wrong")); var map2Data = await map2.ToOutput().DataTask.ConfigureAwait(false); Assert.Equal(2, map2Data.Value.Count); Assert.True(map2Data.Value.ContainsValue("V3")); });
public override void _Input(InputEvent _event) { var method = _event.InputMethod(); if (method == InputMethod.None) { return; } if (method != InputMethod.None && method != CurrentInputMethod) { CurrentInputMethod = method; if (IsVisibleInTree()) { InitializeKeybindings(); } } if (ActionWaitingForInput != null) { GetNode <Control>(keybindingPopupPath).Hide(); KeybindingElement element = GetKeybingingElement(ActionWaitingForInput); InputMap.ActionEraseEvent(ActionWaitingForInput, element.InputEvent); InputMap.ActionAddEvent(ActionWaitingForInput, _event); element.InputEvent = _event; ActionWaitingForInput = null; } }
private void ClearAction(string Action) { if (!InputMap.HasAction(Action)) { InputMap.EraseAction(Action); } }
protected override void UpdateScreen(GameTime gameTime) { if (_session.IsPaused) { FreezeScreen(); ScreenManager.AddScreen(new PauseScreen(this, _session)); } _session.Level.Paddle.StopMoving(); if (InputMap.ActionPressed("MoveLeft")) { _session.Level.Paddle.MoveLeft(); } else if (InputMap.ActionPressed("MoveRight")) { _session.Level.Paddle.MoveRight(); } if (InputMap.NewActionPress("FireBall")) { _session.Level.Ball.Fire(); } if (InputMap.NewActionPress("Pause")) { _session.Pause(); } _session.Update(gameTime); }
void Awake() { // Clean up attackListenerList.Clear (); healthChangeListenerList.Clear (); powerUpChangeListenerList.Clear (); inputMap = InputMap.getInputMap(); inputMap.ClearDictionary (); // Adding input maps (delegates) inputMap.Add(MultiPlatformInputs.UpArrow, JumpSwipe); inputMap.Add(MultiPlatformInputs.SwipeUp, JumpSwipe); inputMap.Add (MultiPlatformInputs.RightArrow, Pierce); inputMap.Add (MultiPlatformInputs.SwipeRight, Pierce); inputMap.Add (MultiPlatformInputs.Shift, OverHeadSwipe); inputMap.Add (MultiPlatformInputs.SwipeRightDown, OverHeadSwipe); inputMap.Add (MultiPlatformInputs.SwipeRightDown, LowSwipe); inputMap.Add (MultiPlatformInputs.DownArrow, LowSwipe); inputMap.Add (MultiPlatformInputs.SwipeDown, LowSwipe); inputMap.Add (MultiPlatformInputs.SpaceBar, JumpStomp); inputMap.Add (MultiPlatformInputs.SwipeUpRightDown, JumpStomp); inputMap.Add (MultiPlatformInputs.Shake, GoBerserk); inputMap.Add (MultiPlatformInputs.Return, GoBerserk); groundCheck = transform.Find ("GroundCheck"); anim = GetComponent<Animator> (); }
public static void UnBind(string KeyName) { KeyName = KeyName.ToLower(); Godot.Collections.Array actions = InputMap.GetActions(); foreach (string a in actions) { if (!a.Contains("ui_")) { Godot.Collections.Array actionList = InputMap.GetActionList(a); foreach (InputEvent ie in actionList) { if (ie is InputEventKey iek) { string key = OS.GetScancodeString(iek.Scancode); if (key.ToLower() == KeyName) { InputMap.ActionEraseEvent(a, iek); RemoveBind(BindingsWithArg, a); RemoveBind(BindingsWithArgDistinct, a); RemoveBind(BindingsWithoutArg, a); RemoveBind(BindingsWithoutArgDistinct, a); } } } } } }
public static void UnBind(string KeyName) { if (InputMap.HasAction(KeyName)) { InputMap.EraseAction(KeyName); List <BindingObject> Removing = new List <BindingObject>(); foreach (BindingObject Bind in BindingsWithArg) { if (Bind.Name == KeyName) { Removing.Add(Bind); } } foreach (BindingObject Bind in Removing) { BindingsWithArg.Remove(Bind); } Removing.Clear(); foreach (BindingObject Bind in BindingsWithoutArg) { if (Bind.Name == KeyName) { Removing.Add(Bind); } } foreach (BindingObject Bind in Removing) { BindingsWithoutArg.Remove(Bind); } } }
private void AddKeyboardInputsToGameMapping() { string playerPrefix; string action; InputEventKey iek; SC.IDictionaryEnumerator it; Dictionary mapping; for (int i = 1; i <= playerAmount; i++) { playerPrefix = this.CreateString("p", i, "_"); mapping = keyboardInputMapping[i.ToString()] as Dictionary; if (mapping != null) { it = mapping.GetEnumerator(); while (it.MoveNext()) { action = this.CreateString(playerPrefix, it.Entry.Key); InputMap.ActionEraseEvents(action); iek = new InputEventKey(); iek.Scancode = uint.Parse(it.Entry.Value as string); InputMap.ActionAddEvent(action, iek); } } } }
/// <summary> /// Evaluates the Change source map /// </summary> /// <typeparam name="T"></typeparam> /// <param name="source">query target</param> /// <returns></returns> public override IEnumerable <LabelledTreeNode <object, Term> > Evaluate <T>(IGraphSource source) { foreach (var item in InputMap.Evaluate <T>(_source)) { yield return(item); } }
private static Func <Vector2> CombineAxes <TAction>(InputMap <TAction, float> inputMap, TAction xAction, TAction yAction) { var pollX = inputMap.Source[xAction]; var pollY = inputMap.Source[yAction]; return(() => new Vector2(pollX(), pollY())); }
private void AddAction(string Action) { if (!InputMap.HasAction(Action)) { InputMap.AddAction(Action); } }
void Awake() { // Clean up attackListenerList.Clear(); healthChangeListenerList.Clear(); powerUpChangeListenerList.Clear(); inputMap = InputMap.getInputMap(); inputMap.ClearDictionary(); // Adding input maps (delegates) inputMap.Add(MultiPlatformInputs.UpArrow, JumpSwipe); inputMap.Add(MultiPlatformInputs.SwipeUp, JumpSwipe); inputMap.Add(MultiPlatformInputs.RightArrow, Pierce); inputMap.Add(MultiPlatformInputs.SwipeRight, Pierce); inputMap.Add(MultiPlatformInputs.Shift, OverHeadSwipe); inputMap.Add(MultiPlatformInputs.SwipeRightDown, OverHeadSwipe); inputMap.Add(MultiPlatformInputs.SwipeRightDown, LowSwipe); inputMap.Add(MultiPlatformInputs.DownArrow, LowSwipe); inputMap.Add(MultiPlatformInputs.SwipeDown, LowSwipe); inputMap.Add(MultiPlatformInputs.SpaceBar, JumpStomp); inputMap.Add(MultiPlatformInputs.SwipeUpRightDown, JumpStomp); inputMap.Add(MultiPlatformInputs.Shake, GoBerserk); inputMap.Add(MultiPlatformInputs.Return, GoBerserk); groundCheck = transform.Find("GroundCheck"); anim = GetComponent <Animator> (); }
public override void Draw(SpriteBatch batch, Vector2 screenSize) { screenSize = Program.ScaleBatch(batch); batch.Rectangle(new Rectangle(0, 0, (int)screenSize.X, (int)screenSize.Y), Color.Black); Font alkhemikal = Assets.Get <Font>("fonts/Alkhemikal.ttf", true); int y = (int)(105 + _scroll); string[] split = _story.Split('\n'); string[] writtenSplit = _writtenStory.Split('\n'); for (int i = 0; i < writtenSplit.Length; i++) { Vector2 m = alkhemikal.Measure(16, split[i]); batch.Text(alkhemikal, 16, writtenSplit[i], new Vector2(screenSize.X / 2 - m.X / 2, y), Color.White); y += 18; } batch.Texture(new Rectangle(0, 0, (int)screenSize.X, (int)screenSize.Y), Assets.Get <Texture2D>("menu/story_mask.png"), Color.White); batch.Texture(new Vector2(screenSize.X / 2 - 160 / 2, 20), Assets.Get <Texture2D>("ui/logo.png", true), Color.White); Font bitcell = Assets.Get <Font>("fonts/bitcell.ttf", true); string s = "Press [" + InputMap.FindMapping(InputAction.Action).Key + "] to " + (_writtenStory.Length == _story.Length ? "start game" : "skip"); Vector2 measure = bitcell.Measure(16, s); float alpha = 0.8f + (float)Math.Sin(Game.Time * 10) * 0.1f; batch.Text(bitcell, 16, s, new Vector2(screenSize.X / 2 - measure.X / 2, screenSize.Y - 8 - 20), Color.White * alpha); Program.BlackBorders(batch); }
public void MakeInputMapper(string actionName) { HBoxContainer container = new HBoxContainer(); //Label Label actionLabel = new Label(); actionLabel.Valign = Label.VAlign.Center; actionLabel.Text = "Controls." + actionName; actionLabel.AddChild(new Translator()); container.AddChild(actionLabel); container.AddChild(ControlUtility.MakeHorizontalFiller()); //Bound actions Godot.Array actionList = InputMap.GetActionList(actionName); foreach (object actionItem in actionList) { InputEvent inputAction = actionItem as InputEvent; MakeRebindActionButton(container, inputAction); } //Add new binding options if its not 2 there. if (actionList.Count < 2) { int difference = 2 - actionList.Count; for (int i = 0; i < difference; i++) { MakeRebindActionButton(container, null); } } GetParent().CallDeferred("add_child", container); }
protected override void UpdateScreen(Microsoft.Xna.Framework.GameTime gameTime) { if (InputMap.NewActionPress("Skip") || videoManager.IsDonePlaying) { ExitScreen(); } }
void InitializeKeybindings() { foreach (Node node in buttonContainer.GetChildren()) { node.QueueFree(); } foreach (string action in InputMap.GetActions()) { if (SkipUiActions && action.StartsWith("ui_")) { continue; } if (SkipDebugActions && action.StartsWith("debug_")) { continue; } KeybindingElement element = (KeybindingElement)keybindingElement.Instance(); buttonContainer.AddChild(element); element.Action = action; foreach (InputEvent _event in InputMap.GetActionList(action)) { if (_event.MatchInputMethod(CurrentInputMethod)) { element.InputEvent = _event; break; } //Debug } element.ConnectPressed(this, nameof(GetNewInput), element.Action.InArray()); } }
public MyFunctionAppSlot(string slotName, FunctionAppSlot app, InputMap <string> settings) : base(slotName, new FunctionAppSlotArgs() { Name = slotName, ResourceGroupName = app.ResourceGroupName, AppServicePlanId = app.AppServicePlanId, StorageAccountName = app.StorageAccountName, StorageAccountAccessKey = app.StorageAccountAccessKey, FunctionAppName = app.Name, Version = "~3", AppSettings = settings, SiteConfig = new FunctionAppSlotSiteConfigArgs { Cors = new FunctionAppSlotSiteConfigCorsArgs { AllowedOrigins = new InputList <string> { "http://localhost:5500" }, SupportCredentials = true } } }) { if (string.IsNullOrWhiteSpace(slotName)) { throw new System.ArgumentException($"'{nameof(slotName)}' cannot be null or whitespace", nameof(slotName)); } }
public override void InitializeScreen() { //CHANGE FOR DYNAMIC RESOLUTION center = new Point(1280 / 2, 720 / 2); border = new Rectangle(center.X - 608, center.Y - 300, 1216, 580); selected = new Rectangle((border.X + (border.Width / 2)) - (480 / 2), (border.Y + (border.Height / 2)) - (270 / 2), 480, 270); left = new Rectangle((border.X + (border.Width / 2)) - (selected.Width / 2) - 20 - 240, (border.Y + (border.Height / 2)) - (135 / 2), 240, 135); right = new Rectangle((border.X + (border.Width / 2)) + (selected.Width / 2) + 20, (border.Y + (border.Height / 2)) - (135 / 2), 240, 135); description = new Rectangle(border.X, border.Bottom + 10, border.Width, 50); backgroundOpacity = 0.5f; index = 0; InputMap.NewAction("Select Left", Microsoft.Xna.Framework.Input.Keys.Left); InputMap.NewAction("Select Right", Microsoft.Xna.Framework.Input.Keys.Right); InputMap.NewAction("Select Map", Microsoft.Xna.Framework.Input.Keys.Enter); InputMap.NewAction("Back", Microsoft.Xna.Framework.Input.Keys.Escape); selectTimeSeconds = 1; selectTime = TimeSpan.FromSeconds(selectTimeSeconds); Removing += new EventHandler(LevelSelectionScreen_Removing); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F1)) { InputMap.SaveSettings(); } }
/// <summary> /// スプレッド連続入力設定処理 /// </summary> /// <param name="pspdObj">スプレッドシートインスタンス</param> /// <returns>true:正常終了 false:エラー</returns> /// <remark> /// 連続入力用初期処理を行います /// </remark> public static bool InitRenzokuInput(FpSpread pspdObj) { try { // 連続入力用 初期処理 // セルがアクティブになったときにそのセルを編集モード pspdObj.EditModePermanent = true; // 編集中セルの Enterキー押下による動作を無効とします。 InputMap linpMap = pspdObj.GetInputMap(InputMapMode.WhenAncestorOfFocused); linpMap.Put(new Keystroke(Keys.Enter, Keys.None), SpreadActions.None); //----------------------------------------------------------------------------- // ※ EditModeOn/EditModeOffのイベントは各自記述する必要があります // // [EditModeOn]の場合 // spdXXX.EditingControl.KeyDown += // new System.Windows.Forms.KeyEventHandler( this.spdXXX_KeyDown ); // [EditModeOff]の場合 // spdXXX.EditingControl.KeyDown -= // new System.Windows.Forms.KeyEventHandler( this.spdXXX_KeyDown ); //----------------------------------------------------------------------------- return(true); } catch (Exception) { return(false); } }
public HumanView(PlayerInfo playerInfo, CharacterInfo selectedCharacter, ContentManager contentLoader) : base(playerInfo, selectedCharacter) { mContentLoader = contentLoader; mPlayerInputMap = null; DrawSegment = null; }
public string TranslateInputName(string inputName, string zone) { string input = ""; // If inputName is renamed value we changed it to original if (InputSources.ContainsKey(inputName)) { inputName = InputSources[inputName]; } // Search for mapping if (InputMap.ContainsKey(inputName)) { input = InputMap[inputName]; } // If there is no mapping maybe value is already mapped value if (InputMap.ContainsValue(inputName)) { input = inputName; } if (!string.IsNullOrWhiteSpace(input)) { if (zone == "1") { input = $"SI{input}"; } else { input = $"Z{zone}{input}"; } } return(input); }
public override void Load() { base.Load(); mPlayerInputMap = mContentLoader.Load <InputMap>("config\\DefaultInputMap"); OnAssignInputMap(); }
public void ScrambleControls() { // Add rotate inputs to the scramble if the player has unlocked it. if (PlayerEvolution > 3 && !_actions.Contains("rotate_left") && !_actions.Contains("rotate_right")) { _actions.Add("rotate_left"); _actions.Add("rotate_right"); } var activeInputs = new ArrayList(); foreach (string action in _actions) { activeInputs.Add(InputMap.GetActionList(action)[0]); InputMap.ActionEraseEvents(action); } // Randomly assign inputs to said events. var random = new Random(); foreach (string action in _actions) { int index = random.Next(activeInputs.Count); InputMap.ActionAddEvent(action, (InputEvent)activeInputs[index]); activeInputs.RemoveAt(index); } }
/// <summary> /// Draw input debug if requested /// </summary> private void DrawInputDebug() { InputMap map = InputManager.map; if (map == null) { return; } StringWriter writer = new StringWriter(); writer.WriteLine("Devices"); writer.WriteLine("-------"); foreach (Device d in map.Devices) { writer.WriteLine(d.ToString() + ": " + d.GetRawValue() + "=>" + d.GetValue()); } writer.WriteLine(); writer.WriteLine("Functions"); writer.WriteLine("---------"); foreach (string s in map.Keys) { writer.Write(s + ": "); foreach (object val in map.GetDeviceValues(s)) { writer.Write(val.ToString() + " "); } writer.WriteLine("=> " + map.GetValue(s)); } GUI.Box(DebugInputArea, writer.ToString()); }
public void StartJoystickCalibration() { //Debug.Log("StartJoystickCalibration()"); droneRacerArm = DroneRacerArm.FindDroneRacerArm(); inputMap = InputMap.Load(InputMapName.JoystickInputMap); if (inputMap == null) { inputMap = new InputMap(); } else { UpdateUi(); } DisableStepDialogs(); joystickCalibrationSteps.gameObject.SetActive(true); currentStep = Step.None; StartCalibrateYaw(); }
/// <summary> /// スプレッド標準キー 無効処理(表示用) /// </summary> /// <param name="pspdObj">スプレッドシートインスタンス</param> /// <returns>true:正常終了 false:エラー</returns> /// <remark> /// 各起動時に実行してください。 /// TAB:フォーカス移動用にします /// ESC:通常画面の終了に使用します など /// /// ※ スプレッド読み取り専用の場合必要なし(OperationModeの設定だけ) /// 標準でキーを取得したい場合に使用します /// </remark> public static bool InitDispInputMap(FpSpread pspdObj) { try { // WhenAncestorOfFocused 入力マップ // コントロールまたはその子にフォーカスがある場合(セル編集モード) InputMap linpMap01 = pspdObj.GetInputMap(InputMapMode.WhenAncestorOfFocused); linpMap01.Put(new Keystroke(Keys.Escape, Keys.None), SpreadActions.None); // ESC linpMap01.Put(new Keystroke(Keys.Tab, Keys.None), SpreadActions.None); // TAB linpMap01.Put(new Keystroke(Keys.Enter, Keys.None), SpreadActions.None); // Enter linpMap01.Put(new Keystroke(Keys.F2, Keys.None), SpreadActions.None); // F2() linpMap01.Put(new Keystroke(Keys.F3, Keys.None), SpreadActions.None); // F3 linpMap01.Put(new Keystroke(Keys.F4, Keys.None), SpreadActions.None); // F4 linpMap01.Put(new Keystroke(Keys.Tab, Keys.Shift, false), SpreadActions.None); // WhenFocused 入力マップ // コントロールにフォーカスがある場合(セル非編集モード) InputMap linpMap02 = pspdObj.GetInputMap(InputMapMode.WhenFocused); linpMap02.Put(new Keystroke(Keys.Enter, Keys.None), SpreadActions.None); // Enter return(true); } catch (Exception) { return(false); } }
// Checks if action or key already exist in map, if not, add to map public void RegisterControl(string a, string k) { bool add = true; for (int i = 0; i < map.Count; ++i) if (map[i].act == a || map[i].key == k) { add = false; break; } if(add == true) { InputMap ad = new InputMap(a, k); map.Add(ad); } }
public float Get(InputMap button) { int index = m_ControllerIndex + 1; switch (button) { case InputMap.AxisLeftX: return UnityEngine.Input.GetAxisRaw("L_XAxis_" + index); case InputMap.AxisLeftY: return -UnityEngine.Input.GetAxisRaw("L_YAxis_" + index); case InputMap.AxisRightX: return UnityEngine.Input.GetAxisRaw("R_XAxis_" + index); case InputMap.AxisRightY: return -UnityEngine.Input.GetAxisRaw("R_YAxis_" + index); case InputMap.LTrigger: return UnityEngine.Input.GetAxisRaw("TriggersL_" + index); case InputMap.RTrigger: return UnityEngine.Input.GetAxisRaw("TriggersR_" + index); case InputMap.LShoulder: return UnityEngine.Input.GetAxisRaw("LB_" + index); case InputMap.RShoulder: return UnityEngine.Input.GetAxisRaw("RB_" + index); case InputMap.A: return UnityEngine.Input.GetAxisRaw("A_" + index); case InputMap.B: return UnityEngine.Input.GetAxisRaw("B_" + index); case InputMap.X: return UnityEngine.Input.GetAxisRaw("X_" + index); case InputMap.Y: return UnityEngine.Input.GetAxisRaw("Y_" + index); case InputMap.Back: return UnityEngine.Input.GetAxisRaw("Back_" + index); case InputMap.Start: return UnityEngine.Input.GetAxisRaw("Start_" + index); case InputMap.LThumstickDown: return UnityEngine.Input.GetAxisRaw("LS_" + index); case InputMap.RThumstickDown: return UnityEngine.Input.GetAxisRaw("RS_" + index); case InputMap.DPadLeft: return -Mathf.Min(0, UnityEngine.Input.GetAxisRaw("DPad_XAxis_" + index)); case InputMap.DPadRight: return Mathf.Max(0, UnityEngine.Input.GetAxisRaw("DPad_XAxis_" + index)); case InputMap.DPadUp: return Mathf.Max(0, UnityEngine.Input.GetAxisRaw("DPad_YAxis_" + index)); case InputMap.DPadDown: return -Mathf.Min(0, UnityEngine.Input.GetAxisRaw("DPad_YAxis_" + index)); } return 0.0f; }
public static InputMap getInputMap() { if (instance == null) { instance = new InputMap (); } return instance; }
public bool IsPressed(InputMap button) { return Get(button) > mOneMinisThreshold; }
public bool IsReleased(InputMap button) { return Get(button) < mThreshold; }
// Dont query from FixedUpdate public bool IsJustReleased(InputMap button) { return (Get(button) < mThreshold) && (mPreviousState[(int) button] > mOneMinisThreshold); }
public PlayerObj(string spriteName, PlayerIndex playerIndex, PhysicsManager physicsManager, ProceduralLevelScreen levelToAttachTo, Game game) : base(spriteName, physicsManager, levelToAttachTo) { this.m_game = game; this.m_playerLegs = (base.GetChildAt(2) as SpriteObj); this.m_playerHead = (base.GetChildAt(12) as SpriteObj); this.m_playerIndex = playerIndex; this.m_currentLogicSet = new LogicSet(null); base.State = 0; base.CollisionTypeTag = 2; this.m_debugInputMap = new InputMap(PlayerIndex.Two, false); this.InitializeInputMap(); this.m_walkDownSound = new FrameSoundObj(this.m_playerLegs, 4, new string[] { "Player_WalkDown01", "Player_WalkDown02" }); this.m_walkUpSound = new FrameSoundObj(this.m_playerLegs, 1, new string[] { "Player_WalkUp01", "Player_WalkUp02" }); this.m_walkUpSoundHigh = new FrameSoundObj(this.m_playerLegs, 1, new string[] { "Player_WalkUp01_High", "Player_WalkUp02_High" }); this.m_walkDownSoundHigh = new FrameSoundObj(this.m_playerLegs, 4, new string[] { "Player_WalkDown01_High", "Player_WalkDown02_High" }); this.m_walkUpSoundLow = new FrameSoundObj(this.m_playerLegs, 1, new string[] { "Player_WalkUp01_Low", "Player_WalkUp02_Low" }); this.m_walkDownSoundLow = new FrameSoundObj(this.m_playerLegs, 4, new string[] { "Player_WalkDown01_Low", "Player_WalkDown02_Low" }); this.m_externalLS = new LogicSet(null); this.m_flightDurationText = new TextObj(Game.JunicodeFont); this.m_flightDurationText.FontSize = 12f; this.m_flightDurationText.Align = Types.TextAlign.Centre; this.m_flightDurationText.DropShadow = new Vector2(2f, 2f); base.OutlineWidth = 2; this.m_translocatorSprite = new ObjContainer("PlayerIdle_Character"); this.m_translocatorSprite.Visible = false; this.m_translocatorSprite.OutlineColour = Color.Blue; this.m_translocatorSprite.OutlineWidth = 2; this.m_swearBubble = new SpriteObj("SwearBubble1_Sprite"); this.m_swearBubble.Scale = new Vector2(2f, 2f); this.m_swearBubble.Flip = SpriteEffects.FlipHorizontally; this.m_swearBubble.Visible = false; this.m_axeProjData = new ProjectileData(this) { SpriteName = "SpellAxe_Sprite", SourceAnchor = new Vector2(20f, -20f), Target = null, Speed = new Vector2(this.AxeProjectileSpeed, this.AxeProjectileSpeed), IsWeighted = true, RotationSpeed = 10f, Damage = this.Damage, AngleOffset = 0f, Angle = new Vector2(-90f, -90f), CollidesWithTerrain = false, Scale = this.AxeSpellScale, IgnoreInvincibleCounter = true }; this.m_rapidDaggerProjData = new ProjectileData(this) { SpriteName = "SpellDagger_Sprite", SourceAnchor = Vector2.Zero, Speed = new Vector2(this.DaggerProjectileSpeed, this.DaggerProjectileSpeed), IsWeighted = false, RotationSpeed = 0f, Damage = this.Damage, AngleOffset = 0f, CollidesWithTerrain = false, Scale = this.DaggerSpellScale, FollowArc = true, IgnoreInvincibleCounter = true }; }
public override void Dispose() { if (!base.IsDisposed) { if (this.m_currentLogicSet.IsActive) { this.m_currentLogicSet.Stop(); } this.m_currentLogicSet = null; this.m_standingAttack3LogicSet.Dispose(); this.m_standingAttack3LogicSet = null; this.m_airAttackLS.Dispose(); this.m_airAttackLS = null; this.m_debugInputMap.Dispose(); this.m_debugInputMap = null; this.m_playerHead = null; this.m_playerLegs = null; this.m_walkDownSound.Dispose(); this.m_walkDownSound = null; this.m_walkUpSound.Dispose(); this.m_walkUpSound = null; this.m_walkDownSoundLow.Dispose(); this.m_walkDownSoundLow = null; this.m_walkUpSoundLow.Dispose(); this.m_walkUpSoundLow = null; this.m_walkDownSoundHigh.Dispose(); this.m_walkDownSoundHigh = null; this.m_walkUpSoundHigh.Dispose(); this.m_walkUpSoundHigh = null; if (this.m_externalLS != null) { this.m_externalLS.Dispose(); } this.m_externalLS = null; this.m_lastTouchedTeleporter = null; this.m_flightDurationText.Dispose(); this.m_flightDurationText = null; this.m_game = null; this.m_translocatorSprite.Dispose(); this.m_translocatorSprite = null; this.m_swearBubble.Dispose(); this.m_swearBubble = null; this.m_flipTween = null; this.m_wizardSpellList.Clear(); this.m_wizardSpellList = null; this.m_closestGround = null; this.m_rapidDaggerProjData.Dispose(); this.m_axeProjData.Dispose(); base.Dispose(); } }
public InputMap BuildInputMap() { _map = new InputMap(); MapInput(); return _map; }
// Use this for initialization void Start () { inputMap = InputMap.getInputMap(); inputMap.Add(MultiPlatformInputs.UpArrow, upArrowKey); inputMap.Add(MultiPlatformInputs.DownArrow, downArrowKey); inputMap.Add(MultiPlatformInputs.RightArrow, rightArrowKey); }
public static void InitializeGlobalInput() { if (Game.GlobalInput != null) { Game.GlobalInput.ClearAll(); } else { Game.GlobalInput = new InputMap(PlayerIndex.One, true); } Game.GlobalInput.AddInput(0, Microsoft.Xna.Framework.Input.Keys.Enter); Game.GlobalInput.AddInput(2, Microsoft.Xna.Framework.Input.Keys.Escape); Game.GlobalInput.AddInput(6, Microsoft.Xna.Framework.Input.Keys.LeftControl); Game.GlobalInput.AddInput(4, Microsoft.Xna.Framework.Input.Keys.Tab); Game.GlobalInput.AddInput(7, Microsoft.Xna.Framework.Input.Keys.LeftShift); Game.GlobalInput.AddInput(5, Microsoft.Xna.Framework.Input.Keys.Back); Game.GlobalInput.AddInput(8, Microsoft.Xna.Framework.Input.Keys.Escape); Game.GlobalInput.AddInput(9, Microsoft.Xna.Framework.Input.Keys.Tab); Game.GlobalInput.AddInput(10, Microsoft.Xna.Framework.Input.Keys.S); Game.GlobalInput.AddInput(11, Microsoft.Xna.Framework.Input.Keys.Space); Game.GlobalInput.AddInput(24, Microsoft.Xna.Framework.Input.Keys.W); Game.GlobalInput.AddInput(12, Microsoft.Xna.Framework.Input.Keys.D); Game.GlobalInput.AddInput(13, Microsoft.Xna.Framework.Input.Keys.A); Game.GlobalInput.AddInput(14, Microsoft.Xna.Framework.Input.Keys.Q); Game.GlobalInput.AddInput(15, Microsoft.Xna.Framework.Input.Keys.E); Game.GlobalInput.AddInput(16, Microsoft.Xna.Framework.Input.Keys.I); Game.GlobalInput.AddInput(17, Microsoft.Xna.Framework.Input.Keys.Up); Game.GlobalInput.AddInput(18, Microsoft.Xna.Framework.Input.Keys.K); Game.GlobalInput.AddInput(19, Microsoft.Xna.Framework.Input.Keys.Down); Game.GlobalInput.AddInput(20, Microsoft.Xna.Framework.Input.Keys.J); Game.GlobalInput.AddInput(21, Microsoft.Xna.Framework.Input.Keys.Left); Game.GlobalInput.AddInput(22, Microsoft.Xna.Framework.Input.Keys.L); Game.GlobalInput.AddInput(23, Microsoft.Xna.Framework.Input.Keys.Right); Game.GlobalInput.AddInput(0, Buttons.A); Game.GlobalInput.AddInput(1, Buttons.Start); Game.GlobalInput.AddInput(2, Buttons.B); Game.GlobalInput.AddInput(3, Buttons.Back); Game.GlobalInput.AddInput(6, Buttons.RightTrigger); Game.GlobalInput.AddInput(4, Buttons.Y); Game.GlobalInput.AddInput(7, Buttons.X); Game.GlobalInput.AddInput(5, Buttons.Back); Game.GlobalInput.AddInput(8, Buttons.Start); Game.GlobalInput.AddInput(9, Buttons.Back); Game.GlobalInput.AddInput(10, Buttons.A); Game.GlobalInput.AddInput(12, Buttons.X); Game.GlobalInput.AddInput(13, Buttons.Y); Game.GlobalInput.AddInput(14, Buttons.LeftTrigger); Game.GlobalInput.AddInput(15, Buttons.RightTrigger); Game.GlobalInput.AddInput(16, Buttons.DPadUp); Game.GlobalInput.AddInput(17, ThumbStick.LeftStick, -90f, 30f); Game.GlobalInput.AddInput(18, Buttons.DPadDown); Game.GlobalInput.AddInput(19, ThumbStick.LeftStick, 90f, 37f); Game.GlobalInput.AddInput(20, Buttons.DPadLeft); Game.GlobalInput.AddInput(21, Buttons.LeftThumbstickLeft); Game.GlobalInput.AddInput(22, Buttons.DPadRight); Game.GlobalInput.AddInput(23, Buttons.LeftThumbstickRight); Game.GlobalInput.AddInput(24, Buttons.B); Game.GlobalInput.AddInput(25, Microsoft.Xna.Framework.Input.Keys.Escape); Game.GlobalInput.AddInput(25, Buttons.Back); Game.GlobalInput.AddInput(26, Microsoft.Xna.Framework.Input.Keys.Back); Game.GlobalInput.AddInput(26, Buttons.Y); Game.GlobalInput.KeyList[1] = Game.GlobalInput.KeyList[12]; Game.GlobalInput.KeyList[3] = Game.GlobalInput.KeyList[10]; }
void Awake() { DontDestroyOnLoad(gameObject); buttonsDown = new bool[3]; touchBuffer = new LFTouch[20]; // set up the default controller configs #if !UNITY_WEBPLAYER configPath = Application.persistentDataPath + "/InputConfig.xml"; if(File.Exists(configPath)){ inputMap = InputMap.Load(configPath); }else{ #endif inputMap = new InputMap(); inputMap.SetDefaults(); #if !UNITY_WEBPLAYER inputMap.Save(configPath); } #endif }
// Use this for initialization void Start () { inputMap = InputMap.getInputMap(); inputMap.Add(MultiPlatformInputs.SwipeUp, upSwipe); inputMap.Add(MultiPlatformInputs.SwipeRight, rightSwipe); }
public override void Dispose() { if (!base.IsDisposed) { Console.WriteLine("Disposing Procedural Level Screen"); Tween.StopAll(false); this.m_currentRoom = null; this.DisposeRTs(); foreach (RoomObj current in this.m_roomList) { current.Dispose(); } this.m_roomList.Clear(); this.m_roomList = null; this.m_enemyStartPositions.Clear(); this.m_enemyStartPositions = null; this.m_tempEnemyStartPositions.Clear(); this.m_tempEnemyStartPositions = null; this.m_textManager.Dispose(); this.m_textManager = null; this.m_physicsManager = null; this.m_projectileManager.Dispose(); this.m_projectileManager = null; this.m_itemDropManager.Dispose(); this.m_itemDropManager = null; this.m_currentRoom = null; this.m_miniMapDisplay.Dispose(); this.m_miniMapDisplay = null; this.m_mapBG.Dispose(); this.m_mapBG = null; this.m_inputMap.Dispose(); this.m_inputMap = null; this.m_lastEnemyHit = null; this.m_playerHUD.Dispose(); this.m_playerHUD = null; this.m_player = null; this.m_enemyHUD.Dispose(); this.m_enemyHUD = null; this.m_impactEffectPool.Dispose(); this.m_impactEffectPool = null; this.m_blackBorder1.Dispose(); this.m_blackBorder1 = null; this.m_blackBorder2.Dispose(); this.m_blackBorder2 = null; this.m_chestList.Clear(); this.m_chestList = null; this.m_projectileIconPool.Dispose(); this.m_projectileIconPool = null; this.m_objKilledPlayer = null; this.m_dungeonLight.Dispose(); this.m_dungeonLight = null; this.m_traitAura.Dispose(); this.m_traitAura = null; this.m_killedEnemyObjList.Clear(); this.m_killedEnemyObjList = null; this.m_roomEnteringTitle.Dispose(); this.m_roomEnteringTitle = null; this.m_roomTitle.Dispose(); this.m_roomTitle = null; this.m_creditsText.Dispose(); this.m_creditsText = null; this.m_creditsTitleText.Dispose(); this.m_creditsTitleText = null; Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length); Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length); this.m_creditsTextTitleList = null; this.m_creditsTextList = null; this.m_filmGrain.Dispose(); this.m_filmGrain = null; this.m_objectivePlate.Dispose(); this.m_objectivePlate = null; this.m_objectivePlateTween = null; this.m_sky.Dispose(); this.m_sky = null; this.m_whiteBG.Dispose(); this.m_whiteBG = null; this.m_compassBG.Dispose(); this.m_compassBG = null; this.m_compass.Dispose(); this.m_compass = null; if (this.m_compassDoor != null) { this.m_compassDoor.Dispose(); } this.m_compassDoor = null; this.m_castleBorderTexture.Dispose(); this.m_gardenBorderTexture.Dispose(); this.m_towerBorderTexture.Dispose(); this.m_dungeonBorderTexture.Dispose(); this.m_neoBorderTexture.Dispose(); this.m_castleBorderTexture = null; this.m_gardenBorderTexture = null; this.m_towerBorderTexture = null; this.m_dungeonBorderTexture = null; this.DebugTextObj.Dispose(); this.DebugTextObj = null; base.Dispose(); } }
public ProceduralLevelScreen() { this.DisableRoomTransitioning = false; this.m_roomList = new List<RoomObj>(); this.m_textManager = new TextManager(700); this.m_projectileManager = new ProjectileManager(this, 700); this.m_enemyStartPositions = new List<Vector2>(); this.m_tempEnemyStartPositions = new List<Vector2>(); this.m_impactEffectPool = new ImpactEffectPool(2000); this.CameraLockedToPlayer = true; this.m_roomTitle = new TextObj(null); this.m_roomTitle.Font = Game.JunicodeLargeFont; this.m_roomTitle.Align = Types.TextAlign.Right; this.m_roomTitle.Opacity = 0f; this.m_roomTitle.FontSize = 40f; this.m_roomTitle.Position = new Vector2(1270f, 570f); this.m_roomTitle.OutlineWidth = 2; this.m_roomEnteringTitle = (this.m_roomTitle.Clone() as TextObj); this.m_roomEnteringTitle.Text = "Now Entering"; this.m_roomEnteringTitle.FontSize = 24f; this.m_roomEnteringTitle.Y -= 50f; this.m_inputMap = new InputMap(PlayerIndex.One, false); this.m_inputMap.AddInput(0, Keys.Y); this.m_inputMap.AddInput(1, Keys.U); this.m_inputMap.AddInput(2, Keys.LeftControl); this.m_inputMap.AddInput(3, Keys.Left); this.m_inputMap.AddInput(4, Keys.Right); this.m_inputMap.AddInput(5, Keys.Up); this.m_inputMap.AddInput(6, Keys.Down); this.m_inputMap.AddInput(7, Keys.OemTilde); this.m_chestList = new List<ChestObj>(); this.m_miniMapDisplay = new MapObj(true, this); this.m_killedEnemyObjList = new List<EnemyObj>(); }