private static void MarryHero(Hero hero)
        {
            if (Hero.MainHero.Spouse == hero || Hero.MainHero.ExSpouses.Contains(hero))
            {
                return;
            }
            //1.4.3 结婚后,第二个英雄状态会变成逃亡状态,并且会被所在部队移除, 所在部队还会解散。

            Hero mainSpouse = Hero.MainHero.Spouse;

            bool needAddPlayerTroop = true;

            if (Hero.MainHero.PartyBelongedTo.MemberRoster.Contains(hero.CharacterObject))
            {
                Hero.MainHero.PartyBelongedTo.MemberRoster.RemoveTroop(hero.CharacterObject, 1);
            }
            if (hero.PartyBelongedTo != null)
            {
                MobileParty partyBelongedTo = hero.PartyBelongedTo;
                partyBelongedTo.MemberRoster.RemoveTroop(hero.CharacterObject, 1);
                partyBelongedTo.RemoveParty();
                //partyBelongedTo.Party.Owner = partyBelongedTo.MemberRoster.First().Character;
            }



            if (null == hero.Clan)
            {
                hero.Clan = Hero.MainHero.Clan;
            }
            MarriageAction.Apply(Hero.MainHero, hero);
            hero.ChangeState(Hero.CharacterStates.Active);
            if (needAddPlayerTroop)
            {
                Hero.MainHero.PartyBelongedTo.MemberRoster.AddToCounts(hero.CharacterObject, 1);
            }


            SpouseOperation.RemoveRepeatExspouses(Hero.MainHero, Hero.MainHero.Spouse);

            TextObject textObject = GameTexts.FindText("sue_more_spouses_marry_target", null);

            StringHelpers.SetCharacterProperties("SUE_HERO", hero.CharacterObject, null, textObject);
            InformationManager.AddQuickInformation(textObject, 0, null, "event:/ui/notification/quest_finished");

            if (null != mainSpouse)
            {
                SpouseOperation.SetPrimarySpouse(mainSpouse);
            }
        }
Пример #2
0
 public void SetPrimarySpouse()
 {
     if (this._selectedHero == Hero.MainHero.Spouse)
     {
         return;
     }
     SpouseOperation.SetPrimarySpouse(this._selectedHero);
     this.IsNotPrimarySpouse = false;
     if (null != this._currentSpouseView)
     {
         this._currentSpouseView.RefreshValues();
     }
     if (null != this._lastPrimaryView)
     {
         this._lastPrimaryView.RefreshValues();
     }
     this._lastPrimaryView = this._currentSpouseView;
 }
Пример #3
0
        public void GetPregnancy()
        {
            if (this._selectedHero.IsPregnant)
            {
                return;
            }

            SpouseOperation.GetPregnancyForHero(Hero.MainHero, this._selectedHero);
            if (Hero.MainHero.IsFemale && !Hero.MainHero.IsPregnant)
            {
                SpouseOperation.GetPregnancyForHero(this._selectedHero, Hero.MainHero);
            }
            this.CanGetPregnancy = false;
            if (null != this._currentSpouseView)
            {
                this._currentSpouseView.RefreshValues();
            }
        }
Пример #4
0
        public void OnDivorceClick()
        {
            if (null == this.SelectedCharacter)
            {
                return;
            }
            TextObject textObject = GameTexts.FindText("sms_divorce_sure", null);

            StringHelpers.SetCharacterProperties("SUE_HERO", this._selectedHero.CharacterObject, null, textObject);
            InquiryData inquiryData = new InquiryData(textObject.ToString(), string.Empty, true, true,
                                                      GameTexts.FindText("sms_sure", null).ToString(),
                                                      GameTexts.FindText("sms_cancel", null).ToString(), () =>
            {
                SpouseOperation.Divorce(this._selectedHero);
            }, null);

            InformationManager.ShowInquiry(inquiryData, false);
        }