예제 #1
0
파일: Segment.cs 프로젝트: si3792/NGJ_2016
        public override bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
        {
            if (otherEntity is Segment)
            {
                Segment otherSnippet = otherEntity as Segment;

                if (this.IsUsableAtStart.Equals(otherSnippet.IsUsableAtStart) == false)
                {
                    return(true);
                }
                if (this.IsUsableInMiddle.Equals(otherSnippet.IsUsableInMiddle) == false)
                {
                    return(true);
                }
                if (this.IsUsableAtEnd.Equals(otherSnippet.IsUsableAtEnd) == false)
                {
                    return(true);
                }

                if (this.IsAutomaticBridgeSegment.Equals(otherSnippet.IsAutomaticBridgeSegment) == false)
                {
                    return(true);
                }

                if (this.DefaultCompatibiltyAsFollower.Equals(otherSnippet.DefaultCompatibiltyAsFollower) == false)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        public void AddPsaiMusicEntity(PsaiMusicEntity entity, int targetIndex)
        {
            if (entity is Segment)
            {
                Segment snippet = (Segment)entity;

                if (GetSnippetById(snippet.Id) != null)
                {
                    snippet.Id = GetNextFreeSnippetId(snippet.Id);
                }
                if (snippet.Group != null)
                {
                    snippet.Group.AddSegment(snippet, targetIndex);
                }
            }
            else if (entity is Group)
            {
                Group group = (Group)entity;
                if (group.Theme != null)
                {
                    group.Theme.Groups.Add(group);
                }
            }
            else if (entity is Theme)
            {
                Theme theme = (Theme)entity;
                if (GetThemeById(theme.Id) != null)
                {
                    theme.Id = GetNextFreeThemeId(theme.Id);
                }
                Themes.Add(theme);
            }

            //AssignUniqueInteralIdForAllEntities();
        }
예제 #3
0
        /*
         * public void DeleteMusicEntity(int internalId)
         * {
         *  PsaiMusicEntity entity = GetPsaiMusicEntityByInternalId(internalId);
         *
         *  if (entity != null)
         *  {
         *      DeleteMusicEntity(entity);
         *  }
         * }
         */

        public void DeleteMusicEntity(PsaiMusicEntity entity)
        {
            if (entity is Segment)
            {
                Segment deletedSnippet = (Segment)entity;
                if (deletedSnippet.Group != null)
                {
                    deletedSnippet.Group.RemoveSegment(deletedSnippet);
                }

                HashSet <Segment> allSnippets = GetSegmentsOfAllThemes();
                foreach (Segment snippet in allSnippets)
                {
                    if (snippet.ManuallyLinkedSnippets.Contains(deletedSnippet))
                    {
                        snippet.ManuallyLinkedSnippets.Remove(deletedSnippet);
                    }

                    if (snippet.ManuallyBlockedSnippets.Contains(deletedSnippet))
                    {
                        snippet.ManuallyBlockedSnippets.Remove(deletedSnippet);
                    }
                }
            }
            else if (entity is Group)
            {
                Group deletedGroup = (Group)entity;
                if (deletedGroup.Theme != null)
                {
                    deletedGroup.Theme.Groups.Remove(deletedGroup);
                }
                // remove from ManuallyLinkes / Blocked Groups
                HashSet <Group> allGroups = GetGroupsOfAllThemes();
                foreach (Group group in allGroups)
                {
                    if (group.ManuallyBlockedGroups.Contains(deletedGroup))
                    {
                        group.ManuallyBlockedGroups.Remove(deletedGroup);
                    }

                    if (group.ManuallyLinkedGroups.Contains(deletedGroup))
                    {
                        group.ManuallyLinkedGroups.Remove(deletedGroup);
                    }
                }
            }
            else if (entity is Theme)
            {
                Theme deletedTheme = (Theme)entity;
                Themes.Remove(deletedTheme);

                foreach (Theme theme in Themes)
                {
                    if (theme.ManuallyBlockedTargetThemes.Contains(deletedTheme))
                    {
                        theme.ManuallyBlockedTargetThemes.Remove(deletedTheme);
                    }
                }
            }
        }
예제 #4
0
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            if (targetEntity is Theme)
            {
                Theme targetTheme = targetEntity as Theme;
                psai.net.ThemeInterruptionBehavior interruptionBehavior = psai.net.Theme.GetThemeInterruptionBehavior((psai.net.ThemeType) this.ThemeTypeInt, (psai.net.ThemeType)targetTheme.ThemeTypeInt);

                if (psai.net.Theme.ThemeInterruptionBehaviorRequiresEvaluationOfSegmentCompatibilities(interruptionBehavior))
                {
                    if (ManuallyBlockedTargetThemes.Contains(targetEntity as Theme))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.blocked_manually);
                    }
                    else
                    {
                        reason = CompatibilityReason.default_behavior_of_psai;
                        return(CompatibilityType.allowed_implicitly);
                    }
                }
                else
                {
                    if (interruptionBehavior == psai.net.ThemeInterruptionBehavior.never)
                    {
                        reason = CompatibilityReason.target_theme_will_never_interrupt_source;
                        return(CompatibilityType.logically_impossible);
                    }
                }
            }

            reason = CompatibilityReason.not_set;
            return(CompatibilityType.undefined);
        }
