Exemple #1
0
        public IMoveActionTarget AddTargetObject(Guid widgetGuid)
        {
            MoveActionTarget target = new MoveActionTarget(widgetGuid);

            _targetObjects[widgetGuid] = target;
            return(target);
        }
Exemple #2
0
        internal override void LoadDataFromXml(XmlElement element)
        {
            base.LoadDataFromXml(element);

            XmlElement tagetObjectsElement = element["TargetObjects"];

            if (tagetObjectsElement != null && tagetObjectsElement.ChildNodes.Count > 0)
            {
                XmlNodeList childList = tagetObjectsElement.ChildNodes;
                foreach (XmlElement childElement in childList)
                {
                    try
                    {
                        MoveActionTarget target = new MoveActionTarget(Guid.Empty);
                        target.LoadDataFromXml(childElement);
                        _targetObjects.Add(target.Guid, target);
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message.ToString());
                        continue;
                    }
                }
            }
        }
Exemple #3
0
        internal MoveActionTarget Clone()
        {
            MoveActionTarget newTarget = new MoveActionTarget(_guid);

            newTarget._moveType    = _moveType;
            newTarget._x           = _x;
            newTarget._y           = _y;
            newTarget._animateType = _animateType;
            newTarget._animateTime = _animateTime;
            return(newTarget);
        }
Exemple #4
0
        internal override void Update(Dictionary <Guid, IObjectContainer> newTargets)
        {
            Dictionary <Guid, MoveActionTarget> newTargetObjects = new Dictionary <Guid, MoveActionTarget>();

            foreach (MoveActionTarget target in _targetObjects.Values)
            {
                if (newTargets.ContainsKey(target.Guid))
                {
                    IObjectContainer objects = newTargets[target.Guid];

                    // Add top group as the target first.
                    foreach (Group group in objects.GroupList)
                    {
                        if (group.ParentGroupGuid == Guid.Empty)
                        {
                            MoveActionTarget newTarget = target.Clone();
                            newTarget.Guid = group.Guid;
                            newTargetObjects.Add(target.Guid, target);
                        }
                    }

                    // Then add the widgets which are not in a group.
                    foreach (Widget widget in objects.WidgetList)
                    {
                        if (widget.ParentGroupGuid != Guid.Empty)
                        {
                            MoveActionTarget newTarget = target.Clone();
                            newTarget.Guid = widget.Guid;
                            newTargetObjects.Add(target.Guid, target);
                        }
                    }
                }
                else
                {
                    newTargetObjects.Add(target.Guid, target);
                }
            }

            _targetObjects = newTargetObjects;
        }