예제 #1
0
        public SpeechBubble(StepInput input)
        {
            string message = RegexUtilities.PullOutTextInsideQuotes(ref input.line);

            this.entity  = input.supplier.GetEntityByAlias(input.chunks[0]);
            this.Message = message;
        }
예제 #2
0
        public GreenTextStep(StepInput input)
        {
            string s             = String.Join(" ", input.chunks.ToArray());
            string withoutquotes = RegexUtilities.PullOutTextInsideQuotes(ref s);

            this.Message = withoutquotes;
        }
예제 #3
0
 public YieldStep(StepInput input)
 {
     this.IDs = input.chunks.Skip(1).ToList();
     foreach (var item in this.IDs)
     {
         System.Diagnostics.Debug.WriteLine(item);
     }
 }
        public ChangeVisibilityStep(StepInput input)
        {
            this.entity = input.supplier.GetEntityByAlias(input.chunks[0]);

            if (input.args.ContainsKey("show"))
            {
                this.Visible = true;
            }
        }
예제 #5
0
        public CameraTarget(StepInput input)
        {
            if (input.chunks.Count > 2 && input.chunks[1].Contains("=>"))
            {
                this.entity  = input.supplier.GetEntityByAlias(input.chunks[2]);
                this.Instant = input.chunks[1].StartsWith("!");
            }

            if (input.args.ContainsKey("distance"))
            {
                this.Distance = float.Parse(input.args["distance"]);
            }

            if (input.args.ContainsKey("speed"))
            {
                this.Speed = float.Parse(input.args["speed"]);
            }

            if (input.args.ContainsKey("low"))
            {
                this.Pose = "low";
            }

            if (input.args.ContainsKey("high"))
            {
                this.Pose = "high";
            }

            if (input.args.ContainsKey("left"))
            {
                this.Pose = "left";
            }

            if (input.args.ContainsKey("right"))
            {
                this.Pose = "right";
            }

            this.Follow = !input.args.ContainsKey("nofollow");
        }
예제 #6
0
 public TurnToFaceStep(StepInput input)
 {
     this.entity     = input.supplier.GetEntityByAlias(input.chunks[0]);
     this.FaceTarget = input.supplier.GetEntityByAlias(input.chunks[2]);
 }
예제 #7
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks[0] == "yield");
 }
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks.Count > 2 && input.chunks[1].StartsWith("=>") &&
            input.supplier.IsEntity(input.chunks[0]) &&
            RegexUtilities.GetVector3FromString(input.line) != Vector3.zero);
 }
 public static bool IsMatch(StepInput input)
 {
     return(input.supplier.IsEntity(input.chunks[0]) && (input.args.ContainsKey("show") || input.args.ContainsKey("hide")));
 }
 public MoveAiInDirectionStep(StepInput input)
 {
     this.Direction = RegexUtilities.GetVector3FromString(input.line);
     this.SpeedType = StepUtilities.SpeedTypeFromString(input.chunks[1]);
     this.entity    = input.supplier.GetEntityByAlias(input.chunks[0]);
 }
예제 #11
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks.Count == 2 && input.chunks[0] == "load_scene");
 }
예제 #12
0
 public LoadSceneStep(StepInput input)
 {
     this.SceneName = input.chunks[1];
 }
예제 #13
0
 public WaitStep(StepInput input)
 {
     this.milliseconds = RegexUtilities.GetDigitsFromString(input.chunks[1]);
 }
예제 #14
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks[0] == "cam" && input.args.ContainsKey("ease"));
 }
예제 #15
0
 public ActivateStep(StepInput input)
 {
     this.entity = input.supplier.GetEntityByAlias(input.chunks[1]);
 }
예제 #16
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks.Count == 3 && (input.chunks[1] == "turn"));
 }
예제 #17
0
        public static bool IsMatch(StepInput input)
        {
            bool match = input.chunks[0] == "cam";

            return(match);
        }