예제 #5
0
 public CommandChangePsaiEntityProperty(PsaiMusicEntity changedEntity, ref PsaiMusicEntity originalEntity, string descriptionOfChange = null)
 {
     _originalEntityReference     = originalEntity;
     _originalEntityCopy          = originalEntity.ShallowCopy();
     _changedEntity               = changedEntity;
     _descriptionOfChange         = descriptionOfChange;
     _changeAffectsCompatibilites = changedEntity.PropertyDifferencesAffectCompatibilities(originalEntity);
 }
        public CommandChangeCompatibility(PsaiMusicEntity sourceEntity, PsaiMusicEntity targetEntity, CompatibilitySetting setting)
        {
            _sourceEntity = sourceEntity;
            _targetEntity = targetEntity;
            _newSetting = setting;

            _oldSetting = sourceEntity.GetCompatibilitySetting(targetEntity);
        }
 public CommandChangePsaiEntityProperty(PsaiMusicEntity changedEntity, ref PsaiMusicEntity originalEntity, string descriptionOfChange = null)
 {
     _originalEntityReference = originalEntity;
     _originalEntityCopy = originalEntity.ShallowCopy();
     _changedEntity = changedEntity;
     _descriptionOfChange = descriptionOfChange;
     _changeAffectsCompatibilites = changedEntity.PropertyDifferencesAffectCompatibilities(originalEntity);
 }
예제 #8
0
        public CommandChangeCompatibility(PsaiMusicEntity sourceEntity, PsaiMusicEntity targetEntity, CompatibilitySetting setting)
        {
            _sourceEntity = sourceEntity;
            _targetEntity = targetEntity;
            _newSetting   = setting;

            _oldSetting = sourceEntity.GetCompatibilitySetting(targetEntity);
        }
예제 #9
0
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            if (targetEntity is Group)
            {
                Group targetGroup = (Group)targetEntity;

                Theme sourceTheme = this.Theme;
                Theme targetTheme = targetGroup.Theme;

                if (sourceTheme.GetCompatibilityType(targetTheme, out reason) == CompatibilityType.logically_impossible)
                {
                    return(CompatibilityType.logically_impossible);
                }
                else
                {
                    if (ManuallyBlockedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.blocked_manually);
                    }
                    else if (ManuallyLinkedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.allowed_manually);
                    }
                    else
                    {
                        CompatibilityType themeCompatibility = Theme.GetCompatibilityType(targetGroup.Theme, out reason);
                        {
                            switch (themeCompatibility)
                            {
                            case CompatibilityType.blocked_manually:
                            {
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.blocked_implicitly);
                            }


                            case CompatibilityType.allowed_manually:
                            {
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.allowed_implicitly);
                            }

                            default:
                                reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                return(themeCompatibility);
                            }
                        }
                    }
                }
            }

            reason = CompatibilityReason.not_set;
            return(CompatibilityType.undefined);
        }
