Beispiel #1
0
        private bool IsValidFamily()
        {
            Individual eldestChild = Children.OrderBy(x => x.BirthDate).FirstOrDefault();

            if (MarriageDate.IsAfter(CensusDate) && (eldestChild == null || eldestChild.BirthDate.IsAfter(CensusDate)))
            {
                return(false);
            }
            if (FamilyID == Family.SOLOINDIVIDUAL || FamilyID == Family.PRE_MARRIAGE)
            {
                return(true); // allow solo individual families to be processed
            }
            // don't process family if either parent is under 16
            //if(Husband != null) rtb.AppendText("Husband : " + Husband.getAge(censusDate) + "\n");
            if (Husband != null && Husband.GetMaxAge(CensusDate) < 16)
            {
                return(false);
            }
            //if(Wife  != null) rtb.AppendText("Wife : " + Wife.getAge(censusDate) + "\n");
            if (Wife != null && Wife.GetMaxAge(CensusDate) < 16)
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
 private void OnTriggerExit2D(Collider2D triggerObj)
 {
     if (triggerObj.gameObject.CompareTag("Talkable"))
     {
         talk.enabled = false;
     }
     else if (triggerObj.gameObject.CompareTag("Untalkable"))
     {
         talk.enabled = false;
     }
     else if (triggerObj.gameObject.CompareTag("MiniGame"))
     {
         MiniGame1.SetBool("isOpen", false);
         MiniGame2.SetBool("isOpen", false);
         MiniGame3.SetBool("isOpen", false);
         MiniGame4.SetBool("isOpen", false);
         MiniGame5.SetBool("isOpen", false);
     }
     else if (triggerObj.gameObject.CompareTag("Suspect"))
     {
         Antique.SetActive(!true);
         Husband.SetActive(!true);
         Sister.SetActive(!true);
         Best.SetActive(!true);
     }
 }
Beispiel #3
0
 public bool BothParentsAlive(FactDate when)
 {
     if (Husband is null || Wife is null || FamilyType.Equals(SOLOINDIVIDUAL))
     {
         return(false);
     }
     return(Husband.IsAlive(when) && Wife.IsAlive(when) && Husband.GetAge(when).MinAge > 13 && Wife.GetAge(when).MinAge > 13);
 }
Beispiel #4
0
 public bool BothParentsAlive(FactDate when)
 {
     if (Husband == null || Wife == null || FamilyID == SOLOINDIVIDUAL)
     {
         return(false);
     }
     return(Husband.IsAlive(when) && Wife.IsAlive(when) && Husband.GetAge(when).MinAge > 13 && Wife.GetAge(when).MinAge > 13);
 }
Beispiel #5
0
 private void OnTriggerEnter2D(Collider2D triggerObj)
 {
     if (triggerObj.gameObject.CompareTag("Talkable"))
     {
         talk.enabled = true;
         buttons.SetActive(true);
         Dial                              = triggerObj.gameObject.GetComponent <DialogDisplay>();
         PlayerData.Dial                   = Dial;
         PlayerData.speakerUILeft          = Dial.speakerLeft.GetComponent <SpeakerUI>();
         PlayerData.speakerUIRight         = Dial.speakerRight.GetComponent <SpeakerUI>();
         PlayerData.speakerUILeft.Speaker  = Dial.conversation.speakerLeft;
         PlayerData.speakerUIRight.Speaker = Dial.conversation.speakerRight;
     }
     if (triggerObj.gameObject.CompareTag("MiniGame"))
     {
         if (triggerObj.gameObject.name == "Minigame1")
         {
             MiniGame1.SetBool("isOpen", true);
         }
         else if (triggerObj.gameObject.name == "Minigame2")
         {
             MiniGame2.SetBool("isOpen", true);
         }
         else if (triggerObj.gameObject.name == "Minigame3")
         {
             MiniGame3.SetBool("isOpen", true);
         }
         else if (triggerObj.gameObject.name == "Minigame4")
         {
             MiniGame4.SetBool("isOpen", true);
         }
         else if (triggerObj.gameObject.name == "Minigame5")
         {
             MiniGame5.SetBool("isOpen", true);
         }
     }
     if (triggerObj.gameObject.CompareTag("Suspect"))
     {
         if (triggerObj.gameObject.name == "Antique")
         {
             Antique.SetActive(true);
         }
         else if (triggerObj.gameObject.name == "Husband")
         {
             Husband.SetActive(true);
         }
         else if (triggerObj.gameObject.name == "Sissy")
         {
             Sister.SetActive(true);
         }
         else if (triggerObj.gameObject.name == "Besty")
         {
             Best.SetActive(true);
         }
     }
 }
Beispiel #6
0
        protected MockPlayer(Mockery mock)
        {
            var location = mock.NewMock <ILocation>();

            _location = mock.NewMock <IPlayerLocation>();
            Stub.On(_location).GetProperty("Current").Will(Return.Value(location));
            var husband = new Husband();

            Meeples = new IMeeple[] { husband };
        }
Beispiel #7
0
 public Player(string name)
 {
     _name   = name;
     Husband = new Husband()
     {
         Player = this
     };
     FianceeList      = new List <IWife>();
     SingleLadiesList = new List <IWife>(Wife.NewWifeList);
     Money            = 12;
 }
Beispiel #8
0
        private void AddFacts(XmlNode node, string factType)
        {
            XmlNodeList list          = node.SelectNodes(factType);
            bool        preferredFact = true;

            foreach (XmlNode n in list)
            {
                Fact f = new Fact(n, this, preferredFact);
                if (f.FactType != Fact.CENSUS)
                {
                    Facts.Add(f);
                    if (!preferredFacts.ContainsKey(f.FactType))
                    {
                        preferredFacts.Add(f.FactType, f);
                    }
                }
                else
                {
                    // Handle a census fact on a family.
                    if (Properties.GeneralSettings.Default.OnlyCensusParents)
                    {
                        if (Husband != null && Husband.IsAlive(f.FactDate))
                        {
                            Husband.AddFact(f);
                        }
                        if (Wife != null && Wife.IsAlive(f.FactDate))
                        {
                            Wife.AddFact(f);
                        }
                    }
                    else
                    {  // all members of the family who are alive get the census fact
                        foreach (Individual person in Members)
                        {
                            if (person.IsAlive(f.FactDate))
                            {
                                person.AddFact(f);
                            }
                        }
                    }
                }
                preferredFact = false;
            }
        }
Beispiel #9
0
        public void TestMethod1()
        {
            AbstractHandler father  = new Father();
            AbstractHandler husband = new Husband();
            AbstractHandler son     = new Son();

            father.SetNext(husband);
            husband.SetNext(son);

            Random random = new Random();

            for (int i = 0; i < 160; i++)
            {
                IWomen women = new Women((WomenLevelEnum)random.Next(0, 3), "我要出去玩");
                father.HandleMessage(women);
            }
//            --Alone 没有地方请示,按不同意处理--
//Father 同意  Daughter 我要出去玩 的请求
//Father 同意 Daughter 我要出去玩 的请求
//Father 同意  Daughter 我要出去玩 的请求
//Husband 同意 Wife 我要出去玩 的请求
//Father 同意  Daughter 我要出去玩 的请求
//Father 同意 Daughter 我要出去玩 的请求
//--Alone 没有地方请示,按不同意处理--
//Husband 同意  Wife 我要出去玩 的请求
//Father 同意 Daughter 我要出去玩 的请求
//--Alone 没有地方请示,按不同意处理--
//Father 同意  Daughter 我要出去玩 的请求
//Father 同意 Daughter 我要出去玩 的请求
//--Alone 没有地方请示,按不同意处理--
//-- Alone 没有地方请示,按不同意处理--
//-- Alone 没有地方请示,按不同意处理--
//-- Alone 没有地方请示,按不同意处理--
//Husband 同意  Wife 我要出去玩 的请求
//Husband 同意 Wife 我要出去玩 的请求
//Husband 同意  Wife 我要出去玩 的请求
//Father 同意 Daughter 我要出去玩 的请求
//Husband 同意  Wife 我要出去玩 的请求
//-- Alone 没有地方请示,按不同意处理--
//-- Alone 没有地方请示,按不同意处理--
        }
Beispiel #10
0
        public List <Person> GetInLaws()
        {
            var inlaw_list = new List <Person>();

            if (Husband != null)
            {
                if (Husband.ParantRecord != null)
                {
                    foreach (var Inlaw in Husband.GetMainParents())
                    {
                        if (Inlaw != null)
                        {
                            inlaw_list.Add(Inlaw);
                        }
                    }
                }
            }



            return(inlaw_list);
        }
Beispiel #11
0
        public Family(XmlNode node, IProgress <string> outputText)
            : this(string.Empty)
        {
            if (node != null)
            {
                XmlNode eHusband = node.SelectSingleNode("HUSB");
                XmlNode eWife    = node.SelectSingleNode("WIFE");
                FamilyID = node.Attributes["ID"].Value;
                string husbandID = eHusband?.Attributes["REF"]?.Value;
                string wifeID    = eWife?.Attributes["REF"]?.Value;
                Husband = ft.GetIndividual(husbandID);
                Wife    = ft.GetIndividual(wifeID);
                if (Husband != null && Wife != null)
                {
                    Wife.MarriedName = Husband.Surname;
                }
                if (Husband != null)
                {
                    Husband.FamiliesAsSpouse.Add(this);
                }
                if (Wife != null)
                {
                    Wife.FamiliesAsSpouse.Add(this);
                }

                // now iterate through child elements of eChildren
                // finding all individuals
                XmlNodeList list = node.SelectNodes("CHIL");
                foreach (XmlNode n in list)
                {
                    if (n.Attributes["REF"] != null)
                    {
                        Individual child = ft.GetIndividual(n.Attributes["REF"].Value);
                        if (child != null)
                        {
                            XmlNode fatherNode = n.SelectSingleNode("_FREL");
                            XmlNode motherNode = n.SelectSingleNode("_MREL");
                            var     father     = ParentalRelationship.GetRelationshipType(fatherNode);
                            var     mother     = ParentalRelationship.GetRelationshipType(motherNode);
                            Children.Add(child);
                            var parent = new ParentalRelationship(this, father, mother);
                            child.FamiliesAsChild.Add(parent);
                            AddParentAndChildrenFacts(child, Husband, father);
                            AddParentAndChildrenFacts(child, Wife, mother);
                        }
                        else
                        {
                            outputText.Report($"Child not found in family: {FamilyRef}\n");
                        }
                    }
                    else
                    {
                        outputText.Report($"Child without a reference found in family: {FamilyRef}\n");
                    }
                }

                AddFacts(node, Fact.ANNULMENT, outputText);
                AddFacts(node, Fact.DIVORCE, outputText);
                AddFacts(node, Fact.DIVORCE_FILED, outputText);
                AddFacts(node, Fact.ENGAGEMENT, outputText);
                AddFacts(node, Fact.MARRIAGE, outputText);
                AddFacts(node, Fact.MARRIAGE_BANN, outputText);
                AddFacts(node, Fact.MARR_CONTRACT, outputText);
                AddFacts(node, Fact.MARR_LICENSE, outputText);
                AddFacts(node, Fact.MARR_SETTLEMENT, outputText);
                AddFacts(node, Fact.SEPARATION, outputText);
                AddFacts(node, Fact.CENSUS, outputText);
                AddFacts(node, Fact.CUSTOM_EVENT, outputText);
                AddFacts(node, Fact.CUSTOM_FACT, outputText);
                AddFacts(node, Fact.REFERENCE, outputText);
                AddFacts(node, Fact.SEALED_TO_SPOUSE, outputText);
                AddFacts(node, Fact.UNKNOWN, outputText);

                //TODO: need to think about family facts having AGE tags in GEDCOM
                if (HasGoodChildrenStatus)
                {
                    CheckChildrenStatusCounts();
                }
                if (MarriageDate.IsKnown && !MarriageDate.Overlaps(FactDate.SAME_SEX_MARRIAGE)) // check for wrongly set gender only if pre-dates same sex marriages
                {
                    if (Husband != null && !Husband.IsMale)
                    {
                        Husband.QuestionGender(this, true);
                    }
                    if (Wife != null && Wife.IsMale)
                    {
                        Wife.QuestionGender(this, false);
                    }
                }
                Children.ToList().Sort(new BirthDateComparer());
            }
        }
Beispiel #12
0
        void AddFacts(XmlNode node, string factType, IProgress <string> outputText)
        {
            XmlNodeList list          = node.SelectNodes(factType);
            bool        preferredFact = true;

            foreach (XmlNode n in list)
            {
                try
                {
                    Fact f = new Fact(n, this, preferredFact, outputText);
                    f.Location.FTAnalyzerCreated = false;
                    if (!f.Location.IsValidLatLong)
                    {
                        outputText.Report($"Found problem with Lat/Long for Location '{f.Location}' in facts for {FamilyID}: {FamilyName}");
                    }
                    if (string.IsNullOrEmpty(f.Comment) && Husband != null && Wife != null && f.IsMarriageFact)
                    {
                        string description = Fact.GetFactTypeDescription(factType);
                        f.Comment = $"{description} of {Husband.Name} and {Wife.Name}";
                    }
                    if (f.FactType != Fact.CENSUS)
                    {
                        Facts.Add(f);
                        if (!_preferredFacts.ContainsKey(f.FactType))
                        {
                            _preferredFacts.Add(f.FactType, f);
                        }
                    }
                    else
                    {
                        // Handle a census fact on a family.
                        if (GeneralSettings.Default.OnlyCensusParents)
                        {
                            if (Husband != null && Husband.IsAlive(f.FactDate))
                            {
                                Husband.AddFact(f);
                            }
                            if (Wife != null && Wife.IsAlive(f.FactDate))
                            {
                                Wife.AddFact(f);
                            }
                        }
                        else
                        {
                            // all members of the family who are alive get the census fact
                            foreach (Individual person in Members.Where(p => p.IsAlive(f.FactDate)))
                            {
                                person.AddFact(f);
                            }
                        }
                    }
                }
                catch (InvalidXMLFactException ex)
                {
                    outputText.Report($"Error with Family : {FamilyID}\n       Invalid fact : {ex.Message}");
                }
                catch (TextFactDateException te)
                {
                    if (te.Message == "UNMARRIED" || te.Message == "NEVER MARRIED" || te.Message == "NOT MARRIED")
                    {
                        Fact f = new Fact(string.Empty, Fact.UNMARRIED, FactDate.UNKNOWN_DATE, FactLocation.UNKNOWN_LOCATION, string.Empty, true, true);
                        Husband?.AddFact(f);
                        Wife?.AddFact(f);
                        Facts.Add(f);
                    }
                }
                preferredFact = false;
            }
        }
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            Workbook workbook = new Workbook();
            
            // Create a designer workbook

            // Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            worksheet.Cells["A1"].PutValue("Husband Name");
            worksheet.Cells["A2"].PutValue("&=Husband.Name");

            worksheet.Cells["B1"].PutValue("Husband Age");
            worksheet.Cells["B2"].PutValue("&=Husband.Age");

            worksheet.Cells["C1"].PutValue("Wife's Name");
            worksheet.Cells["C2"].PutValue("&=Husband.Wives.Name");

            worksheet.Cells["D1"].PutValue("Wife's Age");
            worksheet.Cells["D2"].PutValue("&=Husband.Wives.Age");

            // Apply Style to A1:D1
            Range range = worksheet.Cells.CreateRange("A1:D1");
            Style style = workbook.CreateStyle();
            style.Font.IsBold = true;
            style.ForegroundColor = Color.Yellow;
            style.Pattern = BackgroundType.Solid;
            StyleFlag flag = new StyleFlag();
            flag.All = true;
            range.ApplyStyle(style, flag);

            // Initialize WorkbookDesigner object
            WorkbookDesigner designer = new WorkbookDesigner();

            // Load the template file
            designer.Workbook = workbook;

            System.Collections.Generic.List<Husband> list = new System.Collections.Generic.List<Husband>();

            // Create an object for the Husband class
            Husband h1 = new Husband("Mark John", 30);

            // Create the relevant Wife objects for the Husband object
            h1.Wives = new List<Wife>();
            h1.Wives.Add(new Wife("Chen Zhao", 34));
            h1.Wives.Add(new Wife("Jamima Winfrey", 28));
            h1.Wives.Add(new Wife("Reham Smith", 35));

            // Create another object for the Husband class
            Husband h2 = new Husband("Masood Shankar", 40);

            // Create the relevant Wife objects for the Husband object
            h2.Wives = new List<Wife>();
            h2.Wives.Add(new Wife("Karishma Jathool", 36));
            h2.Wives.Add(new Wife("Angela Rose", 33));
            h2.Wives.Add(new Wife("Hina Khanna", 45));

            // Add the objects to the list
            list.Add(h1);
            list.Add(h2);

            // Specify the DataSource
            designer.SetDataSource("Husband", list);

            // Process the markers
            designer.Process();

            // Autofit columns
            worksheet.AutoFitColumns();

            // Save the Excel file.
            designer.Workbook.Save(dataDir + "output.xlsx");

            // ExEnd:1
        }
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string   dataDir  = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            Workbook workbook = new Workbook();

            // Create a designer workbook

            // Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            worksheet.Cells["A1"].PutValue("Husband Name");
            worksheet.Cells["A2"].PutValue("&=Husband.Name");

            worksheet.Cells["B1"].PutValue("Husband Age");
            worksheet.Cells["B2"].PutValue("&=Husband.Age");

            worksheet.Cells["C1"].PutValue("Wife's Name");
            worksheet.Cells["C2"].PutValue("&=Husband.Wives.Name");

            worksheet.Cells["D1"].PutValue("Wife's Age");
            worksheet.Cells["D2"].PutValue("&=Husband.Wives.Age");

            // Apply Style to A1:D1
            Range range = worksheet.Cells.CreateRange("A1:D1");
            Style style = workbook.CreateStyle();

            style.Font.IsBold     = true;
            style.ForegroundColor = Color.Yellow;
            style.Pattern         = BackgroundType.Solid;
            StyleFlag flag = new StyleFlag();

            flag.All = true;
            range.ApplyStyle(style, flag);

            // Initialize WorkbookDesigner object
            WorkbookDesigner designer = new WorkbookDesigner();

            // Load the template file
            designer.Workbook = workbook;

            System.Collections.Generic.List <Husband> list = new System.Collections.Generic.List <Husband>();

            // Create an object for the Husband class
            Husband h1 = new Husband("Mark John", 30);

            // Create the relevant Wife objects for the Husband object
            h1.Wives = new List <Wife>();
            h1.Wives.Add(new Wife("Chen Zhao", 34));
            h1.Wives.Add(new Wife("Jamima Winfrey", 28));
            h1.Wives.Add(new Wife("Reham Smith", 35));

            // Create another object for the Husband class
            Husband h2 = new Husband("Masood Shankar", 40);

            // Create the relevant Wife objects for the Husband object
            h2.Wives = new List <Wife>();
            h2.Wives.Add(new Wife("Karishma Jathool", 36));
            h2.Wives.Add(new Wife("Angela Rose", 33));
            h2.Wives.Add(new Wife("Hina Khanna", 45));

            // Add the objects to the list
            list.Add(h1);
            list.Add(h2);

            // Specify the DataSource
            designer.SetDataSource("Husband", list);

            // Process the markers
            designer.Process();

            // Autofit columns
            worksheet.AutoFitColumns();

            // Save the Excel file.
            designer.Workbook.Save(dataDir + "output.xlsx");

            // ExEnd:1
        }