コード例 #1
0
 public void AddMethod(MethodParamResult inMethod,Data.Inputs.Interfaces.IEventInput input)
 {
     MethodParamPair pair = new MethodParamPair(inMethod, input);
     _methods.AddLast(pair);
     if (_current == null)
         _current = _methods.First;
 }
コード例 #2
0
 public void AddMethod(MethodParamPair pair)
 {
     _methods.AddLast(pair);
     if (_current == null)
         _current = _methods.First;
 }
コード例 #3
0
 public void MethodExecuted(object sender, MethodParamPair method, MethodResult result)
 {
     _next = method.NextMethod;
     Execute(sender);
 }
コード例 #4
0
 public void AddMethod(MethodParamPair method)
 {
     method.PostExecuteHandler += MethodExecuted;
 }
コード例 #5
0
        public static Data.Inputs.MethodParamPair GenerateMethodFromArgs(string method, string[] param, string[] paths)
        {
            MethodParamPair output = null;

            ExitPathGroup methodPaths = new ExitPathGroup();
            for (int i = 0; i < paths.Length; i++)
            {
                var temp = paths[i].Split(';');
                if (temp.Length != 2)
                    throw new EngineException("Invalid path size",true);
                int rawResult = int.Parse(temp[i]), nextMethod;
                MethodResult result = (MethodResult)rawResult;
                nextMethod = int.Parse(temp[1]);
                methodPaths[result] = nextMethod;
            }
            switch (method.ToLower())
            {
                case "addgold":
                    {
                        break;
                    }
                case "conditional":
                    {
                        ConditionInput conditionInput = new ConditionInput();
                        break;
                    }
                case "addexp":
                    {
                        break;
                    }
                case "toggleswitch":
                    {
                        break;
                    }
                case "activateswitch":
                    {
                        break;
                    }
                case "deactivateswitch":
                    {
                        break;
                    }
                case "showmessagebox":
                    {
                        string messageBoxInput = "";
                        for (int i = 0; i < param.Length; i++)
                        {
                            messageBoxInput += param[i] + "\n";
                        }
                        StringInput methodInput = new StringInput() { Input = messageBoxInput };

                        output = new MethodParamPair(ShowMessageBox, methodInput, methodPaths);
                        break;
                    }
                default:
                    throw new EngineException("Method name Not Found", false);
            }
            return output;
        }
コード例 #6
0
        public static Data.Inputs.MethodParamPair GenerateMethodFromString(string input)
        {
            Data.Inputs.MethodParamPair output = null;
            string[] temp       = input.Split(';');
            string   methodName = temp[0].ToLower();

            switch (methodName)
            {
            case "addgold":
            {
                if (temp.Length != 2)
                {
                    throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                }
                try
                {
                    MethodParamResult method    = AdjustGold;
                    IntInput          parameter = new IntInput();
                    parameter.Input = int.Parse(temp[1]);
                    output          = new MethodParamPair(method, parameter);
                }
                catch
                {
                    EquestriEngine.ErrorMessage = "Error Creating MethodParamPair";
                }
                break;
            }

            case "addexp":
            {
                MethodParamResult method    = AdjustGold;
                IntInput          parameter = new IntInput();
                parameter.Input = int.Parse(temp[1]);
                output          = new MethodParamPair(method, parameter);
                break;
            }

            case "toggleswitch":
            {
                if (temp.Length != 2)
                {
                    throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                }
                MethodParamResult method    = ToggleSwitch;
                StringInput       parameter = new StringInput();
                parameter.Input = temp[1];
                output          = new MethodParamPair(method, parameter);
                break;
            }

            case "activateswitch":
            {
                if (temp.Length != 2)
                {
                    throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                }
                break;
            }

            case "deactivateswitch":
            {
                if (temp.Length != 2)
                {
                    throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                }

                break;
            }

            default:
                throw new Data.Exceptions.EngineException("Method name Not Found", false);
            }
            return(output);
        }
コード例 #7
0
        public static Data.Inputs.MethodParamPair GenerateMethodFromString(string input)
        {
            Data.Inputs.MethodParamPair output = null;
            string[] temp = input.Split(';');
            string methodName = temp[0].ToLower();
            switch (methodName)
            {
                case "addgold":
                    {
                        if (temp.Length != 2)
                            throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                        try
                        {
                            MethodParamResult method = AdjustGold;
                            IntInput parameter = new IntInput();
                            parameter.Input = int.Parse(temp[1]);
                            output = new MethodParamPair(method, parameter);
                        }
                        catch
                        {
                            EquestriEngine.ErrorMessage = "Error Creating MethodParamPair";
                        }
                        break;
                    }
                case "addexp":
                    {
                        MethodParamResult method = AdjustGold;
                        IntInput parameter = new IntInput();
                        parameter.Input = int.Parse(temp[1]);
                        output = new MethodParamPair(method, parameter);
                        break;
                    }
                case "toggleswitch":
                    {
                        if (temp.Length != 2)
                            throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                        MethodParamResult method = ToggleSwitch;
                        StringInput parameter = new StringInput();
                        parameter.Input = temp[1];
                        output = new MethodParamPair(method, parameter);
                        break;
                    }
                case "activateswitch":
                    {
                        if (temp.Length != 2)
                            throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);
                        break;
                    }
                case "deactivateswitch":
                    {
                        if (temp.Length != 2)
                            throw new Data.Exceptions.EngineException("Incorrect number of parameters passed", false);

                        break;
                    }
                default:
                    throw new Data.Exceptions.EngineException("Method name Not Found", false);
            }
            return output;
        }