예제 #10
0
 public override CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity)
 {
     if (targetEntity is Theme)
     {
         if (ManuallyBlockedTargetThemes.Contains((Theme)targetEntity))
         {
             return(CompatibilitySetting.blocked);
         }
     }
     return(CompatibilitySetting.neutral);
 }
예제 #11
0
        public Theme GetTheme()
        {
            PsaiMusicEntity entityToCheck = this;
            Theme           theme;

            do
            {
                theme         = entityToCheck as Theme;
                entityToCheck = entityToCheck.GetParent();
            } while (theme == null && entityToCheck != null);

            return(theme);
        }
예제 #12
0
        public override bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
        {
            if (otherEntity is Theme)
            {
                Theme otherTheme = otherEntity as Theme;

                if (this.ThemeTypeInt != otherTheme.ThemeTypeInt)
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #13
0
파일: Segment.cs 프로젝트: si3792/NGJ_2016
 public override CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity)
 {
     if (targetEntity is Segment)
     {
         if (ManuallyBlockedSnippets.Contains((Segment)targetEntity))
         {
             return(CompatibilitySetting.blocked);
         }
         else if (ManuallyLinkedSnippets.Contains((Segment)targetEntity))
         {
             return(CompatibilitySetting.allowed);
         }
     }
     return(CompatibilitySetting.neutral);
 }
예제 #14
0
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            if (targetEntity is Theme)
            {
                Theme targetTheme = targetEntity as Theme;
                psai.net.ThemeInterruptionBehavior interruptionBehavior = psai.net.Theme.GetThemeInterruptionBehavior((psai.net.ThemeType)this.ThemeTypeInt, (psai.net.ThemeType)targetTheme.ThemeTypeInt);

                if (psai.net.Theme.ThemeInterruptionBehaviorRequiresEvaluationOfSegmentCompatibilities(interruptionBehavior))
                {
                    if (ManuallyBlockedTargetThemes.Contains(targetEntity as Theme))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return CompatibilityType.blocked_manually;
                    }
                    else
                    {
                        reason = CompatibilityReason.default_behavior_of_psai;
                        return CompatibilityType.allowed_implicitly;
                    }
                }
                else
                {
                    if (interruptionBehavior == psai.net.ThemeInterruptionBehavior.never)
                    {
                        reason = CompatibilityReason.target_theme_will_never_interrupt_source;
                        return CompatibilityType.logically_impossible;
                    }
                }
            }

            reason = CompatibilityReason.not_set;
            return CompatibilityType.undefined;
        }
예제 #15
0
 internal EventArgs_PsaiEntityDeleted(PsaiMusicEntity deletedEntity)
 {
     _deletedEntity = deletedEntity;
 }
예제 #16
0
 public EventArgs_PsaiEntityPropertiesChanged(PsaiMusicEntity entity, bool changeAffectsCompatibilities)
 {
     _entity = entity;
     ChangeAffectsCompatibilities = changeAffectsCompatibilities;
 }
