Ejemplo n.º 1
0
        public void End()
        {
            AppShell.RemoveAllFlyoutItems();

            LengthOfThisGame = StartingTime - DateTime.UtcNow;

            var EndInfo = new IntroductionViewModel(AppShell, "Konec");

            if (LengthOfThisGame.Minutes <= Model.Limit.Minutes)
            {
                var EndText = new Text()
                {
                    Title = "Úspěšně jsi dokončil hru", OwnText = "Hra ti trvala " + LengthOfThisGame.Minutes + " minut. "
                                                                  + "Limit byl " + Model.Limit.Minutes + " minut.", PositionInIntroduction = 0
                };

                EndInfo.AddText(EndText);
            }
            else
            {
                var EndText = new Text()
                {
                    Title   = "Hru jsi nestihnul v limitu",
                    OwnText = "Hra ti trvala " + LengthOfThisGame.Minutes + " minut. "
                              + "Limit byl " + Model.Limit.Minutes + " minut.",
                    PositionInIntroduction = 0
                };

                EndInfo.AddText(EndText);
            }
        }
Ejemplo n.º 2
0
        public async void LoadAndPlayGame(int id, AppShell appShell)
        {
            var restClient = new RestClient.RestClient();

            var gameResource = await restClient.GetFullGameByIdAsync(id);

            var converter = new FullGameConverter();

            var game = converter.Convert(gameResource);

            LocationChecker = new LocationChecker();

            AppShell = appShell;

            Model = game;

            MapService = new MapService(AppShell);

            Introduction = new IntroductionViewModel(AppShell, Model.Introduction.Title);

            if (Model.Introduction.DisplayObjects != null)
            {
                foreach (DisplayObject obj in Model.Introduction.DisplayObjects)
                {
                    Introduction.AddDisplayObject(obj);
                }
            }

            Text InfoAboutGame = new Text()
            {
                Title = "Hráči, kteří se podíleli na této hře",
                PositionInIntroduction = 0,
                OwnText = ""
            };

            foreach (User user in Model.Owners)
            {
                InfoAboutGame.OwnText = InfoAboutGame.OwnText + user.UserName + " ";
            }

            Introduction.AddText(InfoAboutGame);

            if (Model.Introduction.MapPositions != null)
            {
                MapService.AddNotStops(Model.Introduction.MapPositions as List <MapPosition>);
            }

            StartingTime = DateTime.UtcNow;

            foreach (Stop stop in Model.Stops)
            {
                SetUpStopModel(stop);
            }
        }
        public async Task <IActionResult> Introduction(string challengeId, string questionId)
        {
            if (string.IsNullOrEmpty(challengeId) || string.IsNullOrEmpty(questionId))
            {
                return(View("Index"));
            }

            var challenge = await challengesProvider.GetItemAsync(challengeId);

            var model = new IntroductionViewModel()
            {
                Id             = challenge.Item2.Id,
                Duration       = challenge.Item2.Duration,
                Name           = challenge.Item2.Name,
                PrereqLinks    = challenge.Item2.PrereqLinks,
                WelcomeMessage = challenge.Item2.WelcomeMessage,
                FirstQuestion  = questionId
            };

            return(View(model));
        }
Ejemplo n.º 4
0
        public IntroPage(IntroductionViewModel intro)
        {
            InitializeComponent();

            this.BindingContext = intro;
        }
Ejemplo n.º 5
0
 public IntroductionWindow(IntroductionViewModel viewModel)
 {
     InitializeComponent();
     DataContext = viewModel;
 }