示例#1
0
        public HelpScene() : base()
        {
            int    size       = (int)(90 * GameView.scaleFactor);
            Bitmap backBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.back,
                                                           size, size);
            BitmapContent backContent = new BitmapContent(backBitmap, null);
            int           hb          = (int)(80 * GameView.scaleFactor);

            backButton = new Button(backContent, new Rect(-hb, -hb, hb, hb),
                                    pivot, -265 * GameView.scaleFactor, -380 * GameView.scaleFactor);
            backButton.Pressed += () =>
            {
                MenuScene.Instance.Show(Side.Left);
                Hide(Side.Right);
            };

            titleText = new TextContent("GAME RULES", ColorBank.Red,
                                        64 * GameView.scaleFactor, pivot, 0, -160 * GameView.scaleFactor);
            int yStart = -70, yDelta = 60;

            rulesText = new TextContent[4];
            for (int i = 0; i < 4; ++i)
            {
                float y = (yStart + yDelta * i) * GameView.scaleFactor;
                rulesText[i] = new TextContent(rules[i], ColorBank.Red,
                                               36 * GameView.scaleFactor, pivot, 0, y);
            }
        }
示例#2
0
        Button CreateHexagonButton(int size, int id, float x, float y)
        {
            int           hsize   = (int)(0.85 * size);
            int           vsize   = (int)(0.9 * size);
            Rect          bounds  = new Rect(-hsize / 2, -vsize / 2, hsize / 2, vsize / 2);
            Bitmap        bitmap  = BitmapLoader.LoadAndResize(id, size, size);
            BitmapContent content = new BitmapContent(bitmap, null);

            return(new Button(content, bounds, pivot, x, y));
        }
示例#3
0
        Button CreateItem(int bitmap_id, string text, Rect bounds,
                          float x, float y)
        {
            ComplexContent cc       = new ComplexContent(null);
            int            size     = (int)(110 * GameView.scaleFactor);
            Bitmap         bitmap   = BitmapLoader.LoadAndResize(bitmap_id, size, size);
            BitmapContent  bContent = new BitmapContent(bitmap, cc.pivot);
            TextContent    tContent = new TextContent(text, ColorBank.Red,
                                                      50 * GameView.scaleFactor, cc.pivot, 0, 120 * GameView.scaleFactor);

            cc.contents.Add(bContent);
            cc.contents.Add(tContent);
            return(new Button(cc, bounds, pivot, x, y));
        }
        Button CreateDifficultyButton(int res_id, string text, float x, float y)
        {
            int           size = (int)(128 * GameView.scaleFactor);
            Bitmap        b    = BitmapLoader.LoadAndResize(res_id, size, size);
            BitmapContent bc   = new BitmapContent(b, null, 0, 0);
            TextContent   tc   = new TextContent(text, ColorBank.Red, 44 * GameView.scaleFactor,
                                                 null, 0, 110 * GameView.scaleFactor);
            ComplexContent cc = new ComplexContent(null, 0, 0);

            cc.contents.Add(bc);
            cc.contents.Add(tc);
            int  h      = (int)(100 * GameView.scaleFactor);
            int  vup    = (int)(-90 * GameView.scaleFactor);
            int  vdown  = (int)(150 * GameView.scaleFactor);
            Rect bounds = new Rect(-h, vup, h, vdown);

            return(new Button(cc, bounds, pivot, x, y));
        }
示例#5
0
        public ChoiceScene() : base()
        {
            linePaint             = new Paint();
            linePaint.Color       = ColorBank.GetColor(ColorBank.Red);
            linePaint.StrokeWidth = 6 * GameView.scaleFactor;
            lineLR = 308 * GameView.scaleFactor;
            lineX  = 80 * GameView.scaleFactor;

            Rect bounds = new Rect((int)(-310 * GameView.scaleFactor),
                                   (int)(-90 * GameView.scaleFactor), (int)(310 * GameView.scaleFactor),
                                   (int)(235 * GameView.scaleFactor));

            spButton = CreateItem(Resource.Drawable.choice_singleplayer,
                                  "SINGLEPLAYER", bounds, 0, -170 * GameView.scaleFactor);
            spButton.Pressed += () => {
                Hide(Side.Left);
                SingleGameRunupScene.Instance.Show(Side.Right);
            };

            bounds     = new Rect(bounds);
            bounds.Top = (int)(-130 * GameView.scaleFactor);
            mpButton   = CreateItem(Resource.Drawable.choice_multiplayer,
                                    "MULTIPLAYER", bounds, 0, 240 * GameView.scaleFactor);

            int    size       = (int)(90 * GameView.scaleFactor);
            Bitmap backBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.back,
                                                           size, size);
            BitmapContent backContent = new BitmapContent(backBitmap, null);
            int           hb          = (int)(80 * GameView.scaleFactor);

            backButton = new Button(backContent, new Rect(-hb, -hb, hb, hb),
                                    pivot, -265 * GameView.scaleFactor, -380 * GameView.scaleFactor);
            backButton.Pressed += () =>
            {
                MenuScene.Instance.Show(Side.Left);
                Hide(Side.Right);
            };
        }