예제 #17
0
        /*
        public void DeleteMusicEntity(int internalId)
        {
            PsaiMusicEntity entity = GetPsaiMusicEntityByInternalId(internalId);

            if (entity != null)
            {
                DeleteMusicEntity(entity);
            }
        }
         */
        public void DeleteMusicEntity(PsaiMusicEntity entity)
        {
            if (entity is Segment)
            {
                Segment deletedSnippet = (Segment)entity;
                if (deletedSnippet.Group != null)
                {
                    deletedSnippet.Group.RemoveSegment(deletedSnippet);
                }

                HashSet<Segment> allSnippets = GetSegmentsOfAllThemes();
                foreach (Segment snippet in allSnippets)
                {
                    if (snippet.ManuallyLinkedSnippets.Contains(deletedSnippet))
                        snippet.ManuallyLinkedSnippets.Remove(deletedSnippet);

                    if (snippet.ManuallyBlockedSnippets.Contains(deletedSnippet))
                        snippet.ManuallyBlockedSnippets.Remove(deletedSnippet);
                }
            }
            else if (entity is Group)
            {
                Group deletedGroup = (Group)entity;
                if (deletedGroup.Theme != null)
                {
                    deletedGroup.Theme.Groups.Remove(deletedGroup);
                }
                // remove from ManuallyLinkes / Blocked Groups
                HashSet<Group> allGroups = GetGroupsOfAllThemes();
                foreach (Group group in allGroups)
                {
                    if (group.ManuallyBlockedGroups.Contains(deletedGroup))
                        group.ManuallyBlockedGroups.Remove(deletedGroup);

                    if (group.ManuallyLinkedGroups.Contains(deletedGroup))
                        group.ManuallyLinkedGroups.Remove(deletedGroup);
                }

            }
            else if (entity is Theme)
            {
                Theme deletedTheme = (Theme)entity;
                Themes.Remove(deletedTheme);

                foreach (Theme theme in Themes)
                {
                    if (theme.ManuallyBlockedTargetThemes.Contains(deletedTheme))
                        theme.ManuallyBlockedTargetThemes.Remove(deletedTheme);
                }
            }
        }
예제 #18
0
 public void AddPsaiMusicEntity(PsaiMusicEntity entity)
 {
     AddPsaiMusicEntity(entity, -1);     // default: enque entity at the end
 }
 public EventArgs_PsaiEntityAdded(PsaiMusicEntity entity)
 {
     _entity = entity;
 }
 public EventArgs_CompatibilitySettingChanged(PsaiMusicEntity sourceEntity, PsaiMusicEntity targetEntity)
 {
     _sourceEntity = sourceEntity;
     _targetEntity = targetEntity;
 }
예제 #21
0
 public abstract psai.Editor.CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity);
예제 #22
0
 public abstract psai.Editor.CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason);
예제 #23
0
 public abstract psai.Editor.CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity);
예제 #24
0
 // for each Subclass, implement this method to be able to tell if a given property change of an entity affects the
 // compatibilities to other Entities, so that the TargetView needs to be redrawn.
 public virtual bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
 {
     return false;
 }
예제 #25
0
 // for each Subclass, implement this method to be able to tell if a given property change of an entity affects the
 // compatibilities to other Entities, so that the TargetView needs to be redrawn.
 public virtual bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
 {
     return(false);
 }
