本文整理汇总了C#中Stats.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Stats.ToString方法的具体用法?C# Stats.ToString怎么用?C# Stats.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
int numPlayers, numGames;
do
{
Console.Write("\n How ay players (2-8)? ");
} while (!int.TryParse(Console.ReadKey().KeyChar.ToString(), out numPlayers) || numPlayers < 2 || numPlayers > 8);
do
{
Console.Write("\nHow many games (1-100,000)? ");
} while (!int.TryParse(Console.ReadLine(), out numGames) || numGames < 1
|| numPlayers > 100000);
Console.WriteLine();
Player[] players = new Player[numPlayers];
players[0] = new Player("You");
for (int i = 1; i < numPlayers; i++) {
players[i] = new Player(String.Format("CPU {0}", i));
}
Stats stats = new Stats(players);
string numFormat = "{0:" + String.Join("", Enumerable.Repeat(0,
(int)Math.Log10((double) numGames) + 1).ToArray()) + "}";
for (int i = 1; i <= numGames; i++) {
new HoldEm(players, ref stats).Play();
Console.Write("\rplaying: " + numFormat + "/{1} @ {2} games /sec", i, numGames,
(int)((double)i/222));
}
Console.Write("\r \r");
Console.WriteLine(stats.ToString());
Console.ReadKey();
}
示例2: AllowMarriage
// Externalized to Woohooer
public static string AllowMarriage(SimDescription actor, SimDescription target, bool autonomous)
{
try
{
if (sMain == null) return null;
Stats stats = new Stats(Main.Romances);
if (!Main.Romances.AllowMarriage(Main.Romances, actor, target, autonomous ? Manager.AllowCheck.None : Manager.AllowCheck.UserDirected))
{
return stats.ToString();
}
return null;
}
catch (Exception e)
{
Common.Exception(actor, target, e);
return null;
}
}
示例3: CanFriendInteract
// Externalized to Woohooer
public static string CanFriendInteract(SimDescription actor, SimDescription target, bool autonomous)
{
try
{
if (sMain == null) return null;
Stats stats = new Stats(Main.Friends);
if (!Main.Friends.AllowFriend(stats, actor, target, autonomous ? Manager.AllowCheck.None : Manager.AllowCheck.UserDirected))
{
return stats.ToString();
}
if (!Main.Friends.AllowEnemy(stats, actor, target, autonomous ? Manager.AllowCheck.None : Manager.AllowCheck.UserDirected))
{
return stats.ToString();
}
return null;
}
catch (Exception e)
{
Common.Exception(actor, target, e);
return null;
}
}
示例4: AllowRomance
// Externalized to Woohooer
public static string AllowRomance(SimDescription sim, bool autonomous)
{
try
{
if (sMain == null) return null;
Stats stats = new Stats(Main.Romances);
if (!Main.Romances.Allow(stats, sim, autonomous ? Manager.AllowCheck.None : Manager.AllowCheck.UserDirected))
{
return stats.ToString();
}
return null;
}
catch (Exception e)
{
Common.Exception(sim, e);
return null;
}
}
示例5: AllowImpregnation
// Externalized to Woohooer
public static string AllowImpregnation(SimDescription sim, bool autonomous)
{
try
{
if (sMain == null) return null;
Stats stats = new Stats(Main.Pregnancies);
if (autonomous)
{
int maximum = Main.GetValue<MaximumNumberOfChildrenOption, int>(sim);
if (maximum > 0)
{
if (Relationships.GetChildren(sim).Count >= maximum)
{
return "Maximum Children";
}
}
if (!Main.Pregnancies.TestCooldown(stats, sim))
{
return stats.ToString();
}
}
if (!Main.Pregnancies.AllowImpregnation(stats, sim, autonomous ? Manager.AllowCheck.None : Manager.AllowCheck.UserDirected))
{
return stats.ToString();
}
return null;
}
catch (Exception e)
{
Common.Exception(sim, e);
return null;
}
}
示例6: ProcessEquipLineTest
public void ProcessEquipLineTest()
{
for (int m_i = 0; m_i < m_TestLineArray.Length; m_i++)
{
string line = m_TestLineArray[m_i];
Stats stats = new Stats();
bool isArmory = false;
if (null != line)
{
SpecialEffects.ProcessEquipLine(line, stats, isArmory, 0, 0);
string szExpected = m_ExpectedArray[m_i].ToString();
string szStats = stats.ToString();
Assert.AreEqual(szExpected, szStats, line);
}
}
}
示例7: GetStatSummary
public static Stats GetStatSummary(string playerName)
{
if(string.IsNullOrEmpty(playerName) || string.IsNullOrWhiteSpace(playerName))
{
return null;
}
WebClient client = new WebClient();
var stats = new Stats();
string htmlString = string.Empty;
htmlString = client.DownloadString("http://www.lolskill.net/summoner/NA/" + playerName);
var solo5V5Container = GetStringInBetween(Tags["summary.solo5v5"], htmlString);
var tier = GetStringInBetween(Tags["summary.solo5v5.tier"], solo5V5Container);
if (tier.Contains("Unranked"))
{
stats.Name = playerName;
stats.Division = "Unranked";
return stats;
}
var leaguePoints = GetStringInBetween(Tags["summary.solo5v5.leaguepoints"], solo5V5Container).TrimEnd(new [] {'L','e','a', 'g', 'u', 'e', 'P', 'o', 'i', 'n','t','s', ' '});
var kdaString = GetStringInBetween(Tags["summary.solo5v5.kda"], solo5V5Container);
string wins = GetStringInBetween(Tags["summary.solo5v5.wins"], solo5V5Container);
string losses = GetStringInBetween(Tags["summary.solo5v5.losses"], solo5V5Container);
var name = playerName;
if(string.IsNullOrEmpty(solo5V5Container))
{
return null;
}
stats.LeaguePoints = int.Parse(leaguePoints);
stats.Division = tier;
int parsedWins;
var winsParsed = int.TryParse(wins, out parsedWins);
stats.Wins = winsParsed ? parsedWins : 0;
int parsedLosses;
var lossesParsed = int.TryParse(losses, out parsedLosses);
stats.Losses = lossesParsed ? parsedLosses : 0;
var kda = kdaString.Substring(0, 3);
var kdaAverages = kdaString.Substring(kdaString.IndexOf("–", StringComparison.Ordinal) + 8);
var kdaStatString = $"{kda} KD | {kdaAverages} Per Game";
stats.Kda = kdaStatString;
stats.Name = name;
Lookup.LookupPage.WriteToLog(stats.ToString());
return stats;
}
示例8: AddKey
/// <summary>
/// Adds a key to the stat list.
/// </summary>
/// <param name="stat">Key</param>
/// <param name="value">Default value.</param>
private void AddKey(Stats stat, float value)
{
Debug.Log("Adding key for " + stat.ToString());
statList.Add(stat, value);
}