示例#6
0
        public LogoScene() : base()
        {
            int    fcsDiameter = (int)(330 * GameView.scaleFactor);
            Bitmap fcsBitmap   = BitmapLoader.LoadAndResize(Resource.Drawable.logo_fcs,
                                                            fcsDiameter, fcsDiameter);

            fcsLogo = new BitmapContent(fcsBitmap, pivot, 0, 80 * GameView.scaleFactor);

            int    hseDiameter = (int)(128 * GameView.scaleFactor);
            Bitmap hseBitmap   = BitmapLoader.LoadAndResize(Resource.Drawable.logo_hse,
                                                            hseDiameter, hseDiameter);

            hseLogo = new BitmapContent(hseBitmap, pivot, 0, 350 * GameView.scaleFactor);

            supbyText = new TextContent("SUPPORTED BY", ColorBank.Red,
                                        70 * GameView.scaleFactor, pivot, 0, -330 * GameView.scaleFactor);

            fcsText = new TextContent("THE FACULTY OF COMPUTER SCIENCE", ColorBank.Red,
                                      38 * GameView.scaleFactor, pivot, 0, -230 * GameView.scaleFactor);

            hseText = new TextContent("HIGHER SCHOOL OF ECONOMICS", ColorBank.Red,
                                      38 * GameView.scaleFactor, pivot, 0, -150 * GameView.scaleFactor);
        }
示例#7
0
        public TopBar() : base()
        {
            int  size   = (int)(110 * GameView.scaleFactor);
            int  vSize  = (int)(size / 1.2);
            Rect bounds = new Rect(-vSize, -vSize, vSize, vSize);

            vSize = (int)(size / 1.5);
            float  x = 360 * GameView.scaleFactor - vSize;
            float  y = -640 * GameView.scaleFactor + vSize;
            Bitmap nightmodeBitmap =
                BitmapLoader.LoadAndResize(Resource.Drawable.top_nightmode, size, size);
            Bitmap daymodeBitmap =
                BitmapLoader.LoadAndResize(Resource.Drawable.top_daymode, size, size);
            BitmapContent nightmode = new BitmapContent(nightmodeBitmap, null);
            BitmapContent daymode   = new BitmapContent(daymodeBitmap, null);
            int           s         = (ColorBank.CurrentBgCoef < 0.5) ? 0 : 1;

            dayNightSwitch = new SwitchButton(s, new DrawablePart[] { nightmode, daymode },
                                              bounds, pivot, x, y);

            dayNightSwitch.StateChanged += (state) => ColorBank.ChangeBackgroundColor(state == 0);

            x = -x;
            Bitmap soundOffBitmap =
                BitmapLoader.LoadAndResize(Resource.Drawable.top_soundoff, size, size);
            Bitmap soundOnBitmap =
                BitmapLoader.LoadAndResize(Resource.Drawable.top_soundon, size, size);
            BitmapContent soundOff = new BitmapContent(soundOffBitmap, null);
            BitmapContent soundOn  = new BitmapContent(soundOnBitmap, null);
            int           st       = (SoundMaster.Volume < 0.5) ? 0 : 1;

            soundSwitch = new SwitchButton(st, new DrawablePart[] { soundOff, soundOn },
                                           bounds, pivot, x, y);

            soundSwitch.StateChanged += (state) => SoundMaster.SetVolume(state);
        }
        public SingleGameRunupScene() : base()
        {
            int         rw        = (int)(170 * GameView.scaleFactor);
            int         rh        = (int)(80 * GameView.scaleFactor);
            Rect        r         = new Rect(-rw, -rh, rw, rh);
            RectContent rect      = new RectContent(r);
            TextContent startText = new TextContent("START", ColorBank.Red,
                                                    70 * GameView.scaleFactor, null);
            ComplexContent startCC = new ComplexContent(null);

            startCC.contents.Add(rect);
            startCC.contents.Add(startText);
            startButton          = new Button(startCC, r, pivot);
            startButton.Pressed += () =>
            {
                SingleGameScene.Instance.InitGame(logic);
                SingleGameScene.Instance.Show(Side.Right);
                Hide(Side.Left);
            };

            processingText = new TextContent("PROCESSING...", ColorBank.Red,
                                             50 * GameView.scaleFactor, pivot, 0, -250 * GameView.scaleFactor);

            loading = new LoadingIndicator((int)(100 * GameView.scaleFactor), pivot, 0, 0);

            easyButton = CreateDifficultyButton(Resource.Drawable.brain_easy, "EASY",
                                                -240 * GameView.scaleFactor, 300 * GameView.scaleFactor);
            easyButton.Pressed += () =>
            {
                lineSwitch.CurrentState  = 0;
                SingleGameLogic.BotDepth = 0;
            };

            normalButton = CreateDifficultyButton(Resource.Drawable.brain_normal, "NORMAL",
                                                  0 * GameView.scaleFactor, 300 * GameView.scaleFactor);
            normalButton.Pressed += () =>
            {
                lineSwitch.CurrentState  = 1;
                SingleGameLogic.BotDepth = 2;
            };

            hardButton = CreateDifficultyButton(Resource.Drawable.brain_hard, "HARD",
                                                240 * GameView.scaleFactor, 300 * GameView.scaleFactor);
            hardButton.Pressed += () =>
            {
                lineSwitch.CurrentState  = 2;
                SingleGameLogic.BotDepth = 4;
            };

            lineSwitch = new HLineSwitch((int)(720 * GameView.scaleFactor),
                                         (int)(200 * GameView.scaleFactor), 3, SingleGameLogic.BotDepth / 2,
                                         pivot, 0, 460 * GameView.scaleFactor);

            int    size       = (int)(90 * GameView.scaleFactor);
            Bitmap backBitmap = BitmapLoader.LoadAndResize(Resource.Drawable.back,
                                                           size, size);
            BitmapContent backContent = new BitmapContent(backBitmap, null);
            int           hb          = (int)(80 * GameView.scaleFactor);

            backButton = new Button(backContent, new Rect(-hb, -hb, hb, hb),
                                    pivot, -265 * GameView.scaleFactor, -380 * GameView.scaleFactor);
            backButton.Pressed += () =>
            {
                ChoiceScene.Instance.Show(Side.Left);
                Hide(Side.Right);
            };
        }