예제 #26
0
파일: Segment.cs 프로젝트: si3792/NGJ_2016
        // this method returns the compatibility type of this Snippet to a following Snippet, based
        // on the compatibility flowchart in the "doc_internal" folder of this project.
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            reason = CompatibilityReason.not_set;

            if (targetEntity is Segment)
            {
                Segment targetSegment = (Segment)targetEntity;
                Group   sourceGroup   = this.Group;
                Group   targetGroup   = targetSegment.Group;


                if (sourceGroup.GetCompatibilityType(targetGroup, out reason) == CompatibilityType.logically_impossible)
                {
                    return(CompatibilityType.logically_impossible);
                }
                else
                {
                    // step 1
                    // a pure END-Segment can never follow another pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        if (targetSegment.HasOnlyEndSuitability())
                        {
                            reason = CompatibilityReason.target_segment_and_source_segment_are_both_only_usable_at_end;
                            return(CompatibilityType.logically_impossible);
                        }
                    }


                    // step 2
                    // transitioning to a pure END-Segment (which is no BridgeSnippet) of some other Group will never happen
                    if (sourceGroup != targetGroup &&
                        targetSegment.HasOnlyEndSuitability() &&
                        !targetSegment.IsAutomaticBridgeSegment &&
                        !targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)
                        )
                    {
                        reason = CompatibilityReason.target_segment_is_of_a_different_group_and_is_only_usable_at_end;
                        return(CompatibilityType.logically_impossible);
                    }


                    // step 3
                    // transitioning to a pure Bridge-Snippet within the same Group is not allowed
                    if (sourceGroup == targetGroup)
                    {
                        if (!targetSegment.IsUsableInMiddle && !targetSegment.IsUsableAtEnd &&
                            (targetSegment.IsAutomaticBridgeSegment || targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)))
                        {
                            reason = CompatibilityReason.target_segment_is_a_pure_bridge_segment_within_the_same_group;
                            return(CompatibilityType.blocked_implicitly);
                        }
                    }


                    // step 4
                    if (ManuallyLinkedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.allowed_manually);
                    }

                    // step 5
                    if (ManuallyBlockedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return(CompatibilityType.blocked_manually);
                    }


                    // step 6
                    // In case of group-transitions: Is there a BridgeSnippet in the targetGroup for the SourceGroup? Then block the TargetSnippet implicitly, if it is no BridgSnippet from the SourceGroup to TargetGroup.
                    // Otherwise allow.
                    if (sourceGroup != null && sourceGroup != targetGroup)
                    {
                        //if (EditorModel.Instance.Project.CheckIfThereIsAtLeastOneBridgeSnippetFromSourceGroupToTargetGroup(sourceGroup, targetGroup))
                        if (targetGroup.ContainsAtLeastOneAutomaticBridgeSegment() || targetGroup.ContainsAtLeastOneManualBridgeSegmentForSourceGroup(sourceGroup))
                        {
                            if (targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup))
                            {
                                reason = CompatibilityReason.target_segment_is_a_manual_bridge_segment_for_the_source_group;
                                return(CompatibilityType.allowed_manually);
                            }

                            if (targetSegment.IsAutomaticBridgeSegment)
                            {
                                reason = CompatibilityReason.target_segment_is_an_automatic_bridge_segment;
                                return(CompatibilityType.allowed_implicitly);
                            }

                            // block all non-bridge-snippets:
                            reason = CompatibilityReason.target_group_contains_at_least_one_bridge_segment;
                            return(CompatibilityType.blocked_implicitly);
                        }
                    }


                    // step
                    // Anything is implicitly allowed after a pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        reason = CompatibilityReason.anything_may_be_played_after_a_pure_end_segment;
                        return(CompatibilityType.allowed_implicitly);
                    }


                    // step
                    // if the default compatibility of the targetSegment is allowed_implicitly, continue evaluation by regarding the parent group
                    if (targetSegment.DefaultCompatibiltyAsFollower == CompatibilityType.allowed_implicitly)
                    {
                        CompatibilityType groupCompatibility = this.Group.GetCompatibilityType(targetSegment.Group, out reason);
                        {
                            switch (groupCompatibility)
                            {
                            case CompatibilityType.blocked_manually:
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.blocked_implicitly);

                            case CompatibilityType.blocked_implicitly:
                                return(CompatibilityType.blocked_implicitly);

                            case CompatibilityType.allowed_manually:
                                reason = CompatibilityReason.manual_setting_of_parent_entity;
                                return(CompatibilityType.allowed_implicitly);

                            default:
                                reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                return(CompatibilityType.allowed_implicitly);
                            }
                        }
                    }
                    else
                    {
                        reason = CompatibilityReason.default_compatibility_of_the_target_segment_as_a_follower;
                        return(targetSegment.DefaultCompatibiltyAsFollower);
                    }
                }
            }

            return(CompatibilityType.undefined);
        }
 internal EventArgs_PsaiEntityDeleted(PsaiMusicEntity deletedEntity)
 {
     _deletedEntity = deletedEntity;
 }
