示例#1
0
        public virtual void BreakUp(People people)
        {
            BreakUpArgs e = new BreakUpArgs
            {
                T = people
            };

            var index = CurrentMate.FindIndex((t) => t.Equals(people));
            if (index == -1)
            {
                throw new Exception("从未在一起,何来分手!");
            }
            else
            {
                PreviousMate.Add(CurrentMate[index]);
                CurrentMate.RemoveAt(index);

                people.PreviousMate.Add(this);
                people.CurrentMate.Remove(this);

                e.Tip = "所以,爱会消失的,对吗?";
                BreakUpEvent?.Invoke(this, e);
            }


        }
示例#2
0
        public virtual void BeMarried(People people)
        {
            MarryArgs e = new MarryArgs
            {
                T = people
            };

            if (PreviousMate.Count == 0 && CurrentMate.Count ==  1 && people.PreviousMate.Count == 0 && people.CurrentMate.Count == 1 && CurrentMate[CurrentMate.Count - 1] == people)
            {
                e.Tip = "从一而终,矢志不渝!";
                MarryEvent?.Invoke(this, e);
            }
            else
            {
                var curIndex = CurrentMate.FindIndex((t) =>  t.Equals(people));
                var preIndex = PreviousMate.FindIndex((t) => t.Equals(people));
                if (curIndex == -1 && preIndex == -1)
                {
                    e.Tip = "我结婚了,新郎(娘)不是他!";
                    MarryEvent?.Invoke(this, e);

                }
                else if (curIndex == CurrentMate.Count - 1)
                {
                    e.Tip = "执子之手,与子偕老!";
                    MarryEvent?.Invoke(this, e);
                }
                else if (preIndex != -1 || curIndex != -1)
                {
                    e.Tip = "破镜也能重圆!";
                    MarryEvent?.Invoke(this, e);
                }

            }

            Couple = people;
            people.Couple = this;
        }