public void AddAction(StageAction stageAction) { if (stageAction != null) { stageTimeline.AddAction(stageAction); } }
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); }
// 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")) { } } } }
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>(); }
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); }
public static void IsValidLoveMin(StageAction action, string expectedCharacterDevName, int expectedMinLove, params ZAssert.IsValidItem <object>[] actionAsserts) { IsValidLoveMin(action, expectedCharacterDevName, expectedMinLove, true, actionAsserts); }
public void MakeAndAddAction(StageAction stageAction) { if (stageAction != null) { makeAction(stageAction); AddAction(stageAction); RefreshPointsRightAndLeft(); } }
public void MakeStepForward() { if (CanMakeStepForward()) { StageAction actionToMake = stageTimeline.MakeOneStepForward(); makeAction(actionToMake); RefreshPointsRightAndLeft(); } }
public void UndoLastAction() { if (CanUndoLastAction()) { StageAction actionToUndo = stageTimeline.MakeOneStepBack(); undoAction(actionToUndo); RefreshPointsRightAndLeft(); } }
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]); } }
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); } }
public StageAction MakeOneStepBack() { StageAction result = null; if (lastActionIndex >= 0) { result = actions [lastActionIndex]; lastActionIndex--; } return(result); }
public StageAction MakeOneStepForward() { StageAction result = null; if (lastActionIndex < actions.Count - 1) { lastActionIndex++; result = actions [lastActionIndex]; } return(result); }
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; }
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); }
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); }
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); } }
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?"); }
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; } }
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)); }
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); }
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); } }
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"); }
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); }
private void Awake() { selectedUI = outSelectedUI; stageAction = outStageAction; }
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); }
public static StageAction GenerateEmpty() { StageAction action = new StageAction(); return(action); }
public static void IsValidBackgroundMusic(StageAction action, string asset) { Assert.AreEqual(StageActionType.BACKGROUND_MUSIC, action.Type); Assert.AreEqual(asset, action.Asset); }
public void MakeAndAddAction(StageAction stageAction) { stageModel.MakeAndAddAction(stageAction); }
public override void ParseBreak() { // assuming we have some existing dialogue mLastDialogueAction = null; }
public void AddAction(StageAction stageAction) { stageModel.AddAction(stageAction); }