Пример #1
0
        private LoadedLoop createLoadedLoop(Game game, LoadedEvent e, object loop)
        {
            object before = loaderUtility.GetBeforeAction(loop);
            LoadedBaseAction beforeAction = null;

            if (before != null)
            {
                Tuple<object, object, object> assignment = loaderUtility.GetAssignment(before);
                beforeAction = new LoadedAssignment(assignment.Item1, assignment.Item2, assignment.Item3, loaderUtility);
            }

            object after = loaderUtility.GetAfterAction(loop);
            LoadedBaseAction afterAction = null;

            if(after != null)
            {
                Tuple<object, object, object> assignment = loaderUtility.GetAssignment(after);
                afterAction = new LoadedAssignment(assignment.Item1, assignment.Item2, assignment.Item3, loaderUtility);
            }

            LoadedLoop ll = new LoadedLoop(loaderUtility.GetCondition(loop), loaderUtility, beforeAction, afterAction);
            addActions(game, loop, e, ll);
            return ll;
        }
Пример #2
0
        //Adds actions to an event or trigger
        private void addActions(Game game, object evt, LoadedEvent loadedEvent, LoadedActionable cond = null)
        {
            IEnumerable<object> actions = loaderUtility.GetOfType(evt, loaderUtility.ActionType);

            foreach (object action in actions)
            {
                LoadedBaseAction actionToAdd;
                if (loaderUtility.IsAciton(action))
                {
                    PropertyHolder actionProperties = loaderUtility.GetProperties(action);
                    string type = loaderUtility.GetType(action);
                    actionToAdd = new LoadedAction(type, actionProperties, loaderUtility);
                }
                else if (loaderUtility.IsAssignment(action))
                {
                    Tuple<object, object, object> assignment = loaderUtility.GetAssignment(action);
                    actionToAdd = new LoadedAssignment(assignment.Item1, assignment.Item2, assignment.Item3, loaderUtility);
                }
                else if (loaderUtility.IsCondition(action))
                {
                    actionToAdd = createCondition(game, loadedEvent, action);
                }
                else
                {
                    actionToAdd = createLoadedLoop(game, loadedEvent, action);
                }

                if (null != cond)
                {
                    cond.AddAction(actionToAdd);
                    cond.Ready();
                }
                else loadedEvent.AddAction(actionToAdd);
            }
        }