コード例 #1
0
ファイル: Characterpage.cs プロジェクト: kxx14cdu/beyondapp
        public CharacterPage(BeyondRootModel Page)
        {
            StackLayout buttonList = new StackLayout {
                Spacing = 15,
                Padding = new Thickness(15,15,15,0),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            ScrollView buttonScroll = new ScrollView {
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            NavigationPage.SetBackButtonTitle (this, "Back");

            Image backgroundImage = new Image () {
                Source = "bg3.jpg",
                Aspect = Aspect.AspectFill
            };

            RelativeLayout layout = new RelativeLayout ();

            layout.Children.Add (backgroundImage, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                }));

            layout.Children.Add (buttonScroll, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                }));

            buttonScroll.Content = buttonList;
            this.Content = layout;
            this.Title = Page.pageName;

            foreach (var character in Page.characters) {
                    buttonList.Children.Add (new BeyondButton {
                        Text = character.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new CharacterViewPage (character));
                        })
                });
            }
        }
コード例 #2
0
ファイル: TextPage.cs プロジェクト: kxx14cdu/beyondapp
        public TextPage(BeyondRootModel Page)
        {
            NavigationPage.SetBackButtonTitle (this, "");
            this.Title = Page.pageName;

            RelativeLayout pageLayout = new RelativeLayout ();

            StackLayout pageView = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand };

            ScrollView scrollContent = new ScrollView { Content = pageView, VerticalOptions = LayoutOptions.FillAndExpand };

            HtmlView test = new HtmlView ();

            ContentView slideContentHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(10,10,10,0) };

            Image backgroundImage = new Image () { Source = "bg4.jpg", Aspect = Aspect.AspectFill };

            slideContentHolder.Content = test;

            test.Text = Page.slideContent;

            pageLayout.Children.Add (backgroundImage, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                })
            );

            pageLayout.Children.Add (scrollContent, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                })
            );

            pageView.Children.Add (slideContentHolder);

            this.Content = pageLayout;
        }
コード例 #3
0
ファイル: MenuPage.cs プロジェクト: kxx14cdu/beyondapp
        public MenuPage(BeyondRootModel[] Pages)
        {
            StackLayout buttonList = new StackLayout {
                Spacing = 15,
                Padding = new Thickness(15,15,15,0),
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            ScrollView buttonScroll = new ScrollView {
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            NavigationPage.SetBackButtonTitle (this, "");

            Image backgroundImage = new Image () {
                Source = "bg1.jpg",
                Aspect = Aspect.AspectFill
            };

            Image logo = new Image () {
                Source = "logo.png"
            };

            RelativeLayout layout = new RelativeLayout ();

            layout.Children.Add (backgroundImage, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                }));

            layout.Children.Add (buttonScroll, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                }));

            buttonScroll.Content = buttonList;

            this.Title = "Main Menu";

            buttonList.Children.Add (logo);

            foreach (var Page in Pages) {
                switch(Page.pageType) {
                case "text":
                    buttonList.Children.Add (new BeyondButton {
                        Text = Page.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new StoryPage (Page),false);
                        })
                    });
                    break;
                case "character_list":
                    buttonList.Children.Add (new BeyondButton {
                        Text = Page.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new CharacterPage (Page));
                        })
                    });
                    break;
                case "screenshots":
                    buttonList.Children.Add (new BeyondButton {
                        Text = Page.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new ScreenshotsPage (Page));
                        })
                    });
                    break;
                case "conceptart":
                    buttonList.Children.Add (new BeyondButton {
                        Text = Page.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new ConceptartPage (Page));
                        })
                    });
                    buttonList.Children.Add (new BeyondButton {
                        Text = "YouTube",
                        Command = new Command (async c => {
                            Device.OpenUri(new Uri("http://www.youtube.com/beyondfleshandbloodgame"));
                        })
                    });
                    buttonList.Children.Add (new BeyondButton {
                        Text = "Social Media",
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new SocialPage ());
                        })
                    });
                    break;
                case "contact":
                    buttonList.Children.Add (new BeyondButton {
                        Text = "About",
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new ContactPage (Page));
                        })
                    });
                    break;
                default:
                    buttonList.Children.Add (new BeyondButton {
                        Text = Page.pageName,
                        Command = new Command (async c => {
                            await Navigation.PushAsync (new TextPage (Page));
                        })
                    });
                    break;
                }
            }

            this.Content = layout;
        }
