protected override MenuScreen ProtectedUpdate(ScreenLayout layout)
    {
        //Title and "back" button.

        DrawTitleString("Credits", layout.Title);

        if (DrawButtonMenu(layout.ButtonMenu, new GUIContent[] { new GUIContent("Back") }, new GetData <bool>[] { () => true }, false))
        {
            return(new MainMenuScreen(MatchData, Consts, Owner));
        }

        Vector2 offset = new Vector2(layout.Body.xMin, layout.Body.yMin);

        for (int i = 0;
             i < Consts.Credits.Length &&
             i < Consts.Credits_Offsets.Length &&
             i < WorldConstants.GUIStyles.Credits.Length;
             ++i)
        {
            GUI.Label(new Rect((Consts.Credits_Offsets[i].x * layout.Body.width) + offset.x,
                               (Consts.Credits_Offsets[i].y * layout.Body.height) + offset.y,
                               layout.Body.width * 0.5f, 100),
                      Consts.Credits[i],
                      WorldConstants.GUIStyles.Credits[i]);
        }

        return(this);
    }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Xamarin.Essentials.Platform.Init(this, bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication((mBarcodeReaderSampleApp = new BarcodeReaderSample.App()));
            mMainPage = (BarcodeReaderSample.MainPage)mBarcodeReaderSampleApp.MainPage;

            //lock application orientation
            ScreenLayout screenSize = Application.Context.ApplicationContext.Resources.Configuration.ScreenLayout & ScreenLayout.SizeMask;

            switch (screenSize)
            {
            case ScreenLayout.SizeXlarge:
            case ScreenLayout.SizeLarge:
                this.RequestedOrientation = ScreenOrientation.Landscape;
                break;

            default:
                this.RequestedOrientation = ScreenOrientation.Portrait;
                break;
            }
        }
Beispiel #3
0
        public static bool IsTablet(this Context context)
        {
            ScreenLayout screenSize = context.Resources.Configuration.ScreenLayout &
                                      ScreenLayout.SizeMask;

            return(screenSize == ScreenLayout.SizeLarge || screenSize == ScreenLayout.SizeXlarge);
        }
 public Cam_Status_Holder(Cam_Status sp, Cam_Status jung, Cam_Status jap, Cam_Status vik, ScreenLayout lay)
 {
     space = sp;
     jungle = jung;
     japan = jap;
     viking = vik;
     layout = lay;
 }
Beispiel #5
0
    protected override MenuScreen ProtectedUpdate(ScreenLayout layout)
    {
        //The music looping system.

        if (!started)
        {
            started = true;

            //Start playing the main menu music if it isn't playing already.
            if (Owner.MusicLooper == null ||
                Owner.MusicLooper.Loop != Owner.MenuMusic)
            {
                if (Owner.MusicLooper != null)
                {
                    Owner.MusicLooper.EndLoop();
                }

                Owner.MusicLooper = new FadeLoopNoise(Owner.MenuMusic, "Menu Music");
                Owner.MusicLooper.StartLoop();
            }
        }
        else
        {
            Owner.MusicLooper.UpdateLoop();
        }


        //The actual main menu.

        if (!DrawBackground)
        {
            Texture2D logo = Owner.Logos[Owner.LogoToUse];

            float logoWidth  = Screen.width;
            float logoHeight = (logo.height / (float)logo.width) * logoWidth;
            float yOffset    = (Screen.height - logoHeight) * 0.5f;

            GUI.DrawTexture(new Rect(0.0f, yOffset, logoWidth, logoHeight), logo);
        }

        GUI.color = Color.white;

        return(DrawButtonMenu(layout.ButtonMenu,
                              new GUIContent[]
        {
            new GUIContent("Quit"),
            new GUIContent("Credits"),
            new GUIContent("Create Game"),
        },
                              new GetData <MenuScreen>[]
        {
            () => { Application.Quit(); return this; },
            () => new CreditsScreen(Owner, MatchData, Consts),
            () => new CreateMatchMenuScreen(MatchData, Consts, Owner),
        },
                              this, WorldConstants.GUIStyles.MainMenuButtons));
    }
Beispiel #6
0
        public static bool IsTablet(Context context)
        {
            ScreenLayout screenSize = context.Resources.Configuration.ScreenLayout & ScreenLayout.SizeMask;
            bool         tablet     = false;

            switch (screenSize)
            {
            case ScreenLayout.SizeXlarge:
                tablet = true;
                break;

            case ScreenLayout.SizeLarge:
                tablet = true;
                break;
            }
            return(tablet);
        }