예제 #28
0
        public void AddPsaiMusicEntity(PsaiMusicEntity entity, int targetIndex)
        {
            if (entity is Segment)
            {
                Segment snippet = (Segment)entity;

                if (GetSnippetById(snippet.Id) != null)
                {
                    snippet.Id = GetNextFreeSnippetId(snippet.Id);
                }
                if (snippet.Group != null)
                {
                    snippet.Group.AddSegment(snippet, targetIndex);
                }
            }
            else if (entity is Group)
            {
                Group group = (Group)entity;
                if (group.Theme != null)
                {
                    group.Theme.Groups.Add(group);
                }
            }
            else if (entity is Theme)
            {
                Theme theme = (Theme)entity;
                if (GetThemeById(theme.Id) != null)
                {
                    theme.Id = GetNextFreeThemeId(theme.Id);
                }
                Themes.Add(theme);
            }

            //AssignUniqueInteralIdForAllEntities();
        }
 public EventArgs_PsaiEntityPropertiesChanged(PsaiMusicEntity entity, bool changeAffectsCompatibilities)
 {
     _entity = entity;
     ChangeAffectsCompatibilities = changeAffectsCompatibilities;
 }
예제 #30
0
 public EventArgs_PsaiEntityAdded(PsaiMusicEntity entity)
 {
     _entity = entity;
 }
예제 #31
0
        // this method returns the compatibility type of this Snippet to a following Snippet, based
        // on the compatibility flowchart in the "doc_internal" folder of this project.
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            reason = CompatibilityReason.not_set;

            if (targetEntity is Segment)
            {
                Segment targetSegment = (Segment)targetEntity;
                Group sourceGroup = this.Group;
                Group targetGroup = targetSegment.Group;

                if (sourceGroup.GetCompatibilityType(targetGroup, out reason) == CompatibilityType.logically_impossible)
                {
                    return CompatibilityType.logically_impossible;
                }
                else
                {
                    // step 1
                    // a pure END-Segment can never follow another pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        if (targetSegment.HasOnlyEndSuitability())
                        {
                            reason = CompatibilityReason.target_segment_and_source_segment_are_both_only_usable_at_end;
                            return CompatibilityType.logically_impossible;
                        }
                    }

                    // step 2
                    // transitioning to a pure END-Segment (which is no BridgeSnippet) of some other Group will never happen
                    if (    sourceGroup != targetGroup
                            && targetSegment.HasOnlyEndSuitability()
                            && !targetSegment.IsAutomaticBridgeSegment
                            && !targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)
                        )
                    {
                        reason = CompatibilityReason.target_segment_is_of_a_different_group_and_is_only_usable_at_end;
                        return CompatibilityType.logically_impossible;
                    }

                    // step 3
                    // transitioning to a pure Bridge-Snippet within the same Group is not allowed
                    if ( sourceGroup == targetGroup)
                    {
                        if ( !targetSegment.IsUsableInMiddle && !targetSegment.IsUsableAtEnd
                            && (targetSegment.IsAutomaticBridgeSegment || targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup)))
                        {
                            reason = CompatibilityReason.target_segment_is_a_pure_bridge_segment_within_the_same_group;
                            return CompatibilityType.blocked_implicitly;
                        }

                    }

                    // step 4
                    if (ManuallyLinkedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return CompatibilityType.allowed_manually;
                    }

                    // step 5
                    if (ManuallyBlockedSnippets.Contains(targetSegment))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return CompatibilityType.blocked_manually;
                    }

                    // step 6
                    // In case of group-transitions: Is there a BridgeSnippet in the targetGroup for the SourceGroup? Then block the TargetSnippet implicitly, if it is no BridgSnippet from the SourceGroup to TargetGroup.
                    // Otherwise allow.
                    if (sourceGroup != null && sourceGroup != targetGroup)
                    {
                        //if (EditorModel.Instance.Project.CheckIfThereIsAtLeastOneBridgeSnippetFromSourceGroupToTargetGroup(sourceGroup, targetGroup))
                        if (targetGroup.ContainsAtLeastOneAutomaticBridgeSegment() || targetGroup.ContainsAtLeastOneManualBridgeSegmentForSourceGroup(sourceGroup))
                        {
                            if (targetSegment.IsManualBridgeSegmentForSourceGroup(sourceGroup))
                            {
                                reason = CompatibilityReason.target_segment_is_a_manual_bridge_segment_for_the_source_group;
                                return CompatibilityType.allowed_manually;
                            }

                            if (targetSegment.IsAutomaticBridgeSegment)
                            {
                                reason = CompatibilityReason.target_segment_is_an_automatic_bridge_segment;
                                return CompatibilityType.allowed_implicitly;
                            }

                            // block all non-bridge-snippets:
                            reason = CompatibilityReason.target_group_contains_at_least_one_bridge_segment;
                            return CompatibilityType.blocked_implicitly;
                        }
                    }

                    // step
                    // Anything is implicitly allowed after a pure END-Segment
                    if (this.HasOnlyEndSuitability())
                    {
                        reason = CompatibilityReason.anything_may_be_played_after_a_pure_end_segment;
                        return CompatibilityType.allowed_implicitly;
                    }

                    // step
                    // if the default compatibility of the targetSegment is allowed_implicitly, continue evaluation by regarding the parent group
                    if (targetSegment.DefaultCompatibiltyAsFollower == CompatibilityType.allowed_implicitly)
                    {
                        CompatibilityType groupCompatibility = this.Group.GetCompatibilityType(targetSegment.Group, out reason);
                        {
                            switch (groupCompatibility)
                            {
                                case CompatibilityType.blocked_manually:
                                    reason = CompatibilityReason.manual_setting_of_parent_entity;
                                    return CompatibilityType.blocked_implicitly;

                                case CompatibilityType.blocked_implicitly:
                                    return CompatibilityType.blocked_implicitly;

                                case CompatibilityType.allowed_manually:
                                    reason = CompatibilityReason.manual_setting_of_parent_entity;
                                    return CompatibilityType.allowed_implicitly;

                                default:
                                    reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                    return CompatibilityType.allowed_implicitly;
                            }
                        }
                    }
                    else
                    {
                        reason = CompatibilityReason.default_compatibility_of_the_target_segment_as_a_follower;
                        return targetSegment.DefaultCompatibiltyAsFollower;
                    }
                }
            }

            return CompatibilityType.undefined;
        }
