Пример #1
0
        public void UpdateReference()
        {
            if (this.parentLayer.TryGetTarget(out AAILayer parentLayer))
            {
                StarLinkEntity starLinkEntity = parentLayer.GetEntityFromAIEntity(this) as StarLinkEntity;

                this.StarFrom = parentLayer.GetAIEntityFromEntity(starLinkEntity.StarFrom) as AIStarEntity;
                this.StarTo   = parentLayer.GetAIEntityFromEntity(starLinkEntity.StarTo) as AIStarEntity;
            }
        }
Пример #2
0
        protected override void OnEntityPropertyChanged(AEntity obj, string propertyName)
        {
            base.OnEntityPropertyChanged(obj, propertyName);

            AAIEntity entityAI;

            lock (this.objectLock)
            {
                switch (propertyName)
                {
                case "CardSocketed":
                    StarEntity   starEntity   = obj as StarEntity;
                    AIStarEntity starEntityAI = this.objectToObjectAIs[obj] as AIStarEntity;

                    lock (starEntityAI.objectLock)
                    {
                        if (starEntity.CardSocketed != null)
                        {
                            starEntityAI.CardEntitySocketed = this.objectToObjectAIs[starEntity.CardSocketed] as AICardEntity;
                        }
                        else
                        {
                            starEntityAI.CardEntitySocketed = null;
                        }
                    }
                    break;

                case "IsSocketed":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).IsSocketed = (obj as CardEntity).ParentStar != null;
                        }
                    }
                    break;

                case "IsFliped":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).IsFliped = (obj as CardEntity).IsFliped;
                        }
                    }
                    break;

                case "IsSelected":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).IsSelected = (obj as CardEntity).IsSelected;
                        }
                    }
                    break;

                case "IsAwakened":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).IsAwakened = (obj as CardEntity).Card.IsAwakened;
                        }
                    }
                    break;

                case "CurrentOwner":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).CardOwnerName = (obj as CardEntity).Card.CurrentOwner.PlayerName;
                        }
                    }
                    break;

                case "Value":
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICardEntity).Value = (obj as CardEntity).Card.Value;
                        }
                    }
                    break;

                case "DomainOwner":
                    CJStarDomain starDomain = obj as CJStarDomain;
                    if (this.objectToObjectAIs.TryGetValue(obj, out entityAI))
                    {
                        lock (entityAI.objectLock)
                        {
                            (entityAI as AICJStarDomain).DomainOwnerName = starDomain.DomainOwner != null ? starDomain.DomainOwner.PlayerName : null;
                        }
                    }
                    break;
                }
            }
        }