Ejemplo n.º 1
0
        // Add to band and set other as enemy
        public void Initialize(CharacterGroup own, CharacterGroup enemy)
        {
            Own = own;
            Own.Add(this);

            Enemies = enemy;
        }
Ejemplo n.º 2
0
        public void TestSetIndex_ArgumentOutOfRange()
        {
            CharacterGroup group = TestUtils.GetDefaultCharacterGroup();

            Assert.ThrowsException <ArgumentOutOfRangeException>(
                delegate
            {
                group.SetIndex(3);
            }
                );
        }
Ejemplo n.º 3
0
        public void Matches_LooseGenderMatching_ExtraBiblicalGroupExtraBiblicalDetail_ReturnsTrue()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("BC-MRK");
            group.CharacterIds.Add("BC-JUD");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                CharacterId = "BC-MAT", Gender = CharacterGender.Either, Age = CharacterAge.Adult
            },
                                        CharacterGenderMatchingOptions.Loose, CharacterAgeMatchingOptions.LooseExceptChild));
        }
Ejemplo n.º 4
0
        public void Matches_LooseGenderMatching_PaulineEpistleNarratorGroupWithPaulAndSomeFutureSetting_ReturnsTrue()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("narrator-ROM");
            group.CharacterIds.Add("narrator-EPH");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                CharacterId = "Paul", Gender = CharacterGender.Male, Age = CharacterAge.Adult
            },
                                        CharacterGenderMatchingOptions.Loose, CharacterAgeMatchingOptions.LooseExceptChild));
        }
        public async Task <IActionResult> Create([Bind("Id,GroupName")] CharacterGroup characterGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(characterGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(characterGroup));
        }
Ejemplo n.º 6
0
        private void AddCharacterGroup(params string[] characterIds)
        {
            var group = new CharacterGroup(m_testProject);

            foreach (var character in characterIds)
            {
                group.CharacterIds.Add(character);
            }
            group.SetGroupIdLabel();
            m_testProject.CharacterGroupList.CharacterGroups.Add(group);
        }
 private IEnumerable <ClaimProblem> GetProblemFroGroup(CharacterGroup group)
 {
     if (group.IsRoot)
     {
         yield break;
     }
     if (!group.ParentCharacterGroupIds.Any() || group.ParentCharacterGroupIds.Any(id => id == group.CharacterGroupId))
     {
         yield return(new ClaimProblem(ClaimProblemType.GroupIsBroken, ProblemSeverity.Fatal, null, group.CharacterGroupName));
     }
 }
Ejemplo n.º 8
0
        private static ICharacterObject ChangeTarget(ICharacterObject actor, CharacterGroup defenderGroup)
        {
            if (actor.GetType() == typeof(MonsterObject))
            {
                return(actor.Threat.ThreatList.Keys.First());
            }

            var lowestHealth = defenderGroup.Members.Min(m => m.Character.GetCurrentHealth());

            return(defenderGroup.Members.First(m => m.Character.GetCurrentHealth() == lowestHealth));
        }
        private CharacterGroup AddCharacterGroup(params string[] characterIds)
        {
            var group = new CharacterGroup(m_testProject);

            foreach (var character in characterIds)
            {
                group.CharacterIds.Add(character);
            }
            m_testProject.CharacterGroupList.CharacterGroups.Add(group);
            return(group);
        }
Ejemplo n.º 10
0
 private void button18_Click_1(object sender, RoutedEventArgs e)
 {
     if (listBox1.SelectedItem != null && listBox2.SelectedItem != null)
     {
         CharacterGroup          g     = (CharacterGroup)listBox1.SelectedItem;
         Character               ch    = (Character)listBox2.SelectedItem;
         PopUp.ChangeGroupWindow chWnd = new PopUp.ChangeGroupWindow(ch, g, _helper);
         chWnd.ShowDialog();
         RefreshMembers_Click(sender, e);
     }
 }
Ejemplo n.º 11
0
        public void Matches_ModerateGenderMatching_ContainsCharacterThatMatchesExactlyOnGenderAndAge_ReturnsTrue()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("Peter (Simon)");
            group.CharacterIds.Add("Stephen");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                Gender = CharacterGender.Male, Age = CharacterAge.Adult
            },
                                        CharacterGenderMatchingOptions.Moderate, CharacterAgeMatchingOptions.LooseExceptChild));
        }
