コード例 #1
0
ファイル: AegisHealPod.cs プロジェクト: geo-vi/NettyBaseTD
        private void Pulse()
        {
            if (TimeFinish < DateTime.Now)
            {
                Active = false;
                End();
                Cooldown = new AegisHealPodCooldown(this);
                Object beacon;
                Beacon.Spacemap.Objects.TryRemove(Beacon.Id, out beacon);
                return;
            }

            TargetIds.Clear();
            foreach (var entity in Beacon.Spacemap.Entities.Where(x =>
                                                                  x.Value.Position.DistanceTo(Beacon.Position) < 300))
            {
                if (Player.Group != null && Player.Group.Members.ContainsKey(entity.Key) || Player == entity.Value)
                {
                    TargetIds.Add(entity.Key);
                    entity.Value.Controller.Heal.Execute(15000, Player.Id);
                }
            }

            ShowEffect();
        }
コード例 #2
0
 public override void execute()
 {
     if (!Enabled)
     {
         return;
     }
     Active = true;
     TargetIds.Add(Player.Id);
     TimeFinish = DateTime.Now.AddMinutes(2);
     Start();
 }
コード例 #3
0
ファイル: PAAModel.cs プロジェクト: wzfxue/Revit
        internal bool CheckParallel(Document document)
        {
            var curves         = TargetIds.Select(c => (document.GetElement(c).Location as LocationCurve).Curve as Line);
            XYZ verticalVector = curves.First().Direction;

            foreach (var curve in curves)
            {
                var crossProduct = curve.Direction.CrossProduct(verticalVector);
                if (!crossProduct.X.IsMiniValue() || !crossProduct.Y.IsMiniValue())
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #4
0
 public override void execute()
 {
     if (!Enabled)
     {
         return;
     }
     Active    = true;
     Selection = Player.SelectedCharacter;
     if (Selection != null && (Selection.FactionId == Player.FactionId || Player.Clan.GetRelation(Selection.Clan) == 1 || Player.Group != null && Player.Group.Members.ContainsKey(Selection.Id)))
     {
         BeamStrenght = 2;
         TargetIds.Add(Selection.Id);
     }
     Start();
     TimeFinish = DateTime.Now.AddSeconds(7);
 }
コード例 #5
0
 public override void execute()
 {
     if (!Enabled)
     {
         return;
     }
     Active = true;
     if (Player.Group != null)
     {
         foreach (var member in Player.Group.Members.Where(x => x.Value.Spacemap == Player.Spacemap))
         {
             TargetIds.Add(member.Key);
         }
     }
     TargetIds.Add(Player.Id);
     Start();
     Heal();
 }
コード例 #6
0
 public IEnumerator <ID> GetEnumerator()
 {
     return(TargetIds.ToList().GetEnumerator());
 }
コード例 #7
0
 public bool Contains(ID item)
 {
     return(TargetIds.Contains(item));
 }
コード例 #8
0
ファイル: PAAModel.cs プロジェクト: wzfxue/Revit
        public bool CalculateLocations()
        {
            switch (ModelType)
            {
            case PAAModelType.SinglePipe:
                #region single
                var target        = Document.GetElement(TargetId);
                var locationCurve = TargetType.GetLine(target);
                UpdateVectors(locationCurve);
                //干线起始点
                var lineBound = Line.CreateBound(BodyStartPoint, BodyEndPoint);
                if (lineBound.VL_IsIntersect(locationCurve))
                {
                    var intersectionPoints = lineBound.VL_GetIntersectedOrContainedPoints(locationCurve);
                    if (intersectionPoints.Count == 1)
                    {
                        BodyStartPoint = intersectionPoints.FirstOrDefault().ToSameZ(BodyEndPoint);    //.ToSameZ(BodyStartPoint);
                    }
                }
                else
                {
                }            //否则不改变原始坐标,仅重置
                             //支线终点
                if (TextType == PAATextType.Option2)
                {
                    if (!IsRegenerate)
                    {
                        LeafEndPoint = BodyEndPoint + LineWidth * ParallelVector;
                    }
                    //文本位置 start:(附着元素中点+线基本高度+文本高度*(文本个数-1))  end: start+宽
                    //高度,宽度 取决于文本
                    AnnotationLocation = TextType.GetTextLocation(CurrentFontHeight, VerticalVector, BodyEndPoint, LeafEndPoint);
                }
                else
                {
                    if (!IsRegenerate)
                    {
                        LeafEndPoint = BodyEndPoint + (IsReversed ? -LineWidth * ParallelVector : LineWidth * ParallelVector);
                    }
                    var bb = BodyEndPoint - BodyStartPoint;
                    var lb = (LeafEndPoint - BodyEndPoint);
                    if (lb.CrossProductByCoordinateType(bb, VLCoordinateType.XY) < 0)
                    {
                        var temp = LeafEndPoint;
                        LeafEndPoint = BodyEndPoint;
                        BodyEndPoint = temp;
                    }
                    //文本位置 start:(附着元素中点+线基本高度+文本高度*(文本个数-1))  end: start+宽
                    //高度,宽度 取决于文本
                    if (bb.CrossProductByCoordinateType(ParallelVector, VLCoordinateType.XY) < 0)
                    {
                        AnnotationLocation = TextType.GetTextLocation(CurrentFontHeight, VerticalVector, LeafEndPoint, BodyEndPoint);
                    }
                    else
                    {
                        AnnotationLocation = TextType.GetTextLocation(CurrentFontHeight, VerticalVector, BodyEndPoint, LeafEndPoint);
                    }
                }
                return(true);

                #endregion
            case PAAModelType.MultiplePipe:
                #region multiple
                PipeAndNodePoints = new List <ElementAndNodePoint>();
                if (IsRegenerate)
                {
                    for (int i = 0; i < TargetIds.Count; i++)
                    {
                        target = Document.GetElement(TargetIds[i]);
                        var annotationId = AnnotationIds[i];
                        var annotation   = Document.GetElement(annotationId);
                        if (annotation == null)
                        {
                            return(false);
                        }
                        PipeAndNodePoints.Add(new ElementAndNodePoint(target, annotation as IndependentTag));
                    }
                }
                else
                {
                    foreach (var selectedId in TargetIds)
                    {
                        PipeAndNodePoints.Add(new ElementAndNodePoint(Document.GetElement(selectedId)));
                    }
                }
                //平行,垂直 向量
                UpdateVectors(PipeAndNodePoints.First().Line);
                //重叠区间
                XYZ        rightOfLefts;
                XYZ        leftOfRights;
                XYZ        startPoint = TargetLocation;
                List <XYZ> lefts      = new List <XYZ>();
                List <XYZ> rights     = new List <XYZ>();
                if (!IsRegenerate)
                {
                    bool usingX = GetLeftsAndRights(PipeAndNodePoints, lefts, rights);
                    rightOfLefts = usingX ? lefts.First(c => c.X == lefts.Max(p => p.X)) : lefts.First(c => c.Y == lefts.Max(p => p.Y));
                    leftOfRights = usingX ? rights.First(c => c.X == rights.Min(p => p.X)) : rights.First(c => c.Y == rights.Min(p => p.Y));
                    if ((usingX && rightOfLefts.X > leftOfRights.X) || (!usingX && rightOfLefts.Y > leftOfRights.Y))
                    {
                        //TODO 提示无重叠区间
                        return(false);
                    }
                }
                else
                {
                    rightOfLefts = leftOfRights = null;
                }
                //节点计算
                XYZ firstNode;
                if (!IsRegenerate)
                {
                    firstNode = (rightOfLefts + leftOfRights) / 2;
                }
                else
                {
                    locationCurve = PipeAndNodePoints[0].Line;
                    firstNode     = locationCurve.Project(startPoint).XYZPoint;
                }
                PipeAndNodePoints[0].NodePoint = firstNode;
                //节点位置
                for (int i = 1; i < PipeAndNodePoints.Count(); i++)
                {
                    PipeAndNodePoints[i].NodePoint = PipeAndNodePoints[i].Line.Project(PipeAndNodePoints[0].NodePoint).XYZPoint;
                }
                //排序
                if (PipeAndNodePoints.Count() > 1)
                {
                    if (Math.Abs(PipeAndNodePoints[0].NodePoint.Y - PipeAndNodePoints[1].NodePoint.Y) < 0.01)
                    {
                        PipeAndNodePoints = PipeAndNodePoints.OrderBy(c => c.NodePoint.X).ToList();
                    }
                    else
                    {
                        PipeAndNodePoints = PipeAndNodePoints.OrderByDescending(c => c.NodePoint.Y).ToList();
                    }
                }
                TargetIds = PipeAndNodePoints.Select(c => c.Target.Id).ToList();
                //标注定位计算
                XYZ    offset       = GetOffSet();
                bool   overMoved    = false;//位移是否超过的最低限制
                double parallelSkew = offset.GetLengthBySide(ParallelVector);
                foreach (var PipeAndNodePoint in PipeAndNodePoints)
                {
                    PipeAndNodePoint.NodePoint += parallelSkew * ParallelVector;
                }
                TargetLocation = PipeAndNodePoints.First().NodePoint;
                if (IsRegenerate)    // && regenerateType != RegenerateType.RegenerateByPipe)
                {
                    //原始线高度+偏移数据
                    var line             = Document.GetElement(LineId);
                    var orientLineHeight = IsRegenerate ? line.GetParameters(TagProperty.线高度1.ToString()).First().AsDouble() : 0;
                    var verticalSkew     = RegenerateType == RegenerateType.ByMultipleTarget ? 0 : VLLocationHelper.GetLengthBySide(offset, VerticalVector);
                    //if (Math.Abs(VerticalVector.X) > 1 - UnitHelper.MiniValueForXYZ)
                    //    verticalSkew = -verticalSkew;
                    var nodesHeight = UnitHelper.ConvertToFoot((PipeAndNodePoints.Count() - 1) * CurrentFontHeight, VLUnitType.millimeter);
                    overMoved = orientLineHeight + verticalSkew < nodesHeight;
                    var lineHeight = orientLineHeight + verticalSkew;
                    if (overMoved)
                    {
                        lineHeight   = nodesHeight;
                        verticalSkew = nodesHeight - orientLineHeight;
                    }
                    LineHeight = lineHeight;
                }
                else
                {
                    LineHeight = CurrentFontHeight;
                }
                LineSpace = CurrentFontHeight;
                UpdateLineWidth(Document.GetElement(TargetIds.First()));
                //string text = GetFullTextForLine(Document.GetElement(TargetIds.First()));
                //var textWidth = TextRenderer.MeasureText(text, PAAContext.FontManagement.OrientFont).Width;
                //LineWidth = textWidth * PAAContext.FontManagement.CurrentFontWidthSize;
                //标注位置
                for (int i = 0; i < PipeAndNodePoints.Count(); i++)
                {
                    var start = TargetLocation + (LineHeight + i * LineSpace) * VerticalVector;
                    var end   = start + LineWidth * ParallelVector;
                    PipeAndNodePoints[PipeAndNodePoints.Count() - 1 - i].AnnotationPoint = TextType.GetTextLocation(CurrentFontHeight, VerticalVector, start, end);
                }
                #endregion
                return(true);

            default:
                throw new NotImplementedException("未支持该类型的生成");
            }
        }