예제 #32
0
 public EventArgs_CompatibilitySettingChanged(PsaiMusicEntity sourceEntity, PsaiMusicEntity targetEntity)
 {
     _sourceEntity = sourceEntity;
     _targetEntity = targetEntity;
 }
예제 #33
0
        private int _targetIndex = 0; // the index position (within the Group / Theme / Project)

        public CommandAddPsaiEntity(PsaiProject psaiProject, PsaiMusicEntity entityToAdd, int targetIndex)
        {
            _psaiProject = psaiProject;
            _entityToAdd = entityToAdd;
            _targetIndex = targetIndex;
        }
예제 #34
0
 public override CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity)
 {
     if (targetEntity is Theme)
     {
         if (ManuallyBlockedTargetThemes.Contains((Theme)targetEntity))
         {
             return CompatibilitySetting.blocked;
         }
     }
     return CompatibilitySetting.neutral;
 }
예제 #35
0
 void BuildContextMenu(PsaiMusicEntity entity)
 {
     //Debug.Log("BuildContextMenu()");
     _contextMenu = new GenericMenu();
     _contextMenu.AddItem(new GUIContent("Delete " + entity.GetClassString() + " " + entity.Name), false, ContextMenuCallback_Delete, entity);
 }
예제 #36
0
        public override bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
        {
            if (otherEntity is Theme)
            {
                Theme otherTheme = otherEntity as Theme;

                if (this.ThemeTypeInt != otherTheme.ThemeTypeInt)
                {
                    return true;
                }
            }

            return false;
        }