コード例 #4
0
ファイル: ScreenshotsPage.cs プロジェクト: kxx14cdu/beyondapp
        public ScreenshotsPage(BeyondRootModel Page)
        {
            NavigationPage.SetBackButtonTitle (this, "");
            this.Title = Page.pageName;

            this.BackgroundColor = Color.FromRgb (70, 124, 154);

            StackLayout pageView = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand };

            ScrollView scrollContent = new ScrollView { Content = pageView, VerticalOptions = LayoutOptions.FillAndExpand };

            WrapLayout layout = new WrapLayout () {
                Spacing = 0,
                Orientation = StackOrientation.Horizontal,
                Padding = new Thickness(0,0,0,0)
            };

            List<Frame> imageList = new List<Frame> ();
            int i = 0;
            int imgwidth = 0;
            if ((DeviceInfo.Instance.ScreenWidth % 3) == 0) {
                imgwidth = (DeviceInfo.Instance.ScreenWidth / 3);
            }
            if ((DeviceInfo.Instance.ScreenWidth % 4) == 0) {
                imgwidth = (DeviceInfo.Instance.ScreenWidth / 3);
            }
            if ((DeviceInfo.Instance.ScreenWidth % 6) == 0) {
                imgwidth = (DeviceInfo.Instance.ScreenWidth / 3);
            }
            if ((DeviceInfo.Instance.ScreenWidth % 8) == 0) {
                imgwidth = (DeviceInfo.Instance.ScreenWidth / 3);
            }
            if ((DeviceInfo.Instance.ScreenWidth % 10) == 0) {
                imgwidth = (DeviceInfo.Instance.ScreenWidth / 3);
            }
            foreach (BeyondImage image in Page.screenshots) {
                imageList.Add(new Frame () {
                    WidthRequest = imgwidth,
                    HeightRequest = imgwidth,
                    OutlineColor = Color.FromHex("007DA1"),

                    HasShadow = false,
                    Padding = 0,
                    Content = new Image () {
                        Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)),
                        Aspect = Aspect.AspectFill
                    }
                });
                imageList [i].GestureRecognizers.Add (new TapGestureRecognizer {
                    Command = new Command (() => {
                        Navigation.PushAsync(new ContentPage () {
                            Title = "View Image",
                            BackgroundColor = Color.White,
                            ToolbarItems = {
                                new ToolbarItem ("Download", null, async () => {
                                    Device.OpenUri (new Uri(image.url));
                                })
                            },
                            Content = new Image () {
                                HorizontalOptions = LayoutOptions.Fill,
                                VerticalOptions = LayoutOptions.Fill,
                                Source = ImageSource.FromStream (() => new System.IO.MemoryStream (image.image)),
                                Aspect = Aspect.AspectFit
                            }
                        });
                    }),
                    NumberOfTapsRequired = 1
                });
                layout.Children.Add(imageList[i]);
                i++;
            }

            pageView.Children.Add (layout);

            this.Content = scrollContent;
        }
コード例 #5
0
ファイル: ContactPage.cs プロジェクト: kxx14cdu/beyondapp
        public ContactPage(BeyondRootModel Page)
        {
            NavigationPage.SetBackButtonTitle (this, "");
            this.Title = Page.pageName;

            RelativeLayout pageLayout = new RelativeLayout ();

            StackLayout pageView = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand };

            StackLayout ButtonSection = new StackLayout {				Spacing = 15,
                Padding = new Thickness(15,15,15,0), VerticalOptions = LayoutOptions.FillAndExpand };

            ScrollView scrollContent = new ScrollView { Content = pageView, VerticalOptions = LayoutOptions.FillAndExpand };

            HtmlView test = new HtmlView ();

            Label ContactInfo = new Label () {
                FontFamily = Device.OnPlatform("Orbitron", null, null),
                TextColor = Color.White,
                XAlign = TextAlignment.Center
            };

            ContentView slideContentHolder = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(10,10,10,0) };
            ContentView slideContentHolder2 = new ContentView () { BackgroundColor = new Color (0, 0, 0, 0.5), Padding = new Thickness(10,10,10,0) };

            Image backgroundImage = new Image () { Source = "bg4.jpg", Aspect = Aspect.AspectFill };

            test.Text = Page.copyrightInformation;
            ContactInfo.Text = "Version 1.0 \n\n Contact [email protected] for any queries or information about this application \n\n Thankyou for downloading our App! \n";

            slideContentHolder2.Content = test;
            slideContentHolder.Content = ContactInfo;

            pageLayout.Children.Add (backgroundImage, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                })
            );

            pageLayout.Children.Add (scrollContent, Constraint.Constant (0), Constraint.Constant (0),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Width;
                }),
                Constraint.RelativeToParent ((parent) => {
                    return parent.Height;
                })
            );

            pageView.Children.Add (slideContentHolder);
            pageView.Children.Add (slideContentHolder2);
            pageView.Children.Add (ButtonSection);

            ButtonSection.Children.Add (new BeyondButton {
                Text = "Wiki",
                Command = new Command (async c => {
                    Device.OpenUri(new Uri("http://www.indiedb.com/games/beyond-flesh-and-blood"));
                })
            });

            ButtonSection.Children.Add (new BeyondButton {
                Text = "Forum",
                Command = new Command (async c => {
                    Device.OpenUri(new Uri("http://beyondfleshandbloodgame.com/forum"));
                })
            });

            ButtonSection.Children.Add (new BeyondButton {
                Text = "Blog",
                Command = new Command (async c => {
                    Device.OpenUri(new Uri("http://beyondfleshandbloodgame.com/d/blog/"));
                })
            });

            this.Content = pageLayout;
        }