예제 #1
0
        //初始化游戏页
        protected GamePage()
        {
            //渐变图层
            mFadeLayer = new FadeLayer(this);

            //对话框
            DialogLabel = new DialogLabel();

            //角色等
            mActorLayout = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };

            //游戏背景
            mGameBackgroundImage = new RelevantImage(this)
            {
                Source    = InterApplication.Resource.LoadImageSource("GamePage." + GetType().Name + ".Background"),
                RelevantX = 0.5,
                RelevantY = 0.5,
                Aspect    = Aspect.AspectFill
            };

            //UI背景
            mMainUiBacnground = new Image()
            {
                Source = InterApplication.Resource.GameMainUi,
                Aspect = Aspect.Fill
            };

            //主布局
            mMainLayout = new AbsoluteLayout
            {
                Children =
                {
                    mGameBackgroundImage,
                    mActorLayout,
                    mMainUiBacnground,
                    DialogLabel,
                    mFadeLayer
                },
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                BackgroundColor   = Color.Black
            };

            //大小变化
            SizeChanged += OnSizeChanged;

            Content = mMainLayout;
        }
예제 #2
0
        public MainMenuPage()
        {
            //渐变图层
            mFadeLayer = new FadeLayer(this);

            //标题
            mTitleImage = new Image
            {
                Source = InterApplication.Resource.Title,

                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };

            //两个按钮
            mStartGameButton = new Control.Button("")
            {
                IsVisible = false
            };
            mAboutButton = new Control.Button("")
            {
                IsVisible = false
            };

            mStartGameButton.Clicked += StartGame;

            //两个按钮的布局
            mSubLayout = new StackLayout
            {
                Children =
                {
                    mStartGameButton,
                    mAboutButton
                },
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            //主布局
            mMainLayout = new StackLayout
            {
                Children =
                {
                    mTitleImage,
                    mSubLayout,
                },
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            //背景
            mBackgroundImage = new RelevantImage(this)
            {
                Source    = InterApplication.Resource.TitleBackground,
                RelevantX = 0.5,
                RelevantY = 0.5,
                Aspect    = Aspect.AspectFill
            };

            mMainLayoutWithBackgroundImage = new AbsoluteLayout
            {
                Children =
                {
                    mBackgroundImage,
                    mMainLayout,
                    mFadeLayer
                }
            };
            Content = mMainLayoutWithBackgroundImage;

            BackgroundColor = Color.Black;
        }