Example #1
0
        //Home Screen
        public HomeLayout(ContentPageController ViewController, bool bypassLogIn)
        {
            HLayout = new StackLayout
            {
                BackgroundColor = Color.FromHex("1393c3"),
                Children =
                {
                    new Image
                    {
                        Source = "unsafespaceslogo.png"
                    },
                    new Label
                    {
                        Text = "#nooneissafe",
                        FontSize = 20,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.Start,
                        HeightRequest = 25
                    },
                    new Image
                    {
                        Source = "shocked_smile.png"
                    }
                }
            };
            StartButton = new Button
            {
                Text = "Play \u25B6",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof (Button)),
                HorizontalOptions = LayoutOptions.Center,
                //VerticalOptions = LayoutOptions.Fill,
                WidthRequest = 120
            };
            HLayout.Children.Add(StartButton);

            StartButton.Clicked += (sender, args) =>
            {
                ViewController.Invoke(() => StartButton.Text = "Loading \u25B6");
                StartButton.IsEnabled = false;
                if (bypassLogIn)
                {
                    var GSlayout = new GameSelectLayout(ViewController);
                }
                else
                {
                    ViewController.Invoke(() => ViewController.View.Content = ViewController.LogIn.LILayout);
                }
                StartButton.IsEnabled = true;
            };
            Display(ViewController);
        }
Example #2
0
 internal static void EndGame()
 {
     GameId = null;
     var GSLayout = new GameSelectLayout(ViewController);
 }
Example #3
0
 public static async Task GetActiveGames(GameSelectLayout gameselectlayout)
 {
     GSLayout = gameselectlayout;
     await Hub.GetActiveGames();
 }
Example #4
0
        public async Task VerifyAndPass(LogInLayout LIlayout, string userName, CookieContainer cookieJar,
            bool saveCredentials, ContentPageController viewController)
        {
            CookieJar = cookieJar;

            // store credientials if it is a new login
            if (saveCredentials)
            {
                //Gather Cookie String
                var gameUri = new Uri(Constants.EndPoint);
                var gamecookies = CookieJar.GetCookies(gameUri);
                string CookieString = null;
                foreach (Cookie c in gamecookies)
                {
                    if (c.Name == ".AspNet.ApplicationCookie") CookieString = c.Value;
                }
                //Store Cookie
                AuthCache.InsertObject(userName, CookieString);
            }

            //just preps the Game Manager
            GameManager.SetupGame(CookieJar, ViewController);

            if (!SeenHomeScreen)
            {
                SeenHomeScreen = true;
                var HLayout = new HomeLayout(ViewController, true);
            }
            else
            {
                var GSlayout = new GameSelectLayout(ViewController);
            }
        }
Example #5
0
        public NavigationDrawer()
        {
            Title = "Lee Game";
            ViewController = new ContentPageController(this);
            string[] temp = {"Refresh Game", "Switch Games", "How To Play", "Logout"};

            listView = GetListView(temp);


            MasterPage = new ContentPage
            {
                Title = "Options",
                Content = listView,
                Icon = "hamburger.png",
                Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5)
            };

            Master = MasterPage;

            MasterPage.IsVisible = false;
            //menu buttons & handlers
            listView.ItemTapped += async (sender, e) =>
            {
                switch (e.Item.ToString())
                {
                    case "Refresh Game":
                        if (InGame) await GameManager.RefreshGame().ConfigureAwait(false); //.ConfigureAwait(false);
                        ViewController.Invoke(() => IsPresented = false);
                        break;
                    case "Switch Games":
                        var GameSelect = new GameSelectLayout(ViewController);
                        ViewController.Invoke(() => IsPresented = false);
                        break;
                    case "Logout":
                        ViewController.LogInManager.LogOut();
                        ViewController.Invoke(() => IsPresented = false);
                        break;
                    case "How To Play":
                        ViewController.Invoke(() => ((ListView) sender).SelectedItem = null);
                        var OkButton = new Button
                        {
                            Text = "Back To Menu",
                            FontSize = 15,
                            HorizontalOptions = LayoutOptions.Center,
                            HeightRequest = 50
                        };
                        var tempstack = new StackLayout
                        {
                            Children =
                            {
                                /*
                                new Label
                                {
                                     Text = "How To Play",
                                     FontSize = 30,
                                     HorizontalOptions = LayoutOptions.Center,
                                     HeightRequest = 50,
                                },
                                */
                                new Image
                                {
                                    Source = "how_to_play.png"
                                },
                                new Label
                                {
                                    Text = HowToPlayOne,
                                    FontSize = 18,
                                    HorizontalOptions = LayoutOptions.Center
                                },
                                new Label
                                {
                                    Text = HowToPlayTwo,
                                    FontSize = 18,
                                    HorizontalOptions = LayoutOptions.Center
                                },
                                new Label
                                {
                                    Text = HowToPlayThree,
                                    FontSize = 18,
                                    HorizontalOptions = LayoutOptions.Center
                                },
                                OkButton
                            }
                        };

                        ViewController.Invoke(() => MasterPage.Content = tempstack);

                        OkButton.Clicked +=
                            (senderer, args) => { ViewController.Invoke(() => MasterPage.Content = listView); };
                        break;
                    default:
                        ViewController.Invoke(() => IsPresented = false);
                        break;
                }
                ViewController.Invoke(() => ((ListView) sender).SelectedItem = null);
            };


            Detail = new NavigationPage(ViewController);
        }