Ejemplo n.º 12
0
        public void Matches_ModerateGenderMatching_GroupContainsOnlyMale_CharacterPreferMale_ReturnsTrue()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("Peter (Simon)");
            group.CharacterIds.Add("Stephen");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                Gender = CharacterGender.PreferMale
            },
                                        CharacterGenderMatchingOptions.Moderate, CharacterAgeMatchingOptions.LooseExceptChild));
        }
Ejemplo n.º 13
0
        public void Matches_ModerateGenderMatching_GroupHasOnlyMaleAndFemale_CharacterIsNeuter_ReturnsFalse()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("Mary Magdalene");
            group.CharacterIds.Add("Judas Iscariot");
            Assert.IsFalse(group.Matches(new CharacterDetail {
                Gender = CharacterGender.Neuter, Age = CharacterAge.Adult
            },
                                         CharacterGenderMatchingOptions.Moderate, CharacterAgeMatchingOptions.LooseExceptChild));
        }
        public SubscribeSettingsViewModel(User user, CharacterGroup group)
        {
            var direct =
                user.Subscriptions.SingleOrDefault(
                    s => s.CharacterGroupId == group.CharacterGroupId);

            Init(user, group, direct);
            ProjectId        = group.ProjectId;
            CharacterGroupId = group.CharacterGroupId;
            Name             = group.CharacterGroupName;
        }
Ejemplo n.º 15
0
        public void Matches_LooseGenderMatching_NarratorGroupWithNonNarratorDetail_ReturnsFalse()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("narrator-MRK");
            group.CharacterIds.Add("narrator-JUD");
            Assert.IsFalse(group.Matches(new CharacterDetail {
                CharacterId = "Thomas"
            },
                                         CharacterGenderMatchingOptions.Loose, CharacterAgeMatchingOptions.LooseExceptChild));
        }
Ejemplo n.º 16
0
        public void LeadingCarot_Negated_Matches()
        {
            var regex = RegularExpression.Of(
                CharacterGroup.Of(new CharacterGroupOptions()
            {
                IsNegated = true
            }, Literal.For("^"))
                ).ToRegex();

            Assert.IsFalse(regex.IsMatch("^"));
        }
Ejemplo n.º 17
0
    public void OnCollisionEnter2D(Collision2D coll)
    {
        lastCollistion = coll.collider;

        GameObject obj = coll.gameObject;

        switch (obj.tag)
        {
        case Config.TAG_CHAR:

            if (isBottom > 0)
            {
                return;
            }
            float delta = coll.contacts[0].point.y - (tf.position.y + centerY);
            if (delta < 0)
            {
                CharacterCell cell = obj.GetComponent <CharacterCell>();
                if (cell.fontData.id == 95)
                {
                    minX = 0;
                    maxX = cell.fontData._actualWidth;
                }
                else
                {
                    root = coll.transform.parent.GetComponent <CharacterGroup>();
                    minX = -root.pivot.x * root.textWidth;
                    maxX = minX + root.textWidth;

                    int curCharIdx = root._character.IndexOf(cell);
                    for (int i = curCharIdx - 1; i > -1; i--)
                    {
                        if (root._character[i].fontData.id == 32 || root._character[i].fontData.id == 95)
                        {
                            minX = root._character[i].tf.localPosition.x + root._character[i].fontData._actualWidth;
                            break;
                        }
                    }

                    for (int i = curCharIdx + 1; i < root._character.Count; i++)
                    {
                        if (root._character[i].fontData.id == 32 || root._character[i].fontData.id == 95)
                        {
                            maxX = root._character[i].tf.localPosition.x;
                            break;
                        }
                    }
                }
                onBottom();
                tf.SetParent(obj.transform.parent, true);
            }
            break;
        }
    }
Ejemplo n.º 18
0
 internal WindowTextFont(string fontFamily, float sizeInPt, FontStyle style, int outlineSize)
 {
     Font        = new Font(fontFamily, (int)Math.Round(sizeInPt * 96 / 72), style, GraphicsUnit.Pixel);
     FontHeight  = Font.Height;
     OutlineSize = outlineSize;
     Characters  = new CharacterGroup(Font, OutlineSize);
     if (Viewer3D.Viewer.Catalog != null)
     {
         EnsureCharacterData(Viewer3D.Viewer.Catalog.GetString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 \",.-+|!$%&/()=?;:'_[]"));
     }
 }
