public ActivityData( string id, string html = null, string text = null, StyleElement parsedText = null, bool? isEditable = null, Uri postUrl = null, int? commentLength = null, CommentData[] comments = null, DateTime? postDate = null, DateTime? editDate = null, ServiceType serviceType = null, PostStatusType? status = null, IAttachable attachedContent = null, ProfileData owner = null, DateTime? getActivityDate = null, ActivityUpdateApiFlag updaterTypes = ActivityUpdateApiFlag.Unloaded) { LoadedApiTypes = updaterTypes; Id = id; IsEditable = isEditable; Html = html; Text = text; ParsedText = parsedText; CommentLength = commentLength; Comments = comments; PostUrl = postUrl; PostDate = postDate; EditDate = editDate; GetActivityDate = getActivityDate; PostStatus = status; Owner = owner; AttachedContent = attachedContent; ServiceType = serviceType; }
public virtual void Detach(IAttachable toRemove) { if (!(toRemove is IOnlyUseMeIfYouKnowWhatYouAreDoingWithAttachables impl)) { throw new NotSupportedException(); } this.attached.Remove(toRemove); impl.AttachedTo = null; }
public void OnMasterEliminated(eEliminateDef eliminateType) { _attachableMaster = null; _isFollowingMasterContinuously = false; if (!_isEliminatedWithMaster) { return; } Eliminate(eEliminateDef.CodeEliminate); }
public Attachment(IAttachable attachable, JObject obj) { Id = obj.GetValue("attachmentId").ToString(); ObjectId = obj.GetValue("objectId").ToString(); Length = obj.GetValue("length").ToObject <long>(); ContentType = obj.GetValue("contentType").ToString(); Filename = obj.GetValue("filename").ToString(); _attachable = attachable; }
public void Attach(IAttachable ToAttach) { if (_children.Contains(ToAttach)) { throw new ArgumentException("This attachable is already attached!"); } _children.Add(ToAttach); ToAttach.Parents.Add(this); }
public void AttachTo(IAttachable master, bool eliminatedWithMaster) { if (_master != null) { return; } _master = master; _master.AddAttachment(this); _isEliminatedWithMaster = eliminatedWithMaster; }
public void AutoPosition() { const float depthSpacing = 4; for (int i = 0; i < mNodesAsList.Count; i++) { HierarchyNode node = mNodesAsList[i]; node.RelativeY = -depthSpacing; IAttachable parent = GetParent(node.ObjectRepresenting); if (parent == null) { node.AttachTo(null, false); node.Y = 5; } else { HierarchyNode parentNode = GetNodeFromAttachable(parent); node.AttachTo(parentNode, false); } } mUnparentedNodes.Clear(); // Gotta do this after all attachments have been made for (int i = 0; i < mNodesAsList.Count; i++) { HierarchyNode node = mNodesAsList[i]; if (node.Parent != null) { node.SetRelativeX(); node.ForceUpdateDependencies(); } else { float xToStartAt = 0; if (mUnparentedNodes.Count != 0) { xToStartAt = mUnparentedNodes.Last.X + mUnparentedNodes.Last.Width / 2.0f; } node.Y = 5; node.X = xToStartAt + node.Width / 2.0f; mUnparentedNodes.Add(node); } } UpdateSelectionMarker(); }
/// <summary> /// Breaks all two-way relationships between this and all contained /// IAttachables. /// </summary> /// <remarks> /// This will still contain the same number of IAttachables before and /// after the call. /// </remarks> #endregion public void MakeOneWay() { for (int i = 0; i < this.Count; i++) { IAttachable ia = this[i]; if (ia.ListsBelongingTo.Contains(this)) { ia.ListsBelongingTo.Remove(this); } } }
/// <summary> /// Makes the relationship between all contained IAttachables and this a two way relationship. /// </summary> /// <remarks> /// If an IAttachable is added (through the Add method), the relationship is already a /// two-way relationship. IAttachables which already have two-way relationships will not be affected /// by this call. IAttachables that have been added through the AddOneWay call or added /// through a call that returns a one-way array will be modified so that they hold a reference to /// this instance in their ListsBelongingTo field. One-way relationships are often created in /// FRB methods which return AttachableLists. /// </remarks> #endregion public void MakeTwoWay() { for (int i = 0; i < this.Count; i++) { IAttachable ia = this[i]; if (ia.ListsBelongingTo.Contains(this) == false) { ia.ListsBelongingTo.Add(this); } } }
public void AddChild(IAttachable modelBone) { if (!Children.Contains(modelBone)) { Children.Add(modelBone); } else { Log.Warn($"Could not add {modelBone.Name} as child of {Definition.Name}"); } }
public void Pick(IAttachable attachable) { if (this.hand != null) { Destroy(this.hand.VehicleComponent.gameObject); } VehicleComponent vehicleComponent = Instantiate(attachable.VehicleComponent, Helper.OutOfMapVector3, Quaternion.identity, this.transform); this.hand = vehicleComponent as IAttachable; }
public void GrantSkill(IAttachable item, Card target) { if (item != null && target != null) { Game.TryDoMessage(new GrantSkillMessage() { Item = item, Target = target }); } }
private bool IsNodeCreatedForAttachable(IAttachable attachable) { #if UseDictionaries { return(mNodes.ContainsKey(attachable)); } #else { return(GetNodeFromAttachable(attachable) != null); } #endif }
public void Attach(IAttachable attachable) { if (!AttachedObjects.Contains(attachable)) { AttachedObjects.Add(attachable); } if (attachable is ICollider) { _physicsFlag = true; } }
private void Start() { shieldAttachment = new Attachment(offHand); swordAttachment = new Attachment(mainHand); currentWeapon = swordAttachment; currentOffhand = shieldAttachment; m_anim = GetComponent <Animator>(); currentWeapon.Revert(); currentOffhand.Revert(); shieldAttachment.OnWeaponAttached.AddListener(() => GetComponent <AudioSource>().Play()); }
public List <IAttachable> GetCurrentColorBuffers() { var list = new List <IAttachable>(); foreach (var item in this.drawBuffers) { uint index = colorbufferDict[item]; IAttachable colorbuffer = this.colorbufferAttachments[index]; list.Add(colorbuffer); } return(list); }
private IAttachable GetParent(IAttachable objectToGetParentOf) { if (string.IsNullOrEmpty(CustomParentProperty)) { return(objectToGetParentOf.ParentAsIAttachable); } else { PropertyInfo pi = objectToGetParentOf.GetType().GetProperty(CustomParentProperty); return((IAttachable)pi.GetValue(objectToGetParentOf, null)); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.tag == "RobotPiece") { IAttachable attachable = collision.gameObject.GetComponent <IAttachable>(); if (attachable != null) { attachable.damage(damage); } } Destroy(gameObject); }
void IAttachableRemovable.RemoveGuaranteedContain(IAttachable attachable) { attachable.ListsBelongingTo.Remove(this); mInternalListAsIList.Remove(attachable); if (this.CollectionChanged != null) { // We put the index for Silverlight - but I don't want to do indexof for performance reasons so 0 it is this.CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, attachable, 0)); } }
public static List <IAttachment> AttachmentList(IAttachable attachable, JArray attachmentArray) { List <IAttachment> attachments = new List <IAttachment>(); foreach (var attachmentJson in attachmentArray) { JObject attachmentObj = (JObject)attachmentJson; IAttachment attachment = Attachment(attachable, attachmentObj); attachments.Add(attachment); } return(attachments); }
public AttachedPostData( ContentType type, string id, string html, string text, StyleElement parsedText, string ownerId, string ownerName, string ownerIconUrl, Uri postUrl, IAttachable attachedContent) : base(type, postUrl) { Id = id; Html = html; Text = text; ParsedText = parsedText; OwnerId = ownerId; OwnerName = ownerName; OwnerIconUrl = ownerIconUrl; AttachedContent = attachedContent; }
public HierarchyNode GetNodeFromAttachable(IAttachable attachable) { if (attachable == null) { return(null); } if (mNodes.ContainsKey(attachable)) { return(mNodes[attachable]); } else { return(null); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.tag == "RobotPiece") { IAttachable attachable = collision.gameObject.GetComponent <IAttachable>(); if (attachable != null) { attachable.damage(damage); } } Instantiate(impact, transform.position, Quaternion.identity); Destroy(gameObject); }
public override void Detach(IAttachable toRemove) { if (toRemove == null) { return; } if (toRemove is Sprite s) { s.AttachOffset = BodyPart.DefaultAttachOffset; s.Visible = true; s.Radius /= 2f; } base.Detach(toRemove); this.count--; UpdateAnimFrame(); }
public virtual void Clear() { ClearTasks(); ObjectsPool.GetInstance().RestorePoolClassToPool <MovableObject>(_movableObj); _movableObj = null; _enemyGo = null; _enemyTf = null; _attachableMaster = null; if (_attachmentsCount != 0) { _attachmentsList.Clear(); _attachmentsCount = 0; } _player = null; _instID = -1; }
public virtual void Clear() { ClearTasks(); _master = null; if (_attachmentsCount > 0) { _attachmentsList.Clear(); _attachmentsCount = 0; } ObjectsPool.GetInstance().RestorePoolClassToPool <MovableObject>(_movableObject); _movableObject = null; _collidedByPlayer = null; _collidedByPlayerBullet = null; _collidedByEnemy = null; _collidedByEnemyBullet = null; }
public bool Equals(IAttachable item) { var buffItem = item as Buff; if (buffItem == null) { return(false); } if (buffItem.GetType() != GetType()) { return(false); } return(LastingType == buffItem.LastingType && isAdding == buffItem.isAdding && isBecoming == buffItem.isBecoming && value == buffItem.value); }
public void HighlightObjectNoCall(IAttachable objectToHighlight) { bool didChange = mHierarchyDiagram.SelectedObject != objectToHighlight; if (didChange) { mHierarchyDiagram.SelectedObject = objectToHighlight; HierarchyNode hierarchyNode = mHierarchyDiagram.GetNodeFromAttachable(SelectedObject); if (hierarchyNode != null) { this.Camera.X = hierarchyNode.X; this.Camera.Y = hierarchyNode.Y; } } }
public override void Attach(IAttachable toAdd) { if (toAdd is BodyPart bodyPart) { var alradyAttached = this.Attached.OfType <BodyPart>().Count(x => x.Type == bodyPart.Type); var maximum = this.MaximumBodyParts(bodyPart.Type); if (alradyAttached >= maximum) { if (toAdd.AttachedTo != null) { toAdd.AttachedTo.Detach(toAdd); } return; } } base.Attach(toAdd); }
public override void Clear() { _attachableMaster = null; if (_attachmentsCount != 0) { _attachmentsList.Clear(); _attachmentsCount = 0; } for (int i = 0; i < _componentsCount; i++) { _components[i].Clear(); } _components.Clear(); _componentsCount = 0; _attachmentsList.Clear(); _attachmentsCount = 0; _player = null; base.Clear(); }
public virtual void Attach(IAttachable toAdd) { if (!(toAdd is IOnlyUseMeIfYouKnowWhatYouAreDoingWithAttachables impl)) { throw new NotSupportedException(); } if (toAdd.AttachedTo == this) { return; } if (toAdd.AttachedTo != null) { toAdd.AttachedTo.Detach(toAdd); } this.attached.Add(toAdd); impl.AttachedTo = this; }
public override void Attach(IAttachable toAdd) { if (toAdd == null) { return; } base.Attach(toAdd); if (toAdd is Sprite s) { s.AttachOffset = Vector2.Zero; s.Visible = false; s.Radius *= 2f; } this.count++; if (this.count > this.initialStock) { initialStock = this.count; } UpdateAnimFrame(); }
public async static Task<AttachedContentViewModel> Create(IAttachable model) { switch (model.Type) { case ContentType.Album: var attachedAlbum = (AttachedAlbum)model; return await AttachedAlbumViewModel.Create(attachedAlbum).ConfigureAwait(false); case ContentType.Image: var attachedImage = (AttachedImage)model; return await AttachedImageViewModel.Create(attachedImage).ConfigureAwait(false); case ContentType.Link: case ContentType.InteractiveLink: var attachedLink = (AttachedLink)model; return await AttachedLinkViewModel.Create(attachedLink).ConfigureAwait(false); case ContentType.YouTube: var attachedYouTube = (AttachedYouTube)model; return await AttachedYouTubeViewModel.Create(attachedYouTube).ConfigureAwait(false); case ContentType.Reshare: var attachedActivity = (AttachedPost)model; return await AttachedActivityViewModel.Create(attachedActivity).ConfigureAwait(false); default: return null; } }
public void AddHook(IAttachable hook) { _hooks.Add(hook); }
private bool IsNodeCreatedForAttachable(IAttachable attachable) { #if UseDictionaries { return mNodes.ContainsKey(attachable); } #else { return GetNodeFromAttachable(attachable) != null; } #endif }
private IAttachable GetParent(IAttachable objectToGetParentOf) { if (string.IsNullOrEmpty(CustomParentProperty)) { return objectToGetParentOf.ParentAsIAttachable; } else { PropertyInfo pi = objectToGetParentOf.GetType().GetProperty(CustomParentProperty); return (IAttachable)pi.GetValue(objectToGetParentOf, null); } }
public static IAttachable AttachedContentDecorator(IAttachable info, PlatformClient client) { switch(info.Type) { case ContentType.Album: return new AttachedAlbum(client, (AttachedAlbumData)info); case ContentType.Image: return new AttachedImage(client, (AttachedImageData)info); case ContentType.Reshare: return new AttachedPost(client, (AttachedPostData)info); default: return info; } }
public Task UpdateGetActivityAsync(bool isForced, ActivityUpdateApiFlag updaterTypes) { var cache = Client.Activity.InternalGetActivityCache(_data.Id); return cache.SyncerUpdateActivity.LockAsync( isForced, () => _data.PostStatus != PostStatusType.Removed && (LoadedApiTypes & updaterTypes) != updaterTypes, async () => { try { var nwData = Client.Activity.InternalUpdateActivity(await Client.ServiceApi.GetActivityAsync(Id, Client)); if (_data.Comments != null) { var nwComments = from newComments in nwData.Comments join oldComments in _data.Comments on newComments.CommentId equals oldComments.CommentId into c from d in c.DefaultIfEmpty() where d == null select newComments; var rmComments = from oldComments in _data.Comments join newComments in nwData.Comments on oldComments.CommentId equals newComments.CommentId into c from d in c.DefaultIfEmpty() where d == null select new CommentData( oldComments.CommentId, oldComments.ActivityId, oldComments.Html, oldComments.PostDate, oldComments.EditDate, oldComments.Owner, PostStatusType.Removed); foreach (var item in nwComments.Concat(rmComments)) Client.Activity.InternalSendObjectToStream(item); } else foreach (var item in nwData.Comments) Client.Activity.InternalSendObjectToStream(item); _data = nwData; _postUser = Client.People.InternalGetAndUpdateProfile(_data.Owner); _attachedContent = _data.AttachedContent != null ? AttachedContentDecorator(_data.AttachedContent, Client) : null; _comments = _data.Comments.Select(dt => new CommentInfo(Client, dt, _data, this)).ToArray(); } catch (ApiErrorException e) { if (e.InnerException is System.Net.WebException && ((System.Net.WebException)e.InnerException).Status == System.Net.WebExceptionStatus.UnknownError) Client.Activity.InternalUpdateActivity(new ActivityData(Id, status: PostStatusType.Removed, updaterTypes: ActivityUpdateApiFlag.GetActivity)); else throw new FailToOperationException<ActivityInfo>("UpdateGetActivityAsync()に失敗しました。", this, e); } }, () => { _data = cache.Value; _postUser = Client.People.InternalGetAndUpdateProfile(_data.Owner); _attachedContent = _data.AttachedContent != null ? AttachedContentDecorator(_data.AttachedContent, Client) : null; if (_data.Comments != null) _comments = _data.Comments.Select(dt => new CommentInfo(Client, dt, _data, this)).ToArray(); }); }
public void OnAttach(IAttachable parent) { }
public HierarchyNode GetNodeFromAttachable(IAttachable attachable) { if (attachable == null) { return null; } if (mNodes.ContainsKey(attachable)) { return mNodes[attachable]; } else { return null; } }