public static void AttachLabelToObject(string text, Vector3 posOffset, NetHandle obj) { var attachedLabel = new AttachedLabel(text, posOffset); switch (obj.Type) { case EntityType.Player: var player = NAPI.Entity.GetEntityFromHandle <Client>(obj); player.SetSharedData("attachedLabel", JsonConvert.SerializeObject(attachedLabel)); Trigger.ClientEventInRange(player.Position, 550, "attachLabel", player); break; case EntityType.Vehicle: var vehicle = NAPI.Entity.GetEntityFromHandle <Vehicle>(obj); vehicle.SetSharedData("attachedLabel", JsonConvert.SerializeObject(attachedLabel)); Trigger.ClientEventInRange(vehicle.Position, 550, "attachLabel", vehicle); break; } }
public SsSequence(IStreamReader reader) : base(reader) { // SS = DataFormat Begin [Chart3DBarShape] [LineFormat AreaFormat PieFormat] // [SerFmt] [GELFRAME] [MarkerFormat] [AttachedLabel] *2SHAPEPROPS [CRTMLFRT] End //// SS = DataFormat Begin [Chart3DBarShape] [LineFormat AreaFormat PieFormat] //// [SerFmt] [LineFormat] [AreaFormat] [GELFRAME] [MarkerFormat] [AttachedLabel] *2SHAPEPROPS [CRTMLFRT] End // DataFormat this.DataFormat = (DataFormat)BiffRecord.ReadRecord(reader); // Begin this.Begin = (Begin)BiffRecord.ReadRecord(reader); // [Chart3DBarShape] if (BiffRecord.GetNextRecordType(reader) == RecordType.Chart3DBarShape) { this.Chart3DBarShape = (Chart3DBarShape)BiffRecord.ReadRecord(reader); } // [LineFormat AreaFormat PieFormat] if (BiffRecord.GetNextRecordType(reader) == RecordType.LineFormat) { this.LineFormat = (LineFormat)BiffRecord.ReadRecord(reader); } if (BiffRecord.GetNextRecordType(reader) == RecordType.AreaFormat) { this.AreaFormat = (AreaFormat)BiffRecord.ReadRecord(reader); } if (BiffRecord.GetNextRecordType(reader) == RecordType.PieFormat) { this.PieFormat = (PieFormat)BiffRecord.ReadRecord(reader); } //// this is for the case that LineFormat and AreaFormat //// exists and is behind the SerFmt which doesn't exists //if (this.PieFormat == null) //{ // if (this.LineFormat1 != null) // { // this.LineFormat2 = this.LineFormat1; // this.LineFormat1 = null; // } // if (this.AreaFormat1 != null) // { // this.AreaFormat2 = this.AreaFormat1; // this.AreaFormat1 = null; // } //} // [SerFmt] if (BiffRecord.GetNextRecordType(reader) == RecordType.SerFmt) { this.SerFmt = (SerFmt)BiffRecord.ReadRecord(reader); } // [LineFormat] [AreaFormat] [GELFRAME] [MarkerFormat] [AttachedLabel] End //if (BiffRecord.GetNextRecordType(reader) == RecordType.LineFormat) //{ // this.LineFormat2 = (LineFormat)BiffRecord.ReadRecord(reader); //} //// [AreaFormat] //if (BiffRecord.GetNextRecordType(reader) == // RecordType.AreaFormat) //{ // this.AreaFormat2 = (AreaFormat)BiffRecord.ReadRecord(reader); //} // [GELFRAME] if (BiffRecord.GetNextRecordType(reader) == RecordType.GelFrame) { this.GelFrameSequence = new GelFrameSequence(reader); } // [MarkerFormat] if (BiffRecord.GetNextRecordType(reader) == RecordType.MarkerFormat) { this.MarkerFormat = (MarkerFormat)BiffRecord.ReadRecord(reader); } // [AttachedLabel] if (BiffRecord.GetNextRecordType(reader) == RecordType.AttachedLabel) { this.AttachedLabel = (AttachedLabel)BiffRecord.ReadRecord(reader); } // *2SHAPEPROPS this.ShapePropsSequences = new List <ShapePropsSequence>(); while (BiffRecord.GetNextRecordType(reader) == RecordType.ShapePropsStream) { this.ShapePropsSequences.Add(new ShapePropsSequence(reader)); } // [CRTMLFRT] if (BiffRecord.GetNextRecordType(reader) == RecordType.CrtMlFrt) { this.CrtMlfrtSequence = new CrtMlfrtSequence(reader); } // End this.End = (End)BiffRecord.ReadRecord(reader); }