async Task CreateResourcesAsync(CanvasAnimatedControl sender) { // c.TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 200); // c.Paused = true; Statics.CrownImage = await CanvasBitmap.LoadAsync(sender, "game\\crown.png"); Statics.LeftColumnWidth = (int)sender.Size.Width - Statics.RightColumnWidth - Statics.RightColumnPadding * 2 - Statics.LeftColumnPadding * 2; Statics.CanvasHeight = (int)sender.Size.Height; Statics.ColumnDividerTop = new Vector2(Statics.LeftColumnWidth + Statics.LeftColumnPadding * 2, 0); Statics.ColumnDividerBottom = new Vector2(Statics.LeftColumnWidth + Statics.LeftColumnPadding * 2, (float)sender.Size.Height); rlbProminent = new RichListBoxProminent(sender.Device, new Vector2(Statics.LeftColumnWidth + Statics.LeftColumnPadding * 2 + Statics.RightColumnPadding, Statics.RightColumnPadding), Statics.RightColumnWidth, "Census of Recent Contentions", Statics.FontLarge, 15, Statics.FontSmall, Statics.FontLarge); rlbLeaderboard = new RichListBoxLeaderboard(sender.Device, new Vector2(rlbProminent.Position.X, rlbProminent.Position.Y + rlbProminent.Height + Statics.RightColumnPadding), rlbProminent.Width, (int)sender.Size.Height - rlbProminent.Height - Statics.RightColumnPadding * 3, "Champions of the Realm", Statics.FontLarge, Statics.FontSmall, Statics.FontMedium); // initialize leaderboard listbox Leaderboard.AttachedListbox = rlbLeaderboard; Leaderboard.InitializeListboxInfo(); // resets map, listbox, debug frame count Reset(sender); }
public void Update(RichListBoxProminent rlb, CanvasAnimatedUpdateEventArgs args) { UpdateDelta += args.Timing.ElapsedTime; if (UpdateDelta.TotalMilliseconds < Statics.MapUpdateThreshold) { return; } //switch (State) //{ // case MAPSTATE.READY_FOR_BATTLE: // // reset update timer // UpdateDelta = TimeSpan.Zero; // // fight a battle // //Region winner = Regions[Statics.Random.Next(Regions.Count)]; // //Region loser = RandomNeighbor(winner.ID); // //winner.Leader.BattleWins++; // //loser.Leader.BattleLosses++; // //string strRandomDefeatString = Statics.DefeatWords.RandomString(); // //loser.OvertakingRegion = winner; // //LastBattle = new BattleEventArgs(winner, strRandomDefeatString, loser); // ////StringManager.Add(LastBattle.ToRichString()); // //if (rlb != null) { rlb.Add(LastBattle.ToRichString()); } // //State = MAPSTATE.TAKEOVER_IN_PROGRESS; // break; // case MAPSTATE.TAKEOVER_IN_PROGRESS: // // reset update timer // UpdateDelta = TimeSpan.Zero; // //MergeRegions(winner.ID, loser.ID); // // update one tile per frame // if (!MiniMerge()) // { // State = MAPSTATE.PAUSE_BETWEEN_BATTLES; // } // break; // case MAPSTATE.PAUSE_BETWEEN_BATTLES: // // don't update timer unless threshold reached // // check for win condition // if (Regions.Count == 1) // { // Leaderboard.DeclareWinner(Regions[0].Leader.ToString()); // State = MAPSTATE.WIN_DRAW_IMAGE; // } // else if (UpdateDelta.TotalMilliseconds > Statics.PauseBetweenBattlesMilliseconds) // { // UpdateDelta = TimeSpan.Zero; // State = MAPSTATE.READY_FOR_BATTLE; // } // break; // case MAPSTATE.WIN_DRAW_IMAGE: // // reset update timer // UpdateDelta = TimeSpan.Zero; // // partial image draw // if (nWinningImageFrame < 100) // { // nWinningImageFrame += 1; // } // else // { // State = MAPSTATE.WIN_DRAW_STRING; // } // break; // case MAPSTATE.WIN_DRAW_STRING: // // partial string draw // if (nWinningStringFrame < strWinnerString.Length * 5) // { // nWinningStringFrame++; // } // else if (UpdateDelta.TotalSeconds >= 5) // { // State = MAPSTATE.FINISHED; // } // break; //} }