Exemple #1
0
        void _battle_BattleFinshed(object sender, BattleFinishedEventArgs e)
        {
            Flash.Show(this);
            LogoBack.IsVisible = true;
            if (e.Winner == Current)
            {
                Sound.WIN();
                Enemy.AddBattleHistory(Current, UserProfile.HISTORY_TYPE.LOSE_OFFLINE);
                Current.AddBattleHistory(Enemy, UserProfile.HISTORY_TYPE.WIN);
                var i = 0;
                Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
                {
                    BattleComment.Show(BattleCommentAreaForEnemy, Enemy.LoseComment);
                    BattleComment.Show(BattleCommentAreaForCurrent, Current.WinComment);
                    i++;
                    return(i != 10);
                });
                Device.BeginInvokeOnMainThread(() =>
                {
                    AnimationView.Animation = "animation_win.json";
                    AnimationView.Play();
                });
                Device.StartTimer(TimeSpan.FromSeconds(3), () =>
                {
                    ShowFourth();
                    return(false);
                });
            }
            else
            {
                Sound.LOSE();
                Enemy.AddBattleHistory(Current, UserProfile.HISTORY_TYPE.WIN_OFFLINE);
                Current.AddBattleHistory(Enemy, UserProfile.HISTORY_TYPE.LOSE);

                var i = 0;
                Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
                {
                    BattleComment.Show(BattleCommentAreaForCurrent, Current.LoseComment);
                    BattleComment.Show(BattleCommentAreaForEnemy, Enemy.WinComment);
                    i++;
                    return(i != 10);
                });
                DependencyService.Get <IDeviceService>().PlayVibrate();
                Device.BeginInvokeOnMainThread(() =>
                {
                    AnimationView.Animation = "animation_lose.json";
                    AnimationView.Play();
                });
                Device.StartTimer(TimeSpan.FromSeconds(3), () =>
                {
                    Back();
                    return(false);
                });
            }
        }