Beispiel #7
0
    public void ChangeScreenLayout(ScreenLayout new_layout)
    {
        layout = new_layout;

        switch (layout)
        {
        case ScreenLayout.Dialog:
            dialogBox.gameObject.SetActive(true);
            choices.SetActive(false);
            break;

        case ScreenLayout.Question:
            dialogBox.gameObject.SetActive(true);
            arrow.SetActive(false);
            choices.SetActive(false);
            break;
        }
    }
Beispiel #8
0
        protected override void OnElementChanged(ElementChangedEventArgs <PclAdBannerView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null || App.AdsRenderState == AdsState.RenderNothing)
            {
                return;
            }

            if (e.OldElement == null && App.AdsRenderState == AdsState.Render)
            {
                ScreenLayout screenlayout = Resources.Configuration.ScreenLayout;
                logger.Info($"screenLayout {screenlayout}");

                adView          = new AdView(Forms.Context);
                adView.AdUnitId = Secrets.DroidBannerId;
                adView.AdSize   = AdSize.SmartBanner;

                adView.LoadAd(new AdRequest.Builder().AddTestDevice(Secrets.DroidTestRequestId).Build());
                SetNativeControl(adView);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Draws the GUI objects for this screen and returns the new MenuScreen to use (return "this" if the screen shouldn't change).
 /// </summary>
 protected abstract MenuScreen ProtectedUpdate(ScreenLayout layout);
Beispiel #10
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Texture2D back = new Texture2D(graphics.GraphicsDevice, 1, 1);

            UInt32[] pixel = { 0xAA000000 };
            back.SetData <UInt32>(pixel, 0, back.Width * back.Height);

            sl = new ScreenLayout(this, spriteBatch);
            var frame = new FrameLayout(this, spriteBatch);

            frame.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.MatchViewport);
            frame.Background       = back;

            var frame2 = new FrameLayout(this, spriteBatch);

            frame2.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.WrapContent);
            frame2.Background       = back;

            var b = new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.Center, Gravity.Start)
                {
                    Height = 300, Wight = 300
                },
                Background = back,
                Text       = "ERTre",
                SpriteFont = Content.Load <SpriteFont>("sp")
            };

            frame2.Views.Add(b);

            frame2.Views.Add(new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start)
                {
                    Wight = 100, Height = 100
                },
                Background = back,
                Text       = "ERTre2",
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            frame2.Views.Add(new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.End, Gravity.Start)
                {
                    Wight = 100, Height = 100
                },
                Background = back,
                Text       = "ERTre2",
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            var frame3 = new FrameLayout(this, spriteBatch);

            frame3.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Center, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.WrapContent)
            {
                Wight = 100, Height = 100
            };
            frame3.Background = back;

            frame3.Views.Add(new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.Center, Gravity.Start)
                {
                    Wight = 100, Height = 100
                },
                Background = back,
                Text       = "ERTre",
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            frame3.Views.Add(new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start)
                {
                    Wight = 100, Height = 100
                },
                Background = back,
                Text       = "ERTre2",
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            frame3.Views.Add(new Button(this, spriteBatch)
            {
                LayoutParameters = new LayoutParameters(Gravity.End, Gravity.Start)
                {
                    Wight = 100, Height = 100
                },
                Background = back,
                Text       = "ERTre2",
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            frame.Views.Add(frame2);
            frame.Views.Add(frame3);

            var hl = new ScrollView(this, spriteBatch)
            {
                LayoutParameters =
                    new LayoutParameters(Gravity.Start, Gravity.End)
                {
                    Height         = 1000,
                    LayoutFillingX = LayoutFilling.MatchViewport
                },
                Background = back
            };

            var bbb2 = new Button(this, spriteBatch)
            {
                Text             = "test-",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            };

            bbb2.Click += (v) =>
            {
                //hl.ContentOffestX -= 50;
                //hl.ApplyChanges(Point.Zero);
            };

            hl.Views.Add(bbb2);

            var bbb = new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            };

            bbb.Click += (v) =>
            {
                //hl.ContentOffestX += 50;
                //hl.ApplyChanges(Point.Zero);
            };

            hl.Views.Add(bbb);

            hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15, PaddingUp = 30
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            });

            hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            }); hl.Views.Add(new Button(this, spriteBatch)
            {
                Text             = "test+",
                Background       = back,
                LayoutParameters = new LayoutParameters()
                {
                    Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5
                },
                SpriteFont = Content.Load <SpriteFont>("sp")
            });
            frame.Views.Add(hl);
            b.Click += button =>
            {
                hl.Direction = hl.Direction == Direction.Horizontal ? Direction.Vertical : Direction.Horizontal;
                hl.ApplyChanges(Point.Zero);
            };

            sl.Views.Add(frame);
            sl.ApplyChanges(Point.Zero);
        }
