AnalyzeResult analyzeResult = null; // объект отвечающий за вывод полученных анализатором результатов public CodeAnalyzer() { InitializeComponent(); _errorList = new ErrorList(); _viewInfo = new ViewInformation(); }
/// <summary> /// Gets the input state of the given type for the given view. /// </summary> /// <param name="viewInfo">The view for which to get the requested input state object</param> public T?TryGetState <T>(ViewInformation viewInfo) where T : InputStateBase { viewInfo.EnsureNotNull(nameof(viewInfo)); var inputStateCount = _inputStates.Count; for (var loop = 0; loop < inputStateCount; loop++) { var actStateCasted = _inputStates[loop] as T; if (actStateCasted == null) { continue; } if (actStateCasted.RelatedView != viewInfo) { continue; } return(actStateCasted); } return(null); }
private void SetWorkStationMode(ViewInformation.ViewType type, WorkStation SingleWorkStation) { CopyValues Copy = new CopyValues(); switch (type) { case ViewInformation.ViewType.CRAFT_VIEW: GameObject Worker = null; switch (SingleWorkStation.mode) { case global::WorkStation.Mode.TO_SELL: Copy.CopyScale(SingleWorkStation.transform, WorkStation.transform, transform); Copy.CopySpriteRender(SingleWorkStation._SpriteRender, WorkStation.GetComponent<SpriteRenderer>()); Copy.CopyBoxCollider2D(SingleWorkStation._boxCollider2D, WorkStation.GetComponent<BoxCollider2D>()); break; case global::WorkStation.Mode.ACTIVE: Copy.CopyScale(SingleWorkStation.transform, WorkerObject.transform, transform); Copy.CopySpriteRender(SingleWorkStation._SpriteRender, WorkerObject.GetComponent<SpriteRenderer>()); Copy.CopyBoxCollider2D(SingleWorkStation._boxCollider2D, WorkerObject.GetComponent<BoxCollider2D>()); break; } break; } }
private void button1_Click(object sender, EventArgs e) { ViewInformation viewInformation = new ViewInformation(this, jsonFilePath, imagesFilePath, questions); this.Hide(); viewInformation.Show(); }
/// <summary> /// This update method gets called on each update pass for each scenes /// this component is attached to. /// </summary> /// <param name="updateState">Current update state.</param> /// <param name="correspondingView">The view which attached this component (may be null).</param> protected override void Update(SceneRelatedUpdateState updateState, ViewInformation correspondingView) { Camera3DBase actCamera = correspondingView.Camera; if (actCamera == null) { return; } foreach (InputFrame actInputFrame in updateState.InputFrames) { foreach (var actInputState in actInputFrame.GetInputStates(correspondingView)) { // Handle keyboard KeyboardState actKeyboardState = actInputState as KeyboardState; bool isControlKeyDown = false; if (actKeyboardState != null) { UpdateForKeyboard(actCamera, actKeyboardState, out isControlKeyDown); continue; } // Handle mouse (or pointer) MouseOrPointerState mouseState = actInputState as MouseOrPointerState; if (mouseState != null) { UpdateForMouse(actCamera, isControlKeyDown, mouseState); } } } }
internal void AddCopyOfState(InputStateBase inputState, ViewInformation viewInfo) { // Get the state object to where to copy the given InputState InputStateBase targetState = null; for (int loop = 0; loop < m_recoveredStates.Count; loop++) { if (m_recoveredStates[loop].CurrentType == inputState.CurrentType) { targetState = m_recoveredStates[loop]; m_recoveredStates.RemoveAt(loop); break; } } if (targetState == null) { targetState = Activator.CreateInstance(inputState.CurrentType) as InputStateBase; } // Copy all state data inputState.CopyAndResetForUpdatePass(targetState); targetState.RelatedView = viewInfo; this.AddState(targetState); }
/// <summary> /// Attaches this component to a scene. /// Be careful, this method gets called from a background thread of seeing#! /// It may also be called from multiple scenes in parallel or simply withoud previous Detach call. /// </summary> /// <param name="manipulator">The manipulator of the scene we attach to.</param> /// <param name="correspondingView">The view which attached this component.</param> /// <returns></returns> protected override PerSceneContext Attach(SceneManipulator manipulator, ViewInformation correspondingView) { PerSceneContext result = new PerSceneContext(); result.CameraDistance = this.CameraDistanceInitial; result.CameraHVRotation = m_hvRotation; return(result); }
/// <summary> /// Is this object visible currently? /// </summary> /// <param name="viewInfo">Information about the view that triggered bounding volume testing.</param> /// <param name="boundingFrustum">The bounding frustum to check.</param> /// <returns></returns> internal override bool IsInBoundingFrustum(ViewInformation viewInfo, ref BoundingFrustum boundingFrustum) { BoundingSphere boundingSphere = this.TryGetBoundingSphere(viewInfo); if (boundingSphere != BoundingSphere.Empty) { return(boundingFrustum.Contains(ref boundingSphere) != ContainmentType.Disjoint); } return(true); }
protected override PerSceneContext Attach(SceneManipulator manipulator, ViewInformation correspondingView) { PerSceneContext context = new PerSceneContext(); NamedOrGenericKey resCubeGeometry = manipulator.AddGeometry(new CubeType()); context.CubeObject = manipulator.AddGeneric(resCubeGeometry); context.CubeObject.Color = Color4.RedColor; return(context); }
/// <summary> /// Tries to get the bounding box for the given render-loop. /// Returns BoundingBox.Empty if it is not available. /// </summary> /// <param name="viewInfo">The ViewInformation for which to get the BoundingBox.</param> public override BoundingBox TryGetBoundingBox(ViewInformation viewInfo) { viewInfo.EnsureNotNull(nameof(viewInfo)); var device = viewInfo.Device; device.EnsureNotNull(nameof(device)); var geometryResource = this.TryGetGeometryResource(device !); if (geometryResource is { IsLoaded : true })
/// <summary> /// Gets all input state for the given view. /// </summary> /// <param name="viewInfo">The view for which to get all input states.</param> public IEnumerable <InputStateBase> GetInputStates(ViewInformation viewInfo) { int inputStateCount = m_inputStates.Count; for (int loop = 0; loop < inputStateCount; loop++) { if (m_inputStates[loop].RelatedView == viewInfo) { yield return(m_inputStates[loop]); } } }
/// <summary> /// Attaches this component to a scene. /// Be careful, this method gets called from a background thread of seeing#! /// It may also be called from multiple scenes in parallel or simply withoud previous Detach call. /// </summary> /// <param name="manipulator">The manipulator of the scene we attach to.</param> /// <param name="correspondingView">The view which attached this component.</param> protected override PerSceneContext Attach(SceneManipulator manipulator, ViewInformation correspondingView) { PerSceneContext context = new PerSceneContext(); switch (m_gradientDirection) { case GradientDirection.LeftToRight: context.BrushResource = new LinearGradientBrushResource( new System.Numerics.Vector2(0f, 0f), new System.Numerics.Vector2(m_textureWidth, 0f), new GradientStop[] { new GradientStop(m_colorStart, 0f), new GradientStop(m_colorEnd, 1f) }); break; case GradientDirection.TopToBottom: context.BrushResource = new LinearGradientBrushResource( new System.Numerics.Vector2(0f, 0f), new System.Numerics.Vector2(0f, m_textureHeight), new GradientStop[] { new GradientStop(m_colorStart, 0f), new GradientStop(m_colorEnd, 1f) }); break; case GradientDirection.Directional: context.BrushResource = new LinearGradientBrushResource( new System.Numerics.Vector2(0f, 0f), new System.Numerics.Vector2(m_textureWidth, m_textureHeight), new GradientStop[] { new GradientStop(m_colorStart, 0f), new GradientStop(m_colorEnd, 1f) }); break; } // Create the background layer if not available already base.CreateLayerIfNotAvailable(manipulator); // Create and add the background context.BackgroundTextureKey = manipulator.AddResource( () => new Direct2DSingleRenderTextureResource(context.BrushResource, m_textureWidth, m_textureHeight)); context.BackgroundPainter = new FullscreenTextureObject(context.BackgroundTextureKey); context.BackgroundPainter.Scaling = 1.1f; manipulator.Add(context.BackgroundPainter, DEFAULT_LAYER); return(context); }
/// <summary> /// Gets all input state for the given view. /// </summary> /// <param name="viewInfo">The view for which to get all input states.</param> public IEnumerable <InputStateBase> GetInputStates(ViewInformation viewInfo) { viewInfo.EnsureNotNull(nameof(viewInfo)); var inputStateCount = _inputStates.Count; for (var loop = 0; loop < inputStateCount; loop++) { if (_inputStates[loop].RelatedView == viewInfo) { yield return(_inputStates[loop]); } } }
public void Flush() { while (mPanelStack.Count != 0) { mPanelStack.Last().mPanel.DeactivatePanel(); _lastClosedPanel = mPanelStack.Last(); mPanelStack.RemoveLast(); } //debug purpose _currentUI.mPanel = null; _currentUI.mType = 0; }
public async Task ViewQueryParametersAreApplied() { UserGenerator.RegisterAndLoginUserWithRole(Role.Analyst, adminDataApiClient, out var dataApiClient); // Generate data for test var searchDataCount = 5; var limit = 2; // This is our view parameter. If view parameters work as expected, only 2 of the 5 search objects are returned. Assume.That(searchDataCount, Is.GreaterThan(limit)); var searchData = SearchDataGenerator.GenerateAndSubmitSearchData(searchDataCount, dataApiClient); ViewInformation viewInformation = null; try { // Setup var viewQuery = $"SELECT Data.Id AS Id FROM {nameof(UnitTestSearchObject)} LIMIT {{limit}}"; var expires = DateTime.UtcNow.AddMinutes(3); Assert.That(() => viewInformation = dataApiClient.CreateViewAsync(viewQuery, expires).Result, Throws.Nothing); Assert.That(viewInformation, Is.Not.Null); // Test 1: BadRequest response if no parameters provided var resultFormat = ResultFormat.Json; AssertStatusCode( () => dataApiClient.GetViewAsync(viewInformation.ViewId, resultFormat).Wait(), HttpStatusCode.BadRequest); // Test 2: View is correctly generated when all parameters are provided and parameters are correctly applied var viewParameters = new Dictionary <string, string> { { "limit", limit.ToString() } }; Stream viewResult = null; Assert.That( async() => viewResult = await dataApiClient.GetViewAsync(viewInformation.ViewId, resultFormat, viewParameters), Throws.Nothing); var resultTable = await Client.Serialization.SeachResultStreamExtensions.ReadAllSearchResultsAsync(viewResult); Assert.That(resultTable.Count, Is.EqualTo(limit)); } finally { SearchDataGenerator.DeleteData(searchData, dataApiClient); if (viewInformation != null) { dataApiClient.DeleteViewAsync(viewInformation.ViewId).Wait(); } UserGenerator.DeleteUser(dataApiClient); } }
protected override void Update(SceneRelatedUpdateState updateState, ViewInformation correspondingView) { base.Update(updateState, correspondingView); foreach (var actInputFrame in updateState.InputFrames) { if (actInputFrame.DefaultKeyboard.IsKeyDown(WinVirtualKey.Escape)) { s_renderTarget.UISynchronizationContext.PostAlsoIfNull(() => { Application.Exit(); }); } } }
/// <summary> /// Tries to get the bounding box for the given render-loop. /// Returns BoundingBox.Empty if it is not available. /// </summary> /// <param name="viewInfo">The ViewInformation for which to get the BoundingBox.</param> public override BoundingBox TryGetBoundingBox(ViewInformation viewInfo) { GeometryResource geometryResource = m_localResources[viewInfo.Device.DeviceIndex]; if ((geometryResource != null) && (geometryResource.IsLoaded)) { BoundingBox result = geometryResource.BoundingBox; result.Transform(this.Transform); return(result); } else { return(BoundingBox.Empty); } }
public void ShowBaseView() { while (mPanelStack.Count > 0 && mPanelStack.Last().mType != UIType.BaseView) { mPanelStack.Last().mPanel.DeactivatePanel(); _lastClosedPanel = mPanelStack.Last(); mPanelStack.RemoveLast(); } //debug purpose _currentUI.mPanel = mPanelStack.Last().mPanel; _currentUI.mType = mPanelStack.Last().mType; //action to fire on landed on base view OnLandedOnLastPanel.SafeInvoke(); LandedOnLastPanel.SafeInvoke(); }
public void LoggedInUserCanCreateAccessAndDeleteOwnViews() { UserGenerator.RegisterAndLoginUserWithRole(Role.Analyst, adminDataApiClient, out var dataApiClient); var query = "SELECT * FROM Computers LIMIT 3"; var expires = DateTime.UtcNow.AddMinutes(3); ViewInformation viewInformation = null; try { Assert.That(() => viewInformation = dataApiClient.CreateViewAsync(query, expires).Result, Throws.Nothing); Assert.That(viewInformation, Is.Not.Null); Assert.That(() => dataApiClient.GetViewAsync(viewInformation.ViewId, ResultFormat.Json).Wait(), Throws.Nothing); Assert.That(() => dataApiClient.DeleteViewAsync(viewInformation.ViewId).Wait(), Throws.Nothing); } finally { UserGenerator.DeleteUser(dataApiClient); } }
public void SetupCamera(ViewInformation view, ProjectionInformation projection) { GraphicsDirect3D9.Device.SetTransform( TransformState.View, Matrix.LookAtLH( view.Position, view.LookAt, view.UpVector ) ); GraphicsDirect3D9.Device.SetTransform( TransformState.Projection, Matrix.PerspectiveFovLH( projection.FieldOfView, projection.Aspect, projection.NearestZ, projection.FarthestZ ) ); }
public PerformanceMeasureDrawingLayer(float verticalPadding, ViewInformation view) { _view = view; _verticalPadding = verticalPadding; _lastTimeSpans = new List <TimeSpan>(); _lastRender = DateTime.UtcNow; // Define drawing resources _textFormatCentered = new TextFormatResource("Arial", 18f); _textFormatCentered.TextAlignment = TextAlignment.Center; _textFormatLeftAligned = new TextFormatResource("Arial", 18f); _textFormatLeftAligned.TextAlignment = TextAlignment.Leading; _backBrush = new SolidBrushResource(Color4.LightGray); _foreBrush = new SolidBrushResource(Color4.Black); _borderBrush = new SolidBrushResource(Color4.DarkGray); _enabled = true; _currentType = PerformanceDrawingLayerType.FramesPerSecond; _keysDown = new List <WinVirtualKey>(12); }
public void ViewQueriesWithPlaceholderInFromArgumentAreRejected() { UserGenerator.RegisterAndLoginUserWithRole(Role.Analyst, adminDataApiClient, out var dataApiClient); var query = "SELECT * FROM {placeholder} LIMIT 3"; var expires = DateTime.UtcNow.AddMinutes(3); ViewInformation viewInformation = null; try { AssertStatusCode( () => viewInformation = dataApiClient.CreateViewAsync(query, expires).Result, HttpStatusCode.BadRequest); } catch { // If test fails and view is created, delete it again dataApiClient.DeleteViewAsync(viewInformation.ViewId).Wait(); } finally { UserGenerator.DeleteUser(dataApiClient); } }
/// <summary> /// Tries to get the bounding sphere for the given render-loop. /// Returns BoundingSphere.Empty, if it is not available. /// </summary> /// <param name="viewInfo">The ViewInformation for which to get the BoundingSphere.</param> public override BoundingSphere TryGetBoundingSphere(ViewInformation viewInfo) { GeometryResource geometryResource = m_localResources[viewInfo.Device.DeviceIndex]; if ((geometryResource != null) && (geometryResource.IsLoaded)) { // Get BoundingBox object BoundingBox boundingBox = geometryResource.BoundingBox; // Calculate bounding sphare BoundingSphere result; BoundingSphere.FromBox(ref boundingBox, out result); result.Transform(this.Transform); return(result); } else { return(BoundingSphere.Empty); } }
/// <summary> /// Picks an object in 3D-World. /// </summary> /// <param name="rayStart">Start of picking ray.</param> /// <param name="rayDirection"></param> /// <param name="viewInfo">Information about the view that triggered picking.</param> /// <param name="pickingOptions">Some additional options for picking calculations.</param> /// <returns> /// Returns the distance to the object or float.NaN if object is not picked. /// </returns> internal override float Pick(Vector3 rayStart, Vector3 rayDirection, ViewInformation viewInfo, PickingOptions pickingOptions) { GeometryResource geometryResource = m_localResources[viewInfo.Device.DeviceIndex]; if ((geometryResource != null) && (geometryResource.IsLoaded)) { BoundingBox boundingBox = geometryResource.BoundingBox; if (!boundingBox.IsEmpty()) { // Transform picking ray to local space Ray pickingRay = new Ray(rayStart, rayDirection); Matrix4x4 temp; Matrix4x4.Invert(base.Transform, out temp); pickingRay.Transform(temp); // Check for intersection on the bounding box float distance = 0f; if (pickingRay.Intersects(ref boundingBox, out distance)) { if (pickingOptions.OnlyCheckBoundingBoxes) { return(distance); } // Perform picking on polygon level if (geometryResource.Intersects(pickingRay, pickingOptions, out distance)) { return(distance); } } } } return(float.NaN); }
public void SetupCamera(ViewInformation view, ProjectionInformation projection) { throw new NotImplementedException(); }
public void Back() { _lastClosedPanel = null; if (mPanelStack.Count <= 0) { PressedBackOnLastPanel.SafeInvoke(); OnPressBackOnLastPanel.SafeInvoke(); return; } var panelInfo = mPanelStack.Last(); //only process back if the gameObject is active if (!panelInfo.mPanel.isActiveAndEnabled) { return; } switch (panelInfo.mType) { case UIType.NormalView: { Debug.Log("Deactivated A NormalView Panel: " + mPanelStack.Last().mPanel.name); mPanelStack.Last().mPanel.DeactivatePanel(); _lastClosedPanel = mPanelStack.Last(); mPanelStack.RemoveLast(); if (mPanelStack.Count > 0) { var peekPanel = mPanelStack.Last(); //.mPanel.ActivatePanel(); peekPanel.mPanel.ActivatePanel(); if (peekPanel.mType == UIType.BaseView && mPanelStack.Count == 1) { OnLandedOnLastPanel.SafeInvoke(); LandedOnLastPanel.SafeInvoke(); } //debug purpose _currentUI.mPanel = peekPanel.mPanel; _currentUI.mType = peekPanel.mType; } else { //debug purpose _currentUI.mPanel = null; _currentUI.mType = 0; } break; } case UIType.StackedView: { Debug.Log("Deactivated a StackedView Panel: " + mPanelStack.Last().mPanel.name); mPanelStack.Last().mPanel.DeactivatePanel(); _lastClosedPanel = mPanelStack.Last(); mPanelStack.RemoveLast(); if (mPanelStack.Count == 1) { OnLandedOnLastPanel.SafeInvoke(); LandedOnLastPanel.SafeInvoke(); } //debug purpose var peekPanel = mPanelStack.Last(); _currentUI.mPanel = peekPanel.mPanel; _currentUI.mType = peekPanel.mType; break; } case UIType.BaseView: { Debug.Log("Landed Base View"); ShowBaseView(); PressedBackOnLastPanel.SafeInvoke(); OnPressBackOnLastPanel.SafeInvoke(); break; } } OnPressBack.SafeInvoke(); PressBack.SafeInvoke(); }
protected override void Detach(SceneManipulator manipulator, ViewInformation correspondingView, PerSceneContext context) { manipulator.Remove(context.CubeObject); }
/// <summary> /// Gets the <see cref="GamepadState"/> for the given view. /// This method may return null if there is no <see cref="GamepadState"/> available. /// </summary> /// <param name="viewInfo">The view for which to get the requested input state object</param> public GamepadState?TryGetGamepadState(ViewInformation viewInfo) { return(this.TryGetState <GamepadState>(viewInfo)); }
private void 查询所有的记录ToolStripMenuItem_Click(object sender, EventArgs e) { var form = new ViewInformation(); form.ShowDialog(); }
protected override void Detach(SceneManipulator manipulator, ViewInformation correspondingView) { }
/// <summary> /// Gets the <see cref="MouseOrPointerState"/> for the given view. /// This method may return null if there is no <see cref="MouseOrPointerState"/> available. /// </summary> /// <param name="viewInfo">The view for which to get the requested input state object</param> public MouseOrPointerState?TryGetMouseOrPointerState(ViewInformation viewInfo) { return(this.TryGetState <MouseOrPointerState>(viewInfo)); }