public async Task<ShapeBase> GetShapeInforAsync (ShapeBase input) { if (input is SquareShape) return await GetSquareInfoAsync (input as SquareShape); if (input is CircleShape) return await GetCircleInfoAsync (input as CircleShape); return input; }
public ShapeViewModel (ShapeBase shape) { _shape = shape; _webServices = ColorWebServices.Instance; _imageService = ImageService.Instance; _shapeFactory = ShapeFactory.Instance; DoubleTapCommand = new Command (async ()=> HandleDoubleTap()); }
public override bool AllowsToAddChild(ShapeBase newChild) { return false; }
public override void onWetFire(ShapeBase obj, int slot) { if (!this["projectile"].isObject()) { console.error("WeaponImage::onFire() - Invalid projectile datablock"); return; } // Decrement inventory ammo. The image's ammo state is updated // automatically by the ammo inventory hooks. if (!this["infiniteAmmo"].AsBool()) { obj.decInventory(this["ammo"], 1); } // Get the player's velocity, we'll then add it to that of the projectile int numProjectiles = this["projectileNum"].AsInt(); if (numProjectiles == 0) { numProjectiles = 1; } TransformF muzzleVector = new TransformF(); for (int i = 0; i < numProjectiles; i++) { if (this["wetProjectileSpread"].AsBool()) { // We'll need to "skew" this projectile a little bit. We start by // getting the straight ahead aiming point of the gun Point3F vec = obj.getMuzzleVector(slot); // Then we'll create a spread matrix by randomly generating x, y, and z // points in a circle Random r = new Random(); TransformF matrix = new TransformF(); matrix.mPositionX = (float)((r.NextDouble() - .5) * 2 * Math.PI * this["wetProjectileSpread"].AsFloat()); matrix.mPositionY = (float)((r.NextDouble() - .5) * 2 * Math.PI * this["wetProjectileSpread"].AsFloat()); matrix.mPositionZ = (float)((r.NextDouble() - .5) * 2 * Math.PI * this["wetProjectileSpread"].AsFloat()); TransformF mat = math.MatrixCreateFromEuler(matrix); muzzleVector = math.MatrixMulVector(mat, vec); } else { muzzleVector = new TransformF(obj.getMuzzleVector(slot)); } Point3F objectVelocity = obj.getVelocity(); muzzleVector = muzzleVector.vectorScale(this["wetProjectile.muzzleVelocity"].AsFloat()); objectVelocity = objectVelocity.vectorScale(this["wetProjectile.velInheritFactor"].AsFloat()); Point3F muzzleVelocity = muzzleVector.GetPosition() + objectVelocity; ObjectCreator tch = new ObjectCreator(this["projectileType"]); tch["dataBlock"] = this["wetProjectile"]; tch["initialVelocity"] = muzzleVelocity; tch["initialPosition"] = obj.getMuzzlePoint(slot); tch["sourceObject"] = obj; tch["sourceSlot"] = slot; tch["client"] = obj["client"]; tch["sourceClass"] = obj.getClassName(); Item projectile = tch.Create(); ((SimSet)"MissionCleanup").pushToBack(projectile); } }
public override bool AllowsToAddChild(ShapeBase newChild) { if (!(newChild is CustomVolumeVertex)) { return false; } return base.AllowsToAddChild(newChild); }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { if (shape is StaticMeshGroupShape) { if (((StaticMeshGroupShape)shape).ExportFileName == _searchExportFileName) { _isUnique = false; return VisitResult.VisitStop; } } return VisitResult.VisitOk; }
public ShapeCreatedEventArgs(ShapeBase shape) { _shape = shape; }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { PostProcessingShape pshape = shape as PostProcessingShape; if (shape.Modifiable && pshape != null) { if (FirstActive == null || pshape.Active) FirstActive = pshape; Found.Add(pshape); } return VisitResult.VisitOk; }
/// <summary> /// This shape type cannot be dragged in the tree view /// </summary> /// <param name="newParent"></param> /// <returns></returns> public override bool AllowsToSetParent(ShapeBase newParent) { return false; }
public void DefaultChartValues() { const string folderName = "TempSlidesSDK"; const string fileName = "test.pptx"; const int slideIndex = 1; const int shapeIndex = 5; const double min1 = 44.3; const double min2 = 12; const double max1 = 104.3; const double max2 = 87; TestUtils.Upload(fileName, folderName + "/" + fileName); Chart dto = new Chart { ChartType = Chart.ChartTypeEnum.Line, Width = 400, Height = 300, Title = new ChartTitle { HasTitle = true, Text = "MyTitle" }, Series = new List <Series> { new OneValueSeries { Type = Series.TypeEnum.ClusteredColumn, DataPointType = OneValueSeries.DataPointTypeEnum.OneValue, Name = "Series1", DataPoints = new List <OneValueChartDataPoint> { new OneValueChartDataPoint { Value = 40 }, new OneValueChartDataPoint { Value = 50 } } } }, Axes = new Axes { HorizontalAxis = new Axis { IsAutomaticMinValue = false, MinValue = min1, IsAutomaticMaxValue = false, MaxValue = max1 } } }; ShapeBase shape = TestUtils.SlidesApi.CreateShape(fileName, slideIndex, dto, password: "******", folder: folderName); Assert.IsInstanceOf <Chart>(shape); shape = TestUtils.SlidesApi.GetShape(fileName, slideIndex, shapeIndex, "password", folderName); Assert.AreEqual(min1, ((Chart)shape).Axes.HorizontalAxis.MinValue); Assert.AreEqual(max1, ((Chart)shape).Axes.HorizontalAxis.MaxValue); dto = new Chart { Axes = new Axes { HorizontalAxis = new Axis { MinValue = min2 } } }; shape = TestUtils.SlidesApi.UpdateShape(fileName, slideIndex, shapeIndex, dto, "password", folderName); Assert.IsInstanceOf <Chart>(shape); shape = TestUtils.SlidesApi.GetShape(fileName, slideIndex, shapeIndex, "password", folderName); Assert.AreEqual(min2, ((Chart)shape).Axes.HorizontalAxis.MinValue); Assert.AreEqual(max1, ((Chart)shape).Axes.HorizontalAxis.MaxValue); dto.Axes = new Axes { HorizontalAxis = new Axis { MaxValue = max2 } }; shape = TestUtils.SlidesApi.UpdateShape(fileName, slideIndex, shapeIndex, dto, "password", folderName); Assert.IsInstanceOf <Chart>(shape); shape = TestUtils.SlidesApi.GetShape(fileName, slideIndex, shapeIndex, "password", folderName); Assert.AreEqual(min2, ((Chart)shape).Axes.HorizontalAxis.MinValue); Assert.AreEqual(max2, ((Chart)shape).Axes.HorizontalAxis.MaxValue); }
internal void method_33(ShapeBase A_0) { this.shapeBase_0 = A_0; }
public void TestConstraintsDoingWhatTheyShould() { // Start the simulation EditorManager.EditorMode = EditorManager.Mode.EM_PLAYING_IN_EDITOR; TestManager.Helpers.ProcessEvents(); // Let the simulation run for 5 seconds DateTime timeBefore = DateTime.Now; while (true) { TimeSpan passedTime = DateTime.Now - timeBefore; if (passedTime.TotalSeconds > 10) { break; } TestManager.Helpers.ProcessEvents(); } try { { // Check the Ball and Socket constraint ShapeBase basLower = EditorManager.Scene.FindShapeByName("Ball and Socket - Lower barrel"); Assert.IsNotNull(basLower, "Failed to find entity"); Vector3F lowerPos = new Vector3F(); Assert.IsTrue(basLower._engineInstance.GetPosition(ref lowerPos), "Failed to get position of entity"); Assert.IsTrue( ((lowerPos.Z < 350) && (lowerPos.Z > 200)), "Z-Position should be between 200 and 350, but was {0}", new object[] { lowerPos.Z }); } { // Limited hinge constraint ShapeBase basLowerMoving = EditorManager.Scene.FindShapeByName("Limited Hinge Barrel Moving"); ShapeBase basLowerFixed = EditorManager.Scene.FindShapeByName("Limited Hinge Barrel Fixed"); Assert.IsNotNull(basLowerMoving, "Failed to find entity"); Assert.IsNotNull(basLowerFixed, "Failed to find entity"); Vector3F lowerPosMoving = new Vector3F(); Vector3F lowerPosFixed = new Vector3F(); Assert.IsTrue(basLowerMoving._engineInstance.GetPosition(ref lowerPosMoving), "Failed to get position of entity"); Assert.IsTrue(basLowerFixed._engineInstance.GetPosition(ref lowerPosFixed), "Failed to get position of entity"); Assert.IsTrue( ((lowerPosMoving.Z > lowerPosFixed.Z) && (lowerPosMoving.Z < 310)), "Z-Position should be lower than the initial one but higher than the fixed barrel."); } { // Hinge constraint ShapeBase basLowerMoving = EditorManager.Scene.FindShapeByName("Unlimited Hinge Barrel Moving"); ShapeBase basLowerFixed = EditorManager.Scene.FindShapeByName("Unlimited Hinge Barrel Fixed"); Assert.IsNotNull(basLowerMoving, "Failed to find entity"); Assert.IsNotNull(basLowerFixed, "Failed to find entity"); Vector3F lowerPosMoving = new Vector3F(); Vector3F lowerPosFixed = new Vector3F(); Assert.IsTrue(basLowerMoving._engineInstance.GetPosition(ref lowerPosMoving), "Failed to get position of entity"); Assert.IsTrue(basLowerFixed._engineInstance.GetPosition(ref lowerPosFixed), "Failed to get position of entity"); Assert.IsTrue( ((lowerPosMoving.Z < lowerPosFixed.Z) && (lowerPosMoving.Z > 150)), "Z-Position should be lower than the initial and the fixed barrel but over 150 units away from the floor."); } { // Check the Stiff Spring constraint ShapeBase basUpper = EditorManager.Scene.FindShapeByName("Stiff Spring - Lower barrel"); Assert.IsNotNull(basUpper, "Failed to find entity"); Vector3F upperPos = new Vector3F(); Assert.IsTrue(basUpper._engineInstance.GetPosition(ref upperPos), "Failed to get position of entity"); Assert.IsTrue( ((upperPos.Z < 350) && (upperPos.Z > 50)), "Z-Position should be between 50 and 350, but was {0}", new object[] { upperPos.Z }); } { // Check the Fixed constraint ShapeBase fixedBox = EditorManager.Scene.FindShapeByName("Fixed - Box"); Assert.IsNotNull(fixedBox, "Failed to find entity"); Vector3F boxPos = new Vector3F(); Assert.IsTrue(fixedBox._engineInstance.GetPosition(ref boxPos), "Failed to get position of entity"); Assert.IsTrue( ((boxPos.Z < 300) && (boxPos.Z > 200)), "Z-Position should be between 200 and 300, but was {0}", new object[] { boxPos.Z }); } { // Check the Prismatic constraint ShapeBase prisUpper = EditorManager.Scene.FindShapeByName("Prismatic - Upper barrel"); Assert.IsNotNull(prisUpper, "Failed to find entity"); Vector3F upperPos = new Vector3F(); Assert.IsTrue(prisUpper._engineInstance.GetPosition(ref upperPos), "Failed to get position of entity"); Assert.IsTrue( ((upperPos.Z < 250) && (upperPos.Z > 150)), "Z-Position should be between 150 and 250, but was {0}", new object[] { upperPos.Z }); } { // Check the Cylindrical constraint ShapeBase cylUpper = EditorManager.Scene.FindShapeByName("Cylindrical - Upper barrel"); Assert.IsNotNull(cylUpper, "Failed to find entity"); Vector3F upperPos = new Vector3F(); Assert.IsTrue(cylUpper._engineInstance.GetPosition(ref upperPos), "Failed to get position of entity"); Assert.IsTrue( ((upperPos.Z < 250) && (upperPos.Z > 150)), "Z-Position should be between 150 and 250, but was {0}", new object[] { upperPos.Z }); } { // Check the PointToPlane constraint ShapeBase pointToPlaneBarrel = EditorManager.Scene.FindShapeByName("PointToPlane - Barrel"); Assert.IsNotNull(pointToPlaneBarrel, "Failed to find entity"); Vector3F barrelPos = new Vector3F(); Assert.IsTrue(pointToPlaneBarrel._engineInstance.GetPosition(ref barrelPos), "Failed to get position of entity"); Assert.IsTrue( ((barrelPos.Z < 300) && (barrelPos.Z > 200)), "Z-Position should be between 300 and 200, but was {0}", new object[] { barrelPos.Z }); } { // Check the PointToPath constraint ShapeBase pointToPathLower = EditorManager.Scene.FindShapeByName("PointToPath - Lower ball"); Assert.IsNotNull(pointToPathLower, "Failed to find entity"); Vector3F lowerPos = new Vector3F(); Assert.IsTrue(pointToPathLower._engineInstance.GetPosition(ref lowerPos), "Failed to get position of entity"); Assert.IsTrue( ((lowerPos.Z < 300) && (lowerPos.Z > 200)), "Z-Position should be between 300 and 200, but was {0}", new object[] { lowerPos.Z }); } { // Check the Pulley constraint ShapeBase pulleyBox = EditorManager.Scene.FindShapeByName("Pulley - Box"); Assert.IsNotNull(pulleyBox, "Failed to find entity"); Vector3F boxPos = new Vector3F(); Assert.IsTrue(pulleyBox._engineInstance.GetPosition(ref boxPos), "Failed to get position of entity"); Assert.IsTrue( ((boxPos.Z < 250) && (boxPos.Z > 50)), "Z-Position should be between 250 and 50, but was {0}", new object[] { boxPos.Z }); } { // Check the Ragdoll constraint ShapeBase ragdollUpper = EditorManager.Scene.FindShapeByName("Ragdoll - Upper ball"); Assert.IsNotNull(ragdollUpper, "Failed to find entity"); Vector3F upperPos = new Vector3F(); Assert.IsTrue(ragdollUpper._engineInstance.GetPosition(ref upperPos), "Failed to get position of entity"); Assert.IsTrue( ((upperPos.Z < 300) && (upperPos.Z > 200)), "Z-Position should be between 300 and 200, but was {0}", new object[] { upperPos.Z }); } } finally { // Stop simulation EditorManager.EditorMode = EditorManager.Mode.EM_NONE; } }
private SubBoard(ShapeBase NewShape) { this.ShowShape = NewShape; initialize(); }
public virtual void onForceUncloak(ShapeBase obj, string reason) { }
public virtual void onEndSequence(ShapeBase obj, int slot, string name) { }
public virtual void onTrigger(ShapeBase obj, int index, bool state) { }
public void Remove(ShapeBase shape) { this.InnerList.Remove(shape); }
void AddPhysXComponentsRecursive(ShapeComponentCollection list, ShapeCollection entityList, ShapeBase parent) { if (parent.ShapeVirtualCounter > 0 || !parent.Modifiable) { return; } if (parent.ComponentCount > 0) { foreach (ShapeComponent comp in parent.Components) { if (!comp.Missing) { continue; } if (comp.DisplayName == "vPhysXRigidBody" || comp.DisplayName == "vPhysXCharacterController") { // Catch invalid casts try { UInt32 iValue = System.Convert.ToUInt32(comp.GetPropertyValue("m_iCollisionBitmask", false)); if (iValue != 0) { list.Add(comp); } } catch (InvalidCastException) {} } } } EntityShape entity = parent as EntityShape; if (entity != null && (entity.EntityClass == "vPhysXEntity" || entity.EntityClass == "LineFollowerEntity_cl")) { entityList.Add(entity); } if (parent.HasChildren()) { foreach (ShapeBase shape in parent.ChildCollection) { AddPhysXComponentsRecursive(list, entityList, shape); } } }
internal Class724(ShapeBase A_0, SizeF A_1) : this(A_0) { this.sizeF_0 = A_1; }
public void Paint(Graphics g, Size size) { LocalMessageBus.Send(null, new MenuMessage( new MenuCommand[] { new MenuCommand { Command = MenuCommands.Delete, Enabled = SelectedCount > 0 } , new MenuCommand { Command = MenuCommands.Copy, Enabled = !(Count < 1 || SelectedCount < 1) } , new MenuCommand { Command = MenuCommands.Paste, Enabled = CopyAction.Current.CanPaste } } )); if (Count < 1 || SelectedCount < 1) { LocalMessageBus.Send(this, new IsSelectShapImage(false)); } else if (SelectedCount == 1 && SelectedShape.Type == ShapeType.Image) { LocalMessageBus.Send(this, new IsSelectShapImage(true)); } else { LocalMessageBus.Send(this, new IsSelectShapImage(false)); } if (Count < 1) { return; } Visitor.Graphics = g; Visitor.Zoom = Zoom; UndoService.Suspend(); //paint background Layer ShapeBase backItem = Find(delegate(ShapeBase item) { return(item.IsBackground && item.IsVisible); }); if (backItem != null) { if (backItem.VirtualBounds.Size != size) { backItem.BeginEdit(); backItem.VirtualBounds = new Rectangle(Point.Empty, size); backItem.EndEdit(); } //backItem.Paint(g); backItem.Accept(Visitor); } ShapeBase[] shapes = this.ToArray(); bool drawSpecialShape = false; //paint all layers except dynamic layers foreach (ShapeBase shape in shapes) { if (!shape.IsVisible || shape.IsBackground //|| shape.Type == ShapeType.DynamicText //|| shape.Type == ShapeType.DynamicVideo ) { continue; } if (shape.Type == ShapeType.DownArrow || shape.Type == ShapeType.Ellipse || shape.Type == ShapeType.LeftArrow || shape.Type == ShapeType.Line || shape.Type == ShapeType.Rectangle || shape.Type == ShapeType.RightArrow || shape.Type == ShapeType.UpArrow) { if (!drawSpecialShape) { DrawSpecialShape(shapes, g); drawSpecialShape = true; } } else { shape.Accept(Visitor); //shape.Paint(g); } } //paint dynamic layers //将DynamicText层永远显示在最上面 add by Michael foreach (ShapeBase shape in shapes) { if (shape.IsVisible && shape.IsDynamicLayer /*(shape.Type == ShapeType.DynamicText)*/) { shape.Accept(Visitor);//shape.Paint(g); } } //paint selected layers' frame foreach (ShapeBase shape in shapes) { if (!shape.IsVisible || !shape.IsSelected) { continue; } //shape.PaintSelect(g, true); shape.DrawTracker(g); } UndoService.Resume(); }
public CopyItem(ShapeBase shape, IShapeLayer layer) { Shape = shape; Layer = layer; }
void AddShapesRecursive(ShapeCollection target, ShapeBase parent, Rectangle2D selection ) { if (parent.ShapeVirtualCounter==0 && parent.CanCopyPaste && (parent is Shape3D)) { Shape3D shape3D = (Shape3D)parent; if (selection.IsInside(shape3D.x, shape3D.y)) { target.Add(parent); //return; // iterate through children as well - the CloneForClipboard will take care of handling duplicates } } if (parent.HasChildren()) { ShapeCollection children = parent.ChildCollection; foreach (ShapeBase child in children) AddShapesRecursive(target, child, selection); } }
protected override void OnOpening(CancelEventArgs e) { this.Left = this.Left + Target.Left; for (int i = 0; i < Items.Count; i++) { Items[i].Enabled = false; } int layersSelected = _messageControl.SelectedLayers.Count; Canvas shapeControl = _messageControl.ShapeControl; if (FrameLayer != null && Target != null) { ShapeBase shape = FrameLayer.Shape; mnuChangeName.Enabled = layersSelected == 1; mnuDeleteLayer.Enabled = layersSelected >= 0; mnuSnap.Enabled = layersSelected > 0; if (FrameLayer.EmphasisEffect.Type != EffectType.None && FrameLayer.EmphasisEffect.Name.ToLower() != "none" && FrameLayer.EmphasisEffect.Duration > 0) { mnuDelEmphasisEffect.Enabled = layersSelected == 1; mnuSetEmphasisEffect.Enabled = layersSelected == 1; } if (!FrameLayer.EntryEffect.IsEmpty && FrameLayer.EntryEffect.Duration > 0) { mnuDelEntryEffect.Enabled = layersSelected == 1; mnuSetEntryEffect.Enabled = layersSelected == 1; } if (!FrameLayer.ExitEffect.IsEmpty && FrameLayer.ExitEffect.Duration > 0) { mnuDelExitEffect.Enabled = layersSelected == 1; mnuSetExitEffect.Enabled = layersSelected == 1; } mnuProperties.Enabled = layersSelected == 1; mnuOpenShowAllLayers.Enabled = !_messageControl.IsShowAllLayers; mnuCloseShowAllLayers.Enabled = _messageControl.IsShowAllLayers; if (!shape.IsBackground) { bool isbackgourd = _messageControl.ShapeControl.Document.Exists( delegate(ShapeBase s) { return(s.IsBackground == true); }); int index = _messageControl.GetLayerIndex(FrameLayer); int maxIndex = _messageControl.GetLayerCount(FrameLayer); if (index != 0 && isbackgourd && index != 1) { mnuSendToBack.Enabled = layersSelected == 1; mnuMoveLayerBackwards.Enabled = layersSelected == 1; } else if (index != 0 && !isbackgourd) { mnuSendToBack.Enabled = layersSelected == 1; mnuMoveLayerBackwards.Enabled = layersSelected == 1; } if (index != maxIndex - 1) { mnuBringToFront.Enabled = layersSelected == 1; mnuMoveLayerForward.Enabled = layersSelected == 1; } } } //this.Left = }
void AddSoundShapesRecursive(ShapeCollection shapeList, ShapeBase parent) { if (parent.ShapeVirtualCounter > 0 || !parent.Modifiable) return; ShapeBase soundShape = parent as ShapeObject3D; if (soundShape != null && (soundShape.GetType().FullName == "SoundEditorPlugin.SoundShape" || soundShape.GetType().FullName == "SoundEditorPlugin.SoundCollisionShape")) shapeList.Add(soundShape); if (parent.HasChildren()) foreach (ShapeBase shape in parent.ChildCollection) AddSoundShapesRecursive(shapeList, shape); }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { if (shape is StaticMeshGroupShape) { StaticMeshGroupShape groupShape = shape as StaticMeshGroupShape; if (groupShape == _ignoreShape || groupShape.ExportFileName == null || groupShape.ExportFileName == "") { return VisitResult.VisitOk; } if (groupShape.ExportFileName.StartsWith(_searchExportFileName)) { int newIndex = -1; string remaining = groupShape.ExportFileName.Substring(_searchExportFileName.Length); if (remaining.Length > 0) { try { newIndex = Convert.ToInt32(remaining); } catch (Exception) { newIndex = -1; } } if (newIndex > _maxIndex) { _maxIndex = newIndex; } } } return VisitResult.VisitOk; }
public GestureListener(ShapeBase shape) { Shape = shape; }
public override void OnChildRemoved(ShapeBase childShape, int iDepth) { base.OnChildRemoved(childShape, iDepth); if (iDepth == 1 && childShape is BoneProxyShape) _cachedBoneList = null; }
Layer GetBestLayer(ShapeBase shape) { BoundingBox bbox; Vector3F pos; if (!GetShapePosAndBox(shape, out pos, out bbox)) return null; if (bbox != null && bbox.Valid) pos = bbox.Center; // position from box center Zone bestZone = null; float fMinDist = 1000000000000.0f; foreach (Zone zone in _zones) { if (zone.Layers.Count < 1) continue; BoundingBox zonebox = zone.AssignmentBoundingBox; float fDist = zonebox.GetDistance(pos); if (fDist <= 0.0f) { if (bbox != null && bbox.Valid && zonebox.IsInside(bbox)) fDist -= 10.0f; // extra score } if (bestZone == null || fDist < fMinDist) { bestZone = zone; fMinDist = fDist; } } if (bestZone == null) return null; return bestZone.Layers[0]; }
public void AddUIControlInstance(ShapeBase child) { if (UIListInstance != null) { if (child is UIShapeSliderControl) { // UIListInstance.AddScrollbarControl(child._engineInstance); } } }
bool GetShapePosAndBox(ShapeBase shape, out Vector3F pos, out BoundingBox box) { if (shape.HasChildren()) { int iValidCount = 0; BoundingBox baccum = new BoundingBox(); Vector3F paccum = Vector3F.Zero; foreach (ShapeBase child in shape.ChildCollection) { BoundingBox b1; Vector3F p1; if (!GetShapePosAndBox(child, out p1, out b1)) continue; iValidCount++; paccum += p1; if (b1 != null && b1.Valid) baccum.AddBox(b1); } pos = paccum; box = baccum; if (iValidCount == 0) return false; pos *= (1.0f / (float)iValidCount); // average position return true; } if (shape is Shape3D) { pos = ((Shape3D)shape).Position; box = ((Shape3D)shape).AbsoluteBoundingBox; if (box == null || !box.Valid) box = null; return true; } pos = Vector3F.Zero; box = null; return false; }
public virtual void onClipEmpty(ShapeBase obj, int slot) { this.schedule("0", "reloadAmmoClip", obj, slot.AsString()); }
Layer GetUnAssignedLayer(ShapeBase shape) { if (_UnAssignedLayers == null) _UnAssignedLayers = new Dictionary<Layer, Layer>(); Layer layer = null; if (!_UnAssignedLayers.TryGetValue(shape.ParentLayer, out layer)) { Object[] parameters = { "UnassignedShapes_" + shape.ParentLayer.LayerName }; layer = EditorManager.LayerFactory.CreateInstance(parameters); this.Add(new AddLayerAction(layer,true)); _UnAssignedLayers.Add(shape.ParentLayer, layer); } return layer; }
/// <summary> /// Overridden function /// </summary> /// <param name="child"></param> public override void RemoveChild(ShapeBase child) { base.RemoveChild(child); if (child is CustomVolumeVertex) Update(); }
public StatePropertyCollection(Project project, ShapeBase parent, int diameterOuter, int diameterInner) { PreInit(project, diameterOuter); parent.Children.Add(circleOuter); PostInit(project, diameterInner); }
public int Add(ShapeBase shape) { return(this.InnerList.Add(shape)); }
internal void method_2(ShapeBase A_0, EscherDrawingType A_1) { this.method_11(A_1).Add(A_0.Id, A_0); }
public Actions(Project project, ShapeBase parent, int diameter) { ActionCollection.CircleType = CircleType; ActionCollection.ActionType = ActionType; actionCollection = new ActionCollection(project, parent, diameter); }
public override bool AllowsToAddChild(ShapeBase newChild) { return(false); }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { #if !HK_ANARCHY if (shape is WaterShape || shape is SunglareShape) { NeedsRendererNodeClass = true; return VisitResult.VisitStop; } #endif return VisitResult.VisitOk; }
/// <summary> /// This shape type cannot be dragged in the tree view /// </summary> /// <param name="newParent"></param> /// <returns></returns> public override bool AllowsToSetParent(ShapeBase newParent) { return(false); }
protected override bool DoPaste() { if (ClipboardService.ContainsImage()) { var img = ClipboardService.GetImage(); var imgFile = Constance.LibraryImageDir + Constance.DirectorySeparator + DateTime.Now.Ticks.ToString() + ".jpg"; IOHelper.SaveImage(img, imgFile); innerControl.AddImageLayer(imgFile); return(true); } foreach (var item in items) { if (item.Layer.Shape.LayerType == LayerType.Paint) { LayerControl lc = innerControl.GetLayerControl(item.Shape); if (lc != null || innerControl.IsExistShapeDraw) { ShapeBase pastedShape = item.Shape; pastedShape.ID = KeyGenerator.Shape; pastedShape.Move(Point.Empty); innerControl.AddLayer(pastedShape, ShapeAddMode.Clone); } else { IShapeLayer sl = item.Layer.Copy(); if (sl.Shape.Type == ShapeType.ShapeDraw) { ShapeDraw sd = sl.Shape as ShapeDraw; sd.Clear(); sd.AddChildShape(item.Shape); //sl.Shape = sd; } sl.Shape.Move(Point.Empty); LayerControl tmlayer = innerControl.NewLayerControl(sl as ShapeLayer, true); innerControl.AddLayer(tmlayer, ShapeAddMode.Clone); tmlayer.Shape.Zoom = item.Shape.Zoom; } } else { //LayerControl layerControl = innerControl.GetLayerControl(item.Shape); //if (layerControl != null) //{ // bool isBackGround = layerControl.Shape.IsBackground; // ShapeLayer item = layerControl.Layer.Copy(); // item.Shape = item.Shape.Copy(); // item.Shape.Move(Point.Empty); // if (isBackGround) // { // item.Shape.BeginEdit(); // item.Shape.IsBackground = false; // item.Shape.EndEdit(); // } // innerControl.AddLayer(innerControl.NewLayerControl(item, true), ShapeAddMode.Clone); // if(isBackGround) // item.Shape.IsBackground = isBackGround; //} //else //{ bool isBackGround = item.Layer.Shape.IsBackground; if (isBackGround) { item.Layer.Shape.BeginEdit(); item.Layer.Shape.IsBackground = false; item.Layer.Shape.EndEdit(); } var sl = item.Layer.Copy(); sl.Shape.Move(Point.Empty); innerControl.AddLayer(innerControl.NewLayerControl(sl as ShapeLayer, true), ShapeAddMode.Clone); if (isBackGround) { item.Layer.Shape.IsBackground = isBackGround; } //} } } innerControl.ShapeControl.Invalidate(); return(true); }
public static bool ProjectOn(this GeometricGraph graph, GeometricEdge edge, float latitude, float longitude, out float projectedLatitude, out float projectedLongitude, out float projectedDistanceFromFirst, out int projectedShapeIndex, out float distanceToProjected, out float totalLength) { distanceToProjected = float.MaxValue; projectedDistanceFromFirst = 0.0f; projectedLatitude = float.MaxValue; projectedLongitude = float.MaxValue; projectedShapeIndex = -1; ICoordinate coordinate1 = (ICoordinate)graph.GetVertex(edge.From); ShapeBase shape = edge.Shape; IEnumerator <ICoordinate> enumerator = (IEnumerator <ICoordinate>)null; if (shape != null) { enumerator = shape.GetEnumerator(); enumerator.Reset(); } float num1 = 0.0f; int num2 = -1; while (true) { bool flag = true; ICoordinate coordinate2; if (enumerator != null && enumerator.MoveNext()) { coordinate2 = enumerator.Current; } else { flag = false; coordinate2 = (ICoordinate)graph.GetVertex(edge.To); } PointF2D pointF2D = new GeoCoordinateLine(new GeoCoordinate((double)coordinate1.Latitude, (double)coordinate1.Longitude), new GeoCoordinate((double)coordinate2.Latitude, (double)coordinate2.Longitude), true, true).ProjectOn((PointF2D) new GeoCoordinate((double)latitude, (double)longitude)); if (pointF2D != (PointF2D)null) { double num3 = GeoCoordinate.DistanceEstimateInMeter(pointF2D[1], pointF2D[0], (double)latitude, (double)longitude); if (num3 < (double)distanceToProjected) { distanceToProjected = (float)num3; projectedLatitude = (float)pointF2D[1]; projectedLongitude = (float)pointF2D[0]; projectedDistanceFromFirst = num1 + (float)GeoCoordinate.DistanceEstimateInMeter((double)projectedLatitude, (double)projectedLongitude, (double)coordinate1.Latitude, (double)coordinate1.Longitude); projectedShapeIndex = num2 + 1; } } if (flag) { num1 += (float)GeoCoordinate.DistanceEstimateInMeter((double)coordinate1.Latitude, (double)coordinate1.Longitude, (double)coordinate2.Latitude, (double)coordinate2.Longitude); ++num2; coordinate1 = coordinate2; } else { break; } } GeoCoordinateSimple vertex = graph.GetVertex(edge.To); totalLength = num1 + (float)GeoCoordinate.DistanceEstimateInMeter((double)coordinate1.Latitude, (double)coordinate1.Longitude, (double)vertex.Latitude, (double)vertex.Longitude); return((double)distanceToProjected != 3.40282346638529E+38); }
/// <summary> /// Overridden function /// </summary> /// <param name="child"></param> public override void RemoveChild(ShapeBase child) { base.RemoveChild (child); if (child is PathNodeShape) Update(); }
private void SelectEntities(ShapeBase shape, String classText, String modelText, ShapeCollection sel) { //check the entity EntityShape entity = shape as EntityShape; if (entity!=null) { bool bSelect = true; if (checkEntityClass.Checked) bSelect &= (entity.EntityClass.ToUpper().IndexOf(classText)!=-1); if (checkModel.Checked) bSelect &= (entity.ModelFile.ToUpper().IndexOf(modelText)!=-1); if (bSelect) sel.Add(shape); } //check its children foreach(ShapeBase child in shape.ChildCollection) { SelectEntities(child, classText, modelText, sel); } }
public override void onInventory(ShapeBase user, int value) { //Player can be either a player object or a aiturret... GameConnection client = user["client"]; for (int i = 0; i < 8; i++) { if (user.GetType() == typeof(Player)) { ShapeBaseImageData image = (user).getMountedImage(i); if (image <= 0) { continue; } if (!image["ammo"].isObject()) { continue; } if (((SimObject)image["ammo"]).getId() != this.getId()) { continue; } (user).setImageAmmo(i, value != 0); } else if (user.GetType() == typeof(AITurretShape)) { ShapeBaseImageData image = (user).getMountedImage(i); if (image <= 0) { continue; } if (!image["ammo"].isObject()) { continue; } if (((SimObject)image["ammo"]).getId() != getId()) { continue; } (user).setImageAmmo(i, value != 0); } int currentammo = user.getInventory(this); // ShapeBaseShapeBaseGetInventory(player, thisobj); if (user.getClassName() != "Player") { continue; } int amountInClips; if (this["clip"].isObject()) { amountInClips = user.getInventory(this["clip"]); // ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]); amountInClips *= this["maxInventory"].AsInt(); amountInClips += user["remaining" + getName()].AsInt(); } else { amountInClips = currentammo; currentammo = 1; } if (user["client"] != string.Empty && !user["isAiControlled"].AsBool()) { client.setAmmoAmountHud(currentammo, amountInClips); } } }
public static void serverCmdCycleWeapon(GameConnection client, string direction) { ShapeBase obj = client["player"]; obj.cycleWeapon(direction); }
public override void OnChildRemoved(ShapeBase childShape, int iDepth) { base.OnChildRemoved(childShape, iDepth); this._relevantShapes = null; }
void AddPhysXComponentsRecursive(ShapeComponentCollection list, ShapeCollection entityList, ShapeBase parent) { if (parent.ShapeVirtualCounter > 0 || !parent.Modifiable) return; if (parent.ComponentCount > 0) { foreach (ShapeComponent comp in parent.Components) { if (!comp.Missing) continue; if (comp.DisplayName == "vPhysXRigidBody" || comp.DisplayName == "vPhysXCharacterController") { // Catch invalid casts try { UInt32 iValue = System.Convert.ToUInt32(comp.GetPropertyValue("m_iCollisionBitmask", false)); if (iValue != 0) list.Add(comp); } catch(InvalidCastException) {} } } } EntityShape entity = parent as EntityShape; if (entity != null && (entity.EntityClass == "vPhysXEntity" || entity.EntityClass == "LineFollowerEntity_cl")) { entityList.Add(entity); } if (parent.HasChildren()) foreach (ShapeBase shape in parent.ChildCollection) AddPhysXComponentsRecursive(list, entityList, shape); }
public GetExportFileNameMaxIndexVisitor(string searchExportFileName, ShapeBase ignoreShape) { _searchExportFileName = searchExportFileName; _ignoreShape = ignoreShape; }
internal Class234(ShapeBase A_0, Class398 A_1) { this.class398_0 = A_1; this.shapeBase_0 = A_0; }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { BoundingBox bbox = shape.AbsoluteBoundingBox; if (bbox==null || !bbox.Valid) return VisitResult.VisitOk; if (_bTouching) { if (!visBBox.Intersects(bbox)) return VisitResult.VisitOk; } else { if (!visBBox.IsInside(bbox)) return VisitResult.VisitOk; } foreach (LinkTarget tgt in shape.LinkTargets) if (shape.CanLink(_srcLink, tgt) && !shape.IsLinkedBySource(_srcLink)) RelevantTargets.Add(tgt); return VisitResult.VisitOk; }
void CheckSceneStatistics() { if (EditorManager.Scene == null || _isSDKScene) { return; } bool physicsUsed = false; bool aiUsed = false; bool behaviorUsed = false; int scriptedObjectCount = 0; Stack <ShapeBase> TempStack = new Stack <ShapeBase>(); foreach (Layer layer in EditorManager.Scene.Layers) { TempStack.Push(layer.Root); } while (TempStack.Count > 0) { ShapeBase current = TempStack.Pop(); foreach (ShapeBase shape in current.ChildCollection) { TempStack.Push(shape); } if (!physicsUsed && current.Components != null) { if (current.Components.GetComponentByEngineName("vHavokRigidBody") != null) { physicsUsed = true; } if (current.Components.GetComponentByEngineName("vHavokCharacterController") != null) { physicsUsed = true; } if (current.Components.GetComponentByEngineName("vHavokTriggerVolume") != null) { physicsUsed = true; } if (current.Components.GetComponentByEngineName("vHavokRagdoll") != null) { physicsUsed = true; } } if (!aiUsed) { if (current.GetType().Name == "HavokNavMeshShape") { aiUsed = true; } } if (!behaviorUsed && current.Components != null) { if (current.Components.GetComponentByEngineName("vHavokBehaviorComponent") != null) { behaviorUsed = true; } } if (current.Components != null && current.Components.GetComponentByEngineName("VScriptComponent") != null) { scriptedObjectCount++; } } VisionGoogleAnalytics.RecordEvent("Usage", "Havok Products", "Physics", physicsUsed ? 1 : 0); VisionGoogleAnalytics.RecordEvent("Usage", "Havok Products", "Behavior", behaviorUsed ? 1 : 0); VisionGoogleAnalytics.RecordEvent("Usage", "Havok Products", "AI", aiUsed ? 1 : 0); VisionGoogleAnalytics.RecordEvent("Usage", "Builtin", "Scripted Objects", scriptedObjectCount); }
/// <summary> /// Overridden function /// </summary> /// <param name="name"></param> /// <param name="otherShape"></param> /// <returns></returns> public override bool CanGroupRelevantOperation(string name, ShapeBase otherShape) { if (name==@"Shaders\Model surfaces") { if (!(otherShape is EntityShape)) return false; return string.Compare(((EntityShape)otherShape).ModelFile,this.ModelFile)==0; } if (name == RO_OPEN_IN_MV) return false; return base.CanGroupRelevantOperation (name, otherShape); }
public override bool onUse(ShapeBase obj) { if (obj.getMountedImage(Constants.WeaponSlot) == this["image"].AsInt()) { return(false); } Audio.AudioServerPlay3D("WeaponUseSound", obj.getTransform()); obj.mountImage(this["image"], Constants.WeaponSlot, true, string.Empty); if (obj["client"].AsBool()) { if (this["description"] != string.Empty) { message.MessageClient(obj["client"], "MsgWeaponUsed", "\\c3%1 \\c5 selected.", this["description"]); } else { message.MessageClient(obj["client"], "MsgWeaponUsed", console.addTaggedString(@"\c0Weapon selected")); } } if (obj.isInNamespaceHierarchy("Player")) { return(false); } Player player = obj._ID; player.allowAllPoses(); SimObject image = this["image"]; if (image["jumpingDisallowed"].AsBool()) { player.allowJumping(false); } if (image["jetJumpingDisallowed"].AsBool()) { player.allowJetJumping(false); } if (image["sprintDisallowed"].AsBool()) { player.allowSprinting(false); } if (image["crouchDisallowed"].AsBool()) { player.allowCrouching(false); } if (image["proneDisallowed"].AsBool()) { player.allowProne(false); } if (image["swimmingDisallowed"].AsBool()) { player.allowSwimming(false); } return(true); }
public override bool AllowsToSetParent(ShapeBase newParent) { return newParent is EntityShape; }
internal Class273 method_6(ShapeBase A_0, EscherShapeKind A_1) { Class273 class2 = new Class273(); if (A_0.IsGroup) { Class285 class3 = new Class285(); class3.method_5(A_0.CoordOrigin); class3.method_7(A_0.CoordSize); class2.method_7().Add(class3); } Class279 class4 = new Class279(); class4.method_5(A_0.Id); switch (A_0.ShapeType) { case ShapeType.OleObject: case ShapeType.OleControl: class4.method_31(ShapeType.Image); break; case ShapeType.Group: class4.method_31(ShapeType.NonPrimitive); break; default: class4.method_31(A_0.ShapeType); break; } class4.method_7(A_0.IsGroup); class4.method_25(A_1 == EscherShapeKind.Background); class4.method_9(A_1 == EscherShapeKind.Child); class4.method_23(A_0.IsConnector); class4.method_15(A_0.IsOle && !A_0.IsInline); class4.method_29(!A_0.IsGroup); class4.method_27(true); class4.method_33(A_0.FlipOrientation); class2.method_7().Add(class4); Class287 class8 = new Class287(false); Class287 class5 = new Class287(true); this.class930_0.method_23(A_0, class8.method_4(), class5.method_4(), class4.method_24()); if (class8.method_4().method_2() > 0) { class2.method_7().Add(class8); } if (class5.method_4().method_2() > 0) { class2.method_7().Add(class5); } if (A_1 == EscherShapeKind.InlineReal) { Class267 class11 = new Class267(); class11.method_5(EscherClientAnchorFlags.Inline); class2.method_7().Add(class11); return(class2); } if (!class4.method_24()) { if (class4.method_8()) { Class291 class6 = new Class291(); Class265 class7 = Class265.smethod_3(A_0); class6.method_5((int)class7.double_0); class6.method_7((int)class7.double_1); class6.method_9((int)class7.double_2); class6.method_11((int)class7.double_3); class2.method_7().Add(class6); } else { Class267 class12 = new Class267(); class2.method_7().Add(class12); } } Class280 class9 = new Class280(); class9.method_5(1); class2.method_7().Add(class9); if (A_0.Txid != 0) { Class282 class10 = new Class282(); class10.method_5(A_0.Txid); class2.method_7().Add(class10); } return(class2); }
public override IShapeVisitor.VisitResult Visit(ShapeBase shape) { if ((shape is ParticleGroupShape) && shape.HasEngineInstance()) ((ParticleGroupShape)shape).EnginePGroup.UpdateParticleColors(); return VisitResult.VisitOk; }
private void method_5(Class273 A_0, ShapeBase A_1) { Class291 class2 = null; for (int i = 0; i < A_0.method_8(); i++) { Class279 class4; Class266 class3 = A_0.method_9(i); if (class3 != null) { switch (class3.method_3().method_8()) { case EscherRecordType.ShapeGroup: { Class285 class5 = (Class285)class3; A_1.CoordOrigin = class5.method_4(); A_1.method_56(class5.method_6()); break; } case EscherRecordType.Shape: class4 = (Class279)class3; A_1.Id = class4.method_4(); if (!class4.method_6()) { goto Label_00AB; } A_1.SetShapeType(ShapeType.Group); goto Label_00C9; case EscherRecordType.ShapeOptions: case EscherRecordType.ShapeOptionsEx: goto Label_00D7; case EscherRecordType.ChildAnchor: goto Label_00F0; } } continue; Label_00AB: if (class4.method_14()) { A_1.SetShapeType(ShapeType.OleObject); } else { A_1.SetShapeType(class4.method_30()); } Label_00C9: A_1.FlipOrientation = class4.method_32(); continue; Label_00D7: this.class930_0.method_0(((Class287)class3).method_4(), A_1); continue; Label_00F0: class2 = (Class291)class3; } if (class2 != null) { Class265.smethod_2(A_1, (double)class2.method_4(), (double)class2.method_6(), (double)class2.method_8(), (double)class2.method_10()); } }