public bool Action(Verb verb, AttachmentPoint target) { Physical physicalSelf = verb.self as Physical; if (physicalSelf != null) { Physical parent = PhysicalUtilities.FindParentPhysical(physicalSelf); target.Attach(parent); } else { target.Attach(verb.self); } // Create data dictionary to be passed to observers Dictionary <string, object> data = new Dictionary <string, object>(); // Message for Verbose pages data["message"] = new ObservableText($"[0] {verb.displayLabel.ToLower()} into [1].", new Tuple <GameObject, string>(verb.self, "name top"), new Tuple <GameObject, string>(target.GetParent(), "name") ); data["turnPage"] = true; data["displayAfter"] = true; TimelineManager.instance.OnAction(data); return(true); }
public string AddCurrent() { GameObject gobj = Managers.personManager.ourPerson.GetAttachmentPointById(AttachmentPoint); if (gobj == null) { DebugLog.Log("Attachment point {0} does not exist!", AttachmentPoint); return(null); } AttachmentPoint ap = gobj.GetComponent <AttachmentPoint>(); if (ap == null) { DebugLog.Log("Attachment point {0} missing AttachmentPoint component; adding it now."); ap = gobj.AddComponent <AttachmentPoint>(); ap.id = AttachmentPoint; } if (ap.attachedThing != null) { string name = ap.attachedThing.name.ToLower(); this[name] = ap.GetAttachmentData(); return(name); } else { return(null); } }
public void CreateAttachments(object source, List <AttachmentInfo> attachments, AttachmentPoint point = AttachmentPoint.None) { if (!this.attachments.ContainsKey(source)) { this.attachments.Add(source, new List <Tuple <AttachmentPoint, GameObject> >()); } foreach (var attachmentInfo in attachments) { var prefab = Resources.Load <GameObject>(attachmentInfo.Prefab); if (prefab == null) { Debug.LogError($"Prefab not found at {attachmentInfo.Prefab}"); return; } var attachmentPoint = attachmentInfo.Point == AttachmentPoint.Auto ? point : attachmentInfo.Point; var attachmentPointTransform = Model.GetAttachmentPoint(attachmentPoint); var attachment = Instantiate(prefab, attachmentPointTransform, attachmentInfo.OriginalScale); attachment.transform.localPosition = Vector3.zero; attachment.transform.localRotation = Quaternion.identity; foreach (var component in attachment.GetComponentsInChildren <Transform>()) { component.gameObject.layer = Model.gameObject.layer; } this.attachments[source].Add(new Tuple <AttachmentPoint, GameObject>(attachmentPoint, attachment)); } Model.OnAttachmentAdded(); }
private static AttachmentPointAdapter GetAttachmentPointAdapter(AttachmentPoint attachmentPoint) { AttachmentPointAdapter attachmentPointAdapter = new AttachmentPointAdapter(); attachmentPointAdapter.HorJust = VdConstHorJust.VdTextHorCenter; attachmentPointAdapter.verJust = VdConstVerJust.VdTextVerBottom; if (attachmentPoint.Equals(AttachmentPoint.BottomCenter)) { return(attachmentPointAdapter); } else if (attachmentPoint.Equals(AttachmentPoint.BottomLeft)) { attachmentPointAdapter.HorJust = VdConstHorJust.VdTextHorLeft; return(attachmentPointAdapter); } else if (attachmentPoint.Equals(AttachmentPoint.MiddleCenter)) { attachmentPointAdapter.HorJust = VdConstHorJust.VdTextHorCenter; attachmentPointAdapter.verJust = VdConstVerJust.VdTextVerCen; return(attachmentPointAdapter); } else if (attachmentPoint.Equals(AttachmentPoint.MiddleLeft)) { attachmentPointAdapter.HorJust = VdConstHorJust.VdTextHorLeft; attachmentPointAdapter.verJust = VdConstVerJust.VdTextVerCen; return(attachmentPointAdapter); } else { attachmentPointAdapter.HorJust = VdConstHorJust.VdTextHorRight; return(attachmentPointAdapter); } }
protected void WriteSkeleton(BinaryWriter writer) { for (ushort i = 0; i < skeleton.BoneCount; ++i) { Bone bone = skeleton.GetBone(i); WriteBone(writer, bone); } for (ushort i = 0; i < skeleton.BoneCount; ++i) { Bone bone = skeleton.GetBone(i); if (bone.Parent != null) { WriteBoneParent(writer, bone, (Bone)bone.Parent); } } for (int i = 0; i < skeleton.AnimationCount; ++i) { Animation anim = skeleton.GetAnimation(i); WriteAnimation(writer, anim); } for (int i = 0; i < skeleton.AttachmentPoints.Count; ++i) { AttachmentPoint ap = skeleton.AttachmentPoints[i]; WriteAttachmentPoint(writer, ap, skeleton.GetBone(ap.ParentBone)); } }
/*///////////////////////////////////////////////////////////////////////////////////////////*/ /// Activate /*///////////////////////////////////////////////////////////////////////////////////////////*/ public override void Activate(SensorData _sensorData) { if (_sensorData.detectee.tag == "Item") { if (_sensorData.status == SensorStatus.ENTERED || _sensorData.status == SensorStatus.PERSISTS && !IsItemInList(_sensorData.detectee)) { items.Add(_sensorData.detectee); } else if (_sensorData.status == SensorStatus.EXITED && IsItemInList(_sensorData.detectee)) { items.Remove(_sensorData.detectee); } } if (_sensorData.detectee.tag == "AttachmentPoint") { if (_sensorData.status == SensorStatus.ENTERED) { attachmentPoint = _sensorData.detectee.GetComponent <AttachmentPoint>(); } else if (_sensorData.status == SensorStatus.EXITED) { attachmentPoint = null; } } }
public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext) { base.CopyFrom(from, cloneContext); DxfMText dxfMtext = (DxfMText)from; this.string_1 = dxfMtext.string_1; this.Style = Class906.GetTextStyle(cloneContext, dxfMtext.Style); this.point3D_0 = dxfMtext.point3D_0; this.double_1 = dxfMtext.double_1; this.double_2 = dxfMtext.double_2; this.double_3 = dxfMtext.double_3; this.attachmentPoint_0 = dxfMtext.attachmentPoint_0; this.drawingDirection_0 = dxfMtext.drawingDirection_0; this.vector3D_0 = dxfMtext.vector3D_0; this.vector3D_1 = dxfMtext.vector3D_1; this.lineSpacingStyle_0 = dxfMtext.lineSpacingStyle_0; this.double_4 = dxfMtext.double_4; this.backgroundFillFlags_0 = dxfMtext.backgroundFillFlags_0; if (dxfMtext.backgroundFillInfo_0 == null) { this.backgroundFillInfo_0 = (BackgroundFillInfo)null; } else { this.backgroundFillInfo_0 = dxfMtext.backgroundFillInfo_0.Clone(cloneContext); } }
/// <summary> /// Sets the cubemap face for a given attachment point. /// </summary> /// <param name="attachment">The attachment point.</param> /// <param name="face">The associated cubemap face.</param> /// <returns>A reference to this Builder for chaining calls.</returns> public RenderTargetBuilder WithFace(AttachmentPoint attachment, TextureCubemapFace face) { ThrowExceptionIfDisposed(); Native.RenderTargetBuilder.Face(NativePtr, (int)attachment, (byte)face); return(this); }
/// <summary> /// Sets the layer for a given attachment point (for 3D textures). /// </summary> /// <param name="attachment">The attachment point.</param> /// <param name="layer">The associated cubemap layer.</param> /// <returns>A reference to this Builder for chaining calls.</returns> public RenderTargetBuilder WithLayer(AttachmentPoint attachment, int layer) { ThrowExceptionIfDisposed(); Native.RenderTargetBuilder.Layer(NativePtr, (int)attachment, layer); return(this); }
/// <summary> Try to lookup the given object. </summary> /// <param name="attachmentPoint"> The attachment point. </param> /// <returns> A LocationAndRotation? </returns> public LocationAndRotation?TryGet(AttachmentPoint attachmentPoint) { LocationAndRotation value; return(_lookup.TryGetValue((int)attachmentPoint, out value) ? (LocationAndRotation?)value : null); }
public void Detach() { isAttachable = false; transform.parent = null; rigidBody.useGravity = true; attachedTo.AttachCollider.enabled = true; attachedTo = null; }
private void TestAttachedObject(SceneObjectGroup attSo, AttachmentPoint attPoint, UUID ownerId) { Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)attPoint)); Assert.That(attSo.IsAttachment); Assert.That(attSo.UsesPhysics, Is.False); Assert.That(attSo.IsTemporary, Is.False); Assert.That(attSo.OwnerID, Is.EqualTo(ownerId)); }
/// <summary> /// Sets the mipmap level for a given attachment point. /// </summary> /// <param name="attachment">The attachment point of the texture.</param> /// <param name="level">The associated mipmap level, 0 by default.</param> /// <returns>A reference to this Builder for chaining calls.</returns> public RenderTargetBuilder WithMipLevel(AttachmentPoint attachment, int level = 0) { ThrowExceptionIfDisposed(); Native.RenderTargetBuilder.MipLevel(NativePtr, (int)attachment, level); return(this); }
/// <summary> /// Sets a texture to a given attachment point. All RenderTargets must have a non-null COLOR attachment. /// </summary> /// <param name="attachment">The attachment point of the texture.</param> /// <param name="texture">The associated texture object.</param> /// <returns>A reference to this Builder for chaining calls.</returns> public RenderTargetBuilder WithTexture(AttachmentPoint attachment, Texture texture) { ThrowExceptionIfDisposed(); Native.RenderTargetBuilder.Texture(NativePtr, (int)attachment, texture.NativePtr); return(this); }
/// <summary> /// Attach the Overlay to [device] at [scale] size with offset [offset], and base position [point]. /// [point] isn't used for HMD or World, and can be ignored. /// </summary> /// <param name="device"></param> /// <param name="scale"></param> /// <param name="offset"></param> /// <param name="point"></param> public void AttachTo(AttachmentDevice device, float scale, Vector3 offset, AttachmentPoint point = AttachmentPoint.Center) { // Update Overlay Anchor position GetOverlayPosition(); if (_anchorDevice != device && OnOverlayAnchorChanges != null) { OnOverlayAnchorChanges(this, device); } // Update cached values _anchorDevice = device; AnchorDevice = device; _anchorPoint = point; AnchorPoint = point; _anchorOffset = offset; AnchorOffset = offset; Scale = scale; if (OnOverlayAnchorRotationChanges != null) { OnOverlayAnchorRotationChanges(this, Quaternion.identity); } // Attach Overlay switch (device) { case AttachmentDevice.Screen: _anchor = OpenVR.k_unTrackedDeviceIndexInvalid; gameObject.transform.localPosition = offset; OverlayReference.transform.localRotation = Quaternion.identity; break; case AttachmentDevice.World: _anchor = OpenVR.k_unTrackedDeviceIndexInvalid; gameObject.transform.localPosition = offset; OverlayReference.transform.localRotation = Quaternion.identity; break; case AttachmentDevice.LeftController: _anchor = HOTK_TrackedDeviceManager.Instance.LeftIndex; AttachToController(point, offset); break; case AttachmentDevice.RightController: _anchor = HOTK_TrackedDeviceManager.Instance.RightIndex; AttachToController(point, offset); break; default: throw new ArgumentOutOfRangeException("device", device, null); } if (OnOverlayAttachmentChanges != null) { OnOverlayAttachmentChanges(this); } }
public void TestOsForceAttachToOtherAvatarFromInventory() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); string taskInvObjItemName = "sphere"; UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); AttachmentPoint attachPoint = AttachmentPoint.Chin; UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "one", 0x1, "pass"); UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "two", 0x2, "pass"); ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); OSSL_Api osslApi = new OSSL_Api(); osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); // Create an object embedded inside the first TaskInventoryHelpers.AddSceneObject( m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); osslApi.osForceAttachToOtherAvatarFromInventory(sp2.UUID.ToString(), taskInvObjItemName, (int)attachPoint); // Check scene presence status Assert.That(sp.HasAttachments(), Is.False); List <SceneObjectGroup> attachments = sp.GetAttachments(); Assert.That(attachments.Count, Is.EqualTo(0)); Assert.That(sp2.HasAttachments(), Is.True); List <SceneObjectGroup> attachments2 = sp2.GetAttachments(); Assert.That(attachments2.Count, Is.EqualTo(1)); SceneObjectGroup attSo = attachments2[0]; Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName)); Assert.That(attSo.OwnerID, Is.EqualTo(ua2.PrincipalID)); Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint)); Assert.That(attSo.IsAttachment); Assert.That(attSo.UsesPhysics, Is.False); Assert.That(attSo.IsTemporary, Is.False); // Check appearance status List <AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments(); Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); List <AvatarAttachment> attachmentsInAppearance2 = sp2.Appearance.GetAttachments(); Assert.That(attachmentsInAppearance2.Count, Is.EqualTo(1)); Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint)); }
public MyText(Point3d pt3, string cont, double th, Database db, AttachmentPoint ap) { this.SetDatabaseDefaults(); this.Location = pt3; this.Contents = cont; this.TextStyleId = db.Textstyle; this.TextHeight = th; this.Attachment = ap; }
public void Attach(AttachmentPoint attachmentPoint) { attachedTo = attachmentPoint; rigidBody.useGravity = false; transform.parent = transform; transform.localPosition = Vector3.zero; transform.localRotation = LocalAttachRotation; attachedTo.AttachCollider.enabled = false; }
public Attachment(AttachmentPoint attachmentPoint, PixelFormat pixelFormat, PixelInternalFormat pixelInternalFormat, PixelType pixelType, int index = 0, bool mipmaps = false) { AttachmentPoint = attachmentPoint; PixelFormat = pixelFormat; PixelInternalFormat = pixelInternalFormat; PixelType = pixelType; Index = index; MipMaps = mipmaps; }
public List <ObjectGroup> this[AttachmentPoint ap] => m_AttachmentsRwLock.AcquireReaderLock(() => { Dictionary <UUID, ObjectGroup> aplist; if (m_AttachmentsPerPoint.TryGetValue(ap, out aplist)) { return(new List <ObjectGroup>(aplist.Values)); } return(new List <ObjectGroup>()); });
public void Add(AttachmentPoint ap, ObjectGroup sog) => m_AttachmentsRwLock.AcquireWriterLock(() => { m_AllAttachments.Add(sog.ID, sog); if (!m_AttachmentsPerPoint.ContainsKey(ap)) { m_AttachmentsPerPoint.Add(ap, new Dictionary <UUID, ObjectGroup>()); } m_AttachmentsPerPoint[ap].Add(sog.ID, sog); m_AttachedTo[sog.ID] = ap; });
public Transform GetAttachmentPoint(AttachmentPoint attachmentPoint) { if (this.attachmentPoints[attachmentPoint] != null) { return(this.attachmentPoints[attachmentPoint]); } Debug.LogWarning($"No attachment point of type {attachmentPoint} on actor {name}"); return(transform); }
public DxfMTextObjectContextData(DxfMText mtext, DxfScale scale) : base(scale) { this.size2D_0.X = mtext.ReferenceRectangleWidth; this.size2D_0.Y = mtext.ReferenceRectangleHeight; this.size2D_1.X = mtext.BoxWidth; this.size2D_1.Y = mtext.BoxHeight; this.vector3D_0 = mtext.XAxis; this.point3D_0 = mtext.InsertionPoint; this.attachmentPoint_0 = mtext.AttachmentPoint; }
public static MText MText(Point3d pt3, string cont, double th, Database db, AttachmentPoint ap) { MText mt = new MText(); mt.SetDatabaseDefaults(); mt.Location = pt3; mt.Contents = cont; mt.TextStyleId = db.Textstyle; mt.TextHeight = th; mt.Attachment = ap; return mt; }
/// <summary> 在不改变单行文字定位的情况下,修改其对正方式。默认为默认的左对齐 </summary> /// <param name="txt"></param> /// <param name="justify"> 整体对正方式 </param> public static void SetAlignment(this DBText txt, AttachmentPoint justify) { switch (justify) { case AttachmentPoint.BaseLeft: SetAlignment(txt, TextVerticalMode.TextBase, TextHorizontalMode.TextLeft); break; case AttachmentPoint.BaseFit: SetAlignment(txt, TextVerticalMode.TextBase, TextHorizontalMode.TextFit); break; } }
public ReportList GetInternalReports(AttachmentPoint point, Visibility visibility) { List<Report> reports = new List<Report>(); foreach (Report report in Reports) { if (!report.HasFlag(Flag.Internal)) continue; if (report.AttachmentPoint != point) continue; bool visible = report.Visibility == visibility; visible = visible || Visibility.All == report.Visibility; if (!visible) continue; reports.Add(report); } return reports; }
public InventoryItem AttachmentAt(AttachmentPoint point) { lock (attachments) { foreach (KeyValuePair <UUID, AttachmentInfo> att in attachments) { if (att.Value.Point == point) { return(att.Value.Item); } } } return(null); }
private AttachmentSlot FindSlotForPoint(IEnumerable <AttachmentSlot> slots, AttachmentPoint point, Transform pointParent, Transform slotParent) { Vector3 pointPos = point.GetWorldPosition(pointParent); foreach (var slot in slots) { Vector3 slotPos = slot.GetWorldPosition(slotParent); if (Vector2.Distance(pointPos, slotPos) < 0.1f) { return(slot); } } return(null); }
/// <summary> /// Deserializes this structure from binary data. /// </summary> /// <param name="reader">The <see cref="BinaryReader"/> to read the data from.</param> /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception> public void ReadFrom(BinaryReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } _count = reader.ReadUInt16(); for (int i = 0; i < _count; i++) { AttachmentPoint point = new AttachmentPoint(); point.ReadFrom(reader); } }
public bool Remove(UUID sogid) => m_AttachmentsRwLock.AcquireWriterLock(() => { try { AttachmentPoint ap = m_AttachedTo[sogid]; m_AttachmentsPerPoint[ap].Remove(sogid); bool ret = m_AllAttachments.Remove(sogid); m_AttachedTo.Remove(sogid); return(ret); } catch (KeyNotFoundException) { return(false); } });
private void CreateAttachmentPoint() { AttachmentPoint p = new AttachmentPoint(); p.x = new int[virtualFrames.Count]; p.y = new int[virtualFrames.Count]; p.rotation = new float[virtualFrames.Count]; for (int i = 0; i < virtualFrames.Count; i++) { p.x[i] = 0; p.y[i] = 0; p.rotation[i] = 0; } attachmentPoints.Add(p); }
private void RezAttachment(UUID itemID, AttachmentPoint attachpointFlagged) { InventoryItem item; try { item = InventoryService.Item[ID, itemID]; } catch { SendAlertMessage("ALERT: CantFindInvItem", SceneID); return; } if (item.AssetType != AssetType.Object) { SendAlertMessage("ALERT: InvalidObjectParams", SceneID); return; } var accessFailed = false; try { accessFailed = !AssetService.Exists(item.AssetID); } catch (Exception e) { m_Log.WarnFormat("Attaching item {0} / asset {1} not possible due {2}: {3}", item.ID, item.AssetID, e.GetType().FullName, e.ToString()); SendAlertMessage("ALERT: CantFindInvItem", SceneID); return; } if (accessFailed) { m_Log.WarnFormat("Attaching item {0} / asset {1} not possible since it is missing", item.ID, item.AssetID); SendAlertMessage("ALERT: CantFindInvItem", SceneID); return; } new RezAttachmentHandler( Circuits[SceneID].Scene, item.AssetID, AssetService, Owner, attachpointFlagged, Attachments, item).QueueWorkItem(); }
/// <summary> /// Reads bone information from the file. /// </summary> protected void ReadAttachmentPoint(BinaryMemoryReader reader) { // bone name string name = ReadString(reader); ushort boneHandle = ReadUShort(reader); // read and set the position of the bone Vector3 position = ReadVector3(reader); // read and set the orientation of the bone Quaternion q = ReadQuat(reader); // create the attachment point AttachmentPoint ap = skeleton.CreateAttachmentPoint(name, boneHandle, q, position); }
public System.Collections.IEnumerator MyCoroutine(AttachmentPoint point, AttachmentData data) { GameObject gobj = null; yield return(StartCoroutine(Managers.thingManager.InstantiateThingViaCache(ThingRequestContext.PersonClassAttachNewThing, data.thingId, delegate(GameObject go) { gobj = go; }))); if (gobj != null) { gobj.transform.parent = point.transform; gobj.transform.localPosition = data.position; gobj.transform.localEulerAngles = data.rotation; Managers.personManager.DoAttachThing(point.gameObject, gobj); } }
/// <summary> /// Attach an item to our agent specifying attachment details /// </summary> /// <param name="itemID">The <seealso cref="OpenMetaverse.UUID"/> of the item to attach</param> /// <param name="ownerID">The <seealso cref="OpenMetaverse.UUID"/> attachments owner</param> /// <param name="name">The name of the attachment</param> /// <param name="description">The description of the attahment</param> /// <param name="perms">The <seealso cref="OpenMetaverse.Permissions"/> to apply when attached</param> /// <param name="itemFlags">The <seealso cref="OpenMetaverse.InventoryItemFlags"/> of the attachment</param> /// <param name="attachPoint">The <seealso cref="OpenMetaverse.AttachmentPoint"/> on the agent /// <param name="replace">If true replace existing attachment on this attachment point, otherwise add to it (multi-attachments)</param> /// to attach the item to</param> public void Attach(UUID itemID, UUID ownerID, string name, string description, Permissions perms, uint itemFlags, AttachmentPoint attachPoint, bool replace) { // TODO: At some point it might be beneficial to have AppearanceManager track what we // are currently wearing for attachments to make enumeration and detachment easier RezSingleAttachmentFromInvPacket attach = new RezSingleAttachmentFromInvPacket(); attach.AgentData.AgentID = Client.Self.AgentID; attach.AgentData.SessionID = Client.Self.SessionID; attach.ObjectData.AttachmentPt = replace ? (byte)attachPoint : (byte)(ATTACHMENT_ADD | (byte)attachPoint); attach.ObjectData.Description = Utils.StringToBytes(description); attach.ObjectData.EveryoneMask = (uint)perms.EveryoneMask; attach.ObjectData.GroupMask = (uint)perms.GroupMask; attach.ObjectData.ItemFlags = itemFlags; attach.ObjectData.ItemID = itemID; attach.ObjectData.Name = Utils.StringToBytes(name); attach.ObjectData.NextOwnerMask = (uint)perms.NextOwnerMask; attach.ObjectData.OwnerID = ownerID; Client.Network.SendPacket(attach); }
private void AttachTo(InventoryItem item, AttachmentPoint pnt) { client.Appearance.Attach(item, pnt, false); client.Inventory.CreateLink(instance.CoF.UUID, item.UUID, item.Name, string.Empty, AssetType.Link, item.InventoryType, UUID.Random(), (success, newItem) => { if (success) { client.Inventory.RequestFetchInventory(newItem.UUID, newItem.OwnerID); } }); WearTakeoff(true, selectednode); }
private void InitPrintButton(AttachmentPoint attachmentPoint, PrintButton button) { button.AttachmentPoint = attachmentPoint; Visibility visibility; switch (_oClientType) { case OClientTypes.Person: visibility = Visibility.Individual; break; case OClientTypes.Group: visibility = Visibility.Group; break; case OClientTypes.Corporate: visibility = Visibility.Corporate; break; default: visibility = Visibility.All; break; } button.Visibility = visibility; button.ReportInitializer = report => { report.SetParamValue("user_id", User.CurrentUser.Id); if (_credit != null) report.SetParamValue("contract_id", _credit.Id); if (_saving != null) report.SetParamValue("saving_id", _saving.Id); if (_guarantee != null) report.SetParamValue("guarantee_id", _guarantee.Id); }; button.LoadReports(); }
public void Unattach(AttachmentPoint parentJoint, AttachmentPoint childJoint) { // First remove all children of limb from skeleton... foreach (RobotComponent limb in childJoint.owner.getDirectChildren()) { childJoint.owner.Unattach(limb.parentAttachmentPoint, limb.parentAttachmentPoint.child); } AttachmentSlot slot = parentJoint.slot; Bone bone = Skeleton.GetBoneForSlot(slot); // Unparent from lower joint bone if it exists (for limbs) if (bone && bone.LowerJoint) { bone = bone.LowerJoint; } AttachmentType attachmentType = childJoint.owner.parentAttachmentPoint.attachmentType; RobotComponent child = childJoint.owner; child.Skeleton = null; if (LevelMusic.Instance) { LevelMusic.Instance.DetachLimb(childJoint.owner.limbType, childJoint.owner.Slot); } parentJoint.child = null; childJoint.parent = null; childJoint.owner.parentComponent = null; childJoint.owner.parentAttachmentPoint= null; if (parentJoint.connectsGround) { groundConnections.Remove(childJoint.owner); } parentJoint.childTransform = parentJoint.transform; // parent child to null bone.Detach(child.transform); child.transform.parent = null; child.parentComponent = null; child.Skeleton = null; // Unparent all child joints from bones foreach (AttachmentPoint joint in childJoint.owner.allJoints) { Bone jointBone = Skeleton.GetBoneForSlot(joint.slot); jointBone.Detach(joint.transform); joint.transform.parent = joint.owner.transform; } child.transform.localScale = Vector3.one; childJoint.owner.OnRemove(); OnLimbRemoved(childJoint.owner, slot, attachmentType); // stop listening to childs' add/removeArm event childJoint.owner.LimbAdded -= OnLimbAdded; childJoint.owner.LimbRemoved -= OnLimbRemoved; // Restore rigid body to unattached childJoint part childJoint.owner.ResetPhysics(); }
public void Attach(AttachmentPoint parentJoint, AttachmentPoint childJoint) { AttachmentSlot slot = parentJoint.slot; Bone bone = Skeleton.GetBoneForSlot(slot); RobotComponent child = childJoint.owner; // Parent to lower joint bone if it exists (for limbs) if (bone.LowerJoint) { bone = bone.LowerJoint; } child.currentBone = bone; child.Skeleton = Skeleton; // parent child to player object child.transform.parent = transform.rootParent(); // attach child to bone bone.Attach(child.transform); if (childJoint.rigidbody2D) { // If we don't set body to kinematic, it will get will physics update that will // move component after attaching... child.rigidbody2D.isKinematic = true; } if (childJoint.owner.rigidbody2D) { Destroy(childJoint.owner.rigidbody2D); } // Parent all child joints to the bones themselves (for torso) foreach (AttachmentPoint joint in childJoint.owner.allJoints) { Bone jointBone = Skeleton.GetBoneForSlot(joint.slot); joint.bone = jointBone; joint.transform.parent = transform.rootParent(); jointBone.Attach(joint.transform); } parentJoint.child = childJoint; childJoint.parent = parentJoint; childJoint.owner.parentComponent = parentJoint.owner; childJoint.owner.parentAttachmentPoint = parentJoint; if (parentJoint.connectsGround) { groundConnections.Add(childJoint.owner); } // listen to childs' add/removelimb event childJoint.owner.LimbAdded += OnLimbAdded; childJoint.owner.LimbRemoved += OnLimbRemoved; foreach (RobotComponent limb in child.getAllChildren()) { AttachmentType type = limb.parentAttachmentPoint.attachmentType; if (LevelMusic.Instance) { LevelMusic.Instance.AttachLimb(limb.limbType, limb.Slot); } OnLimbAdded(limb, slot, type); } parentJoint.childTransform = childJoint.transform; child.OnAttach(); child.ResetColliders(); getRootComponent().ResetSpriteOrders(); getRootComponent().ResetPhysics(); }
/// <summary> /// Attach an inventory item /// </summary> /// <param name="item">Item to be attached</param> /// <param name="point">Attachment point</param> /// <param name="replace">Replace existing attachment at that point first?</param> public void Attach(InventoryItem item, AttachmentPoint point, bool replace) { Client.Appearance.Attach(item, point, replace); AddLink(item); }
public void DetachFromLevelObject() { child = null; if (AttachedToLevelObject) { Destroy(joint); joint = null; } }
/// <summary> /// Attach an item to an avatar at a specific attach point /// </summary> /// <param name="item">A <seealso cref="OpenMetaverse.InventoryItem"/> to attach</param> /// <param name="attachPoint">the <seealso cref="OpenMetaverse.AttachmentPoint"/> on the avatar /// to attach the item to</param> public void Attach(InventoryItem item, AttachmentPoint attachPoint) { Attach(item.Guid, item.OwnerID, item.Name, item.Description, item.Permissions, item.Flags, attachPoint); }
/// <summary> /// Attach an item to our agent at a specific attach point /// </summary> /// <param name="item">A <seealso cref="OpenMetaverse.InventoryItem"/> to attach</param> /// <param name="attachPoint">the <seealso cref="OpenMetaverse.AttachmentPoint"/> on the avatar /// <param name="replace">If true replace existing attachment on this attachment point, otherwise add to it (multi-attachments)</param> /// to attach the item to</param> public void Attach(InventoryItem item, AttachmentPoint attachPoint, bool replace) { Attach(item.UUID, item.OwnerID, item.Name, item.Description, item.Permissions, item.Flags, attachPoint, replace); }
void SetSelectedParent(AttachmentPoint point) { if (selectedParentJoint != point) { if (selectedParentJoint != null) { selectedParentJoint.selected = false; if (selectedParentJoint.owner != null) { selectedParentJoint.owner.OnDestroy -= OnParentDestroyed; } } if (point != null) { point.selected = true; if (point.owner != null) { point.owner.OnDestroy += OnParentDestroyed; } AudioSource.PlayClipAtPoint(jointHoverClip, transform.position); } } selectedParentJoint = point; }
/// <summary> /// Установка параметров MText. /// </summary> /// <param name="mt">Объект MText</param> /// <param name="pt3">Местоположение</param> /// <param name="cont">Содержимое</param> /// <param name="th">Высота текста</param> /// <param name="db">База данных документа</param> /// <param name="ap">Точка выравнивания</param> /// <param name="ang">Угол поворота текста (в градусах)</param> public static void SetMText(MText mt, Point3d pt3, string cont, double th, Database db, AttachmentPoint ap, double ang) { mt.SetDatabaseDefaults(); mt.Location = pt3; mt.Contents = cont; mt.TextStyleId = db.Textstyle; mt.TextHeight = th; mt.Attachment = ap; mt.Rotation = ang * Math.PI / 180; }
/// <summary> /// Attach an item to an avatar specifying attachment details /// </summary> /// <param name="itemID">The <seealso cref="libsecondlife.LLUUID"/> of the item to attach</param> /// <param name="ownerID">The <seealso cref="libsecondlife.LLUUID"/> attachments owner</param> /// <param name="name">The name of the attachment</param> /// <param name="description">The description of the attahment</param> /// <param name="perms">The <seealso cref="libsecondlife.Permissions"/> to apply when attached</param> /// <param name="itemFlags">The <seealso cref="libsecondlife.InventoryItemFlags"/> of the attachment</param> /// <param name="attachPoint">the <seealso cref="libsecondlife.AttachmentPoint"/> on the avatar /// to attach the item to</param> public void Attach(LLUUID itemID, LLUUID ownerID, string name, string description, Permissions perms, InventoryItemFlags itemFlags, AttachmentPoint attachPoint) { // TODO: At some point it might be beneficial to have AppearanceManager track what we // are currently wearing for attachments to make enumeration and detachment easier RezSingleAttachmentFromInvPacket attach = new RezSingleAttachmentFromInvPacket(); attach.AgentData.AgentID = Client.Self.AgentID; attach.AgentData.SessionID = Client.Self.SessionID; attach.ObjectData.AttachmentPt = (byte)attachPoint; attach.ObjectData.Description = Helpers.StringToField(description); attach.ObjectData.EveryoneMask = (uint)perms.EveryoneMask; attach.ObjectData.GroupMask = (uint)perms.GroupMask; attach.ObjectData.ItemFlags = (uint)itemFlags; attach.ObjectData.ItemID = itemID; attach.ObjectData.Name = Helpers.StringToField(name); attach.ObjectData.NextOwnerMask = (uint)perms.NextOwnerMask; attach.ObjectData.OwnerID = ownerID; Client.Network.SendPacket(attach); }
/// <summary> /// Attach an item to our agent at a specific attach point /// </summary> /// <param name="item">A <seealso cref="OpenMetaverse.InventoryItem"/> to attach</param> /// <param name="attachPoint">the <seealso cref="OpenMetaverse.AttachmentPoint"/> on the avatar /// to attach the item to</param> public void Attach(InventoryItem item, AttachmentPoint attachPoint) { Attach(item, attachPoint, true); }
/// <summary> /// Attach an object to this avatar /// </summary> /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param> /// <param name="localID">The objects ID which is local to the simulator the object is in</param> /// <param name="attachPoint">The point on the avatar the object will be attached</param> /// <param name="rotation">The rotation of the attached object</param> public void AttachObject(Simulator simulator, uint localID, AttachmentPoint attachPoint, Quaternion rotation) { ObjectAttachPacket attach = new ObjectAttachPacket(); attach.AgentData.AgentID = Client.Self.AgentID; attach.AgentData.SessionID = Client.Self.SessionID; attach.AgentData.AttachmentPoint = (byte)attachPoint; attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); attach.ObjectData[0].ObjectLocalID = localID; attach.ObjectData[0].Rotation = rotation; Client.Network.SendPacket(attach, simulator); }
/// <summary> /// Attach an item to our agent specifying attachment details /// </summary> /// <param name="itemID">The <seealso cref="OpenMetaverse.UUID"/> of the item to attach</param> /// <param name="ownerID">The <seealso cref="OpenMetaverse.UUID"/> attachments owner</param> /// <param name="name">The name of the attachment</param> /// <param name="description">The description of the attahment</param> /// <param name="perms">The <seealso cref="OpenMetaverse.Permissions"/> to apply when attached</param> /// <param name="itemFlags">The <seealso cref="OpenMetaverse.InventoryItemFlags"/> of the attachment</param> /// <param name="attachPoint">The <seealso cref="OpenMetaverse.AttachmentPoint"/> on the agent /// to attach the item to</param> public void Attach(UUID itemID, UUID ownerID, string name, string description, Permissions perms, uint itemFlags, AttachmentPoint attachPoint) { Attach(itemID, ownerID, name, description, perms, itemFlags, attachPoint, true); }
void SetSelectedChild(AttachmentPoint point) { if (selectedChildJoint != point) { if (selectedChildJoint != null) { selectedChildJoint.selected = false; if (selectedChildJoint.owner != null) { selectedChildJoint.owner.OnDestroy -= OnChildDestroyed; selectedChildJoint.owner.GetComponent<PulsingSprite>().Disable(); } } if (point != null) { point.selected = true; if (point.owner != null) { point.owner.OnDestroy += OnChildDestroyed; point.owner.GetComponent<PulsingSprite>().Enable(); } AudioSource.PlayClipAtPoint(jointHoverClip, transform.position); } } selectedChildJoint = point; }
public InventoryItem AttachmentAt(AttachmentPoint point) { lock (attachments) { foreach (KeyValuePair<UUID, AttachmentInfo> att in attachments) { if (att.Value.Point == point) { return att.Value.Item; } } } return null; }
private void InitPrintButton(AttachmentPoint attachmentPoint, PrintButton button) { button.AttachmentPoint = attachmentPoint; Visibility visibility; switch (_oClientType) { case OClientTypes.Person: visibility = Visibility.Individual; break; case OClientTypes.Group: visibility = Visibility.Group; break; case OClientTypes.Corporate: visibility = Visibility.Corporate; break; default: visibility = Visibility.All; break; } button.Visibility = visibility; button.ReportInitializer = report => { report.SetParamValue("user_id", User.CurrentUser.Id); if (_credit != null) report.SetParamValue("contract_id", _credit.Id); if (_saving != null) report.SetParamValue("saving_id", _saving.Id); if (_guarantee != null) report.SetParamValue("guarantee_id", _guarantee.Id); }; button.LoadReports(); //from extension foreach (var item in PrintButtonContextMenuStrips) { var menuItems = item.GetContextMenuStrip(_client, _credit, _guarantee, _saving, attachmentPoint.ToString()); if (menuItems == null) continue; foreach (var menuItem in menuItems) { button.Menu.Items.Add(menuItem); } } }
/// <summary> /// Attach an item to an avatar at a specific attach point /// </summary> /// <param name="item">A <seealso cref="OpenMetaverse.InventoryItem"/> to attach</param> /// <param name="attachPoint">the <seealso cref="OpenMetaverse.AttachmentPoint"/> on the avatar /// to attach the item to</param> public void Attach(ItemData item, AttachmentPoint attachPoint) { Attach(item.UUID, item.OwnerID, item.Name, item.Description, item.Permissions, item.Flags, attachPoint); }
public void AttachToLevelObject(AttachmentPoint levelAttachment) { joint = PlayerBehavior.Player.gameObject.AddComponent<DistanceJoint2D>(); joint.anchor = transform.position - PlayerBehavior.Player.transform.position; joint.connectedBody = levelAttachment.collider2D.attachedRigidbody; joint.connectedAnchor = levelAttachment.transform.position - levelAttachment.collider2D.attachedRigidbody.transform.position; child = levelAttachment; }