public void PlayModelTestsSetUp() { playModel = new PlayModel() { AttemptId = 12345, ThemeId = 1 }; }
public void ToHighScores(PlayModel playModel, GameModeSetting currentSetting) { playUI.Unsubscribe(playModel); playUI.Deactivate(); highScoreUI.Activate(currentSetting, playModel.Score); }
public RecentPlayViewModel(IRepository repository, PlayModel play) { _repository = repository; _play = play; Delete = ReactiveCommand.Create(() => _repository.DeletePlay(_play)); }
private void UpdatePlayerToList(Online.League.Leaderboard board) { var leaguescore = PlayModel.GetScore(); if (leaguescore < 1) { return; } board.current.Sort((x, y) => y.score - x.score); if (board.current.Count < 1 || leaguescore < board.current.LastOne().score) { return; } var mine = board.current.Find(x => x.username == Profile.Username); if (mine == null) { board.current.RemoveAt(board.current.LastIndex()); mine = new Online.League.Profile() { avatar = Profile.Avatar.Json, nickname = Profile.Nickname, status = Profile.Status, username = Profile.Username, score = leaguescore }; board.current.Add(mine); } else if (mine.score < leaguescore) { mine.score = leaguescore; } }
public void ToPlay(PlayModel playModel, int gameDurationInSeconds) { menuUI.Deactivate(); playUI.Subscribe(playModel); playUI.Activate(gameDurationInSeconds); }
private async Task <bool> PlayNext() { _log.Information("[{0}] Executing next item in playlist", ChannelId); PlayModel result = null; try { result = await _playlistService.PlayNext(ChannelId); } catch (Exception e) { _log.Information(e, "[{0}] Failed to load next playlist item, trying to restart channel", ChannelId); StopInternal(); return(false); } _status = result; if (result == null) { _log.Information("[{0}] Channel playlist is empty", ChannelId); await StopEmptyChannel(); return(false); } else { _log.Information("[{0}] Playing media id: {1}, duration: {2}", ChannelId, _status.MediaId, _status.Duration); await PublishPlayEvent(); return(true); } }
public static bool SetPlayModel() { if (Profile.Hearts < 1) { Game.Instance.OpenPopup <Popup_BuyHearts>(); return(false); } else { Profile.Hearts--; } PlayModel.Reset(PlayModel.Type.Classic); PlayModel.ballId = Profile.Avatar.BallId; PlayModel.level.name = string.Format(LocalizationService.Get(111127), Profile.MaxClassicScore); PlayModel.level.theme = Random.Range(0, 1000); PlayModel.level.pattern = GlobalFactory.Patterns.Classic.Get(); PlayModel.level.startBallCount = 5; PlayModel.level.minBlockHealth = 1; PlayModel.level.maxBlockHealth = 10; PlayModel.onPreLose = OnPreLose; PlayModel.onLose = OnLose; return(true); }
public void AddToPlay(PlayModel play) { var item = playList.FirstOrDefault(x => x.songid == play.songid); if (item != null) { mediaPlaybackList.MoveTo(Convert.ToUInt32(playList.IndexOf(item))); return; } if (!play.pic.Contains("300w_300h_1e_1c")) { play.pic = play.pic + "@300w_300h_1e_1c.jpg"; } playList.Add(play); var binder = new MediaBinder(); binder.Token = play.songid.ToString(); binder.Binding += Binder_Binding; var source = MediaSource.CreateFromMediaBinder(binder); source.CustomProperties["id"] = play.songid; mediaPlaybackList.Items.Add(new MediaPlaybackItem(source)); mediaPlaybackList.MoveTo(Convert.ToUInt32(playList.IndexOf(play))); //var item = new MediaPlaybackItem(MediaSource.CreateFromUri(play.play_url)); //mediaPlaybackList.Items.Add(item); }
private static void OnLose(System.Action <bool> exitplaying) { int score = PlayModel.GetScore(); if (score > Profile.MaxClassicScore) { Profile.MaxClassicScore = score; } if (score > 0) { exitplaying(false); Game.Instance.OpenPopup <Popup_Lose>().Setup(replayFunc => OnReward(() => { if (SetPlayModel()) { replayFunc(); } }), () => OnReward(() => Game.Instance.OpenState <State_Main>(true))); } else { exitplaying(true); } }
private static void OnLose(System.Action <bool> callback) { int score = PlayModel.GetScore(); if (score > data.score) { var hashbase = "seganx_" + data.score + "&" + score + "#(" + info.id; Online.League.SetScore(info.id, data.score, score, hashbase.ComputeMD5(null).ToLower(), (success, value) => { }); data.score += score; } if (score > 0) { callback(false); Game.Instance.OpenPopup <Popup_Lose>().Setup(replayFunc => { if (SetPlayerModel()) { replayFunc(); } }, () => Game.Instance.OpenState <State_Main>(true)); } else { callback(true); } }
public static bool SetPlayerModel() { if (Profile.Hearts < 1) { Game.Instance.OpenPopup <Popup_BuyHearts>(); return(false); } else { Profile.Hearts--; } PlayModel.Reset(info.playType); PlayModel.ballId = Profile.Avatar.BallId; PlayModel.level.name = info.name; PlayModel.level.theme = Random.Range(0, 1000); PlayModel.level.pattern = GlobalFactory.Patterns.Leagues.Get(); PlayModel.level.startBallCount = Random.Range(info.startBallCount.x, info.startBallCount.y); PlayModel.level.minBlockHealth = PlayModel.level.startBallCount / 2; PlayModel.level.maxBlockHealth = PlayModel.level.startBallCount * 3 / 2; PlayModel.onPreLose = OnPreLose; PlayModel.onLose = OnLose; return(true); }
public async Task <IActionResult> DeckList() { User user = await _userManager.GetUserAsync(User); var userWithDecks = await _context.Users .Where(u => u.UserName == user.UserName) .Include(u => u.Decks) .FirstOrDefaultAsync(); var createdDecks = _context.Decks .Where(deck => deck.CreatorId == user.Id) .ToList(); var allDecks = createdDecks .Concat(userWithDecks.Decks) .ToList(); var model = new PlayModel { Username = (await _userManager.GetUserAsync(User)).UserName, UserDecks = allDecks .Select(deck => new PlayDeckModel { Name = deck.Name, Id = deck.Id }) .ToList() }; return(View(model)); }
public JsonResult StatusUpdate(PlayModel play) { play.ModifiedBy = 1; PlayModel playmodel = PlayDAC.Upsert(play, true); return(Json(playmodel, JsonRequestBehavior.AllowGet)); }
private void OnPlayEventReceived(object sender, BasicDeliverEventArgs e) { _log.Information("[{0}] PlayEvent Received", channelId); var body = e.Body; var message = Encoding.UTF8.GetString(body.ToArray()); _status = JsonConvert.DeserializeObject <PlayModel>(message); _ = SendPlayEvent(); }
private async Task LoadStatus() { using (var conn = DataFactory.OpenConnection()) { _status = await conn.QueryFirstOrDefaultAsync <PlayModel>(@"SELECT ph.ChannelId, ph.MediaId, ph.StartDateUTC, ph.Duration FROM play_history ph WHERE ph.ChannelId = @channelId ORDER BY ph.StartDateUTC DESC LIMIT 1", new { channelId }); } }
public ActionResult PlayLoto(long?Id) { PlayModel oPlay = PlayDAC.Get(new PlayModel { Id = Id }, true).FirstOrDefault(); PlayLoadCombos(oPlay.Game.Id, oPlay.CreatedOn); return(View(oPlay)); }
public PlayPresenter(View view, Model model) { this.View = (PlayView)view; this.Model = (PlayModel)model; this.View.Presenter = this; this.Model.Presenter = this; // Init the View Initialization(); }
private static void OnPreLose(System.Action <bool> exitplaying) { if (PlayModel.GetScore() < Profile.MaxClassicScore) { Game.Instance.OpenPopup <Popup_Confirm>().Setup(111128, true, true, ok => exitplaying(ok)).GetComponent <UiCharacter>(true, true).SetBody(1).SetFace(2); } else { exitplaying(true); } }
//[ResponseCache(Duration = 30, Location = ResponseCacheLocation.Any, VaryByQueryKeys = new []{"player1","player2"})] public async Task <IActionResult> Play(int team1, int team2) { var model = new PlayModel(); model.Team1 = await _teamService.GetTeam(team1); model.Team2 = await _teamService.GetTeam(team2); ViewData.Model = model; return(View("Play_m")); }
public void LoadUserDataFile() { Debug.Log("=============LoadUserDataFile " + GameConstants.SAVEFILE_PATH); ByteBuffer bb = new ByteBuffer(File.ReadAllBytes(GameConstants.SAVEFILE_PATH)); UserModel userMode = UserModel.GetRootAsUserModel(bb); int score = userMode.Score; int coin = userMode.Coin; PlayData playData = null; if (userMode.PlayData.HasValue) { //lastparts LastBlocks lastParts = null; PlayModel playModel = userMode.PlayData.Value; LastPartsModel?lastPartsModel = playModel.LastPartsData; if (lastPartsModel.HasValue) { lastParts = new LastBlocks(lastPartsModel.Value.GetCellPartsArrayArray(), lastPartsModel.Value.AngleValue); } //cells int[,] cells = new int[GameConstants.CELL_ARRAY_SIZE, GameConstants.CELL_ARRAY_SIZE]; for (int i = 0; i < playModel.CellArrayLength; i++) { //Debug.Log("CellArrayLength = " + i + " / CellArrayLength : " + playModel.CellArrayLength); int x = playModel.CellArray(i).Value.X; int y = playModel.CellArray(i).Value.Y; int value = playModel.CellArray(i).Value.Value; cells[x, y] = value; } ItemUseCountInfo itemUseCountInfo = new ItemUseCountInfo(); for (int i = 0; i < playModel.ItemUseCountArrayLength; i++) { itemUseCountInfo.AddCount((ItemType)i, playModel.ItemUseCountArray(i)); } playData = new PlayData(playModel.Score, playModel.Coin, cells, lastParts, itemUseCountInfo, playModel.AdContinueWatchCount); } UserRewardInfo userRewardInfo = new UserRewardInfo(userMode.DailyRewardDay, userMode.CoinBoxRewardDay, userMode.CointBoxRewardCount, userMode.CointBoxRewardTimeStamp); _userData = new UserData(score, coin, playData, userRewardInfo); Debug.Log("Score : " + _userData.Score); Debug.Log("Coin : " + _userData.Coin); Debug.Log("DailyRewardDay : " + _userData.UserRewardInfo.DailyRewardDay); Debug.Log("CoinBoxRewardDay : " + _userData.UserRewardInfo.CoinBoxRewardDay); Debug.Log("CointBoxRewardCount : " + _userData.UserRewardInfo.CoinBoxRewardCount); Debug.Log("CointBoxRewardTimeStamp : " + _userData.UserRewardInfo.CointBoxRewardTimeStamp); // if(_userData.PlayData !=null) // _userData.PlayData.Print(); }
/// <summary> /// 清除播放列表 /// </summary> public void ClearPlaylist() { playList.Clear(); playInfo = new PlayModel() { title = "哔哩哔哩 (゜-゜)つロ 干杯~", pic = "ms-appx:///Assets/StoreLogo.scale-100.png" }; mediaPlaybackList.Items.Clear(); bufferingProgress = 0; this.totalDuration = 0; this.position = 0; this.durationStr = "00:00 / 00:00"; }
private IEnumerator Start() { scoreLabel.SetText("0"); int totalBalls = PlayModel.result.totalBalls + PlayModel.level.startBallCount; descLabel.SetFormatedText(PlayModel.result.totalTurn.ToString(), PlayModel.result.totalBlocks.ToString(), totalBalls); inviteButton.onClick.AddListener(() => { var str = string.Format(GlobalConfig.Socials.invitationText, Profile.Username, GlobalConfig.Market.storeUrl); SocialAndSharing.ShareText(str); }); replayButton.onClick.AddListener(() => { onReplayFunc(() => { base.Back(); UIBackground.Hide(); Game.Instance.ClosePopup(true); Game.Instance.OpenState <State_Playing>(); }); }); baloon.gameObject.SetActive(false); UiShowHide.ShowAll(transform); yield return(new WaitForSeconds(0.5f)); // Incentive text { var index = BaloonIndex++ % 25; var incentiveStr = LocalizationService.Get(111090 + index); baloon.SetText(incentiveStr); baloon.gameObject.SetActive(true); } float t = 0; float curscore = 0, maxscore = PlayModel.GetScore(); var wait = new WaitForEndOfFrame(); while (t < 1) { t += Time.deltaTime * 0.75f; curscore = Mathf.Lerp(0, maxscore, t); scoreLabel.SetText(Mathf.RoundToInt(curscore).ToString()); yield return(wait); } }
public void PlayModelPropertiesTest(int attemptId, int curriculumChapterTopicId, TopicTypeEnum topicType, string topicName) { var playModel = new PlayModel { AttemptId = attemptId, CurriculumChapterTopicId = curriculumChapterTopicId, TopicType = topicType, TopicName = topicName }; Assert.AreEqual(attemptId, playModel.AttemptId); Assert.AreEqual(curriculumChapterTopicId, playModel.CurriculumChapterTopicId); Assert.AreEqual(topicType, playModel.TopicType); Assert.AreEqual(topicName, playModel.TopicName); }
public virtual void Init(TargetPresenter presenter, PlayModel playModel) { this.presenter = presenter; this.playModel = playModel; targetMoveBehaviour = GetComponent <TargetMoveBehaviour>(); if (targetMoveBehaviour == null) { Debug.LogError("No ITargetMoveBehaviour found for WhackTarget"); } else { targetMoveBehaviour.MoveToStartPos(); } }
public ActionResult Play(PlayModel play) { try { PlayLoadCombos(); List <PlayModel> oLst = PlayDAC.Get(play, false); return(View(oLst)); } catch (Exception) { throw; } }
public void PlayerLose() { if (PlayModel.onLose != null) { PlayModel.onLose(ok => { if (ok) { base.Back(); } }); } else { base.Back(); } }
public void StartGame(int gameDurationInSeconds, int slotCount) { playModel = new PlayModel(); currentGameModeSetting = new GameModeSetting(gameDurationInSeconds, slotCount); targetGenerator.GenerateTargets(slotCount); List <RoundDefinition> roundDefinitions = roundsGenerator.GenerateRounds(gameDurationInSeconds, slotCount); roundsController.StartRounds(roundsGenerator.TargetTypeCollection, roundDefinitions, playModel); roundsController.OnRoundsFinished += EndGame; platformLoader.SelectionManager.IsBlocked = false; OnGameStart?.Invoke(playModel, gameDurationInSeconds); }
private void MessageCenter_Logined(object sender, object e) { if (mediaPlaybackList.Items.Count == 0) { return; } PlayModel[] list = new PlayModel[playList.Count]; playList.CopyTo(list, 0); var now = playInfo; ReplacePlayList(list); var id = now.songid; var item = mediaPlaybackList.Items.FirstOrDefault(x => x.Source.CustomProperties["id"].Equals(id)); mediaPlaybackList.MoveTo(Convert.ToUInt32(mediaPlaybackList.Items.IndexOf(item))); }
/// <summary> /// 删除播放项 /// </summary> /// <param name="playModel"></param> public void DeletePlayitem(PlayModel playModel) { if (mediaPlaybackList.Items.Count == 1) { ClearPlaylist(); return; } //if (playModel.select) //{ // mediaPlaybackList.MoveNext(); //} var id = playModel.songid; var playitem = mediaPlaybackList.Items.FirstOrDefault(x => x.Source.CustomProperties["id"].Equals(id)); playList.Remove(playModel); mediaPlaybackList.Items.Remove(playitem); }
public Engine(Model model, ShootListener listener) { // Reference of the model this.Model = (PlayModel)model; this.shootListener = listener; randInvader = new Random(); currentMoveCount = 0; currentMoveSens = Direction.Right; // Timer for moving invaders timerMovingInvaders = new System.Timers.Timer(700); timerMovingInvaders.Elapsed += new ElapsedEventHandler(OnMoveInvaders); timerMovingInvaders.Start(); // creation of a timer for generating missile from invaders timerInvadersMissile = new System.Timers.Timer(INTERVAL_INVADER_MISSILE_SHOOT); timerInvadersMissile.Elapsed += new ElapsedEventHandler(OnGenerateMissile); timerInvadersMissile.Start(); }