Example #1
0
 public void Select(ButtonSprite button)
 {
     if (Selected != button || !SelectionMenu)
     {
         if (Selected != null && SelectionMenu)
         {
             //Selected.BorderColor = "#00AA33";
             //Selected.ButtonColor = "#11CC55";
             Selected.SetColorScheme(0);
         }
         Selected = button;
         var OSC  = OnChoose;
         var self = this;
         if (SelectionMenu && Selected != null)
         {
             //Selected.BorderColor = "#FFFFFF";
             //Selected.ButtonColor = "#FF0000";
             Selected.SetColorScheme(1);
         }
         if (Selected != null && Script.Write <bool>("OSC"))
         {
             self.OnChoose();
         }
     }
 }
Example #2
0
        public ButtonSprite AddButton(string buttonText, int row = -1, dynamic data = null)
        {
            TextSprite T = new TextSprite();

            T.Text     = buttonText;
            T.FontSize = FontSize;
            //ButtonSprite B = new ButtonSprite(T, (int)(FontSize * 0.05));
            ButtonSprite B = new ButtonSprite(T, (int)(FontSize * 0.1));

            if (data != null)
            {
                B.Data = data;
            }
            AddButton(B, row);
            return(B);
        }
Example #3
0
 public void AddButton(ButtonSprite button, int row = -1)
 {
     if (rows.Count == 0)
     {
         rows.Add(new List <ButtonSprite>());
     }
     if (row == -1)
     {
         row = rows.Count - 1;
     }
     if (button != null)
     {
         button.OnClick = () => { Self.Select(button); };
     }
     rows[row].Add(button);
 }
Example #4
0
        protected void UpdateRow(int index, float y)
        {
            List <ButtonSprite> row = rows[index];
            float X  = (MenuWidth / (row.Count + 1.0f));
            int   i  = 0;
            float CX = X;

            CX += Position.X;
            while (i < row.Count)
            {
                ButtonSprite B = row[i];
                if (B != null)
                {
                    CenterOn(B, new Vector2(CX, y));
                }
                CX += X;
                i++;
            }
        }
        public TitleScreen()
        {
            spriteBuffer.Width  = App.Canvas.Width;
            spriteBuffer.Height = (int)(spriteBuffer.Width * App.TargetAspect);
            Title          = new TextSprite();
            Title.FontSize = (int)(spriteBuffer.Width * 0.06f);
            //Title.Text = "Cirno and the mysterious tower";
            Title.Text         = App.GameName;
            Title.TextColor    = "#77FFFF";
            Title.ShadowColor  = "#000000";
            Title.ShadowOffset = new Vector2(2, 2);
            Title.ShadowBlur   = 2;

            CenterTextWithFloats(Title, 0.5f, 0.06f);

            Version              = new TextSprite();
            Version.FontSize     = (int)(spriteBuffer.Width * 0.016f);
            Version.Text         = "Version:" + App.GameVersion;
            Version.TextColor    = "#FFFFFF";
            Version.ShadowColor  = "#000000";
            Version.ShadowOffset = new Vector2(2, 2);
            Version.ShadowBlur   = 2;

            CenterTextWithFloats(Version, 0.75f, 0.11f);

            /*Title.ForceUpdate();
             * Title.Position.Y = spriteBuffer.Height * 0.01f;
             * Title.Position.X = (spriteBuffer.Width / 2) - (Title.spriteBuffer.Width / 2);*/



            Desc           = new TextSprite();
            Desc.FontSize  = (int)(spriteBuffer.Width * 0.030f);
            Desc.TextColor = "#FFFFFF";
            //Desc.Text = "Cirno has found herself in a strange dungeon filled with ghosts!\nHer energy has been stolen, reclaim the energy orbs to extend your time.\nFind the big key to unlock the door.";
            //Desc.Text = "Cirno has found herself in a strange dungeon filled with ghosts!\nReclaim your stolen energy sealed inside the orbs to extend your time.\nFind the gold key to unlock the door.";
            Desc.Text         = "Cirno has found herself in a strange tower filled with ghosts!\nReclaim your stolen energy sealed inside the orbs to extend your time.\nRemember the door's location and search for the gold key.";
            Desc.ShadowColor  = "#000000";
            Desc.ShadowOffset = new Vector2(2, 2);
            Desc.ShadowBlur   = 2;
            CenterTextWithFloats(Desc, 0.5f, 0.2f);

            Controls              = new TextSprite();
            Controls.FontSize     = (int)(spriteBuffer.Width * 0.025f);
            Controls.TextColor    = "#FFFFFF";
            Controls.Text         = "Keyboard Controls:\nLeft/Right=Move\nUp/Down=Aim(Up activates chests/doors)\nZ=Shoot\nX=Jump/Mid-air jump\nA=Place block below you(costs time)\nEnter=Pause\nM=Toggle mute";
            Controls.ShadowColor  = "#000000";
            Controls.ShadowOffset = new Vector2(2, 2);
            Controls.ShadowBlur   = 2;
            CenterTextWithFloats(Controls, 0.5f, 0.4f);
            Controls.Position.X = Desc.Position.X;

            menu = new ButtonMenu(spriteBuffer.Width * 0.8f, spriteBuffer.Height * 0.5f, (int)(spriteBuffer.Width * 0.05f));
            var B = menu.AddButton("Start Game");

            B.OnClick = () => {
                game.Start();
            };
            //menu.Finish();
            B.Position.X += spriteBuffer.Width * 0.38f;
            B.Position.Y  = spriteBuffer.Height * 0.7f;

            //var CB = menu.AddButton("Controller:"+InputControllerManager._this.Controllers[0].id);
            var CB = menu.AddButton("Controller:" + App.IC.id);

            Controller = CB;
            CB.OnClick = () => {
                var ind = InputControllerManager._this.Controllers.IndexOf(App.IC);
                ind++;
                if (ind >= InputControllerManager._this.Controllers.Count)
                {
                    ind -= InputControllerManager._this.Controllers.Count;
                }
                App.IC = InputControllerManager._this.Controllers[ind];
                var TS = CB.Contents.As <TextSprite>();
                var W  = TS.spriteBuffer.Width;
                TS.Text = "Controller:" + App.IC.id;
                TS.ForceUpdate();
                CB.Position.X -= ((TS.spriteBuffer.Width - W) / 2);
            };
            CB.Position.X += spriteBuffer.Width * 0.38f;;
            CB.Position.Y  = B.Position.Y + (spriteBuffer.Height * 0.15f);
            //CB.Visible = false;
            CB.Lock();

            Credits           = new TextSprite();
            Credits.FontSize  = (int)(spriteBuffer.Width * 0.015f);
            Credits.TextColor = "#77FFFF";
            //Credits.Text = "Made by:RSGmaker                                                                                                                     Touhou Project and it's characters are owned by ZUN";
            Credits.Text         = "Made by:RSGmaker                                                                                                           Touhou Project and it's characters are owned by ZUN";
            Credits.ShadowColor  = "#000000";
            Credits.ShadowOffset = new Vector2(2, 2);
            Credits.ShadowBlur   = 2;
            CenterTextWithFloats(Credits, 0.5f, 0.98f);
        }