public ListadoOscViewModel() { if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; } this.vistaNavegable = CollectionViewSource.GetDefaultView(this.listaDeResultados); this.vistaNavegable.CurrentChanged += this.VistaNavegableCurrentChanged; this.settings = ControlsSettings.Default; this.Parametros.NumeroDeResultados = this.settings.NumeroDeResultados; this.moverAlPrimero = new DelegateCommand(this.ExecuteMoverAlPrimero); this.moverAlSiguiente = new DelegateCommand(this.ExecuteMoverAlSiguiente); this.moverAlAnterior = new DelegateCommand(this.ExecuteMoverAlAnterior); this.moverAlUltimo = new DelegateCommand(this.ExecuteMoverAlUltimo); this.buscar = new DelegateCommand(this.EjecutarBusqueda); this.limpiarBusqueda = new DelegateCommand(() => { this.Parametros = new ParametrosBusquedaOrdenDeServicio { NumeroDeResultados = this.settings.NumeroDeResultados }; this.ListaDeResultados.Clear(); }); this.ordenImprimir = new DelegateCommand <string>(this.OnOrdenImprimirCommand); this.ordenImprimirLabels = new DelegateCommand <OrdenDeServicio>(this.OnOrdenImprimirLabelsCommand); }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } }
private void Start() { if (instance == null) { controlsSetting = PlayerPrefs.GetInt("controlType", 0); } instance = this; }
public static void OV_receiveChatMessage(CSteamID speakerSteamID, string iconURL, EChatMode mode, Color color, bool isRich, string text) { G.Settings.Mute.TryGetValue(speakerSteamID.m_SteamID, out Mute MuteState); if (MuteState == Mute.All) { return; } if (MuteState == Mute.Global && mode == EChatMode.GLOBAL) { return; } if (MuteState == Mute.Area && mode == EChatMode.LOCAL) { return; } if (MuteState == Mute.Group && mode == EChatMode.GROUP) { return; } text = text.Trim(); ControlsSettings.formatPluginHotkeysIntoText(ref text); if (OptionsSettings.streamer) { color = Color.white; } SteamPlayer speaker; if (speakerSteamID == CSteamID.Nil) { speaker = null; } else { if (!OptionsSettings.chatText && speakerSteamID != Provider.client) { return; } speaker = PlayerTool.getSteamPlayer(speakerSteamID); } ReceivedChatMessage item = new ReceivedChatMessage(speaker, iconURL, mode, color, isRich, text); ChatManager.receivedChatHistory.Insert(0, item); if (ChatManager.receivedChatHistory.Count > Provider.preferenceData.Chat.History_Length) { ChatManager.receivedChatHistory.RemoveAt(ChatManager.receivedChatHistory.Count - 1); } if (ChatManager.onChatMessageReceived != null) { ChatManager.onChatMessageReceived(); } }
private void Awake() { instance = this; animator = GetComponent <Animator>(); inputActions = new ControlsManager(); ControlsSettings.MaskInputBindings(inputActions.Controls);//enable chosen control scheme //When the input for the movemet is detected, //call the MakeMove() function inputActions.Controls.MoveWASD.started += context => MakeMove(context.ReadValue <Vector2>()); inputActions.Controls.MoveAWEF.started += context => MakeMove(context.ReadValue <Vector2>()); inputActions.Controls.MoveKeypad.started += context => MakeMove(context.ReadValue <Vector2>()); //start and cancel grabbing action inputActions.Controls.Grab.started += context => SetGrabbing(true); inputActions.Controls.Grab.canceled += context => SetGrabbing(false); //undo last move inputActions.Controls.Undo.started += context => LevelManager.instance.UndoMove(); linearSpeed = 0f; isMoving = false; isPushing = false; isPulling = false; isGrabbing = false; }
public static void OV_FixedUpdate(PlayerInput instance) { if (instance.player != OptimizationVariables.MainPlayer) { return; } Player player = OptimizationVariables.MainPlayer; if (Step == -1) { Rate = 4; Run = false; } else if (Step == 1 && !Run) { Run = true; } else if (Step == 2) { /* * Buffer++; * if (Buffer > 3) * Buffer = 0; * * if (MiscOptions.TimeAcceleration == 1 && Buffer % 4 != 0) * return; * * if (MiscOptions.TimeAcceleration == 2 && Buffer % 2 != 0) * return; */ Run = false; switch (MiscOptions.TimeAcceleration) { case 1: Rate = 4; break; case 2: Rate = 2; break; case 4: Rate = 1; break; } } if (!Run && SequenceDiff <= 0) { Rate = 4; SequenceDiff = 0; Step = -1; Run = false; } Count++; if (Count % Rate == 0u) { if (Rate == 1) { SequenceDiff--; } else if (Rate == 2 && Count % 4 == 0) { SequenceDiff--; } if (Run) { if (Time.realtimeSinceStartup - LastReal > 8) { LastReal = Time.realtimeSinceStartup; } else { SequenceDiff++; return; } } SetTick(instance, Time.realtimeSinceStartup); instance.keys[0] = player.movement.jump; instance.keys[1] = player.equipment.primary; // Phase between false and true every other tick to simulate rapid tapping of the mouse // (gunfire is simulated server-side from inputs) if (WeaponOptions.FastSemiAuto && player.equipment.useable is UseableGun gun && (GetFiremode(gun) == EFiremode.SEMI || GetFiremode(gun) == EFiremode.BURST) && player.equipment.primary) { if (!clicking) { instance.keys[1] = true; clicking = true; } else { instance.keys[1] = false; clicking = false; } } else { clicking = false; } instance.keys[2] = player.equipment.secondary; instance.keys[3] = player.stance.crouch; instance.keys[4] = player.stance.prone; instance.keys[5] = player.stance.sprint; instance.keys[6] = player.animator.leanLeft; instance.keys[7] = player.animator.leanRight; instance.keys[8] = false; for (int i = 0; i < (int)ControlsSettings.NUM_PLUGIN_KEYS; i++) { int num = instance.keys.Length - ControlsSettings.NUM_PLUGIN_KEYS + i; instance.keys[num] = Input.GetKey(ControlsSettings.getPluginKeyCode(i)); } Analog = (byte)(player.movement.horizontal << 4 | player.movement.vertical); player.life.simulate(instance.simulation); player.stance.simulate(instance.simulation, player.stance.crouch, player.stance.prone, player.stance.sprint); Pitch = player.look.pitch; Yaw = player.look.yaw; player.movement.simulate(instance.simulation, 0, player.movement.horizontal - 1, player.movement.vertical - 1, player.look.look_x, player.look.look_y, player.movement.jump, player.stance.sprint, Vector3.zero, PlayerInput.RATE); ClientSequence++; PlayerInputPacket playerInputPacket; if (player.stance.stance == EPlayerStance.DRIVING) { playerInputPacket = new DrivingPlayerInputPacket(); } else { playerInputPacket = new WalkingPlayerInputPacket(); } playerInputPacket.sequence = ClientSequence; playerInputPacket.recov = instance.recov; playerInputPacket.clientsideInputs = new List <RaycastInfo>(); if (MiscOptions.PunchSilentAim) { OV_DamageTool.OVType = OverrideType.PlayerHit; } RaycastInfo raycast = DamageTool.raycast(new Ray(player.look.aim.position, player.look.aim.forward), 6f, RayMasks.DAMAGE_SERVER); OV_DamageTool.OVType = OverrideType.None; if (MiscOptions.PunchAura && !player.equipment.isSelected && !(raycast.player == null && raycast.vehicle == null && raycast.zombie == null && raycast.animal == null)) { if (Count % 6 == 0) { playerInputPacket.clientsideInputs.Add(raycast); instance.keys[1] = true; } else { instance.keys[1] = false; } } ushort num2 = 0; for (byte b = 0; b < instance.keys.Length; b++) { if (instance.keys[b]) { num2 |= (ushort)(1 << b); } } playerInputPacket.keys = num2; if (playerInputPacket is DrivingPlayerInputPacket drivingPlayerInputPacket) { InteractableVehicle vehicle = player.movement.getVehicle(); if (vehicle != null) { Transform transform = vehicle.transform; drivingPlayerInputPacket.position = vehicle.asset.engine == EEngine.TRAIN ? new Vector3(vehicle.roadPosition, 0f, 0f) : transform.position; drivingPlayerInputPacket.angle_x = MeasurementTool.angleToByte2(transform.rotation.eulerAngles.x); drivingPlayerInputPacket.angle_y = MeasurementTool.angleToByte2(transform.rotation.eulerAngles.y); drivingPlayerInputPacket.angle_z = MeasurementTool.angleToByte2(transform.rotation.eulerAngles.z); drivingPlayerInputPacket.speed = (byte)(Mathf.Clamp(vehicle.speed, -100f, 100f) + 128f); drivingPlayerInputPacket.physicsSpeed = (byte)(Mathf.Clamp(vehicle.physicsSpeed, -100f, 100f) + 128f); drivingPlayerInputPacket.turn = (byte)(vehicle.turn + 1); } } else { WalkingPlayerInputPacket walkingPlayerInputPacket = playerInputPacket as WalkingPlayerInputPacket; walkingPlayerInputPacket.analog = Analog; walkingPlayerInputPacket.position = instance.transform.localPosition; var inputX = GetInputX(OptimizationVariables.MainPlayer.movement); var inputY = GetInputY(OptimizationVariables.MainPlayer.movement); if (MiscOptions.Spinbot && spinStances.Contains(OptimizationVariables.MainPlayer.stance.stance)) { // Ghetto movement fix if (inputX == 0 && inputY == 0) { walkingPlayerInputPacket.yaw = MiscOptions.StaticSpinbotYaw ? MiscOptions.SpinbotYaw : NextSpinbotYaw(MiscOptions.SpinbotYaw); } else { // use walkSpin bool to phase between actual angle and inverted angle to spin while walking // and have fixed movement; only way we can do it with the d-pad like controls. if (!walkSpin) { // Flip x/y input to account for reversed yaw (where intended movement direction will be reversed) inputY *= -1; inputX *= -1; // Reverse yaw to spin while moving walkingPlayerInputPacket.yaw = ReverseAngle180(Yaw); walkingPlayerInputPacket.analog = (byte)(((byte)(inputX + 1)) << 4 | (byte)(inputY + 1)); walkSpin = true; } else { walkingPlayerInputPacket.yaw = Yaw; walkSpin = false; } } walkingPlayerInputPacket.pitch = MiscOptions.StaticSpinbotPitch ? MiscOptions.SpinbotPitch : NextSpinbotPitch(MiscOptions.SpinbotPitch); } else { walkingPlayerInputPacket.yaw = Yaw; walkingPlayerInputPacket.pitch = Pitch; } } Packets.Add(playerInputPacket); player.equipment.simulate(instance.simulation, instance.keys[1], player.equipment.secondary, player.stance.sprint); player.animator.simulate(instance.simulation, player.animator.leanLeft, player.animator.leanRight); SetSim(instance, GetSim(instance) + 1); }
protected override string GetPresetName(string filename) { return(ControlsSettings.GetCurrentPresetName(filename)); }
public ControlsMenu(ControlsSettings settings) { this.settings = settings; }
public void Initialize(ScreenManager screenManager) { this.screenManager = screenManager; GraphicsDevice = screenManager.GraphicsDevice; _content = new ContentManager(screenManager.ServiceProvider, "Content"); //Background settingsMenu = new Sprite2D(_content.Load <Texture2D>("Sprites/SettingsMenu"), new Rectangle(100, 50, 1080, 620)); audioSettings = Settings.Instance.Audio.Clone() as AudioSettings; controlsSettings = Settings.Instance.Controls.Clone() as ControlsSettings; graphicsSettings = Settings.Instance.Graphics.Clone() as GraphicsSettings; rubiksSettings = Settings.Instance.RubiksCube.Clone() as RubiksCubeSettings; SpriteFont font = _content.Load <SpriteFont>("Fonts/Arial24"); Texture2D boxTexture = _content.Load <Texture2D>("Sprites/Transparent"); ButtonAnimation hover = new ButtonAnimation(null, null, new Color(0, 255, 255, 150)); ButtonAnimation unHoverUnMark = new ButtonAnimation(null, null, Color.Transparent); ButtonAnimation mark = new ButtonAnimation(null, null, new Color(0, 180, 255, 250)); // //Buttons // // //Controls // controlsBtn = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 120, 225, 75))); controlsBtn.Color = Color.Transparent; controlsBtn.HoverAnimation = hover; controlsBtn.UnHoverAnimation = unHoverUnMark; controlsBtn.UnMarkAnimation = unHoverUnMark; controlsBtn.MarkAnimation = mark; controlsBtn.TextMessege = new Text(categoriesName[0], font); controlsBtn.TextMessege.Center(controlsBtn.Bounds); // //Audio // audioBtn = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 195, 225, 75))); audioBtn.Color = Color.Transparent; audioBtn.HoverAnimation = hover; audioBtn.UnHoverAnimation = unHoverUnMark; audioBtn.UnMarkAnimation = unHoverUnMark; audioBtn.MarkAnimation = mark; audioBtn.TextMessege = new Text(categoriesName[1], font); audioBtn.TextMessege.Center(audioBtn.Bounds); // //Window // windowBtn = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 270, 225, 75))); windowBtn.Color = Color.Transparent; windowBtn.HoverAnimation = hover; windowBtn.UnHoverAnimation = unHoverUnMark; windowBtn.UnMarkAnimation = unHoverUnMark; windowBtn.MarkAnimation = mark; windowBtn.TextMessege = new Text(categoriesName[2], font); windowBtn.TextMessege.Center(windowBtn.Bounds); // //Rubiks // rubiksBtn = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 345, 225, 75))); rubiksBtn.Color = Color.Transparent; rubiksBtn.HoverAnimation = hover; rubiksBtn.UnHoverAnimation = unHoverUnMark; rubiksBtn.UnMarkAnimation = unHoverUnMark; rubiksBtn.MarkAnimation = mark; rubiksBtn.TextMessege = new Text(categoriesName[3], font); rubiksBtn.TextMessege.Center(rubiksBtn.Bounds); // //Menus // audioMenu = new AudioMenu(audioSettings); audioMenu.Initialize(_content, GraphicsDevice); audioMenu.Location = new Vector2(375, 65); audioMenu.Show = false; rubiksMenu = new RubiksCubeMenu(rubiksSettings); rubiksMenu.Initialize(_content, GraphicsDevice); rubiksMenu.Location = new Vector2(375, 65); rubiksMenu.Show = false; controlsMenu = new ControlsMenu(controlsSettings); controlsMenu.Initialize(_content, GraphicsDevice); controlsMenu.Location = new Vector2(375, 65); controlsMenu.Show = false; graphicsMenu = new GraphicsMenu(graphicsSettings); graphicsMenu.Initialize(_content, GraphicsDevice); graphicsMenu.Location = new Vector2(375, 65); graphicsMenu.Show = false; // //Panel // categories = new MarkableButtonPanel(); categories.Add(controlsBtn); categories.Add(audioBtn); categories.Add(windowBtn); categories.Add(rubiksBtn); categories.SetMarked(0); audioBtn.Click += new EventHandler((s, e) => { audioMenu.Show = true; rubiksMenu.Show = false; controlsMenu.Show = false; graphicsMenu.Show = false; }); windowBtn.Click += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = false; controlsMenu.Show = false; graphicsMenu.Show = true; }); rubiksBtn.Click += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = true; controlsMenu.Show = false; graphicsMenu.Show = false; }); controlsBtn.Click += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = false; controlsMenu.Show = true; graphicsMenu.Show = false; }); // //Btns // backBtn = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/BackBtn"), new Rectangle(85, 630, 100, 75))); backBtn.Click += On_ExitButtonClick; applyBtn = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/ApplyBtn"), new Rectangle(1050, 630, 150, 75))); applyBtn.Click += On_ApplySettings; resetBtn = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/ResetBtn"), new Rectangle(825, 630, 150, 75))); resetBtn.Click += On_ResetSettings; }
private void InitRow(int index, ControlsSettings settings) { buttons[index] = new List<ClickerLabel>(); for (int i = 0; i < 12; i++) { ClickerLabel l = new ClickerLabel(); l.AutoSize = false; l.Size = settings.btnSize; l.Cursor = Cursors.Hand; l.BackColor = Color.Transparent; l.ForeColor = Color.FromArgb(220, 218, 202); l.TextAlign = ContentAlignment.BottomCenter; l.Font = new Font("Open Sans", 8F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(204))); string key = (index == 0 ? "F" : (index == 2 ? "NUMPAD" : "")) + (i + 1); l.Tag = key; l.IsActive = true; l.Location = new Point(settings.startX + (settings.btnSize.Width + settings.btnMargin) * i + (int)Math.Floor((float)i / 4) * 5, (settings.startY)); l.Elapsed += labelTimer_Elapsed; buttons[index].Add(l); settings.parent.Controls.Add(l); } }
private void InitControls() { ControlsSettings s = new ControlsSettings(); s.btnMargin = 3; s.startX = 21; s.btnSize = new Size(34, 34); s.parent = this; for (int i = 0; i < 3; i++) { s.startY = 7 + (46 * (2 - i)); InitRow(i, s); } }