Ejemplo n.º 19
0
 public AddCharacterViewModel Fill(CharacterGroup characterGroup, int currentUserId)
 {
     ProjectId = characterGroup.ProjectId;
     FillFields(new Character()
     {
         Project                 = characterGroup.Project,
         ProjectId               = ProjectId,
         IsAcceptingClaims       = true,
         ParentCharacterGroupIds = new [] { characterGroup.CharacterGroupId },
     }, currentUserId);
     return(this);
 }
Ejemplo n.º 20
0
        public async Task <Project> AddProject(CreateProjectRequest request)
        {
            var rootGroup = new CharacterGroup()
            {
                IsPublic = true,
                IsRoot   = true,
                //TODO[Localize]
                CharacterGroupName      = "Все роли",
                IsActive                = true,
                ResponsibleMasterUserId = CurrentUserId,
                HaveDirectSlots         = true,
                AvaiableDirectSlots     = -1,
            };

            MarkCreatedNow(rootGroup);
            var project = new Project()
            {
                Active            = true,
                IsAcceptingClaims = false,
                CreatedDate       = Now,
                ProjectName       = Required(request.ProjectName),
                CharacterGroups   = new List <CharacterGroup>()
                {
                    rootGroup,
                },
                ProjectAcls = new List <ProjectAcl>()
                {
                    ProjectAcl.CreateRootAcl(CurrentUserId, isOwner: true),
                },
                Details = new ProjectDetails(),
            };

            MarkTreeModified(project);
            switch (request.ProjectType)
            {
            case ProjectTypeDto.Larp:
                break;

            case ProjectTypeDto.Convention:
                project.Details.AutoAcceptClaims    = true;
                project.Details.EnableAccommodation = true;
                project.Details.GenerateCharacterNamesFromPlayer = true;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            UnitOfWork.GetDbSet <Project>().Add(project);
            await UnitOfWork.SaveChangesAsync();

            return(project);
        }
 public CharacterListByGroupViewModel(int currentUserId,
                                      IReadOnlyCollection <Character> characters,
                                      CharacterGroup group)
     : base(currentUserId,
            $"Персонажи — {group.CharacterGroupName}",
            characters,
            group.Project)
 {
     GroupModel =
         new CharacterGroupDetailsViewModel(group,
                                            currentUserId,
                                            GroupNavigationPage.Characters);
 }
Ejemplo n.º 22
0
        public CharacterGroup CreateCharacterGroup(CharacterGroup characterGroup = null)
        {
            characterGroup ??= new CharacterGroup();

            characterGroup.Project          = Project;
            characterGroup.ProjectId        = Project.ProjectId;
            characterGroup.CharacterGroupId = Project.CharacterGroups.GetNextId();
            characterGroup.CharacterGroupName ??= "test_" + characterGroup.CharacterGroupId;
            characterGroup.IsActive = true;
            Project.CharacterGroups.Add(characterGroup);

            return(characterGroup);
        }
Ejemplo n.º 23
0
 public ChangeGroupWindow(Character ch, CharacterGroup gr, Helper help)
 {
     InitializeComponent();
     _char                       = ch;
     _orygGroup                  = gr;
     _helper                     = help;
     comboBox1.ItemsSource       = _helper.Groups;
     comboBox1.DisplayMemberPath = "GroupName";
     comboBox1.SelectedItem      = gr;
     comboBox2.ItemsSource       = _helper.Groups;
     comboBox2.DisplayMemberPath = "GroupName";
     textBox1.Text               = ch.Name;
 }
Ejemplo n.º 24
0
        public void IsVoiceActorAssignmentsComplete_GroupWithNoActor_ReturnsFalse()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor = new Glyssen.VoiceActor.VoiceActor();

            project.VoiceActorList.Actors.Add(actor);
            var group = new CharacterGroup(project);

            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.False(project.IsVoiceActorAssignmentsComplete);
        }
Ejemplo n.º 25
0
 public ChangeGroupWindow(Character ch, CharacterGroup gr, Helper help)
 {
     InitializeComponent();
     _char = ch;
     _orygGroup = gr;
     _helper = help;
     comboBox1.ItemsSource = _helper.Groups;
     comboBox1.DisplayMemberPath = "GroupName";
     comboBox1.SelectedItem = gr;
     comboBox2.ItemsSource = _helper.Groups;
     comboBox2.DisplayMemberPath = "GroupName";
     textBox1.Text = ch.Name;
 }
