/// <summary> /// Retire une ligne dans un script de manière récursive /// </summary> /// <param name="LineToRemove"></param> /// <param name="CurrentList"></param> /// <returns></returns> public bool RemoveLineInScript(VO_Line LineToRemove, List <VO_Line> CurrentList) { if (CurrentList.Find(VO_Line => VO_Line == LineToRemove) == null) { foreach (VO_Line CurrentLine in CurrentList) { if (CurrentLine is VO_Script_Loop) { VO_Script_Loop CurrentLoop = CurrentLine as VO_Script_Loop; if (RemoveLineInScript(LineToRemove, CurrentLoop.WhileSubLines) == true) { return(true); } } else if (CurrentLine is VO_Script_Condition) { VO_Script_Condition CurrentCondition = CurrentLine as VO_Script_Condition; if (RemoveLineInScript(LineToRemove, CurrentCondition.ElseSubLines) == true) { return(true); } if (RemoveLineInScript(LineToRemove, CurrentCondition.IfSubLines) == true) { return(true); } } else if (CurrentLine is VO_Script_ChoiceMessage) { VO_Script_ChoiceMessage CurrentChoice = CurrentLine as VO_Script_ChoiceMessage; foreach (VO_LineChoices CurrentLineChoice in CurrentChoice.Choices) { if (RemoveLineInScript(LineToRemove, CurrentLineChoice.SubLines) == true) { return(true); } } } } } else { CurrentList.Remove(LineToRemove); return(true); } return(false); }
/// <summary> /// Click sur Ok /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { if (Loop == null) { Loop = new VO_Script_Loop(); Loop.WhileSubLines = new List <VO_Line>(); } Loop.Id = Guid.NewGuid(); Loop.Button = trgButton.TriggerGuid; Loop.ButtonValue = chkButtonActive.Checked; Loop.Operator = (Enums.ComparativeOperator)((ddpOperator.SelectedItem.GetType()).GetProperty("Key")).GetValue(ddpOperator.SelectedItem, null); Loop.UseButton = rdButton.Checked; Loop.UseVariable = rdVariable.Checked; Loop.Variable = varVariable1.VariableGuid; Loop.VariableValue = varVariable2.VariableGuid; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
//Non à mettre dans la méthode du eventactions private void ScriptManager_Modify(object sender, EventArgs e) { if (this.Manager.SelectedNode != null) { Object CurrentNode = this.Manager.SelectedNode.Tag; if (CurrentNode is VO_Script_Message) { VO_Script_Message line = (VO_Script_Message)CurrentNode; FormsManager.Instance.DialogManager.CurrentDialog = line.Dialog; FormsManager.Instance.DialogManager.CurrentDialog.Messages = line.Dialog.Messages; FormsManager.Instance.DialogManager.LoadDialog(FormsManager.Instance.DialogManager.CurrentDialog, Script.ScriptType); DialogResult Result = FormsManager.Instance.DialogManager.ShowDialog(); if (Result == DialogResult.OK) { line.Dialog = FormsManager.Instance.DialogManager.CurrentDialog; } } else if (CurrentNode is VO_Script_Condition) { VO_Script_Condition line = (VO_Script_Condition)CurrentNode; FormsManager.Instance.ScriptCondition.Condition = line; if (FormsManager.Instance.ScriptCondition.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line = FormsManager.Instance.ScriptCondition.Condition; } } else if (CurrentNode is VO_Script_Loop) { VO_Script_Loop line = (VO_Script_Loop)CurrentNode; FormsManager.Instance.ScriptLoop.Loop = line; if (FormsManager.Instance.ScriptLoop.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line = FormsManager.Instance.ScriptLoop.Loop; } } else if (CurrentNode is VO_Script_ChoiceMessage) { VO_Script_ChoiceMessage line = (VO_Script_ChoiceMessage)CurrentNode; FormsManager.Instance.ScriptChoice.ChoiceMessage = line; if (FormsManager.Instance.ScriptChoice.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line = FormsManager.Instance.ScriptChoice.ChoiceMessage; } } else if (CurrentNode is VO_Script_MovePlayer) { VO_Script_MovePlayer line = (VO_Script_MovePlayer)CurrentNode; FormsManager.Instance.CoordsManager.SourceResolution = EditorHelper.Instance.GetCurrentStageInstance().Dimensions; FormsManager.Instance.CoordsManager.SourceObject = new Rectangle(line.Coords.Location, new Size()); if (FormsManager.Instance.CoordsManager.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Coords = FormsManager.Instance.CoordsManager.DestinationObject; } } else if (CurrentNode is VO_Script_ChangePlayerDirection) { VO_Script_ChangePlayerDirection line = (VO_Script_ChangePlayerDirection)CurrentNode; FormsManager.Instance.EventActions.ScriptChangePlayerDirection.Direction = line.Direction; if (FormsManager.Instance.EventActions.ScriptChangePlayerDirection.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Direction = FormsManager.Instance.EventActions.ScriptChangePlayerDirection.Direction; } } else if (CurrentNode is VO_Script_ChangeCharacterDirection) { VO_Script_ChangeCharacterDirection line = (VO_Script_ChangeCharacterDirection)CurrentNode; FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.Direction = line.Direction; FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.CurrentCharacterId = line.CharacterId; if (FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Direction = FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.Direction; line.CharacterId = FormsManager.Instance.EventActions.ScriptChangeCharacterDirection.CurrentCharacterId; } } else if (CurrentNode is VO_Script_PlayMusic) { VO_Script_PlayMusic line = (VO_Script_PlayMusic)CurrentNode; FormsManager.Instance.ResourcesManager.Filter = GlobalConstants.PROJECT_DIR_MUSICS; FormsManager.Instance.ResourcesManager.SelectedFilePath = line.Music; if (FormsManager.Instance.ResourcesManager.ShowDialog() == DialogResult.OK) { line.Music = FormsManager.Instance.ResourcesManager.SelectedFilePath; } } else if (CurrentNode is VO_Script_AddItem) { VO_Script_AddItem line = (VO_Script_AddItem)CurrentNode; FormsManager.Instance.EventActions.ScriptItem.CharacterGuid = line.Character; FormsManager.Instance.EventActions.ScriptItem.ItemGuid = line.Item; FormsManager.Instance.EventActions.ScriptItem.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptItem.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptItem.CharacterGuid; line.Item = FormsManager.Instance.EventActions.ScriptItem.ItemGuid; } } else if (CurrentNode is VO_Script_RemoveItem) { VO_Script_RemoveItem line = (VO_Script_RemoveItem)CurrentNode; FormsManager.Instance.EventActions.ScriptItem.CharacterGuid = line.Character; FormsManager.Instance.EventActions.ScriptItem.ItemGuid = line.Item; FormsManager.Instance.EventActions.ScriptItem.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptItem.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptItem.CharacterGuid; line.Item = FormsManager.Instance.EventActions.ScriptItem.ItemGuid; } } else if (CurrentNode is VO_Script_ChangeMusicFrequency) { VO_Script_ChangeMusicFrequency line = (VO_Script_ChangeMusicFrequency)CurrentNode; FormsManager.Instance.EventActions.ScriptMusicFrequency.Frequency = line.Frequency; FormsManager.Instance.EventActions.ScriptMusicFrequency.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptMusicFrequency.ShowDialog() == DialogResult.OK) { line.Frequency = FormsManager.Instance.EventActions.ScriptMusicFrequency.Frequency; } } else if (CurrentNode is VO_Script_Wait) { VO_Script_Wait line = (VO_Script_Wait)CurrentNode; FormsManager.Instance.EventActions.ScriptWait.WaitTime = line.SecondsToWait; FormsManager.Instance.EventActions.ScriptWait.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptWait.ShowDialog() == DialogResult.OK) { line.SecondsToWait = FormsManager.Instance.EventActions.ScriptWait.WaitTime; } } else if (CurrentNode is VO_Script_ChangeVariable) { VO_Script_ChangeVariable line = (VO_Script_ChangeVariable)CurrentNode; FormsManager.Instance.EventActions.ScriptVariable.CurrentVariable = line; FormsManager.Instance.EventActions.ScriptVariable.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptVariable.ShowDialog() == DialogResult.OK) { line = FormsManager.Instance.EventActions.ScriptVariable.CurrentVariable; } } else if (CurrentNode is VO_Script_PressSwitch) { VO_Script_PressSwitch line = (VO_Script_PressSwitch)CurrentNode; FormsManager.Instance.EventActions.ScriptPressSwitch.Switch = line; FormsManager.Instance.EventActions.ScriptPressSwitch.IsAdd = false; if (FormsManager.Instance.EventActions.ScriptPressSwitch.ShowDialog() == DialogResult.OK) { line.Button = FormsManager.Instance.EventActions.ScriptPressSwitch.Switch.Button; line.IsActive = FormsManager.Instance.EventActions.ScriptPressSwitch.Switch.IsActive; } } else if (CurrentNode is VO_Script_Random) { VO_Script_Random line = (VO_Script_Random)CurrentNode; FormsManager.Instance.EventActions.ScriptRandom.IsAdd = false; FormsManager.Instance.EventActions.ScriptRandom.MaxValue = line.MaxValue; FormsManager.Instance.EventActions.ScriptRandom.MinValue = line.MinValue; FormsManager.Instance.EventActions.ScriptRandom.VariableId = line.Variable; if (FormsManager.Instance.EventActions.ScriptRandom.ShowDialog() == DialogResult.OK) { line.MaxValue = FormsManager.Instance.EventActions.ScriptRandom.MaxValue; line.MinValue = FormsManager.Instance.EventActions.ScriptRandom.MinValue; line.Variable = FormsManager.Instance.EventActions.ScriptRandom.VariableId; } } else if (CurrentNode is VO_Script_PlaySound) { VO_Script_PlaySound line = (VO_Script_PlaySound)CurrentNode; FormsManager.Instance.ResourcesManager.Filter = GlobalConstants.PROJECT_DIR_EFFECTS; FormsManager.Instance.ResourcesManager.SelectedFilePath = line.Sound; if (FormsManager.Instance.ResourcesManager.ShowDialog() == DialogResult.OK) { line.Sound = FormsManager.Instance.ResourcesManager.SelectedFilePath; } } else if (CurrentNode is VO_Script_ChangeCurrentCharacter) { VO_Script_ChangeCurrentCharacter line = (VO_Script_ChangeCurrentCharacter)CurrentNode; FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.Character = line.Character; FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.Coords = line.Coords; FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.UseOldCoords = line.UseOldCoords; if (FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.Character; line.Coords = FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.Coords; line.UseOldCoords = FormsManager.Instance.EventActions.ScriptChangeCurrentCharacter.Character.UseOldCoords; } } else if (CurrentNode is VO_Script_SetAnchor) { VO_Script_SetAnchor line = (VO_Script_SetAnchor)CurrentNode; FormsManager.Instance.EventActions.ScriptGetSetAnchor.IsAdd = false; FormsManager.Instance.EventActions.ScriptGetSetAnchor.Anchor = line.Anchor; if (FormsManager.Instance.EventActions.ScriptGetSetAnchor.ShowDialog() == DialogResult.OK) { line.Anchor = FormsManager.Instance.EventActions.ScriptGetSetAnchor.Anchor; } } else if (CurrentNode is VO_Script_GoToAnchor) { VO_Script_GoToAnchor line = (VO_Script_GoToAnchor)CurrentNode; FormsManager.Instance.EventActions.ScriptGetSetAnchor.IsAdd = false; FormsManager.Instance.EventActions.ScriptGetSetAnchor.Anchor = line.Anchor; if (FormsManager.Instance.EventActions.ScriptGetSetAnchor.ShowDialog() == DialogResult.OK) { line.Anchor = FormsManager.Instance.EventActions.ScriptGetSetAnchor.Anchor; } } else if (CurrentNode is VO_Script_Teleport) { VO_Script_Teleport line = (VO_Script_Teleport)CurrentNode; FormsManager.Instance.CoordsManager.SourceFullObject = new VO_Coords(line.Coords.Location, line.Coords.Map); FormsManager.Instance.CoordsManager.UseStages = true; FormsManager.Instance.CoordsManager.SourceObject = new Rectangle(new Point(), new Size()); if (FormsManager.Instance.CoordsManager.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Coords = FormsManager.Instance.CoordsManager.DestinationObject; } } else if (CurrentNode is VO_Script_StopCharacterMovements) { VO_Script_StopCharacterMovements line = (VO_Script_StopCharacterMovements)CurrentNode; FormsManager.Instance.EventActions.ScriptStopCharacterMovement.IsAdd = false; FormsManager.Instance.EventActions.ScriptStopCharacterMovement.CurrentCharacter.Id = line.Character; if (FormsManager.Instance.EventActions.ScriptStopCharacterMovement.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptStopCharacterMovement.CurrentCharacter.Id; } } else if (CurrentNode is VO_Script_MoveCamera) { VO_Script_MoveCamera line = (VO_Script_MoveCamera)CurrentNode; FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera = new VO_Script_MoveCamera(); FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.Coords = line.Coords; FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.UseImmediately = line.UseImmediately; FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.Speed = line.Speed; if (FormsManager.Instance.EventActions.ScriptMoveCamera.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Coords = FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.Coords; line.Speed = FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.Speed; line.UseImmediately = FormsManager.Instance.EventActions.ScriptMoveCamera.MoveCamera.UseImmediately; } } else if (CurrentNode is VO_Script_MoveCharacter) { VO_Script_MoveCharacter line = (VO_Script_MoveCharacter)CurrentNode; FormsManager.Instance.EventActions.ScriptMoveCharacter.MoveCharacter = new VO_Script_MoveCharacter(); FormsManager.Instance.EventActions.ScriptMoveCharacter.MoveCharacter.Coords = line.Coords; FormsManager.Instance.EventActions.ScriptMoveCharacter.MoveCharacter.Character = line.Character; if (FormsManager.Instance.EventActions.ScriptMoveCharacter.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Coords = FormsManager.Instance.EventActions.ScriptMoveCharacter.MoveCharacter.Coords; line.Character = FormsManager.Instance.EventActions.ScriptMoveCharacter.MoveCharacter.Character; } } else if (CurrentNode is VO_Script_FocusOnCharacter) { VO_Script_FocusOnCharacter line = (VO_Script_FocusOnCharacter)CurrentNode; FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter = new VO_Script_FocusOnCharacter(); FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.Character = line.Character; FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.UseImmediately = line.UseImmediately; FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.Speed = line.Speed; if (FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.Character; line.Speed = FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.Speed; line.UseImmediately = FormsManager.Instance.EventActions.ScriptCameraFocusOnCharacter.FocusOnCharacter.UseImmediately; } } else if (CurrentNode is VO_Script_FocusOnAnimation) { VO_Script_FocusOnAnimation line = (VO_Script_FocusOnAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation = new VO_Script_FocusOnAnimation(); FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.Animation = line.Animation; FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.UseImmediately = line.UseImmediately; FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.Speed = line.Speed; if (FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Animation = FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.Animation; line.Speed = FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.Speed; line.UseImmediately = FormsManager.Instance.EventActions.ScriptCameraFocusOnAnimation.FocusOnAnimation.UseImmediately; } } else if (CurrentNode is VO_Script_AddPlayerAction) { VO_Script_AddPlayerAction line = (VO_Script_AddPlayerAction)CurrentNode; FormsManager.Instance.EventActions.ScriptAddPlayerAction.IsAdd = false; FormsManager.Instance.EventActions.ScriptAddPlayerAction.ActionId = line.ActionId; FormsManager.Instance.EventActions.ScriptAddPlayerAction.CharacterId = line.CharacterId; if (FormsManager.Instance.EventActions.ScriptAddPlayerAction.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.ActionId = FormsManager.Instance.EventActions.ScriptAddPlayerAction.ActionId; line.CharacterId = FormsManager.Instance.EventActions.ScriptAddPlayerAction.CharacterId; } } else if (CurrentNode is VO_Script_RemovePlayerAction) { VO_Script_RemovePlayerAction line = (VO_Script_RemovePlayerAction)CurrentNode; FormsManager.Instance.EventActions.ScriptAddPlayerAction.IsAdd = false; FormsManager.Instance.EventActions.ScriptAddPlayerAction.ActionId = line.ActionId; FormsManager.Instance.EventActions.ScriptAddPlayerAction.CharacterId = line.CharacterId; if (FormsManager.Instance.EventActions.ScriptAddPlayerAction.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.ActionId = FormsManager.Instance.EventActions.ScriptAddPlayerAction.ActionId; line.CharacterId = FormsManager.Instance.EventActions.ScriptAddPlayerAction.CharacterId; } } else if (CurrentNode is VO_Script_CallGlobalEvent) { VO_Script_CallGlobalEvent line = (VO_Script_CallGlobalEvent)CurrentNode; FormsManager.Instance.EventActions.ScriptCallGlobalEvent.IsAdd = false; FormsManager.Instance.EventActions.ScriptCallGlobalEvent.GlobalEventId = line.GlobalEvent; if (FormsManager.Instance.EventActions.ScriptCallGlobalEvent.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.GlobalEvent = FormsManager.Instance.EventActions.ScriptCallGlobalEvent.GlobalEventId; } } else if (CurrentNode is VO_Script_ChangePlayerSpeed) { VO_Script_ChangePlayerSpeed line = (VO_Script_ChangePlayerSpeed)CurrentNode; FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.CharacterId = line.CharacterId; FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.Frequency = line.Speed.IntValue; if (FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Speed.IntValue = FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.Frequency; line.CharacterId = FormsManager.Instance.EventActions.ScriptChangePlayerSpeed.CharacterId; } } else if (CurrentNode is VO_Script_Comment) { VO_Script_Comment line = (VO_Script_Comment)CurrentNode; FormsManager.Instance.EventActions.ScriptAddComment.IsAdd = false; FormsManager.Instance.EventActions.ScriptAddComment.Comment = line.Comment; if (FormsManager.Instance.EventActions.ScriptAddComment.ShowDialog() == System.Windows.Forms.DialogResult.OK) { line.Comment = FormsManager.Instance.EventActions.ScriptAddComment.Comment; } } else if (CurrentNode is VO_Script_ChangeHP) { VO_Script_ChangeHP line = (VO_Script_ChangeHP)CurrentNode; FormsManager.Instance.EventActions.ScriptChangePlayerHP.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangePlayerHP.CharacterId = line.CharacterId; FormsManager.Instance.EventActions.ScriptChangePlayerHP.Operator = line.Operator; FormsManager.Instance.EventActions.ScriptChangePlayerHP.Value = line.Value; if (FormsManager.Instance.EventActions.ScriptChangePlayerHP.ShowDialog() == DialogResult.OK) { line.CharacterId = FormsManager.Instance.EventActions.ScriptChangePlayerHP.CharacterId; line.Operator = FormsManager.Instance.EventActions.ScriptChangePlayerHP.Operator; line.Value = FormsManager.Instance.EventActions.ScriptChangePlayerHP.Value; } } else if (CurrentNode is VO_Script_ChangeMaxHP) { VO_Script_ChangeMaxHP line = (VO_Script_ChangeMaxHP)CurrentNode; FormsManager.Instance.EventActions.ScriptChangePlayerHP.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangePlayerHP.CharacterId = line.CharacterId; FormsManager.Instance.EventActions.ScriptChangePlayerHP.Operator = line.Operator; FormsManager.Instance.EventActions.ScriptChangePlayerHP.Value = line.Value; if (FormsManager.Instance.EventActions.ScriptChangePlayerHP.ShowDialog() == DialogResult.OK) { line.CharacterId = FormsManager.Instance.EventActions.ScriptChangePlayerHP.CharacterId; line.Operator = FormsManager.Instance.EventActions.ScriptChangePlayerHP.Operator; line.Value = FormsManager.Instance.EventActions.ScriptChangePlayerHP.Value; } } else if (CurrentNode is VO_Script_ChangeCharacterAnimFrequency) { VO_Script_ChangeCharacterAnimFrequency line = (VO_Script_ChangeCharacterAnimFrequency)CurrentNode; FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.IsAdd = false; FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.Frequency = line.Frequency.IntValue; if (FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.AnimationType; line.Frequency.IntValue = FormsManager.Instance.EventActions.ScriptCharacterAnimationFrequency.Frequency; } } else if (CurrentNode is VO_Script_FreezeCharacterAnimation) { VO_Script_FreezeCharacterAnimation line = (VO_Script_FreezeCharacterAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.IsAdd = false; FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.AllAnimation = line.FreezeAll; if (FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.AnimationType; line.FreezeAll = FormsManager.Instance.EventActions.ScriptFreezeCharacterAnimation.AllAnimation; } } else if (CurrentNode is VO_Script_FreeCharacterAnimation) { VO_Script_FreeCharacterAnimation line = (VO_Script_FreeCharacterAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.IsAdd = false; FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.AllAnimation = line.FreeAll; if (FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.AnimationType; line.FreeAll = FormsManager.Instance.EventActions.ScriptFreeCharacterAnimation.AllAnimation; } } else if (CurrentNode is VO_Script_FreezePlayerAnimation) { VO_Script_FreezePlayerAnimation line = (VO_Script_FreezePlayerAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.IsAdd = false; FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.AllAnimation = line.FreezeAll; if (FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.AnimationType; line.FreezeAll = FormsManager.Instance.EventActions.ScriptFreezePlayerAnimation.AllAnimation; } } else if (CurrentNode is VO_Script_FreePlayerAnimation) { VO_Script_FreePlayerAnimation line = (VO_Script_FreePlayerAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.IsAdd = false; FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.AllAnimation = line.FreeAll; if (FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.AnimationType; line.FreeAll = FormsManager.Instance.EventActions.ScriptFreePlayerAnimation.AllAnimation; } } else if (CurrentNode is VO_Script_ChangePlayerAnimation) { VO_Script_ChangePlayerAnimation line = (VO_Script_ChangePlayerAnimation)CurrentNode; FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.IsAdd = false; FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.CharacterId = line.Character; FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.Loop = line.Loop; FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.AnimationType = line.AnimationType; FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.CharacterAnimationType = line.Animation; if (FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.CharacterId; line.AnimationType = FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.AnimationType; line.Animation = FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.CharacterAnimationType; line.Loop = FormsManager.Instance.EventActions.ScriptChangePlayerAnimation.Loop; } } else if (CurrentNode is VO_Script_LookForwardPlayer) { VO_Script_LookForwardPlayer line = (VO_Script_LookForwardPlayer)CurrentNode; FormsManager.Instance.EventActions.ScriptLookForwardPlayer.IsAdd = false; FormsManager.Instance.EventActions.ScriptLookForwardPlayer.CharacterId = line.Character; if (FormsManager.Instance.EventActions.ScriptLookForwardPlayer.ShowDialog() == DialogResult.OK) { line.Character = FormsManager.Instance.EventActions.ScriptLookForwardPlayer.CharacterId; } } if (ScriptUpdated != null) { this.ScriptUpdated(this, new EventArgs()); } LoadScript(Script); } }
public static bool EventScriptIntegritySublinesCheck(VO_Line CurrentLine) { bool IsValid = true; if (CurrentLine is VO_Script_Condition) { VO_Script_Condition CurrentScriptCondition = CurrentLine as VO_Script_Condition; CurrentScriptCondition.Valid = CurrentScriptCondition.IsScriptValid(); IsValid = CurrentScriptCondition.Valid; foreach (IScriptable CurrentIfSubLine in CurrentScriptCondition.IfSubLines) { if ((CurrentIfSubLine.Valid = CurrentIfSubLine.IsScriptValid()) == false) { IsValid = false; } if (EventScriptIntegritySublinesCheck(CurrentIfSubLine as VO_Line) == false) { IsValid = false; } } foreach (IScriptable CurrentElseSubLine in CurrentScriptCondition.ElseSubLines) { if ((CurrentElseSubLine.Valid = CurrentElseSubLine.IsScriptValid()) == false) { IsValid = false; } if (EventScriptIntegritySublinesCheck(CurrentElseSubLine as VO_Line) == false) { IsValid = false; } } } if (CurrentLine is VO_Script_Loop) { VO_Script_Loop CurrentLoop = CurrentLine as VO_Script_Loop; CurrentLoop.Valid = CurrentLoop.IsScriptValid(); IsValid = CurrentLoop.Valid; foreach (IScriptable CurrentWhileSubLine in CurrentLoop.WhileSubLines) { if ((CurrentWhileSubLine.Valid = CurrentWhileSubLine.IsScriptValid()) == false) { IsValid = false; } if (EventScriptIntegritySublinesCheck(CurrentWhileSubLine as VO_Line) == false) { IsValid = false; } } } if (CurrentLine is VO_Script_ChoiceMessage) { VO_Script_ChoiceMessage CurrentChoiceMessage = CurrentLine as VO_Script_ChoiceMessage; CurrentChoiceMessage.Valid = CurrentChoiceMessage.IsScriptValid(); IsValid = CurrentChoiceMessage.Valid; foreach (VO_LineChoices CurrentChoiceSubLine in CurrentChoiceMessage.Choices) { foreach (IScriptable CurrentLineChoiceChoice in CurrentChoiceSubLine.SubLines) { if ((CurrentLineChoiceChoice.Valid = CurrentLineChoiceChoice.IsScriptValid()) == false) { IsValid = false; } if (EventScriptIntegritySublinesCheck(CurrentLineChoiceChoice as VO_Line) == false) { IsValid = false; } } } } return(IsValid); }