Esempio n. 1
0
 public void AddAction(StageAction stageAction)
 {
     if (stageAction != null)
     {
         stageTimeline.AddAction(stageAction);
     }
 }
Esempio n. 2
0
        private static IEnumerable <StageAction> ParseStageActions(string currentCharacterDevName, string[] cues)
        {
            List <StageAction> results = new List <StageAction>();
            var charMoves = new List <CharacterMove>();

            string characterName = currentCharacterDevName;

            foreach (string cue in cues)
            {
                if (!int.TryParse(cue, out int newStagePos))
                {
                    string      expression       = cue;
                    StageAction expressionAction = StageActionFactory.NewExpressionAction(characterName, expression);
                    results.Add(expressionAction);
                    // yield return expressionAction;
                }
                else
                {
                    charMoves.Add(new CharacterMove(characterName, newStagePos));
                    StageAction stageAction = StageActionFactory.NewStageMoveAction(charMoves);
                    // yield return stageAction;
                    results.Add(stageAction);
                }
            }

            return(results);
        }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0)) // 마우스 왼클릭
        {
            Vector2        vector = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Ray2D          ray    = new Ray2D(vector, Vector2.zero);
            RaycastHit2D[] hits   = Physics2D.RaycastAll(ray.origin, ray.direction);

            for (int i = 0; i < hits.Length; i++)
            {
                Collider2D  collider    = hits[i].collider;
                StageAction stageAction = Data.stageAction;

                string tag = collider.tag;

                //Logger.Log("MouseInput Tag", tag, stageAction);

                if (tag.Equals("pallette"))
                {
                    stageAction.ActionPallette(collider);
                }
                else if (tag.Equals("placable"))
                {
                    stageAction.ActionUnitCreate(collider);
                }
                else if (tag.Equals("created"))
                {
                }
            }
        }
    }
Esempio n. 4
0
 public ICollection<Stage> FindNextStages(StageAction action = null)
 {            
     var jumper = GetStageJumper(action ?? EvaluatedAction, NewObject);
     if (jumper != null && jumper.Stages != null)
         return jumper.Stages;
     return new List<Stage>();
 }
Esempio n. 5
0
        public IWorkflowBuilder Attach(ISchedulable schedulable)
        {
            StageAction stageAction;

            if (schedulable is IActivity)
            {
                stageAction = StageAction.NewScheduleActivity((IActivity)schedulable);
            }
            else if (schedulable is IWorkflow)
            {
                stageAction = StageAction.NewStartChildWorkflow((IWorkflow)schedulable);
            }
            else
            {
                throw new NotSupportedException(string.Format(
                                                    "Type [{0}] is not a supported schedulable action",
                                                    schedulable.GetType()));
            }

            var stage = new Stage(stages.Count, stageAction);

            stages.Add(stage);

            return(this);
        }
Esempio n. 6
0
 public static void IsValidLoveMin(StageAction action,
                                   string expectedCharacterDevName,
                                   int expectedMinLove,
                                   params ZAssert.IsValidItem <object>[] actionAsserts)
 {
     IsValidLoveMin(action, expectedCharacterDevName, expectedMinLove, true, actionAsserts);
 }
Esempio n. 7
0
 public void MakeAndAddAction(StageAction stageAction)
 {
     if (stageAction != null)
     {
         makeAction(stageAction);
         AddAction(stageAction);
         RefreshPointsRightAndLeft();
     }
 }
Esempio n. 8
0
 public void MakeStepForward()
 {
     if (CanMakeStepForward())
     {
         StageAction actionToMake = stageTimeline.MakeOneStepForward();
         makeAction(actionToMake);
         RefreshPointsRightAndLeft();
     }
 }
Esempio n. 9
0
 public void UndoLastAction()
 {
     if (CanUndoLastAction())
     {
         StageAction actionToUndo = stageTimeline.MakeOneStepBack();
         undoAction(actionToUndo);
         RefreshPointsRightAndLeft();
     }
 }
Esempio n. 10
0
 public static void IsValidMove(StageAction action, params Action <CharacterMove>[] moveAssertions)
 {
     Assert.AreEqual(StageActionType.MOVE, action.Type);
     Assert.AreEqual(moveAssertions.Length, action.CharacterMoves.Count);
     for (int i = 0; i < action.CharacterMoves.Count; i++)
     {
         moveAssertions[i](action.CharacterMoves[i]);
     }
 }
Esempio n. 11
0
        public IWorkflowBuilder Attach(ISchedulable[] schedulables, Func <Dictionary <int, string>, string> reducer)
        {
            var fsharpReducer = FuncConvert.ToFSharpFunc(new Converter <Dictionary <int, string>, string>(reducer));
            var stageAction   = StageAction.NewParallelActions(schedulables, fsharpReducer);
            var stage         = new Stage(stages.Count, stageAction);

            stages.Add(stage);

            return(this);
        }
 public StageActionValidationContext(StageAction action)
 {
     ValidationRules = new List<ValidationBindingItem>();
     var rules = action.ValidatonRules;
     foreach (var stageActionValidationItem in rules)
     {
         var keypair = new ValidationBindingItem(stageActionValidationItem.Property, stageActionValidationItem.ValidationRule);
         ValidationRules.Add(keypair);
     }
 }