예제 #18
0
        public BaseStep BuildStep(string inputLine)
        {
            inputLine = inputLine.Trim();

            var split = inputLine.Split(' ').ToList();

            var args = split.Where(x => x.StartsWith("--"));

            var chunks = split
                         .Except(args)
                         .Where(chunk => chunk != "!!");

            var argsDict = args.ToDictionary(
                s => s.Trim('-').Split('=').ElementAtOrDefault(0) ?? "",
                s => s.Trim('-').Split('=').ElementAtOrDefault(1) ?? "");

            var types = System.Reflection.Assembly
                        .GetExecutingAssembly()
                        .GetTypes()
                        .Where(x => x.BaseType == typeof(BaseStep));

            StepInput input = new StepInput()
            {
                chunks   = chunks.ToList(),
                supplier = this.entitySupplier,
                args     = argsDict.ToDictionary(x => x.Key, x => x.Value.TrimEnd(',')),
                line     = inputLine
            };

            foreach (var item in argsDict)
            {
                System.Diagnostics.Debug.WriteLine(item.Key);
                System.Diagnostics.Debug.WriteLine(item.Value);
            }

            bool containsRef = argsDict.ContainsKey("ref");

            //System.Diagnostics.Debug.WriteLine("Contains ref :: " + containsRef.ToString());
            //System.Diagnostics.Debug.WriteLine("Ref ID :: " + argsDict["ref"]);

            foreach (var type in types)
            {
                var method = type.GetMethod("IsMatch");

                if (method != null)
                {
                    bool isMatch = (bool)method.Invoke(null, new [] { input as object });

                    if (isMatch)
                    {
                        var      constructor = type.GetConstructor(new[] { typeof(StepInput) });
                        BaseStep step        = (BaseStep)constructor.Invoke(new object[] { input });

                        step.RefID = argsDict.ContainsKey("ref") ? argsDict["ref"] : "";
                        step.Wait  = !inputLine.EndsWith("!!");
                        return(step);
                    }
                }
            }

            IEntity    entity = this.GetEntityFromInput(inputLine);
            StepAction action = this.GetActionFromInput(inputLine);

            switch (action)
            {
            case StepAction.Move:

                BaseMoveStep moveStep = MoveToPositionStep.CreateFromInputString(inputLine, this.entitySupplier);

                if (moveStep != null)
                {
                    return(moveStep);
                }

                throw new MisformedStepException(inputLine);

            case StepAction.Pose:
                return(PoseMasterStep.CreateFromInputString(entity, inputLine));
            }


            throw new MisformedStepException(inputLine);
        }
예제 #19
0
 public WaypointMove(StepInput input)
 {
     this.Increment = GetIncrement(input.chunks[1]);
     this.Instant   = input.chunks[1].StartsWith("!");
     this.entity    = input.supplier.GetEntityByAlias(input.chunks[0]);
 }
예제 #20
0
        public static bool IsMatch(StepInput input)
        {
            bool actionMatch = input.chunks.Count == 2 && GetIncrement(input.chunks[1]) != 0;

            return(actionMatch && input.supplier.IsEntity(input.chunks[0]));
        }
예제 #21
0
 public FadeCameraIn(StepInput input)
 {
     this.entity = input.supplier.GetEntityByAlias(input.chunks[2]);
     this.Follow = !input.args.ContainsKey("nofollow");
 }
예제 #22
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks.Count > 1 && input.chunks[0] == "activate");
 }
예제 #23
0
 public static bool IsMatch(StepInput input)
 {
     return(input.chunks.Count > 1 && input.supplier.IsEntity(input.chunks[0]) && input.chunks[1] == "say");
 }
예제 #24
0
 public TurnVectorStep(StepInput input)
 {
     this.entity = input.supplier.GetEntityByAlias(input.chunks[0]);
     this.dir    = CreateFromInputString(input.chunks[2]);
 }
예제 #25
0
 public FadeScreenStep(StepInput input)
 {
     this.Alpha     = float.Parse(input.chunks[2]);
     this.SpeedType = StepUtilities.SpeedTypeFromString(input.chunks[1]);
 }