Example #1
0
 public void FinalizeSetup(App game, AvailablePlayerFeatures availableFeatures)
 {
     if (string.IsNullOrEmpty(this.Faction))
     {
         this.Faction = App.GetSafeRandom().Choose <Kerberos.Sots.PlayerFramework.Faction>(availableFeatures.Factions.Keys).Name;
     }
     Kerberos.Sots.PlayerFramework.Faction faction = game.AssetDatabase.GetFaction(this.Faction);
     if (string.IsNullOrEmpty(this.Name))
     {
         this.Name = "Player";
     }
     if (string.IsNullOrEmpty(this.EmpireName))
     {
         this.EmpireName = AssetDatabase.CommonStrings.Localize(faction.EmpireNames.GetNextStringID());
     }
     if (string.IsNullOrEmpty(this.Avatar))
     {
         this.Avatar = Path.GetFileNameWithoutExtension(availableFeatures.Factions[faction].Avatars.TakeRandom());
     }
     if (string.IsNullOrEmpty(this.Badge))
     {
         this.Badge = Path.GetFileNameWithoutExtension(availableFeatures.Factions[faction].Badges.TakeRandom());
     }
     if (this.EmpireColor.HasValue)
     {
         return;
     }
     this.EmpireColor = new int?(availableFeatures.EmpireColors.TakeRandom());
 }
Example #2
0
        public string GetAvatarTextureAssetPath(AssetDatabase assetdb)
        {
            if (string.IsNullOrEmpty(this.Avatar) || string.IsNullOrEmpty(this.Faction))
            {
                return(string.Empty);
            }
            Kerberos.Sots.PlayerFramework.Faction faction = assetdb.GetFaction(this.Faction);
            if (faction == null)
            {
                return(string.Empty);
            }
            string path = ((IEnumerable <string>)faction.AvatarTexturePaths).FirstOrDefault <string>((Func <string, bool>)(x => Path.GetFileNameWithoutExtension(x).ToLowerInvariant() == this.Avatar.ToLowerInvariant()));

            if (path == null)
            {
                return(string.Empty);
            }
            return(Path.Combine("factions", faction.Name, "avatars", Path.GetFileNameWithoutExtension(path) + ".tga"));
        }