Exemple #1
0
 public void Start(Event actObject)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         element.paused = false;
     }
 }
Exemple #2
0
 public void Paused(bool pause, Event actObject)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         element.paused = pause;
     }
 }
Exemple #3
0
 private void RemoveAction(int index, Actions.ActionElement element)
 {
     CollectionUtils.RemoveAt(element.actions, index);
     if (element.actionIndex >= index)
     {
         element.actionIndex--;
     }
     if ((element.actions.Count == 0))
     {
         DeleteElement(element);
     }
 }
Exemple #4
0
 public void AddAction(ActionEvent action, Event actObject,
                       bool paused)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element == null)
     {
         element = new Actions.ActionElement(actObject, paused);
         actions.Put(actObject, element);
     }
     CollectionUtils.Add(element.actions, action);
     action.Start(actObject);
 }
Exemple #5
0
 public void AddAction(ActionEvent action, Event actObject,
         bool paused)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element == null)
     {
         element = new Actions.ActionElement(actObject, paused);
         actions.Put(actObject, element);
     }
     CollectionUtils.Add(element.actions, action);
     action.Start(actObject);
 }
Exemple #6
0
 public void RemoveAllActions(Event actObject)
 {
     if (actObject == null)
     {
         return;
     }
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         CollectionUtils.Clear(element.actions);
         DeleteElement(element);
     }
 }
Exemple #7
0
 public void RemoveAction(ActionEvent action)
 {
     if (action == null)
     {
         return;
     }
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(action
                                                                        .GetOriginal());
     if (element != null)
     {
         int i = element.actions.IndexOf(action);
         if (i != -1)
         {
             RemoveAction(i, element);
         }
     }
 }
Exemple #8
0
        public void Update(long elapsedTime)
        {
            int Size = actions.Size();

            for (int i = Size - 1; i > -1; --i)
            {
                Actions.ActionElement currentTarget = (Actions.ActionElement)actions.Get(i);
                if (currentTarget == null)
                {
                    continue;
                }
                lock (currentTarget) {
                    if (!currentTarget.paused)
                    {
                        for (currentTarget.actionIndex = 0; currentTarget.actionIndex < currentTarget.actions
                             .Count; currentTarget.actionIndex++)
                        {
                            currentTarget.currentAction = (ActionEvent)currentTarget.actions
                                                          [currentTarget.actionIndex];
                            if (currentTarget.currentAction == null)
                            {
                                continue;
                            }
                            if (!currentTarget.currentAction.isInit)
                            {
                                currentTarget.currentAction.isInit = true;
                                currentTarget.currentAction.OnLoad();
                            }
                            currentTarget.currentAction.Step(elapsedTime);
                            if (currentTarget.currentAction.IsComplete())
                            {
                                currentTarget.currentAction.Stop();
                                RemoveAction(currentTarget.currentAction);
                            }
                            currentTarget.currentAction = null;
                        }
                    }
                    if (currentTarget.actions.Count == 0)
                    {
                        DeleteElement(currentTarget);
                    }
                }
            }
        }
Exemple #9
0
 public void RemoveAction(object tag, Event actObject)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         if (element.actions != null)
         {
             int limit = element.actions.Count;
             for (int i = 0; i < limit; i++)
             {
                 ActionEvent a = (ActionEvent)element.actions[i];
                 if (a.GetTag() == tag && a.GetOriginal() == actObject)
                 {
                     RemoveAction(i, element);
                 }
             }
         }
     }
 }
Exemple #10
0
 public ActionEvent GetAction(object tag, Event actObject)
 {
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         if (element.actions != null)
         {
             int limit = element.actions.Count;
             for (int i = 0; i < limit; i++)
             {
                 ActionEvent a = (ActionEvent)element.actions[i];
                 if (a.GetTag() == tag)
                 {
                     return(a);
                 }
             }
         }
     }
     return(null);
 }
Exemple #11
0
 private void DeleteElement(Actions.ActionElement element)
 {
     CollectionUtils.Clear(element.actions);
     actions.Remove(element.key);
 }