PDA

Просмотр полной версии : IPlayerStat



_79_dev
17.09.2013, 12:19
I found this piece of code on Japanese forums:

http://silkyskyjp.blogspot.ie/2013/05/il-2-sturmovik-cliffs-of-dover.html

It does works but seems that some features from this IPlyerStats class are not working properly or not working at all...
For exaample "bulletsFire" is not responding...

Anyone have experienced with it ???





private string GetDictionary<T>(Dictionary<string, T> ds)
{
StringBuilder sb = new StringBuilder();
foreach (string key in ds.Keys)
{
T d = ds[key];
if (sb.Length != 0)
{
sb.Append(", ");
}
//sb.AppnedFormat("[{0}]={1}", key, d);
}
return sb.ToString();
}

public string WritePlayerStat(Player player)
{
if (player is IPlayer)
{
IPlayerStat st = (player as IPlayer).GetBattleStat();
string stats = (String.Format("PlayerStat[{0}] bulletsFire={1}, landings={2}, kills={3}, fkills={4}, deaths={5}, bails={6}, ditches={7}, planeChanges={8}, planesWrittenOff={9}, netBattles={10}, singleBattles={11}, tccountry={12}, killsTypes=\"{13}\", tTotalTypes=\"{14}\"",
player.Name(), st.bulletsFire, st.landings, st.kills, st.fkills, st.deaths, st.bails, st.ditches, st.planeChanges, st.planesWrittenOff, st.netBattles, st.singleBattles, st.tccountry, GetDictionary(st.killsTypes), GetDictionary(st.tTotalTypes)));

return stats;
}
else
{
return string.Empty;
}
}