예제 #37
0
        public override CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason)
        {
            if (targetEntity is Group)
            {
                Group targetGroup = (Group)targetEntity;

                Theme sourceTheme = this.Theme;
                Theme targetTheme = targetGroup.Theme;

                if (sourceTheme.GetCompatibilityType(targetTheme, out reason) == CompatibilityType.logically_impossible)
                {
                    return CompatibilityType.logically_impossible;
                }
                else
                {
                    if (ManuallyBlockedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return CompatibilityType.blocked_manually;
                    }
                    else if (ManuallyLinkedGroups.Contains(targetGroup))
                    {
                        reason = CompatibilityReason.manual_setting_within_same_hierarchy;
                        return CompatibilityType.allowed_manually;
                    }
                    else
                    {
                        CompatibilityType themeCompatibility = Theme.GetCompatibilityType(targetGroup.Theme, out reason);
                        {

                            switch (themeCompatibility)
                            {
                                case CompatibilityType.blocked_manually:
                                    {
                                        reason = CompatibilityReason.manual_setting_of_parent_entity;
                                        return CompatibilityType.blocked_implicitly;
                                    }

                                case CompatibilityType.allowed_manually:
                                    {
                                        reason = CompatibilityReason.manual_setting_of_parent_entity;
                                        return CompatibilityType.allowed_implicitly;
                                    }

                                default:
                                    reason = CompatibilityReason.inherited_from_parent_hierarchy;
                                    return themeCompatibility;
                            }
                        }

                    }
                }
            }

            reason = CompatibilityReason.not_set;
            return CompatibilityType.undefined;
        }
예제 #38
0
 public void AddPsaiMusicEntity(PsaiMusicEntity entity)
 {
     AddPsaiMusicEntity(entity, -1);     // default: enque entity at the end
 }
예제 #39
0
 private void HandleEvent_ProjectLoaded(object sender, System.EventArgs e)
 {
     _entity = null;
     _lastSelectedAudioClip = null;
 }
예제 #40
0
 public override CompatibilitySetting GetCompatibilitySetting(PsaiMusicEntity targetEntity)
 {
     if (targetEntity is Segment)
     {
         if (ManuallyBlockedSnippets.Contains((Segment)targetEntity))
         {
             return CompatibilitySetting.blocked;
         }
         else if (ManuallyLinkedSnippets.Contains((Segment)targetEntity))
         {
             return CompatibilitySetting.allowed;
         }
     }
     return CompatibilitySetting.neutral;
 }
예제 #41
0
 public abstract psai.Editor.CompatibilityType GetCompatibilityType(PsaiMusicEntity targetEntity, out CompatibilityReason reason);
예제 #42
0
        public override bool PropertyDifferencesAffectCompatibilities(PsaiMusicEntity otherEntity)
        {
            if (otherEntity is Segment)
            {
                Segment otherSnippet = otherEntity as Segment;

                if (this.IsUsableAtStart.Equals(otherSnippet.IsUsableAtStart) == false)
                {
                    return true;
                }
                if (this.IsUsableInMiddle.Equals(otherSnippet.IsUsableInMiddle) == false)
                {
                    return true;
                }
                if (this.IsUsableAtEnd.Equals(otherSnippet.IsUsableAtEnd) == false)
                {
                    return true;
                }

                if (this.IsAutomaticBridgeSegment.Equals(otherSnippet.IsAutomaticBridgeSegment) == false)
                {
                    return true;
                }

                if (this.DefaultCompatibiltyAsFollower.Equals(otherSnippet.DefaultCompatibiltyAsFollower) == false)
                {
                    return true;
                }
            }

            return false;
        }
        private int _targetIndex = 0; // the index position (within the Group / Theme / Project)

        #endregion Fields

        #region Constructors

        public CommandAddPsaiEntity(PsaiProject psaiProject, PsaiMusicEntity entityToAdd, int targetIndex)
        {
            _psaiProject = psaiProject;
            _entityToAdd = entityToAdd;
            _targetIndex = targetIndex;
        }