// Use this for initialization void Start() { if (Application.platform == RuntimePlatform.Android) { orientationController = new AndroidAccelOrientationManager(this); if (Application.loadedLevel == 4) { positionController = new GPSPositionController(this); } Debug.Log("Using android orientation"); } else { Debug.Log("Using PC orientation"); orientationController = new MouseOrientationController(this); positionController = new KeyboardPositionController(this); } if(orientationController != null) { orientationController.Start(); } if(positionController != null) { positionController.Start(); } }
public void PerformBeatingCheckTest() { var controller = GameFactory.CreateGameController(); var context = controller.GameContext; Assert.AreEqual(false, PositionController.MakeMove(context, 0)); }
public void Update_ShouldFail_GivenPositionDoesntExist() { // Given // PositionController over a mock service that would alway throw exceptions on Get & GetAsync _positionService.When(s => s.GetAsync(Arg.Any <Guid>())) .Do(v => throw new ItemNotFoundException(v[0].ToString(), "position")); var positionController = new PositionController( _positionService, _tenantIdProvider, Substitute.For <ILogger <PositionController> >()); var positionId = Guid.NewGuid(); var positionDto = new PositionDto { Id = positionId.ToString(), Name = "Position" }; // When // Put is called on the controller AsyncTestDelegate action = async() => await positionController.Put(positionId, positionDto); // Then // The controller should thrown ItemNotFoundException Assert.ThrowsAsync <ItemNotFoundException>(action); }
IEnumerator PlayMelody(int[] melody, float repeatQuant = -1f, int initialWait = 0, int noteDuration = 1) { if (repeatQuant == -1) { repeatQuant = Mathf.Infinity; } while (initialWait > 0) { print("Waiting"); yield return(NextCompass()); initialWait--; } for (int repetition = 0; repetition < repeatQuant; repetition++) { foreach (int note in melody) { print("Playing: " + note); yield return(WaitBeats(noteDuration)); musicPlayer.PlayNote(note % 12, (note / 12) - musicPlayer.baseOctave); PositionController.MoveNoteToPosition(VisualNote.main, note); } } }
public void InsertUpdateDelete() { PositionController positionController = new PositionController(); //create new entity Position position = new Position(); position.positionId = Guid.NewGuid(); position.committeeId = Guid.NewGuid(); position.parentPositionId = Guid.NewGuid(); position.name = "Test Name"; position.jobDescription = "Test description"; position.entryDate = DateTime.Now; position.appUserId = Guid.NewGuid(); position.modifiedDate = DateTime.Now; position.remark = "Test Remark"; //insert var result1 = positionController.Post(position); //update var result2 = positionController.Post(position); //delete var result3 = positionController.Delete(position.positionId); //assert Assert.IsNotNull(result1); Assert.IsNotNull(result2); Assert.IsNotNull(result3); Assert.IsTrue(result1 is OkResult); Assert.IsTrue(result2 is OkResult); Assert.IsTrue(result3 is OkResult); }
/// <summary> /// Обновление координаты наведения /// </summary> protected override void OnNewPositionCaptured(object[] args) { var cameraType = (CameraTypes)args[0]; if (CameraType != cameraType) { return; } if ((SourceCommandType)args[1] != SourceCommandType.Auto) { return; } var objectImagePosition = (Vector2Int)args[2]; var wideFieldAzimuthStep = (int)args[3]; var tightAzimuthStep = wideFieldAzimuthStep.AzimuthTightFieldCameraStep(); var elevationStep = objectImagePosition.ElevationTightFieldCameraStep(); var newPosition = new Vector2Int(tightAzimuthStep, elevationStep); newPosition.Clamp(MinStepValue, MaxStepValue); PositionController.SetUp(newPosition); }
void Start() { sprite = GetComponent <SpriteRenderer>(); GameObject go = GameObject.FindWithTag("Controller"); position = go.GetComponent <PositionController>(); }
public void OnLoadComplete(AssetRequest assetRequest) { isLoadDone = true; GameObject asset = assetRequest.asset as GameObject; gameObject = GameObject.Instantiate <GameObject>(asset); transform = gameObject.transform; m_PositionController = gameObject.AddComponent <PositionController>(); // 绘制可视区域 m_DrawTool = gameObject.AddComponent <DebugController>(); m_DrawTool.DrawViewArea(battleEntity.GetViewRange()); //可见范围 m_DrawTool.DrawAttackArea(battleEntity.GetAttackRange()); //攻击范围 m_AnimController = gameObject.AddComponent <AnimationController>(); m_HeroStateController = new HeroStateController(battleEntity, m_AnimController); InitPosition(Vector3.zero); if (m_LoadedCallback != null) { m_LoadedCallback(gameObject); } // todo 找一个区分玩家与友军的标记 if (camp == BattleCamp.FRIENDLY) { GameMsg.instance.SendMessage(GameMsgDef.PlayerActor_Created, this, camp == BattleCamp.ENEMY); } gameObject.name = string.Format("[{0}][{1}][UID:{2}][CID:{3}][Lv:{4}][Speed:{5}]", battleEntity.GetName(), camp.ToString(), battleEntity.GetUniqueID(), battleEntity.GetID(), battleEntity.GetLevel(), battleEntity.GetMoveSpeed()); GameMsg.instance.SendMessage(GameMsgDef.BattleActor_Created, this, camp == BattleCamp.ENEMY); }
public void GetPositions() { // Arrange PositionController controller = new PositionController(); // Act JsonResult result = controller.GetPositions(1); JsonGetPositionResultModel resData = null; string errMsg = ""; try { resData = (JsonGetPositionResultModel)result.Data; } catch (Exception ex) { errMsg = ex.Message; resData = null; } // Assert Assert.IsNotNull(result.Data); Assert.AreEqual("", errMsg); Assert.IsNotNull(resData); Assert.AreEqual(true, resData.result); Assert.AreNotEqual(0, resData.data.Count); }
private void Awake() { if (instance == null) { instance = this; } }
public EmploymentForm(EmploymentController employmentController, EmployeeController employeeController, PositionController positionController, StorePlaceController storePlaceController) { _employmentController = employmentController; _employeeController = employeeController; _positionController = positionController; _storePlaceController = storePlaceController; InitializeComponent(); }
public void Get() { PositionController positionController = new PositionController(); Position[] cities = positionController.Get().ToArray(); Assert.IsNotNull(cities); }
public void CreatePortfolio_ReturnPartialView() { positionController = new PositionController(positionService.Object); var result = positionController.Save(0) as PartialViewResult; Assert.IsNotNull(result); Assert.IsNull(result.Model); }
public PositionControllerTest() { var context = AppDbContextFactory.TestDbContext(); _routeInDb = Factories.TestRoute(); context.Routes.Add(_routeInDb); context.SaveChanges(); _controller = new PositionController(context); }
public PositionControllerTest() { _provider = new EmptyModelMetadataProvider(); _context = new Context(InMemoryContext.NewContext()); _mapper = new Mapper(new MapperConfiguration(mc => mc.AddProfile(new EmployeeProfile()))); _employees = new EmployeeRepository(_context, _provider, _mapper); InMemoryContext.SeedData(_context); _authService = new Mock <IAuthService>().Object; _positionController = new PositionController(new PositionRepository(_context, _provider, _mapper, _employees), new Mock <IAuthService>().Object); }
protected override void Start() { base.Start(); _dragItemComponent = GetComponentInChildren<DraggableEntity>(); Assert.IsNotNull(_dragItemComponent); _dragItemComponent.SetEntity(this); _positionController = GetComponentInChildren<PositionController>(); Assert.IsNotNull(_positionController); _positionController.SetEntity(this); }
/// <summary> /// 保存为ASS字幕文件 /// </summary> /// <param name="danmakus">弹幕</param> /// <param name="outputPath">保存路径</param> /// <returns></returns> public static async Task SaveAsAssAsync(DanmakuItem[] danmakus, string outputPath) { var sb = new StringBuilder(); // ASS字幕文件头 sb.AppendLine("[Script Info]"); sb.AppendLine("Script Updated By: BBDown(https://github.com/nilaoda/BBDown)"); sb.AppendLine("ScriptType: v4.00+"); sb.AppendLine($"PlayResX: {MONITOR_WIDTH}"); sb.AppendLine($"PlayResY: {MONITOR_HEIGHT}"); sb.AppendLine($"Aspect Ratio: {MONITOR_WIDTH}:{MONITOR_HEIGHT}"); sb.AppendLine("Collisions: Normal"); sb.AppendLine("WrapStyle: 2"); sb.AppendLine("ScaledBorderAndShadow: yes"); sb.AppendLine("YCbCr Matrix: TV.601"); sb.AppendLine("[V4+ Styles]"); sb.AppendLine("Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding"); sb.AppendLine($"Style: BBDOWN_Style, 宋体, {FONT_SIZE}, &H00FFFFFF, &H00FFFFFF, &H00000000, &H00000000, 0, 0, 0, 0, 100, 100, 0.00, 0.00, 1, 2, 0, 7, 0, 0, 0, 0"); sb.AppendLine("[Events]"); sb.AppendLine("Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"); PositionController controller = new PositionController(); // 弹幕位置控制器 Array.Sort(danmakus, comparer); foreach (DanmakuItem danmaku in danmakus) { int height = controller.updatePosition(danmaku.DanmakuMode, danmaku.Second, danmaku.Content.Length); if (height == -1) { continue; } string effect = ""; switch (danmaku.DanmakuMode) { case 3: effect += $"\\an8\\pos({MONITOR_WIDTH / 2}, {MONITOR_HEIGHT - FONT_SIZE - height})"; break; case 2: effect += $"\\an8\\pos({MONITOR_WIDTH / 2}, {height})"; break; default: effect += $"\\move({MONITOR_WIDTH}, {height}, {-danmaku.Content.Length * FONT_SIZE}, {height})"; break; } if (danmaku.Color != "FFFFFF") { effect += $"\\c&{danmaku.Color}&"; } sb.AppendLine($"Dialogue: 2,{danmaku.StartTime},{danmaku.EndTime},BBDOWN_Style,,0000,0000,0000,,{{{effect}}}{danmaku.Content}"); } await File.WriteAllTextAsync(outputPath, sb.ToString(), Encoding.UTF8); }
public void Handle(Selector selector, Player p1, Player p2, Field p1Field, Field p2Field, KeyboardState state, KeyboardState previousState) { // Handles left and right HandleLeftRightWithMaxIndex(selector, state, previousState, 6); if (p1.hand[selector.index].sprite == null) { selector.defaultPosition = p1.handPositions[selector.index]; } selector.selected = p1.hand[selector.index]; // Handles up and down PositionController.Builder builder = new PositionController.Builder(); PositionController controller = builder.WithSelector(selector) .WithUpArea(SelectedState.P1_MAGIC_AND_TRAP_ZONE) .WithUpZone(p1Field.magicAndTrapZone) .WithUpPositions(p1Field.magicAndTrapPositions) .WithDownArea(SelectedState.P2_MAGIC_AND_TRAP_ZONE) .WithDownZone(p2Field.magicAndTrapZone) .WithDownPositions(p2Field.magicAndTrapPositions) .WithCurrentState(state) .WithPreviousState(previousState) .Build(); HandleUpAndDown(controller); // Handles actions if (state.IsKeyDown(Keys.Enter) && previousState.IsKeyUp(Keys.Enter)) { if (selector.selected is MonsterCard) { selector.state = SelectedState.SUMMON_OR_SET; selector.action = SelectedAction.SUMMON; selector.summoning = (MonsterCard)selector.selected; selector.index = 0; selector.defaultPosition = selectorPositions[0]; } else if (selector.selected is MagicCard) { selector.state = SelectedState.SET_OR_ACTIVATE; selector.action = SelectedAction.SET; selector.settingMagic = (MagicCard)selector.selected; selector.index = 0; selector.defaultPosition = selectorPositions[0]; } else if (selector.selected is TrapCard) { selector.state = SelectedState.SETTING_TRAP; selector.settingTrap = (TrapCard)selector.selected; selector.index = 0; selector.selected = p1Field.magicAndTrapZone[0]; selector.defaultPosition = p1Field.magicAndTrapPositions[0]; } } }
public TransformController(Transform transform, GameMap map, int initialRow, int initialCol) { this.transform = transform; controller = new PositionController <GameMap, GameTile>(map, GameTile.elevationScale, initialRow, initialCol); GameTile initialPositionedAbove = controller.CurrentPosition().positionedAbove; Vector3 initialPosition = initialPositionedAbove.WorldPosition(controller.CurrentPosition().elevation); initialPosition.y += transform.lossyScale.y / 2; transform.position = initialPosition; }
public void PerformBeatingCheckTest2() { var controller = GameFactory.CreateGameController(); var context = controller.GameContext; PositionController.MakeMove(context, 0); PositionController.MakeMove(context, 1); PositionController.MakeMove(context, 100); Assert.AreEqual(true, PositionController.MakeMove(context, 19)); }
public void CangetDeletePosition_ReturnJson() { positionService.Setup(c => c.DeletePosition(It.IsAny <int?>())) .Callback <int?>(i => ListPositions.RemoveAll(c => c.Id == i.Value)); positionController = new PositionController(positionService.Object); var result = positionController.DeletePosition(1); positionService.Verify(m => m.DeletePosition(1)); Assert.IsTrue(ListPositions.Count() == 2); }
public void CangetDeletePosition_ReturnPartialView() { positionService.Setup(c => c.GetPosition(It.IsAny <int>())) .Returns((int i) => ListPositions.FirstOrDefault(c => c.Id == i)); positionController = new PositionController(positionService.Object); var result = positionController.Delete(1) as PartialViewResult; Assert.IsNotNull(result); Assert.AreEqual(1, positionController.ViewBag.Id); }
public void CreatePortfolio_ModelStateNotValid() { positionController = new PositionController(positionService.Object); positionController.ModelState.AddModelError("test", "test"); positionController.Save(new PositionModel { Name = null }, 1); Assert.IsTrue(positionController.ViewData.ModelState.Count == 1, "test"); }
private void positionComboBox_SelectedIndexChanged(object sender, EventArgs e) { ComboBox positionComboBox = sender as ComboBox; PositionControllerInterface positionController = new PositionController(); if (positionComboBox.SelectedIndex != -1) { Position position = positionController.fetchPositionByName(positionComboBox.SelectedItem.ToString()); salary.Text = position.salary.ToString(); } }
// Use this for initialization void Start() { ShootFrontButton.enabled = false; // resolving TangoPositionController for motion tracking, handled via PositionController script positionController = TangoPositionController.GetComponent("PositionController") as PositionController; // defining coordinate frame pair fp.baseFrame = Tango.TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_START_OF_SERVICE; fp.targetFrame = Tango.TangoEnums.TangoCoordinateFrameType.TANGO_COORDINATE_FRAME_DEVICE; }
public void PositionHome() { // Arrange PositionController controller = new PositionController(); // Act ViewResult result = controller.PositionHome() as ViewResult; // Assert Assert.IsNotNull(result); }
public void CreateGetView_True() { // Arrange - create the controller PositionController target = new PositionController(mock.Object); // Act - call the action method var result = target.Create() as ViewResult; // Assert - check the result Assert.AreEqual("", result.ViewName); }
public void EditView_True() { // Arrange - create the controller PositionController target = new PositionController(mock.Object); // Act - call the action method var result = target.Edit(2); // Assert - check the result Assert.AreEqual("", ((ViewResult)result).ViewName); }
public void DeleteGet_ValidPositionWithAssociatedDate_CannotDelete() { // Arrange - create the controller PositionController target = new PositionController(mock.Object); // Act - call the action method var result = target.Delete(4); // Assert - check the result Assert.AreEqual("CannotDelete", ((ViewResult)result).ViewName); Assert.IsInstanceOf(typeof(ViewResult), result); }
public void Index_Default_Allpositions() { // Arrange - create the controller PositionController target = new PositionController(mock.Object); // Act - call the action method IEnumerable <Position> result = (IEnumerable <Position>)target.Index().Model; List <Position> positionView = result.ToList <Position>(); // Assert - check the result CollectionAssert.AreEqual(mock.Object.Positions, positionView); }
private void setPositionObject(GameObject gridPosObject) { if (gridPositionObject != null) { PositionController positionControllerOld = gridPositionObject.GetComponent <PositionController>(); positionControllerOld.removeDoor(); } gridPositionObject = gridPosObject; PositionController positionController = gridPositionObject.GetComponent <PositionController>(); positionController.setDoor(gameObject); }
public void HandleInZone(PositionController c) { // Handles setting the selected card in the zone if (c.activeZone[c.selector.index].sprite == null) { c.selector.defaultPosition = c.activeZonePositions[c.selector.index]; } c.selector.selected = c.activeZone[c.selector.index]; // Handles up and down HandleUpAndDown(c); }
// 按下加入職位 private void ClickAddPositionButton(object sender, EventArgs e) { if (this.SetAllNewPositionVariableToPM()) { _positionController = new PositionController(_positionPresentationModel); _positionController.AddPosition(); } }
// 按下修改職位按鈕 private void ClickEditPositionButton(object sender, EventArgs e) { this.SetAllEditPositionVariableToPM(); _positionController = new PositionController(_positionPresentationModel); if (_positionController.EditPosition()) { this.SetAllPositionEditToNotEnable(); this.ResetEditPositionUI(); } }
// 按下查詢職位按鈕 private void ClickSearchPositionButtom(object sender, EventArgs e) { String positionID = _editPositionIDTB.Text; _positionPresentationModel.SetPositionID(positionID); _positionController = new PositionController(_positionPresentationModel); _positionPresentationModel = _positionController.SearchDataByPositionID(); if (_positionPresentationModel.GetPositionID() == null || _positionPresentationModel.GetPositionID() == "") return; this.SetAllPositionEditToEnable(); this.ResetSearchEditPositionUI(); }