本文整理汇总了C#中Hearthstone_Deck_Tracker.Stats.GameStats类的典型用法代码示例。如果您正苦于以下问题:C# GameStats类的具体用法?C# GameStats怎么用?C# GameStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameStats类属于Hearthstone_Deck_Tracker.Stats命名空间,在下文中一共展示了GameStats类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddGameDialog
public AddGameDialog(GameStats game)
{
InitializeComponent();
_tcs = new TaskCompletionSource<GameStats>();
_editing = true;
_game = game;
if(game == null)
return;
ComboBoxResult.SelectedItem = game.Result;
HeroClass heroClass;
if(Enum.TryParse(game.OpponentHero, out heroClass))
ComboBoxOpponent.SelectedItem = heroClass;
ComboBoxMode.SelectedItem = game.GameMode;
ComboBoxRegion.SelectedItem = game.Region;
if(game.GameMode == GameMode.Ranked)
TextBoxRank.Text = game.Rank.ToString();
TextBoxRank.IsEnabled = game.GameMode == GameMode.Ranked;
ComboBoxCoin.SelectedItem = game.Coin ? YesNo.Yes : YesNo.No;
ComboBoxConceded.SelectedItem = game.WasConceded ? YesNo.Yes : YesNo.No;
TextBoxTurns.Text = game.Turns.ToString();
TextBoxDuration.Text = game.Duration;
TextBoxDuration.IsEnabled = false;
TextBoxNote.Text = game.Note;
TextBoxOppName.Text = game.OpponentName;
BtnSave.Content = "save";
}
开发者ID:karimsah,项目名称:Hearthstone-Deck-Tracker,代码行数:26,代码来源:AddGameDialog.xaml.cs
示例2: Upload
public static async Task<bool> Upload(string[] logLines, GameMetaData gameMetaData, GameStats game)
{
var log = string.Join(Environment.NewLine, logLines);
var item = new UploaderItem(log.GetHashCode());
if(InProgress.Contains(item))
{
Log.Info($"{item.Hash} already in progress. Waiting for it to complete...");
InProgress.Add(item);
return await item.Success;
}
InProgress.Add(item);
Log.Info($"Uploading {item.Hash}...");
var success = false;
try
{
success = await TryUpload(logLines, gameMetaData, game, true);
}
catch(Exception ex)
{
Log.Error(ex);
Influx.OnGameUploadFailed();
}
Log.Info($"{item.Hash} complete. Success={success}");
foreach(var waiting in InProgress.Where(x => x.Hash == item.Hash))
waiting.Complete(success);
InProgress.RemoveAll(x => x.Hash == item.Hash);
return success;
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:28,代码来源:LogUploader.cs
示例3: Apply
public string Apply(GameStats game)
{
var name = "";
foreach(var token in Pattern)
{
var tokenLower = token.ToLower();
if(tokenLower == "{playerclass}")
{
name += game.PlayerHero;
}
else if(tokenLower == "{opponentclass}")
{
name += game.OpponentHero;
}
else if(tokenLower == "{playername}")
{
name += game.PlayerName;
}
else if(tokenLower == "{opponentname}")
{
name += game.OpponentName;
}
else if(tokenLower.Contains("{date:"))
{
name += ParseDate(token);
}
else
{
name += token;
}
}
return name;
}
开发者ID:eefret,项目名称:hdt-plugin-endgame,代码行数:33,代码来源:NamingPattern.cs
示例4: AddGameDialog
public AddGameDialog(GameStats game)
{
InitializeComponent();
_tcs = new TaskCompletionSource<GameStats>();
_editing = true;
_game = game;
if(game == null)
return;
ComboBoxResult.SelectedItem = game.Result;
HeroClass heroClass;
if(!string.IsNullOrWhiteSpace(game.OpponentHero) && Enum.TryParse(game.OpponentHero, out heroClass))
ComboBoxOpponent.SelectedItem = heroClass;
ComboBoxMode.SelectedItem = game.GameMode;
ComboBoxFormat.SelectedItem = game.Format;
ComboBoxRegion.SelectedItem = game.Region;
if(game.GameMode == Ranked)
{
TextBoxRank.Text = game.Rank.ToString();
TextBoxLegendRank.Text = game.LegendRank.ToString();
}
PanelRank.Visibility = PanelLegendRank.Visibility = game.GameMode == Ranked ? Visible : Collapsed;
PanelFormat.Visibility = game.GameMode == Ranked || game.GameMode == Casual ? Visible : Collapsed;
ComboBoxCoin.SelectedItem = game.Coin ? Yes : No;
ComboBoxConceded.SelectedItem = game.WasConceded ? Yes : No;
TextBoxTurns.Text = game.Turns.ToString();
TextBoxDuration.Text = game.Duration;
TextBoxDuration.IsEnabled = false;
TextBoxNote.Text = game.Note;
TextBoxOppName.Text = game.OpponentName;
TextBoxPlayerName.Text = game.PlayerName;
BtnSave.Content = "save";
Title = "Edit game";
}
开发者ID:ChuckJrster,项目名称:Hearthstone-Deck-Tracker,代码行数:33,代码来源:AddGameDialog.xaml.cs
示例5: TryUpload
private static async Task<bool> TryUpload(string[] logLines, GameMetaData gameMetaData, GameStats game, bool submitFailure)
{
try
{
game?.HsReplay.UploadTry();
Influx.OnGameUpload(game?.HsReplay.UploadTries ?? 1);
var lines = logLines.SkipWhile(x => !x.Contains("CREATE_GAME")).ToArray();
var metaData = UploadMetaDataGenerator.Generate(lines, gameMetaData, game);
Log.Info("Creating upload request...");
var uploadRequest = await ApiWrapper.CreateUploadRequest(metaData);
Log.Info("Upload Id: " + uploadRequest.ShortId);
await ApiWrapper.UploadLog(uploadRequest, lines);
Log.Info("Upload complete");
if(game != null)
{
game.HsReplay.UploadId = uploadRequest.ShortId;
game.HsReplay.ReplayUrl = uploadRequest.ReplayUrl;
if(DefaultDeckStats.Instance.DeckStats.Any(x => x.DeckId == game.DeckId))
DefaultDeckStats.Save();
else
DeckStatsList.Save();
}
return true;
}
catch(WebException ex)
{
Log.Error(ex);
if(submitFailure)
Influx.OnGameUploadFailed(ex.Status);
return false;
}
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:32,代码来源:LogUploader.cs
示例6: ShowDeleteGameStatsMessage
public static async Task<MessageDialogResult> ShowDeleteGameStatsMessage(MetroWindow window, GameStats stats)
{
var settings = new MetroDialogSettings {AffirmativeButtonText = "Yes", NegativeButtonText = "No"};
return
await
window.ShowMessageAsync("Delete Game",
stats.Result + " vs " + stats.OpponentHero + "\nfrom " + stats.StartTime + "\n\nAre you sure?",
MessageDialogStyle.AffirmativeAndNegative, settings);
}
开发者ID:hertzg,项目名称:Hearthstone-Deck-Tracker,代码行数:9,代码来源:MessageDialogs.cs
示例7: ShowDeleteGameStatsMessage
//LocUtil.Get()}
public static async Task<MessageDialogResult> ShowDeleteGameStatsMessage(this MetroWindow window, GameStats stats)
=> await window.ShowMessageAsync(LocUtil.Get(LocDeleteGameStatsTitle),
stats + Environment.NewLine + Environment.NewLine + LocUtil.Get(LocDeleteGameStatsSure),
AffirmativeAndNegative,
new Settings
{
AffirmativeButtonText = LocUtil.Get(LocDeleteGameStatsButtonDelete),
NegativeButtonText = LocUtil.Get(LocDeleteGameStatsButtonCancel)
});
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:11,代码来源:MessageDialogs.cs
示例8: NoteDialog
public NoteDialog(GameStats game)
{
InitializeComponent();
_game = game;
CheckBoxEnterToSave.IsChecked = Config.Instance.EnterToSaveNote;
Show();
Activate();
TextBoxNote.Focus();
_initialized = true;
}
开发者ID:christopher7694,项目名称:Hearthstone-Deck-Tracker,代码行数:10,代码来源:NoteDialog.xaml.cs
示例9: CreateGame
public static GameStats CreateGame(Guid deck, Region region, GameMode mode, int days)
{
var game = new GameStats(GameResult.Win, "Mage", "Mage");
game.DeckId = deck;
game.Region = region;
game.GameMode = mode;
game.StartTime = DateTime.Now.Subtract(TimeSpan.FromDays(days));
return game;
}
开发者ID:ChuckFork,项目名称:hdt-plugin-statsconverter,代码行数:10,代码来源:TestHelper.cs
示例10: NoteDialog
public NoteDialog(GameStats game, List<Image> screenshots)
{
InitializeComponent();
_game = game;
CheckBoxEnterToSave.IsChecked = Config.Instance.EnterToSaveNote;
Show();
Activate();
TextBoxNote.Focus();
ListBox_Images.DataContext = screenshots;
_initialized = true;
}
开发者ID:eefret,项目名称:hdt-plugin-endgame,代码行数:13,代码来源:NoteDialog.xaml.cs
示例11: NoteDialog
public NoteDialog(GameStats game)
{
InitializeComponent();
_game = game;
CheckBoxEnterToSave.IsChecked = Config.Instance.EnterToSaveNote;
TextBoxNote.Text = game.Note;
DeckList.ItemsSource = game.OpponentCards
.Select(x => new NoteCard(x))
.OrderBy(x => x.Cost);
Show();
Activate();
TextBoxNote.Focus();
_initialized = true;
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:14,代码来源:NoteDialog.xaml.cs
示例12: ShowGameResultToast
internal static void ShowGameResultToast(string deckName, GameStats game)
{
if(game == null)
return;
var result = new ToastHelper(new GameResultToast(deckName, game));
if(Config.Instance.ShowReplayShareToast)
{
var replay = new ToastHelper(new ReplayToast(game));
GameResultToasts.Add(replay, result);
ShowToast(result);
ShowToast(replay);
}
else
ShowToast(result);
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:15,代码来源:ToastManager.cs
示例13: SaveImage
public static void SaveImage(GameStats game, Image screenshot, String note = null)
{
if(game != null)
{
if (!String.IsNullOrEmpty(note))
game.Note = note;
DeckStatsList.Save();
if(Config.Instance.StatsInWindow)
{
((DeckStatsControl)Helper.MainWindow.StatsWindow.FindName("StatsControl")).Refresh();
}
else
{
((DeckStatsControl)Helper.MainWindow.FindName("DeckStatsFlyout")).Refresh();
}
if(screenshot != null)
{
try
{
var dir = Settings.Default.OutputDir;
if(!Directory.Exists(dir))
{
dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
}
var pattern = Settings.Default.FileNamePattern;
NamingPattern np = null;
if(!NamingPattern.TryParse(pattern, out np))
Logger.WriteLine("Invalid file name pattern, using default", "EndGame");
var filename = np.Apply(game);
SaveAsPng(screenshot.Full, Path.Combine(dir, filename));
}
catch(Exception e)
{
Logger.WriteLine("Error saving image: " + e.Message, "EndGame");
}
}
else
{
Logger.WriteLine("Screenshot is null", "EndGame");
}
}
else
{
Logger.WriteLine("Game is null", "EndGame");
}
}
开发者ID:eefret,项目名称:hdt-plugin-endgame,代码行数:48,代码来源:Capture.cs
示例14: ShowReplay
public static async Task<bool> ShowReplay(GameStats game, bool showToast)
{
if(game == null)
return false;
if(Config.Instance.ForceLocalReplayViewer)
{
ReplayReader.LaunchReplayViewer(game.ReplayFile, false);
return true;
}
Action<ReplayProgress> setToastStatus = null;
if(game.HasReplayFile && !game.HsReplay.Uploaded)
{
if(showToast)
setToastStatus = ToastManager.ShowReplayProgressToast();
var log = GetLogFromHdtReplay(game.ReplayFile).ToArray();
var validationResult = LogValidator.Validate(log);
if(validationResult.IsValid)
await LogUploader.Upload(log, null, game);
else
{
Log.Error("Invalid log: " + validationResult.Reason);
game.HsReplay.Unsupported = true;
}
if(DefaultDeckStats.Instance.DeckStats.Any(x => x.DeckId == game.DeckId))
DefaultDeckStats.Save();
else
DeckStatsList.Save();
}
if(game.HsReplay?.Uploaded ?? false)
{
setToastStatus?.Invoke(ReplayProgress.Complete);
Helper.TryOpenUrl(game.HsReplay?.Url);
}
else if(game.HasReplayFile)
{
setToastStatus?.Invoke(ReplayProgress.Error);
ReplayReader.LaunchReplayViewer(game.ReplayFile, true);
}
else
{
setToastStatus?.Invoke(ReplayProgress.Error);
return false;
}
return true;
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:45,代码来源:ReplayLauncher.cs
示例15: Generate
public static UploadMetaData Generate(string[] log, GameMetaData gameMetaData, GameStats game)
{
var metaData = new UploadMetaData();
var playerInfo = GetPlayerInfo(log, game);
if(playerInfo != null)
{
metaData.Player1 = playerInfo.Player1;
metaData.Player2 = playerInfo.Player2;
}
if(!string.IsNullOrEmpty(gameMetaData?.ServerInfo?.Address))
metaData.ServerIp = gameMetaData.ServerInfo.Address;
if(gameMetaData?.ServerInfo?.Port > 0)
metaData.ServerPort = gameMetaData.ServerInfo.Port.ToString();
if(gameMetaData?.ServerInfo?.GameHandle > 0)
metaData.GameHandle = gameMetaData.ServerInfo.GameHandle.ToString();
if(gameMetaData?.ServerInfo?.ClientHandle > 0)
metaData.ClientHandle = gameMetaData.ServerInfo.ClientHandle.ToString();
if(!string.IsNullOrEmpty(gameMetaData?.ServerInfo?.SpectatorPassword))
metaData.SpectatePassword = gameMetaData.ServerInfo.SpectatorPassword;
if(!string.IsNullOrEmpty(gameMetaData?.ServerInfo?.AuroraPassword))
metaData.AuroraPassword = gameMetaData.ServerInfo.AuroraPassword;
if(!string.IsNullOrEmpty(gameMetaData?.ServerInfo?.Version))
metaData.ServerVersion = gameMetaData.ServerInfo.Version;
if(game?.StartTime > DateTime.MinValue)
metaData.MatchStart = game.StartTime.ToString("o");
if(game != null)
metaData.GameType = game.GameType != GameType.GT_UNKNOWN ? (int)HearthDbConverter.GetBnetGameType(game.GameType, game.Format) : (int)HearthDbConverter.GetGameType(game.GameMode, game.Format);
if(game?.Format != null)
metaData.Format = (int)HearthDbConverter.GetFormatType(game.Format);
metaData.SpectatorMode = game?.GameMode == GameMode.Spectator;
metaData.Reconnected = gameMetaData?.Reconnected ?? false;
metaData.Resumable = gameMetaData?.ServerInfo?.Resumable ?? false;
metaData.FriendlyPlayerId = game?.FriendlyPlayerId > 0 ? game.FriendlyPlayerId : (playerInfo?.FriendlyPlayerId > 0 ? playerInfo?.FriendlyPlayerId : null);
var scenarioId = game?.ScenarioId ?? gameMetaData?.ServerInfo?.Mission;
if(scenarioId > 0)
metaData.ScenarioId = scenarioId;
var build = gameMetaData?.HearthstoneBuild ?? game?.HearthstoneBuild ?? (game != null ? BuildDates.GetByDate(game.StartTime) : null);
if(build > 0)
metaData.HearthstoneBuild = build;
if(game?.BrawlSeasonId > 0)
metaData.BrawlSeason = game.BrawlSeasonId;
if(game?.RankedSeasonId > 0)
metaData.LadderSeason = game.RankedSeasonId;
return metaData;
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:45,代码来源:UploadMetaDataGenerator.cs
示例16: GameResultToast
public GameResultToast(string deckName, [NotNull] GameStats game)
{
InitializeComponent();
InitializeComponent();
DeckName = deckName;
_game = game;
ComboBoxResult.ItemsSource = new[] { GameResult.Win, GameResult.Loss };
ComboBoxFormat.ItemsSource = new[] { Enums.Format.Standard, Enums.Format.Wild };
ComboBoxGameMode.ItemsSource = new[]
{
GameMode.Arena,
GameMode.Brawl,
GameMode.Casual,
GameMode.Friendly,
GameMode.Practice,
GameMode.Ranked,
GameMode.Spectator
};
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:19,代码来源:GameResultToast.xaml.cs
示例17: GetPlayerInfo
private static PlayerInfo GetPlayerInfo(string[] log, GameStats game)
{
var friendly = new UploadMetaData.Player();
var opposing = new UploadMetaData.Player();
if(game?.Rank > 0)
friendly.Rank = game.Rank;
if(game?.LegendRank > 0)
friendly.LegendRank = game.LegendRank;
if(game?.PlayerCardbackId > 0)
friendly.Cardback = game.PlayerCardbackId;
if(game?.Stars > 0)
friendly.Stars = game.Stars;
if(game?.PlayerCards.Sum(x => x.Count) == 30 && game?.PlayerCards.Sum(x => x.Unconfirmed) <= 24)
{
friendly.DeckList = game.PlayerCards.Where(x => x.Id != Database.UnknownCardId).SelectMany(x => Enumerable.Repeat(x.Id, x.Count)).ToArray();
if(game.HsDeckId > 0)
friendly.DeckId = game.HsDeckId;
}
if(game?.ArenaWins > 0)
friendly.Wins = game.ArenaWins;
if(game?.ArenaLosses > 0)
friendly.Losses = game.ArenaLosses;
if(game?.OpponentRank > 0)
opposing.Rank = game.OpponentRank;
if(game?.OpponentLegendRank > 0)
opposing.LegendRank = game.OpponentLegendRank;
if(game?.OpponentCardbackId > 0)
opposing.Cardback = game.OpponentCardbackId;
if(game?.FriendlyPlayerId > 0)
{
return new PlayerInfo(game.FriendlyPlayerId == 1 ? friendly : opposing,
game.FriendlyPlayerId == 2 ? friendly : opposing);
}
var player1Name = GetPlayer1Name(log);
if(player1Name == game?.PlayerName)
return new PlayerInfo(friendly, opposing, 1);
if(player1Name == game?.OpponentName)
return new PlayerInfo(opposing, friendly, 2);
return null;
}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:43,代码来源:UploadMetaDataGenerator.cs
示例18: GenerateTestMatches
private static void GenerateTestMatches()
{
_match1 = new GameStats(GameResult.Win, "Druid", "Druid");
_match1.Result = GameResult.Win;
_match1.Rank = 20;
_match1.Coin = true;
_match1.DeckName = _deck1.Name;
_match1.StartTime = DateTime.Now.AddMinutes(-5);
_match1.EndTime = DateTime.Now;
_match1.Region = Region.EU;
_match1.GameMode = GameMode.Casual;
_match1.PlayerName = "Epix";
_match1.OpponentName = "trigun";
_match1.Turns = 10;
_match2 = new GameStats(GameResult.Win, "Priest", "Warlock");
_match2.Result = GameResult.Win;
_match2.Rank = 19;
_match2.Coin = true;
_match2.DeckName = _deck2.Name;
_match2.StartTime = DateTime.Now.AddMinutes(-7);
_match2.EndTime = DateTime.Now;
_match2.Region = Region.US;
_match2.GameMode = GameMode.Casual;
_match2.PlayerName = "Epix";
_match2.OpponentName = "trigun";
_match2.Turns = 10;
_match3 = new GameStats(GameResult.Win, "Mage", "Warrior");
_match3.Result = GameResult.Win;
_match3.Rank = 18;
_match3.Coin = false;
_match3.DeckName = _deck2.Name;
_match3.StartTime = DateTime.Now.AddMinutes(-6);
_match3.EndTime = DateTime.Now;
_match3.Region = Region.ASIA;
_match3.GameMode = GameMode.Casual;
_match3.PlayerName = "Epix";
_match3.OpponentName = "trigun";
_match3.Turns = 10;
}
开发者ID:christopher7694,项目名称:Hearthstone-Deck-Tracker,代码行数:41,代码来源:ApiTest.cs
示例19: UploadMatchAsync
public static async Task<PostResult> UploadMatchAsync(GameStats game, Deck deck, bool saveFilesAfter = true, bool background = false)
{
Log.Info("trying to upload match: " + game);
if(!HearthStatsAPI.IsLoggedIn)
{
Log.Error("not logged in");
return PostResult.Failed;
}
if(!HearthStatsAPI.IsValidGame(game))
return PostResult.Failed;
if(background)
AddBackgroundActivity();
if(!deck.HasHearthStatsId)
{
Log.Info("...deck has no HearthStats id, uploading deck");
var success = await UploadDeckAsync(deck);
if(!success.Success)
{
Log.Error("deck could not be uploaded or did not return an id. Can not upload match.");
if(background)
RemoveBackgroundActivity();
return PostResult.Failed;
}
}
var result = await HearthStatsAPI.PostGameResultAsync(game, deck);
if(!result.Success && result.Retry)
{
await Task.Delay(RetryDelay);
Log.Info("try #2 to upload match: " + game);
result = await HearthStatsAPI.PostGameResultAsync(game, deck);
}
if(result.Success && saveFilesAfter)
DeckStatsList.Save();
if(background)
RemoveBackgroundActivity();
if(result.Success)
Log.Info("success uploading match " + game);
return result;
}
开发者ID:JDurman,项目名称:Hearthstone-Deck-Tracker,代码行数:39,代码来源:HearthStatsManager.cs
示例20: GameResultNotificationWindow
public GameResultNotificationWindow(string deckName, [NotNull] GameStats game)
{
InitializeComponent();
DeckName = deckName;
_game = game;
ComboBoxOpponentClass.ItemsSource = Enum.GetValues(typeof(HeroClass)).Cast<HeroClass>().Select(x => new HeroClassWrapper(x));
ComboBoxResult.ItemsSource = new[] {GameResult.Win, GameResult.Loss};
ComboBoxGameMode.ItemsSource = new[]
{
GameMode.Arena,
GameMode.Brawl,
GameMode.Casual,
GameMode.Friendly,
GameMode.Practice,
GameMode.Ranked,
GameMode.Spectator
};
UpdatePosition();
_startUpTime = DateTime.UtcNow;
CloseAsync();
Logger.WriteLine("Now showing", "GameResultNotification");
Activate();
}
开发者ID:Rob2K2,项目名称:Hearthstone-Deck-Tracker,代码行数:23,代码来源:GameResultNotificationWindow.xaml.cs
注:本文中的Hearthstone_Deck_Tracker.Stats.GameStats类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论