Ejemplo n.º 26
0
        public Combat(CharacterGroup attackers, CharacterGroup defenders)
        {
            _timer       = 0;
            CombatOutput = new CombatOutput();
            Attackers    = attackers;
            Defenders    = defenders;

            CombatMembers = new List <ICharacterObject>();

            CombatMembers.AddRange(Attackers.Members);
            CombatMembers.AddRange(Defenders.Members);
            SetInitialThreat();
        }
Ejemplo n.º 27
0
        void EnsureCharacterData(string text)
        {
            var characters = Characters;

            foreach (var ch in text)
            {
                if (!characters.ContainsCharacter(ch))
                {
                    Characters = new CharacterGroup(text.ToCharArray(), characters);
                    break;
                }
            }
        }
        public void SetInactive_PreviouslyActiveAndUnassignedSetToInactive_ModifyActiveStateButNoChangeToGroups()
        {
            var actor          = m_testProject.VoiceActorList.AllActors.Single(a => a.Id == 2);
            var characterGroup = new CharacterGroup(m_testProject);

            m_testProject.CharacterGroupList.CharacterGroups.Add(characterGroup);
            Assert.False(actor.IsInactive);
            Assert.False(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));

            m_model.SetInactive(actor, true);
            Assert.True(actor.IsInactive);
            Assert.False(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));
        }
Ejemplo n.º 29
0
        public void Matches_ProjectSpecificCharacter_ReturnTrue()
        {
            m_project.AddProjectCharacterDetail(new CharacterDetail {
                CharacterId = "Bobette", Gender = CharacterGender.Female, Age = CharacterAge.YoungAdult
            });
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("Bobette");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                Gender = CharacterGender.Female, Age = CharacterAge.YoungAdult
            },
                                        CharacterGenderMatchingOptions.Moderate, CharacterAgeMatchingOptions.Strict));
        }
        public void SetInactive_PreviouslyActiveAndAssignedSetToActive_NoChange()
        {
            var actor          = m_testProject.VoiceActorList.AllActors.Single(a => a.Id == 2);
            var characterGroup = new CharacterGroup(m_testProject);

            m_testProject.CharacterGroupList.CharacterGroups.Add(characterGroup);
            characterGroup.AssignVoiceActor(actor.Id);
            Assert.False(actor.IsInactive);
            Assert.True(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));

            m_model.SetInactive(actor, false);
            Assert.False(actor.IsInactive);
            Assert.True(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));
        }
Ejemplo n.º 31
0
        private CharacterGroup ParseGroupElement(XElement rootElement)
        {
            CharacterGroup characterGroup = new CharacterGroup
            {
                Name = rootElement.Attribute("name") != null?rootElement.Attribute("name").Value : "Unamed Group",
                ID   = rootElement.Attribute("id").Value
            };

            foreach (XElement child in rootElement.Elements())
            {
                characterGroup.ChildGroups.Add(ParseGroupElement(child));
            }
            return(characterGroup);
        }
Ejemplo n.º 32
0
        public void Matches_LooseGenderMatching_ContainsCharacterThatMatchesExactlyOnAgeWithCompatibleGender_ReturnsTrue()
        {
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("eagle crying with loud voice");
            Assert.IsTrue(group.Matches(new CharacterDetail {
                Gender = CharacterGender.Male, Age = CharacterAge.Adult
            },
                                        CharacterGenderMatchingOptions.Loose, CharacterAgeMatchingOptions.LooseExceptChild));
            Assert.IsTrue(group.Matches(new CharacterDetail {
                Gender = CharacterGender.PreferMale, Age = CharacterAge.Adult
            },
                                        CharacterGenderMatchingOptions.Loose, CharacterAgeMatchingOptions.LooseExceptChild));
        }
