public void DelayedStart() { if (rayCasters != null) { InputBase.registerRayCasters(rayCasters); } }
public Player SpawnPlayer(PlayerType type, Vector3 position, Quaternion rotation, int ID) { if (playerPrefab) // && AIPlayerPrefab) { //Player prefab = type == PlayerType.HUMAN ? playerPrefab : AIPlayerPrefab; Player player = Instantiate(playerPrefab, transform, true); player.transform.SetPositionAndRotation(position, rotation); InputBase input = GenerateInput(type, ID); player.InitializePlayer(type, ID, input); if (type == PlayerType.HUMAN) { SetupPlayer(player); } else if (type == PlayerType.AI) { SetupPlayerAI(player); } playerList.Add(player); return(player); } else { Debug.LogError("Player Prefab is null"); return(null); } }
private void Send(InputBase input) { try { if (ClientSocket == null || !ClientSocket.Connected) { // not connected throw new SocketException(); } byte[] buf = null; using (var stream = new System.IO.MemoryStream()) { using (var writer = new System.IO.BinaryWriter(stream)) { stream.Seek(3, System.IO.SeekOrigin.Begin); Serializer.WriteObject(stream, input); var len = (ushort)(stream.Position - 3); stream.Seek(0, System.IO.SeekOrigin.Begin); stream.WriteByte(0x1b); writer.Write(len); buf = stream.ToArray(); } } SocketError socketError; ClientSocket.BeginSend(buf, 0, buf.Length, SocketFlags.None, out socketError, BeginSendCallback, ClientSocket); } catch { this.Detach(); throw; } }
void Start() { player = GetComponent <Player>(); input = player.input; pointerPosition = new Vector2(); }
public InputMng() { #if UNITY_EDITOR m_curInput = new InputMouse(); #else m_curInput = new InputTouch(); #endif }
void Start() { damageData.owner = player.Health; input = player.input; hitScanner = player.hitScanner; input.SubscribeButtonHold(Action.Fire, Fire); }
InputManager() { #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) instance = new InputDevice(); #else instance = new InputMouse(); #endif instance.Init(); }
void Start() { pieceSpeed = inputPiece.pieceSpeed; if (rayCasters != null) { InputBase.registerRayCasters(rayCasters); } }
public InputBase AddInput(InputBase input, UIComponent uiComponent = null) { int index = InputsSet.Count; input.Index = index; input.UIComponent = uiComponent; InputsSet.Add(index, input); return(input); }
public void registerRayCasters() { rayCastersRegistered = true; if (rayCasters != null) { InputBase.registerRayCasters(rayCasters); } }
void activateRayCasters(bool activate) { InputBase.activateAllRayCasters(activate); /*for(int i = 0; i < rayCasters.Length; i++) * { * rayCasters[i].SetActive(activate); * }*/ }
private void InitInput() { m_oInput = InputFactory.GetInput(m_eInputSource); if(m_oInput != null) { m_oInput.Init(); m_oInput.Activate(JumpDetecet, ShootDetected); } }
void Start() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; input = camera.player.input; //Screen.lockCursor = true; deadzone_rect = new Rect((Screen.width / 2) - (deadzone_radius), (Screen.height / 2) - (deadzone_radius), deadzone_radius * 2, deadzone_radius * 2); }
public void Handle(InputBase inputBase) { IHaveInputBase haveInputBase = inputBase as IHaveInputBase; if (haveInputBase != null) { foreach (InputBase input in haveInputBase.Inputs) { this.Handle(input); } } inputBase.DateCreated = this.dateTimeService.UtcNow();
private void InitInput() { m_oInput = InputFactory.GetInput(); if (m_oInput != null) { m_oInput.Init(m_paintTable); m_oInput.Activate( OnSlideDetected ); } }
private static InputDef MakeInputDef(InputBase m) { return(new InputDef() { ID = m.ID, Name = m.Name, Description = m.Name, Unit = m.Unit, Dimension = m.Dimension, Type = m.Type, DefaultValue = m.GetDefaultValue() }); }
private void Awake() { switch (Application.platform) { case RuntimePlatform.Android: input = new InputAndroid(this); break; default: input = new InputComputer(this); break; } }
public void SetTimerMessage(FormInput formInput) { SetFormForMessage(formInput); for (int i = 0; i < inputBases.Length; i++) { InputBase inputBase = inputBases[i]; if (inputBase is InputText) { InputText inputText = (InputText)inputBase; inputText.SetTimer(); } } }
void Start() { pieceSpeed = inputPiece.pieceSpeed; if (pieceStock == null) { print("Falta asignarlo en el editor"); } if (rayCasters != null) { InputBase.registerRayCasters(rayCasters); } }
public void ChangeInput(eInputSource eNewInputSource) { if(eNewInputSource != m_eInputSource) { if(m_oInput != null) { m_oInput.Deactivate(); m_oInput = null; } m_eInputSource = eNewInputSource; InitInput(); } }
public void DelayedStart() { onDragFinish += foo; onDragUpdate += foo; onDragStart += foo; onTap += foo; onTapToDelete += foo; onLetterOnGridDragFinish += foo; onChangePutLetterOverContainer += foo; if (rayCasters != null) { InputBase.registerRayCasters(rayCasters); } }
protected override void Initialize() { base.Initialize(); var dirs = new[] { @"img\PPD\home", @"img\PPD\main_game", @"img\PPD\single", @"img\PPD\multi" }; foreach (var dir in dirs) { var spriteManager = new DirSpriteManager(dir); spriteManager.Pack(); } homeResourceManager = new PPDFramework.Resource.SpriteResourceManager(device, @"img\PPD\home"); input = PPDSetting.Setting.EveryFramePollingDisabled ? new AccurateInput(Form.MainForm, PPDSetting.Setting.AccurateInputSleepTime) : new Input(Form.MainForm); input.Load(); sound = new Sound(Form.MainForm); sound.Initialize(); keyConfigManager = new KeyConfigManager(); keyConfigManager.Load("keyconfig.ini"); for (int i = 0; i < PPDSetting.DefaultSounds.Length; i++) { sound.AddSound(PPDSetting.DefaultSounds[i]); } Form.MainForm.ClientSize = new System.Drawing.Size(PPDSetting.Setting.Width, PPDSetting.Setting.Height); mouseManager = new MouseManager(Control, device.Offset, device.Scale); screenShotManager = new ScreenShotManager(device); sceneManager = new SceneManager(device) { GameHost = this }; sceneManager.Update(EmptyInputInfo.Instance, MouseInfo.Empty, sound); movieVolumeSprite = new MovieVolumeSprite(device, this); timerManager = new TimerManager(gameTimer); if (CheckExecuteMode(out string gamePath)) { LoadSpecial(gamePath); } else { InitOverray(); LoadNormal(); } LoadCommon(); TextEditableControl.IMEStarted += control_IMEStarted; TextEditableControl._EnabledChanged += control_EnabledChanged; }
public override Task <StepResult> Step(Timestamp t, InputValue[] inputValues) { foreach (InputValue v in inputValues) { InputBase input = inputs.FirstOrDefault(inn => inn.ID == v.InputID); if (input != null) { input.VTQ = v.Value; } } foreach (var output in outputs) { output.VTQ = VTQ.Make(DataValue.Empty, t, Quality.Good); output.ValueHasBeenAssigned = false; } stepAction(t, dt); StateValue[] resStates = states.Select(kv => new StateValue() { StateID = kv.ID, Value = kv.GetValue() }).ToArray(); var outputValues = new List <OutputValue>(outputs.Length); foreach (OutputBase output in outputs) { if (output.ValueHasBeenAssigned) { outputValues.Add(new OutputValue() { OutputID = output.ID, Value = output.VTQ }); } } var stepRes = new StepResult() { Output = outputValues.ToArray(), State = resStates, }; return(Task.FromResult(stepRes)); }
private void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; this.Title = "文本域"; var ib = new InputBase(); this.Content = ib; bd = ib.bd; tb_Host = ib.tb_Host; tb_Host.TextChanged += tb_Host_TextChanged; host_ClearText = ib.host_ClearText; host_ClearText.MouseLeftButtonDown += ClearAllText; }
private static void GetPipeline(IHostEnvironment env, InputBase input, out IDataView startingData, out RoleMappedData transformedData) { Contracts.AssertValue(env); env.AssertValue(input); env.AssertNonEmpty(input.Models); ISchema inputSchema = null; startingData = null; transformedData = null; byte[][] transformedDataSerialized = null; string[] transformedDataZipEntryNames = null; for (int i = 0; i < input.Models.Length; i++) { var model = input.Models[i]; var inputData = new EmptyDataView(env, model.TransformModel.InputSchema); model.PrepareData(env, inputData, out RoleMappedData transformedDataCur, out IPredictor pred); if (inputSchema == null) { env.Assert(i == 0); inputSchema = model.TransformModel.InputSchema; startingData = inputData; transformedData = transformedDataCur; } else if (input.ValidatePipelines) { using (var ch = env.Start("Validating pipeline")) { if (transformedDataSerialized == null) { ch.Assert(transformedDataZipEntryNames == null); SerializeRoleMappedData(env, ch, transformedData, out transformedDataSerialized, out transformedDataZipEntryNames); } CheckSamePipeline(env, ch, transformedDataCur, transformedDataSerialized, transformedDataZipEntryNames); ch.Done(); } } } }
public async Task <IHttpActionResult> GetContent(InputBase input) { var userId = ((UserIdentity)User.Identity).UserId; try { if (input != null) { var result = await Task.Run(() => (from s in db.Purchases.Where(s => s.is_or == 3) orderby s.Id select s).Skip((input.PageIndex - 1) * input.PageSize).Take(input.PageSize)); return(Json(new { code = 200, data = result })); } return(Json(new { code = 400 })); } catch (Exception) { throw; } }
public static InputBase GetInput() { InputBase oInputImplementation = null; if (Input.touchSupported) { oInputImplementation = new InputPlayerTouch(); } else { oInputImplementation = new InputMouse(); } if (oInputImplementation == null) { Debug.LogError("Input implementation not available!"); } return(oInputImplementation); }
public static InputBase GetInput(InputManager.eInputSource eInputType) { InputBase oInputImplementation = null; switch (eInputType) { case InputManager.eInputSource.PLAYER: //if(Input.touchSupported) { oInputImplementation = new InputPlayerTouchContinuous(); } /*else * { * oInputImplementation = new InputMouse(); * }*/ break; case InputManager.eInputSource.AI: Debug.LogWarning("AI input not yet available - Replay fallback"); oInputImplementation = new InputReplay(); break; case InputManager.eInputSource.NETWORK: Debug.LogWarning("AI network not yet available - Replay fallback"); oInputImplementation = new InputReplay(); break; case InputManager.eInputSource.REPLAY: oInputImplementation = new InputReplay(); break; } ; if (oInputImplementation == null) { Debug.LogError("Input implementation not available!"); } return(oInputImplementation); }
public Tetris(int stage_w, int stage_h, Tetrimino tetrimino, Generator generator, InputBase input) { m_stage_w = stage_w; m_stage_h = stage_h; m_stage = new Stage(m_stage_w, m_stage_h); m_tetrimino = tetrimino; initTetriminoStartPosition(); m_generator = generator; m_drop_serial = 0; m_input = input; m_drop_interval = DROP_INTERVAL; //m_fix_interval = 0; m_is_game_over = false; // 落下するブロックのIDを更新 updateDropTypeId(); }
public static bool TryParseSelectableValueFromString <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TValue>( this InputBase <TValue> input, string?value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string?validationErrorMessage) { try { // We special-case bool values because BindConverter reserves bool conversion for conditional attributes. if (typeof(TValue) == typeof(bool)) { if (TryConvertToBool(value, out result)) { validationErrorMessage = null; return(true); } } else if (typeof(TValue) == typeof(bool?)) { if (TryConvertToNullableBool(value, out result)) { validationErrorMessage = null; return(true); } } else if (BindConverter.TryConvertTo <TValue>(value, CultureInfo.CurrentCulture, out var parsedValue)) { result = parsedValue; validationErrorMessage = null; return(true); } result = default; validationErrorMessage = $"The {input.DisplayName ?? input.FieldIdentifier.FieldName} field is not valid."; return(false); } catch (InvalidOperationException ex) { throw new InvalidOperationException($"{input.GetType()} does not support the type '{typeof(TValue)}'.", ex); } }
public static bool TryParseSelectableValueFromString <TValue>(this InputBase <TValue> input, string?value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string?validationErrorMessage) { try { if (BindConverter.TryConvertTo <TValue>(value, CultureInfo.CurrentCulture, out var parsedValue)) { result = parsedValue; validationErrorMessage = null; return(true); } else { result = default; validationErrorMessage = $"The {input.DisplayName} field is not valid."; return(false); } } catch (InvalidOperationException ex) { throw new InvalidOperationException($"{input.GetType()} does not support the type '{typeof(TValue)}'.", ex); } }
public static InputBase GetInput(InputManager.eInputSource eInputType) { InputBase oInputImplementation = null; // bool _forceTouch = false; //#if DEBUG // _forceTouch = true; //#endif switch (eInputType) { case InputManager.eInputSource.PLAYER: oInputImplementation = new InputPlayerKeyboard(); break; case InputManager.eInputSource.AI: Debug.LogWarning("AI input not yet available"); //oInputImplementation = new InputAi(); break; case InputManager.eInputSource.NETWORK: Debug.LogWarning("Network input not yet available"); //oInputImplementation = new InputNetwork(); break; case InputManager.eInputSource.REPLAY: Debug.LogWarning("REPLAY input not yet available"); //oInputImplementation = new InputReplay(); break; } ; if (oInputImplementation == null) { Debug.LogError("Input implementation not available!"); } return(oInputImplementation); }
public void BaseClass(InputBase input) { }