本文整理汇总了C#中db.Database.GetArenaLeaderboards方法的典型用法代码示例。如果您正苦于以下问题:C# Database.GetArenaLeaderboards方法的具体用法?C# Database.GetArenaLeaderboards怎么用?C# Database.GetArenaLeaderboards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db.Database
的用法示例。
在下文中一共展示了Database.GetArenaLeaderboards方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleRequest
protected override void HandleRequest()
{
string result = "";
using (Database dbx = new Database())
{
Account acc = dbx.Verify(Query["guid"], Query["password"], Program.GameData);
if (String.IsNullOrEmpty(Query["guid"]) ||
String.IsNullOrEmpty(Query["password"]) ||
String.IsNullOrEmpty(Query["type"]) ||
acc == null)
{
Context.Response.StatusCode = 400;
result = "<Error>Invalid GUID/password combination</Error>";
}
else
{
string[][] ranks = dbx.GetArenaLeaderboards(Query["type"], acc);
result += "<ArenaRecords>";
foreach (string[] i in ranks)
{
MySqlCommand cmd = dbx.CreateQuery();
cmd.CommandText = "select skin, tex1, tex2, items, charType, petId from characters where charid = @charid";
cmd.Parameters.AddWithValue("@charid", i[2]);
string skin, tex1, tex2, inventory, cclass, petid;
skin = tex1 = tex2 = inventory = cclass = petid = null;
using (MySqlDataReader drdr = cmd.ExecuteReader())
{
while (drdr.Read())
{
skin = drdr.GetString("skin");
tex1 = drdr.GetString("tex1");
tex2 = drdr.GetString("tex2");
inventory = drdr.GetString("items");
cclass = drdr.GetString("charType");
petid = drdr.GetString("petId");
}
}
var _pet = dbx.GetPet(int.Parse(petid), acc);
result += $"<Record><WaveNumber>{i[0]}</WaveNumber><Time>{i[4]}</Time><PlayData><CharacterData>";
if (acc.Guild.Name != null) result += [email protected]"<GuildName>{acc.Guild.Name}</GuildName><GuildRank>{acc.Guild.Rank}</GuildRank>";
result += $"<Id>{i[2]}</Id><Texture>{skin}</Texture><Tex1>{tex1}</Tex1><Tex2>{tex2}</Tex2><Inventory>{inventory}</Inventory><Name>{acc.Name}</Name><Class>{cclass}</Class></CharacterData>";
result += "<Pet name=\"" + _pet.SkinName + "\" type=\"" + _pet.Type + "\" instanceId=\"" + _pet.InstanceId + "\" rarity=\"" + _pet.Rarity + "\" maxAbilityPower=\"" + _pet.MaxAbilityPower + "\" skin=\"" + _pet.Skin + "\" family=\"" + "Farm" + "\"><Abilities>";
for (int e = 0; e < 3; e++)
result += "<Ability type=\"" + _pet.Abilities[e].Type + "\" power=\"" + _pet.Abilities[e].Power + "\" points=\"" + _pet.Abilities[e].Points + "\"/>";
result += "</Abilities></Pet></PlayData></Record>";
}
result += "</ArenaRecords>";
}
}
byte[] buf = Encoding.UTF8.GetBytes(result);
Context.Response.ContentType = "text/*";
Context.Response.OutputStream.Write(buf, 0, buf.Length);
}
示例2: HandleRequest
protected override void HandleRequest()
{
string result = "";
using (Database dbx = new Database())
{
Account acc = dbx.Verify(Query["guid"], Query["password"], Program.GameData);
if (String.IsNullOrEmpty(Query["guid"]) ||
String.IsNullOrEmpty(Query["password"]) ||
String.IsNullOrEmpty(Query["type"]) ||
acc == null)
{
Context.Response.StatusCode = 400;
result = "<Error>Invalid GUID/password combination</Error>";
}
else
{
string[][] ranks = dbx.GetArenaLeaderboards(Query["type"], acc);
result += "<ArenaRecords>";
foreach (string[] i in ranks)
{
MySqlCommand cmd = dbx.CreateQuery();
cmd.CommandText =
"SELECT 'skin','tex1','tex2','inventory','class' FROM characters WHERE charid = @charid";
cmd.Parameters.AddWithValue("@charid", i[2]);
string skin, tex1, tex2, inventory, cclass;
skin = tex1 = tex2 = inventory = cclass = null;
using (MySqlDataReader drdr = cmd.ExecuteReader())
{
while (drdr.Read())
{
skin = drdr.GetString("skin");
tex1 = drdr.GetString("tex1");
tex2 = drdr.GetString("tex2");
inventory = drdr.GetString("inventory");
cclass = drdr.GetString("class");
}
}
cmd = dbx.CreateQuery();
cmd.CommandText =
"SELECT 'skin','tex1','tex2','inventory','class' FROM characters WHERE charid = @charid";
cmd.Parameters.AddWithValue("@charid", i[2]);
using (MySqlDataReader drdr = cmd.ExecuteReader())
{
while (drdr.Read())
{
skin = drdr.GetString("skin");
tex1 = drdr.GetString("tex1");
tex2 = drdr.GetString("tex2");
inventory = drdr.GetString("inventory");
cclass = drdr.GetString("class");
}
}
result += "<Record>";
//wave number
result += "<WaveNumber>" + i[0] + "</WaveNumber>";
//playtime
result += "<Time>" + i[4] + "</Time>";
result += "<PlayData>";
result += "<CharacterData>";
result += "<GuildName>" + acc.Guild.Name + "</GuildName>";
result += "<GuildRank>" + acc.Guild.Rank + "</GuildRank>";
result += "<Id>" + i[2] + "</Id>";
result += "<Texture>" + skin + "</Texture>";
result += "<Invantory>" + inventory + "</Inventory>";
result += "<Name>" + acc.Name + "</Name>";
result += "<Class>" + cclass + "</Class>";
result += "</CharacterData>";
result += "<Pet name=\"" +
"\" type=\"" +
"\" instanceId=\"" +
"\" rarity=\"" +
"\" maxAbilityPower=\"" +
"\" skin=\"" +
"\" family=\"" +
"\">";
result += "<Abilities>";
result += "</Abilities>";
result += "</Pet>";
result += "</PlayData>";
result += "</Record>";
}
result += "</ArenaRecords";
}
}
byte[] buf = Encoding.UTF8.GetBytes(result);
Context.Response.OutputStream.Write(buf, 0, buf.Length);
}