Beispiel #11
0
 public override void Update()
 {
     if (m_addPlayerButton.IsClicked)
     {
         SubsystemGameInfo subsystemGameInfo = m_subsystemPlayers.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
         if (subsystemGameInfo.WorldSettings.GameMode == GameMode.Cruel)
         {
             DialogsManager.ShowDialog(null, new MessageDialog("Unavailable", "Cannot add players in cruel mode.", LanguageControl.Get("Usual", "ok"), null, null));
         }
         else if (subsystemGameInfo.WorldSettings.GameMode == GameMode.Adventure)
         {
             DialogsManager.ShowDialog(null, new MessageDialog("Unavailable", "Cannot add players in adventure mode.", LanguageControl.Get("Usual", "ok"), null, null));
         }
         else if (m_subsystemPlayers.PlayersData.Count >= 4)
         {
             DialogsManager.ShowDialog(null, new MessageDialog("Unavailable", $"A maximum of {4} players are allowed.", LanguageControl.Get("Usual", "ok"), null, null));
         }
         else
         {
             ScreensManager.SwitchScreen("Player", PlayerScreen.Mode.Add, m_subsystemPlayers.Project);
         }
     }
     if (m_screenLayoutButton.IsClicked)
     {
         ScreenLayout[] array = null;
         if (m_subsystemPlayers.PlayersData.Count == 1)
         {
             array = new ScreenLayout[1];
         }
         else if (m_subsystemPlayers.PlayersData.Count == 2)
         {
             array = new ScreenLayout[3]
             {
                 ScreenLayout.DoubleVertical,
                 ScreenLayout.DoubleHorizontal,
                 ScreenLayout.DoubleOpposite
             };
         }
         else if (m_subsystemPlayers.PlayersData.Count == 3)
         {
             array = new ScreenLayout[4]
             {
                 ScreenLayout.TripleVertical,
                 ScreenLayout.TripleHorizontal,
                 ScreenLayout.TripleEven,
                 ScreenLayout.TripleOpposite
             };
         }
         else if (m_subsystemPlayers.PlayersData.Count == 4)
         {
             array = new ScreenLayout[2]
             {
                 ScreenLayout.Quadruple,
                 ScreenLayout.QuadrupleOpposite
             };
         }
         if (array != null)
         {
             DialogsManager.ShowDialog(null, new ListSelectionDialog("Select Screen Layout", array, 80f, delegate(object o)
             {
                 string str  = o.ToString();
                 string name = "Textures/Atlas/ScreenLayout" + str;
                 return(new StackPanelWidget
                 {
                     Direction = LayoutDirection.Horizontal,
                     VerticalAlignment = WidgetAlignment.Center,
                     Children =
                     {
                         (Widget) new RectangleWidget
                         {
                             Size = new Vector2(98f, 56f),
                             Subtexture = ContentManager.Get <Subtexture>(name),
                             FillColor = Color.White,
                             OutlineColor = Color.Transparent,
                             Margin = new Vector2(10f, 0f)
                         },
                         (Widget) new StackPanelWidget
                         {
                             Direction = LayoutDirection.Vertical,
                             VerticalAlignment = WidgetAlignment.Center,
                             Margin = new Vector2(10f, 0f),
                             Children =
                             {
                                 (Widget) new LabelWidget
                                 {
                                     Text = StringsManager.GetString("ScreenLayout." + str + ".Name"),
                                     Font = ContentManager.Get <BitmapFont>("Fonts/Pericles")
                                 },
                                 (Widget) new LabelWidget
                                 {
                                     Text = StringsManager.GetString("ScreenLayout." + str + ".Description"),
                                     Font = ContentManager.Get <BitmapFont>("Fonts/Pericles"),
                                     Color = Color.Gray
                                 }
                             }
                         }
                     }
                 });
             }, delegate(object o)
             {
                 if (o != null)
                 {
                     if (m_subsystemPlayers.PlayersData.Count == 1)
                     {
                         SettingsManager.ScreenLayout1 = (ScreenLayout)o;
                     }
                     if (m_subsystemPlayers.PlayersData.Count == 2)
                     {
                         SettingsManager.ScreenLayout2 = (ScreenLayout)o;
                     }
                     if (m_subsystemPlayers.PlayersData.Count == 3)
                     {
                         SettingsManager.ScreenLayout3 = (ScreenLayout)o;
                     }
                     if (m_subsystemPlayers.PlayersData.Count == 4)
                     {
                         SettingsManager.ScreenLayout4 = (ScreenLayout)o;
                     }
                 }
             }));
         }
     }
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen("Game");
     }
 }