Esempio n. 1
0
 public static Behavior GetCopyDisplayObjectsBehavior(string moduleName, List <Element> copiedElements, bool needSelect = true, CombineType combineType = CombineType.Independent)
 {
     return(new Behavior(isReDo => DisplayObjectUtil.CopySelectDisplayObjectsBehavior(moduleName, copiedElements, needSelect),
                         isReUndo => DisplayObjectUtil.RemoveDisplayObjectsBehavior(moduleName, copiedElements),
                         BehaviorType.CopyDisplayObjects,
                         true,
                         combineType));
 }
Esempio n. 2
0
    public static Behavior GetRemoveSelectedDisplayObjectBehavior(string moduleName)
    {
        List <Element> elements     = GlobalData.CurrentSelectDisplayObjectDic.Select(pair => GlobalData.GetElement(pair.Key)).ToList();
        int            length       = elements.Count;
        List <string>  elementNames = new List <string>();

        for (int idx = 0; idx < length; ++idx)
        {
            elementNames.Add(elements[idx].Name);
        }
        return(new Behavior(isReDo => DisplayObjectUtil.RemoveDisplayObjectsBehavior(moduleName, elementNames),
                            isReUndo => {
            DisplayObjectUtil.AddDisplayObjectsBehavior(moduleName, elements);
            foreach (string elementName in elementNames)
            {
                Transform displayObject = GlobalData.CurrentDisplayObjectDic[elementName];
                GlobalData.CurrentSelectDisplayObjectDic.Add(elementName, displayObject);
            }
            UlEventSystem.Dispatch <DataEventType, SelectedChangeData>(DataEventType.SelectedChange,
                                                                       new SelectedChangeData(moduleName, elementNames));
//								MessageBroker.SendUpdateSelectDisplayObjectDic(elementNames);
        },
                            BehaviorType.RemoveSelectedDisplayObject));
    }