示例#1
0
 public frmKingdomRelationshipPolicyEditor(AMProject project, MBKingdom kingdom)
 {
     InitializeComponent();
     this.project = project;
     this.kingdom = kingdom;
     Text         = string.Format(Text, kingdom.name);
     LoadKingdomRelationships();
     LoadKingdomPolicy();
 }
示例#2
0
        private void FactionList_SelectKingdomChanged(MBKingdom kingdom, int index)
        {
            factionDetailsCtrl = new ucKingdomDetails(project, kingdom, factionListCtrl.State, index);
            panel2.Controls.Clear();
            panel2.Controls.Add(factionDetailsCtrl);
            factionDetailsCtrl.Dock = DockStyle.Fill;

            factionDetailsCtrl.SaveKingdomInfoFinished += FactionDetailsCtrl_SaveKingdomInfoFinished;
        }
 public void SetUp(Func <bool, List <MBSettlement> > getSettlementsFunc, bool payorMeetsRequirements = false)
 {
     _sut            = new BasicKingdomHostRequirementsComparerImpl();
     _mockHeroFinder = MockRepository.Create <HeroFinder>();
     _sut.HeroFinder = _mockHeroFinder.Object;
     _mockKingdom    = MockRepository.Create <MBKingdom>();
     _mockKingdom.SetupGet(Kingdom => Kingdom.Settlements)
     .Returns(getSettlementsFunc(payorMeetsRequirements));
     _kingdom = _mockKingdom.Object;
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            state = AddEditState.Add;

            factionList.Enabled = false;
            btnAdd.Enabled      = false;
            btnDelete.Enabled   = false;
            btnModify.Enabled   = false;

            MBKingdom kingdom = new MBKingdom();

            SelectKingdomChanged?.Invoke(kingdom, -1);
        }
 public frmKingdomRelationshipAddEdit(AMProject project, MBKingdom kingdom, bool isAddOrEdit, KingdomRelationship relationship = null)
 {
     InitializeComponent();
     this.project     = project;
     this.kingdom     = kingdom;
     this.isAddOrEdit = isAddOrEdit;
     if (!isAddOrEdit)
     {
         txtKingdom.Text    = relationship.kingdom;
         txtValue.Text      = relationship.value;
         chkIsAtWar.Checked = bool.Parse(relationship.isAtWar);
     }
 }
 public ucKingdomDetails(AMProject project, MBKingdom kingdom, AddEditState state, int index)
 {
     InitializeComponent();
     loadKingdomDetails(kingdom);
     this.state   = state;
     this.index   = index;
     this.project = project;
     if (state == AddEditState.Add || state == AddEditState.Edit)
     {
         btnSave.Enabled = true;
     }
     else if (state == AddEditState.View)
     {
         btnSave.Enabled = false;
     }
 }
示例#7
0
 private void FactionDetailsCtrl_SaveKingdomInfoFinished(MBKingdom savedKingdom, AddEditState state, int index)
 {
     if (state == AddEditState.Add)
     {
         kingdoms.Kingdoms.Add(savedKingdom);
         XmlObjectLoader xmlObjectLoader = new XmlObjectLoader(kingdoms.FilePath);
         xmlObjectLoader.Save(kingdoms);
         factionListCtrl.ChangeAddEditState(AddEditState.View);
         factionListCtrl.RefreshData();
     }
     else if (state == AddEditState.Edit)
     {
         kingdoms.Kingdoms[index] = savedKingdom;
         XmlObjectLoader xmlObjectLoader = new XmlObjectLoader(kingdoms.FilePath);
         xmlObjectLoader.Save(kingdoms);
         factionListCtrl.ChangeAddEditState(AddEditState.View);
         factionListCtrl.RefreshData();
     }
 }
 private void loadKingdomDetails(MBKingdom kingdom)
 {
     this.kingdom              = kingdom;
     txtAlternativeColor.Text  = kingdom.alternative_color;
     txtAlternativeColor2.Text = kingdom.alternative_color2;
     txtBannerKey.Text         = kingdom.banner_key;
     txtColor.Text             = kingdom.color;
     txtColor2.Text            = kingdom.color2;
     txtCulture.Text           = kingdom.culture;
     txtFlagMesh.Text          = kingdom.flag_mesh;
     txtID.Text                       = kingdom.id;
     txtIntroduction.Text             = kingdom.text;
     txtLabelColor.Text               = kingdom.label_color;
     txtName.Text                     = kingdom.name;
     txtOwner.Text                    = kingdom.owner;
     txtPrimaryBannerColor.Text       = kingdom.primary_banner_color;
     txtRulerTitle.Text               = kingdom.ruler_title;
     txtSecondaryBannerlordColor.Text = kingdom.secondary_banner_color;
     txtSettlementBannerMesh.Text     = kingdom.settlement_banner_mesh;
     txtShortName.Text                = kingdom.short_name;
     txtTitle.Text                    = kingdom.title;
 }
 protected override bool MeetsRequirements(MBKingdom kingdom) =>
 !kingdom.Settlements.IsEmpty() &&
 kingdom.Settlements.FindIndex(
     (settlement) => settlement.IsTown &&
     PayorMeetsRequirements(settlement.OwnerClan.Leader)
     ) != -1;
 private void UcKingdomList_SelectKingdomChanged(MBKingdom kingdom, int index)
 {
     selectedKingdom = kingdom;
 }
 public new bool MeetsRequirements(MBKingdom Kingdom) => base.MeetsRequirements(Kingdom);