Esempio n. 13
0
    public StageAction MakeOneStepBack()
    {
        StageAction result = null;

        if (lastActionIndex >= 0)
        {
            result = actions [lastActionIndex];
            lastActionIndex--;
        }

        return(result);
    }
Esempio n. 14
0
    public StageAction MakeOneStepForward()
    {
        StageAction result = null;

        if (lastActionIndex < actions.Count - 1)
        {
            lastActionIndex++;
            result = actions [lastActionIndex];
        }

        return(result);
    }
Esempio n. 15
0
        public static IEnumerable <StageAction> ParseStageActions(int a, string lastCharacterDevName, string[] cues)
        {
            List <StageAction>   results   = new List <StageAction>();
            List <CharacterMove> charMoves = new List <CharacterMove>();

            // int charIdx;
            // int actionIdx ;
            for (int charIdx = -1, actionIdx = 0; charIdx < a; charIdx += 2, actionIdx += 2)
            {
                string characterName;
                if (charIdx == -1)
                {
                    characterName = lastCharacterDevName;
                }
                else
                {
                    characterName = cues[charIdx].Trim();
                }

                string cueMeta = cues[actionIdx].Trim();

                string expression;

                if (int.TryParse(cueMeta, out int newStagePos))
                {
                    // ZLog.Info($"[MOVE] {characterName} to pos: {newStagePos}");
                    charMoves.Add(new CharacterMove(characterName, newStagePos));
                    continue;
                    // throw new ArgumentException($"Failed to parse: {cueMeta} as a numeric stage position");
                }

                expression = cueMeta;
                StageAction expressionAction = StageActionFactory.NewExpressionAction(characterName, expression);

                results.Add(expressionAction);
                return(results);
                // yield return expressionAction;
                // yield break;
            }

            if (charMoves.Count == 0)
            {
                // yield break;
                return(results);
            }
            StageAction stageAction = StageActionFactory.NewStageMoveAction(charMoves);

            results.Add(stageAction);

            return(results);
            // yield return stageAction;
        }
Esempio n. 16
0
        public static void IsValidLoveMin(StageAction action,
                                          string expectedCharacterDevName,
                                          int expectedMinLove,
                                          bool assertSize,
                                          params ZAssert.IsValidItem <object>[] actionAsserts)
        {
            Assert.AreEqual(StageActionType.LOVE_MIN, action.Type);
            Assert.AreEqual(expectedCharacterDevName, action.CharacterDevName);
            Assert.AreEqual(expectedMinLove, action.LoveAmount);

            Assert.IsNotNull(action.TrueBranch, "Expected that love min action defined a true branch");

            ZAssert.IsValidItems(action.TrueBranch, assertSize, actionAsserts);
        }
Esempio n. 17
0
        public static bool TryGetStageActionForCue(string cueToken, string cueData, out StageAction stageAction)
        {
            if (SINGLE_LINE_REGISTRY.TryGetValue(cueToken, out var entry))
            {
                stageAction = entry(cueData);
                return(true);
            }

            if (SINGLE_LINE_REGISTRY_NO_PARAM.TryGetValue(cueToken, out var entryNoParam))
            {
                stageAction = entryNoParam();
                return(true);
            }

            stageAction = null;
            return(false);
        }
Esempio n. 18
0
        public override void ParseMisc(string content)
        {
            if (mLastDialogueAction != null)
            {
                if (mLastDialogueAction.DialogueText == "")
                {
                    mLastDialogueAction.DialogueText = content;
                }
                else
                {
                    mLastDialogueAction.DialogueText = $"{mLastDialogueAction.DialogueText}{Environment.NewLine}{content}";
                }
            }
            else
            {
                mLastDialogueAction = StageActionFactory.NewDialogueAction(mCurrentCharacterDevName, content);

                def.Actions.Add(mLastDialogueAction);
            }
        }
Esempio n. 19
0
        public override void ParseCue(string cueToken, string cueData)
        {
            if (mSettings.KnownInitGunks.Contains(cueToken))
            {
                int gunkAmount = int.Parse(cueData);

                def.Actions.Add(StageActionFactory.NewGunkInit(cueToken, gunkAmount));
                return;
            }

            if (mSettings.KnownIndexedGunks.Contains(cueToken))
            {
                int[] data = cueData.AsIntArray();

                def.Actions.Add(StageActionFactory.NewGunkIndices(cueToken, data));
                return;
            }

            if (mSettings.KnownSpeakerNames.Contains(cueToken))
            {
                mCurrentCharacterDevName = cueToken;

                mLastDialogueAction = StageActionFactory.NewDialogueAction(mCurrentCharacterDevName, "");

                def.Actions.Add(mLastDialogueAction);
                return;
            }

            switch (cueToken)
            {
            case "ACTION_NEW_PATIENT":
                ZLog.Warn("Need to handle ACTION_NEW_PATIENT");
                return;

            case "VO":
                def.Actions.Add(StageActionFactory.NewVOAction(cueData));
                return;
            }

            throw new InvalidOperationException($"[PHASE] Unknown cue token! token: {cueToken}, is this a speaker or surgery gunk?");
        }
