public NewFactionWindow(bool editing, DataGrid dataGrid, GameScenario scen) { this.scen = scen; edit = editing; InitializeComponent(); faction = new Faction(); if (editing) { //faction2 = JsonConvert.DeserializeObject<Faction>(JsonConvert.SerializeObject(scen.Factions.GetGameObject(int.Parse(((DataRowView)dataGrid.SelectedItem).Row["ID"].ToString())) as Faction)) ; faction = scen.Factions.GetGameObject(int.Parse(((DataRowView)dataGrid.SelectedItem).Row["ID"].ToString())) as Faction; } else { faction.Name = "新势力"; faction.ID = scen.Factions.GetFreeGameObjectID(); faction.ColorIndex = 52; faction.guanjue = 0; faction.BaseMilitaryKindsString = "0 1 3"; faction.UpgradingTechnique = -1; faction.TransferingMilitaries = new MilitaryList(); faction.TransferingMilitariesString = ""; faction.TransferingMilitaryCount = 0; faction.AvailableTechniquesString = ""; faction.PreferredTechniqueKinds = new List <int>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; faction.PlanTechniqueString = -1; faction.GetGeneratorPersonCountString = "0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0"; faction.InformationsString = ""; faction.LegionsString = ""; faction.MilitariesString = ""; faction.RoutewaysString = ""; faction.SectionsString = ""; faction.TroopListString = ""; } //this.Closed += NewFactionWindow_Closed; leadertemp = this.faction.Leader; princetemp = this.faction.Prince; architectureListtemp = this.faction.Architectures; capitaltemp = this.faction.Capital; availableTechniquestemp = faction.AvailableTechniques; baseMilitaryKindstemp = faction.BaseMilitaryKinds; coloridtemp = faction.ColorIndex; guanjuezhitemp = faction.guanjue; BtFcationColor.Background = new SolidColorBrush(Color.FromArgb(scen.GameCommonData.AllColors[this.faction.ColorIndex].A, scen.GameCommonData.AllColors[this.faction.ColorIndex].R, scen.GameCommonData.AllColors[this.faction.ColorIndex].G, scen.GameCommonData.AllColors[this.faction.ColorIndex].B)); InitArchis(); InitTechniques(); InitMilkinds(); InitDipRelations(); txname.Text = this.faction.Name; btleader.Content = leadertemp; btPrince.Content = princetemp; txTechniquePoint.Text = this.faction.TechniquePoint.ToString(); txReputation.Text = this.faction.Reputation.ToString(); txgongxiandu.Text = this.faction.chaotinggongxiandu.ToString(); btguanjuezi.Content = this.faction.guanjuezifuchuan; btCapital.Content = this.faction.Capital; cmUpingTec.SelectedIndex = this.faction.UpgradingTechnique; txleftdays.Text = this.faction.UpgradingDaysLeft.ToString(); cbIsAlien.IsChecked = this.faction.IsAlien; cbNoPSelectable.IsChecked = this.faction.NotPlayerSelectable; //txname.SetBinding(TextBox.TextProperty, new Binding("Name") { Source = faction }); //btleader.SetBinding(Button.ContentProperty, new Binding("Leader") { Source = faction }); //btPrince.SetBinding(Button.ContentProperty, new Binding("Prince") { Source = faction }); //txTechniquePoint.SetBinding(TextBox.TextProperty, new Binding("TechniquePoint") { Source = faction }); //txReputation.SetBinding(TextBox.TextProperty, new Binding("Reputation") { Source = faction }); //txgongxiandu.SetBinding(TextBox.TextProperty, new Binding("chaotinggongxiandu") { Source = faction }); //btguanjuezi.SetBinding(Button.ContentProperty, new Binding("guanjuezifuchuan") { Source = faction }); //btCapital.SetBinding(Button.ContentProperty, new Binding("Capital") { Source = faction }); //cmUpingTec.SelectedIndex = faction.UpgradingTechnique; //txleftdays.SetBinding(TextBox.TextProperty, new Binding("UpgradingDaysLeft") { Source = faction }); //cbIsAlien.SetBinding(CheckBox.IsCheckedProperty, new Binding("IsAlien") { Source = faction }); //cbNoPSelectable.SetBinding(CheckBox.IsCheckedProperty, new Binding("NotPlayerSelectable") { Source = faction}); // btleader.Content = faction.Leader; }
public void Init() { MilitaryKinds = new MilitaryKindTable(); }