public static MPCombatant CreateParty(BattleSideEnum side, BasicCultureObject culture, TeamConfig teamConfig, bool isPlayerTeam) { bool isAttacker = side == BattleSideEnum.Attacker; uint color1 = Utility.BackgroundColor(culture, isAttacker); uint color2 = Utility.ForegroundColor(culture, isAttacker); var combatant = new MPCombatant(side, teamConfig.TacticLevel, culture, new Tuple <uint, uint>(color1, color2), new Banner(culture.BannerKey, color1, color2)); if (teamConfig.HasGeneral) { if (teamConfig.General is MPCharacterConfig general) { combatant.AddCharacter( new MPSpawnableCharacter(general, (int)general.CharacterObject.DefaultFormationClass, general.FemaleRatio > 0.5, isPlayerTeam), 1); } } for (int i = 0; i < teamConfig.Troops.Troops.Length; ++i) { var troopConfig = teamConfig.Troops.Troops[i]; var mpCharacter = troopConfig.Character as MPCharacterConfig; if (mpCharacter == null) { continue; } var femaleCount = (int)(troopConfig.Number * mpCharacter.FemaleRatio + 0.49); var maleCount = troopConfig.Number - femaleCount; combatant.AddCharacter(new MPSpawnableCharacter(mpCharacter, i, true), femaleCount); combatant.AddCharacter(new MPSpawnableCharacter(mpCharacter, i, false), maleCount); } return(combatant); }
public void SetConfig(TeamConfig teamConfig, CharacterConfig config, bool isAttacker) { Config = config; OnSetConfig(config); Characters.SelectedIndex = -1; Characters.SelectedIndex = CharactersInCurrentGroup.FindIndex(c => c.StringId == Config.Character.StringId); Character.SetConfig(teamConfig, Config, isAttacker); }
public CharacterSelectionData(TeamConfig teamConfig, CharacterConfig config, bool isAttacker, Action <CharacterConfig> selectAction, bool pauseGameActiveState) { TeamConfig = teamConfig; Config = config; IsAttacker = isAttacker; SelectAction = selectAction; PauseGameActiveState = pauseGameActiveState; }
public void Init(TeamConfig config) { this.configReference = config; this.Name = configReference.name; this.Score = configReference.score; this.Coach = configReference.coach; this.Color = configReference.color; }
public TroopVM(TeamConfig teamConfig, TroopConfig config, TextObject troopRole, bool isPlayerSide, BattleTypeConfig battleTypeConfig) { _config = config; CharacterButton = new CharacterButtonVM(teamConfig, _config.Character, troopRole, isPlayerSide, battleTypeConfig); NumberText = new TextVM(GameTexts.FindText("str_ebt_number")); Number = new NumberVM <int>(config.Number, 0, 5000, true); Number.OnValueChanged += number => config.Number = number; InvalidText = new TextVM(GameTexts.FindText("str_ebt_invalid")); }
private void ScoreChanged(ModernWpf.Controls.NumberBox sender, ModernWpf.Controls.NumberBoxValueChangedEventArgs args) { TeamConfig config = (string)sender.Tag == "Blue" ? BroadcastHubController.ClientConfig.frontend.blueTeam : BroadcastHubController.ClientConfig.frontend.redTeam; if (args.NewValue != config.score) { config.score = (int)args.NewValue; BroadcastHubController.UpdateConfig(); } }
public Team(BeepLiveGame beepLiveGame, TeamConfig teamConfig) { BeepLiveGame = beepLiveGame; TeamConfig = teamConfig; Players = new List <Player>(teamConfig.MaxPlayers); VoxelType = new VoxelType { OwnerTeam = this, Color = teamConfig.Color, Resistance = teamConfig.TerritoryResistance }; }
private void ColorChanged(object sender, TextChangedEventArgs e) { TextBox textBox = sender as TextBox; TeamConfig config = (string)textBox.Tag == "Blue" ? BroadcastHubController.ClientConfig.frontend.blueTeam : BroadcastHubController.ClientConfig.frontend.redTeam; if (textBox.Text != config.color) { config.color = textBox.Text; BroadcastHubController.UpdateConfig(); } }
public static void FillPartyMembers(PartyBase party, BattleSideEnum side, BasicCultureObject culture, TeamConfig teamConfig, bool isPlayerTeam) { party.MemberRoster.Clear(); party.MemberRoster.Add(new[] { new FlattenedTroopRosterElement(GetCharacterObject(teamConfig.General.CharacterObject), teamConfig.HasGeneral ? RosterTroopState.Active : RosterTroopState.WoundedInThisBattle) }); party.MemberRoster.Add(teamConfig.Troops.Troops.Select(troopConfig => new FlattenedTroopRosterElement(GetCharacterObject(troopConfig.Character.CharacterObject)))); }
public static BasicCultureObject GetCulture(TeamConfig config) { if (config.HasGeneral) { return(config.General.Character.Culture); } else { return(config.Troops.Troops.FirstOrDefault(troopConfig => troopConfig.Number != 0)?.Character.Character .Culture ?? Game.Current.ObjectManager.GetObject <BasicCultureObject>(culture => true)); } }
public override void SetConfig(TeamConfig teamConfig, CharacterConfig config, bool isAttacker) { if (!(config is SPCharacterConfig spConfig)) { return; } _teamConfig = teamConfig; _config = spConfig; _isAttacker = isAttacker; FemaleRatio.Value = _config.FemaleRatio; SetCharacterToViewModel(); }
public static List <CharacterObject> OrderHeroesByPriority(TeamConfig teamConfig) { var characters = teamConfig.Troops.Troops .Select(troopConfig => troopConfig.Character); if (teamConfig.HasGeneral) { characters = characters.Prepend(teamConfig.General); } return(characters.Select(character => character.CharacterObject as CharacterObject) .Where(character => character != null && character.IsHero).Select(character => character.HeroObject) .ToList().ConvertAll(hero => hero.CharacterObject)); }
private void UpdateTeamInfo(List <long> userIds, TeamConfig userConfig) { var sqlList = new List <string>(); IEnumerable <BatchParameter> batchParameters = new List <BatchParameter>(); foreach (var userId in userIds) { var userMap = GetSingle(userId); if (userMap != null) { // 设置当前会员的直推数量和子会员数据为空 var sql = $"update User_UserMap set LevelNumber=0 , ChildNode='',TeamNumber=0 where UserId={userId}"; sqlList.Add(sql); var parentMap = new List <ParentMap>(); try { parentMap = userMap.ParentMap.DeserializeJson <List <ParentMap> >(); } catch (Exception ex) { // 组织架构图数据出错处理 Console.WriteLine(ex.Message); userMap.ParentMap = new List <ParentMap>().ToJson(); // 默认值 UpdateMap(userMap.UserId, userMap.ParentMap); parentMap = userMap.ParentMap.DeserializeJson <List <ParentMap> >(); } // 更新直推会员数量 var parentUser = parentMap?.FirstOrDefault(r => r.ParentLevel == 1); // 直推用户Id if (parentUser != null) { sql = $"update User_UserMap set LevelNumber=LevelNumber+1 where UserId={parentUser.UserId}"; sqlList.Add(sql); } // 更新团队有效人数的会员数 var teamUserIds = parentMap.Where(r => r.ParentLevel <= userConfig.TeamLevel).Select(r => r.UserId) .ToList(); if (teamUserIds.Count > 0) { sql = $"update User_UserMap set TeamNumber=TeamNumber+1 ,ChildNode=ChildNode+',{userId}' where UserId in ({teamUserIds.ToSqlString()})"; sqlList.Add(sql); } } } var count = RepositoryContext.ExecuteSqlList(sqlList); }
public override void SetConfig(TeamConfig teamConfig, CharacterConfig config, bool isAttacker) { if (!(config is MPCharacterConfig mpConfig)) { return; } _config = mpConfig; _isAttacker = isAttacker; FirstPerks.SelectedIndex = _config.SelectedFirstPerk; SecondPerks.SelectedIndex = _config.SelectedSecondPerk; IsHero.Value = _config.IsHero; FemaleRatio.Value = _config.FemaleRatio; SetCharacterToViewModel(); }
public static SPCombatant CreateParty(PartyBase party, BattleSideEnum side, BasicCultureObject culture, TeamConfig teamConfig, bool isPlayerTeam) { party.Owner = null; if (teamConfig.HasGeneral) { var characterObject = (teamConfig.General as SPCharacterConfig)?.ActualCharacterObject; if (characterObject?.IsHero ?? false) { party.Owner = characterObject.HeroObject; } } Utility.FillPartyMembers(party, side, culture, teamConfig, isPlayerTeam); bool isAttacker = side == BattleSideEnum.Attacker; var combatant = new SPCombatant(party, side, teamConfig.TacticLevel, culture, new Tuple <uint, uint>(teamConfig.Color1, teamConfig.Color2), teamConfig.Banner); if (teamConfig.HasGeneral) { if (teamConfig.General is SPCharacterConfig general) { combatant.AddCharacter( new SPSpawnableCharacter(general, (int)general.CharacterObject.DefaultFormationGroup, general.FemaleRatio > 0.5, isPlayerTeam), 1); } } for (int i = 0; i < teamConfig.Troops.Troops.Length; ++i) { var troopConfig = teamConfig.Troops.Troops[i]; if (troopConfig.Character is SPCharacterConfig spCharacter) { var femaleCount = (int)(troopConfig.Number * spCharacter.FemaleRatio + 0.49); var maleCount = troopConfig.Number - femaleCount; combatant.AddCharacter(new SPSpawnableCharacter(spCharacter, i, true), femaleCount); combatant.AddCharacter(new SPSpawnableCharacter(spCharacter, i, false), maleCount); } } return(combatant); }
public abstract void SetConfig(TeamConfig teamConfig, CharacterConfig config, bool isAttacker);
public ChampSelectTeamViewModel(TeamConfig config) { this.configReference = config; }