Ejemplo n.º 33
0
        //! Load cloth with given name and for given group.
        public ClothItemGroup load(string Name, CharacterGroup Group)
        {
            // Not loaded yet
            if (!clothes.ContainsKey(Name))
            {
                string full_path = wrkPath + '/' + Name;
                XmlReader xml = XmlReader.Create(new StringReader(((TextAsset)Resources.Load(full_path, typeof(TextAsset))).text));

                // Parse file
                xml.Read();
                // Root node
                xml.MoveToContent();
                // Move to first child
                if (!xml.ReadToDescendant("item"))
                    throw new XmlException("Cannot find element 'item' - " + xml.Name);

                // Get item name
                string item_name = xml.GetAttribute("name");
                // Make new group dict
                var group_dict = new Dictionary<CharacterGroup, ClothItemGroup>();
                // Get items
                xml.ReadToDescendant("group");
                do
                {
                    // Get group type
                    CharacterGroup group = (CharacterGroup)Convert.ToUInt16(xml.GetAttribute("id"));
                    // Get prefab name
                    string prefab = xml.GetAttribute("prefab");
                    // Read all character parts affected
                    var char_items = new List<ClothItem>();
                    xml.ReadToDescendant("item");
                    do
                    {
                        char_items.Add(new ClothItem(CharacterPartHelper.FromString(xml.GetAttribute("part")), (CharacterType)Convert.ToUInt16(xml.GetAttribute("type"))));
                    } while (xml.ReadToNextSibling("item"));
                    // Add tuple
                    group_dict[group] = new ClothItemGroup(prefab, char_items.ToArray());

                } while (xml.ReadToNextSibling("group"));
                // Add new group
                clothes[Name] = group_dict;
            }

            return clothes[Name][Group];
        }
Ejemplo n.º 34
0
 //! Get part prefab name.
 public string PartPrefab(CharacterPart Part, CharacterGroup Group, CharacterType Type)
 {
     return characterParts[Part][Group][(int)Type].prefab;
 }
Ejemplo n.º 35
0
 public Soldier(TerrainTile Tile, CharacterGroup Group)
     : this()
 {
     tile = Tile;
     group = Group;
 }
Ejemplo n.º 36
0
        public void Initialize(Size gameAreaSize)
        {
            _gameAreaRectangle = new Rectangle(new Point(0, 0), gameAreaSize);
            _quadTree = new QuadTree<GameObject>(new Size(1, 1), _gameAreaRectangle);
            GameObject.QuadTree = _quadTree;

            Size test = _gameAreaRectangle.Size;
            _gameAreaSize = gameAreaSize;

            CharacterGroup b1 = new CharacterGroup();
            CharacterGroup b2 = new CharacterGroup();

            int count1 = 3;

            for (int i = 0; i < count1; i++)
            {
                Character c1 = ObjectFactory.GetKnight(0, BehaviorType.NoAI);
                c1.ID = i;
                c1.Initialize(b1, b2);
                //c1.Location = new Point(100, 100);
                c1.Location = new Point((_gameAreaSize.Width / (count1 + 1)) * (i + 1),  c1.Size.Height * 2 + 100);
                //c1.SetBehavior(BehaviorType.NoAI);
                objects.Add(c1);
                _quadTree.Insert(c1);
            }

            int count = 10 ;

            for (int i = 0; i < count; i++)
            {
                Character c2 = ObjectFactory.GetPeasant(1, BehaviorType.SmartAttack);
                c2.Initialize(b2, b1);
                //c2.Location = new Point(200,100);
                c2.Location = new Point(1000 + (i + 1) * ((_gameAreaSize.Width - 1000) / (count +1)), _gameAreaSize.Height - c2.Size.Height * 2);
                objects.Add(c2);
                //c2.SetBehavior(BehaviorType.SmartAttack);
                _quadTree.Insert(c2);
            }

            GameObject house = ObjectFactory.House();
            house.Location = new Point(400, _gameAreaSize.Height - 400);
            _quadTree.Insert(house);

            GameObject f1 = ObjectFactory.FenceHorizontal();
            f1.Location = new Point(400, _gameAreaSize.Height - 700);
            _quadTree.Insert(f1);

            GameObject f2 = ObjectFactory.FenceVertical();
            f2.Location = new Point(800, _gameAreaSize.Height - 400);
            _quadTree.Insert(f2);

            init(b1, b2);
        }
Ejemplo n.º 37
0
 private void init(CharacterGroup b1, CharacterGroup b2)
 {
     // Decide which band starts
     //if (GameRules.GetD10Roll() % 2 == 0)
     //{
         _own = b1;
         _enemy = b2;
     //}
     //else
     //{
     //    _b1 = b2;
     //    _b2 = b1;
     //}
 }
Ejemplo n.º 38
0
 public Character(CharacterGroup Group)
 {
     group = Group;
 }