Esempio n. 20
0
    public void AddAction(StageAction stageAction)
    {
        if (lastActionIndex == actions.Count - 1)
        {
            actions.Add(stageAction);
            lastActionIndex = actions.Count - 1;
        }
        else
        {
            if (lastActionIndex < 0)
            {
                actions.Clear();
            }
            else
            {
                actions.RemoveRange(lastActionIndex, actions.Count - lastActionIndex);
            }

            actions.Add(stageAction);
            lastActionIndex = actions.Count - 1;
        }
    }
Esempio n. 21
0
    public static object GetData(StageParams config)
    {
        string[] parts = config.map.Split(new char[] { ':' }, 3);
        if (parts.Length > 2)
        {
            config.map = parts[2];
        }

        string      key    = parts[0] + parts[1];
        StageAction action = null;

        lock ( loaded )
        {
            if (loaded.ContainsKey(key))
            {
                action = loaded[key];
            }
        }

        if (action == null)
        {
            Assembly   asm     = Assembly.GetExecutingAssembly();
            Type       filters = asm.GetType(parts[0]);
            MethodInfo filter  = filters.GetMethod(parts[1]);

            action = delegate(StageParams conf)
            {
                return(filter.Invoke(null, new object[] { conf }));
            };

            lock (loaded)
            {
                loaded.Add(key, action);
            }
        }

        return(action(config));
    }
Esempio n. 22
0
        public static bool TryParseDialogueObj(object obj, out StageAction stageAction)
        {
            switch (obj)
            {
            case ActionChoiceDef actionChoiceDef:

                stageAction = StageActionFactory.NewChoicesAction(actionChoiceDef);
                return(true);

            case LoveMinDef loveMinDef:

                stageAction = StageActionFactory.NewLoveMinAction(loveMinDef);
                return(true);

            case CheckFlagDef checkFlagDef:

                stageAction = StageActionFactory.NewCheckFlagAction(checkFlagDef);
                return(true);
            }

            stageAction = null;
            return(false);
        }
Esempio n. 23
0
    void makeAction(StageAction stageAction)
    {
        if (stageAction == null)
        {
            return;
        }

        if (stageAction.GetType() == typeof(CreateNodeAction))
        {
            makeMove((CreateNodeAction)stageAction);
        }
        else if (stageAction.GetType() == typeof(DeleteNodeAction))
        {
            makeMove((DeleteNodeAction)stageAction);
        }
        else if (stageAction.GetType() == typeof(ChangeWidthAction))
        {
            makeMove((ChangeWidthAction)stageAction);
        }
        else if (stageAction.GetType() == typeof(MoveNodeAction))
        {
            makeMove((MoveNodeAction)stageAction);
        }
    }
Esempio n. 24
0
 public static void IsValidExpression(StageAction action, string characterDevName, string expressionType)
 {
     Assert.AreEqual(StageActionType.EXPRESSION, action.Type);
     Assert.AreEqual(characterDevName, action.CharacterDevName);
     Assert.AreEqual(expressionType, action.ExpressionType, $"Expected that {action.CharacterDevName} had the given expression");
 }
Esempio n. 25
0
 public static void IsValidGunkInit(StageAction action, string gunkType, int gunkAmount)
 {
     Assert.AreEqual(StageActionType.GUNK_INIT, action.Type);
     Assert.AreEqual(gunkType, action.GunkType);
     Assert.AreEqual(gunkAmount, action.GunkAmount);
 }
Esempio n. 26
0
 private void Awake()
 {
     selectedUI  = outSelectedUI;
     stageAction = outStageAction;
 }
Esempio n. 27
0
 public static void IsValidGunkIndices(StageAction action, string gunkType, int[] gunkIndices)
 {
     Assert.AreEqual(StageActionType.GUNK_INDICES, action.Type);
     Assert.AreEqual(gunkType, action.GunkType);
     ZAssert.AreEqual(gunkIndices, action.GunkIndices);
 }
Esempio n. 28
0
        public static StageAction GenerateEmpty()
        {
            StageAction action = new StageAction();

            return(action);
        }
Esempio n. 29
0
 public static void IsValidBackgroundMusic(StageAction action, string asset)
 {
     Assert.AreEqual(StageActionType.BACKGROUND_MUSIC, action.Type);
     Assert.AreEqual(asset, action.Asset);
 }
Esempio n. 30
0
 public void MakeAndAddAction(StageAction stageAction)
 {
     stageModel.MakeAndAddAction(stageAction);
 }
Esempio n. 31
0
 public override void ParseBreak()
 {
     // assuming we have some existing dialogue
     mLastDialogueAction = null;
 }
Esempio n. 32
0
 public void AddAction(StageAction stageAction)
 {
     stageModel.AddAction(stageAction);
 }