Пример #1
0
        /// <summary>This method is used to convert Engine conditionals to ESMS conditionals.
        /// It's extremely complicated to do a very simple and useless thing anyway it's
        /// necessary to keep Engine and ESMS separated.
        /// It's obvious that object orientation is not for faint-hearted ;o)
        /// </summary>
        public static Conditional parseConditional(Conditional cond)
        {
            Condition[] tempCond = new Condition[cond.Conditions.Length];
            for (int index = 0; index < cond.Conditions.Length; index++)
            {
                // HZ: cambie Engine.Conditions.Condition_Fields de STRUC a ENUM y agregue (Condition_Fields) en el SWITCH, ver si funciona
                switch ((Condition_Fields)cond.Conditions[index].Type)
                {
                case Engine.Conditions.Condition_Fields.MINUTE:  {
                    tempCond[index] = new ESMSMinCondition(cond.Conditions[index]); break;
                }

                case Engine.Conditions.Condition_Fields.RED:  {
                    tempCond[index] = new ESMSRedCondition(cond.Conditions[index]); break;
                }

                case Engine.Conditions.Condition_Fields.INJURY:  {
                    tempCond[index] = new ESMSInjCondition(cond.Conditions[index]); break;
                }

                case Engine.Conditions.Condition_Fields.YELLOW:  {
                    tempCond[index] = new ESMSYellowCondition(cond.Conditions[index]); break;
                }

                case Engine.Conditions.Condition_Fields.SCORE:  {
                    tempCond[index] = new ESMSScoreCondition(cond.Conditions[index]); break;
                }

                default:  throw new System.Exception("Unknown Condition in conditional");
                }
            }
            Action tempAction = null;

            // HZ: cambie Engine.Conditions.Action_Fields de STRUC a ENUM y agregue (Action_Fields) en el SWITCH, ver si funciona
            switch ((Action_Fields)cond.Action.Type)
            {
            case Engine.Actions.Action_Fields.TACTIC:  {
                tempAction = new ESMSTacticAction(cond.Action); break;
            }

            case Engine.Actions.Action_Fields.SUB:  {
                tempAction = new ESMSSubAction(cond.Action); break;
            }

            case Engine.Actions.Action_Fields.CHANGE:  {
                tempAction = new ESMSChangePosAction(cond.Action); break;
            }

            default:  throw new System.Exception("Unknown Action in conditional");
            }
            return(new Conditional(tempAction, tempCond));
        }
Пример #2
0
 public ESMSSubAction(Action action) : base((SubAction)action)
 {
 }
Пример #3
0
 /// <summary>Creates a new instance of ESMSChangePosAction </summary>
 public ESMSChangePosAction(Action action) : base((ChangePosAction)action)
 {
 }
Пример #4
0
 /// <summary>Creates a new instance of ESMSTacticAction </summary>
 public ESMSTacticAction(Action action) : base((TacticAction)action)
 {
 }