示例#1
0
 public override void TouchDown(LTouch touch)
 {
     if (desktop != null)
     {
         LComponent[] cs = desktop.GetContentPane().GetComponents();
         for (int i = 0; i < cs.Length; i++)
         {
             if (cs[i] is LButton)
             {
                 LButton btn = ((LButton)cs[i]);
                 if (btn != null && btn.IsVisible())
                 {
                     if (btn.Intersects(touch.X(), touch.Y()))
                     {
                         btn.DoClick();
                     }
                 }
             }
             else if (cs[i] is LPaper)
             {
                 LPaper paper = ((LPaper)cs[i]);
                 if (paper != null && paper.IsVisible())
                 {
                     if (paper.Intersects(touch.X(), touch.Y()))
                     {
                         paper.DoClick();
                     }
                 }
             }
         }
     }
     Click();
 }
示例#2
0
        public override void Build(Transform parent)
        {
            base.Build(parent);

            LButton button = this.gameObject.AddComponent <LButton>();

            button.targetGraphic = this.gameObject.transform.GetComponentInChildren <Image>();
            button.transition    = Selectable.Transition.None;
            button.onClick.AddListener(ButtonOnClick);
        }
 // Замена текущего набора технологий на набор выбранной технологии
 private void DoChangeTech(ShipType AShipType)
 {
     // Очистка предыдущих технологий
     foreach (MonoUIObjectTechShipBuy LButton in FButtons)
     {
         LButton.Delete();
     }
     FButtons.Clear();
     // Создание трейтов и модельки корабликов
     DoCreateTraits(AShipType);
     DoCreateModel(AShipType);
 }
示例#4
0
        public override void OnLoad()
        {
            // 设置指定背景图
            // SetBackground("assets/back2.png");

            // 变更背景
            SetBackground("assets/back1.png");

            // 创建一个开始按钮,按照宽191,高57分解按钮图,并设定其Click事件
            start = new LButton("assets/title_start.png", 191, 57);
            // 设定按钮位置为x=2,y=5
            start.SetLocation(2, 5);
            // 设定此按钮不可用
            start.SetEnabled(false);
            start.Tag   = this;
            start.Click = new StartClick();
            // 添加按钮
            Add(start);

            // 创建一个记录读取按钮,按照宽160,高56分解按钮图
            LButton btn2 = new LButton("assets/title_load.png", 160, 56);

            // 设定按钮位置为x=2,y=start位置类推
            btn2.SetLocation(2, start.GetY() + start.GetHeight() + 20);
            // 设定此按钮不可用
            btn2.SetEnabled(false);
            // 添加按钮
            Add(btn2);

            // 创建一个环境设置按钮,按照宽215,高57分解按钮图
            LButton btn3 = new LButton("assets/title_option.png", 215, 57);

            // 设定按钮位置为x=2,y=btn2位置类推
            btn3.SetLocation(2, btn2.GetY() + btn2.GetHeight() + 20);
            // 设定此按钮不可用
            btn3.SetEnabled(false);
            // 添加按钮
            Add(btn3);

            // 创建一个退出按钮,按照宽142,高57分解按钮图,并设定其Click事件
            end = new LButton("assets/title_end.png", 142, 57);
            // 设定按钮位置为x=2,y=btn3位置类推
            end.SetLocation(2, btn3.GetY() + btn3.GetHeight() + 20);
            // 设定此按钮不可用
            end.SetEnabled(false);
            // 添加按钮
            Add(end);
            // 增加一个标题
            title = new LPaper("assets/title.png", -200, 0);
            // 添加标题
            Add(title);
        }
示例#5
0
 public override bool NextScript(String mes)
 {
     // 自定义命令(有些自定义命令为了突出写成了中文,实际不推荐)
     if (roleName != null)
     {
         if ("noname".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(false);
         }
         else if ("name0".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(true);
             roleName.SetBackground("assets/name0.png");
             roleName.SetLocation(5, 15);
         }
         else if ("name1".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(true);
             roleName.SetBackground("assets/name1.png");
             roleName.SetLocation(GetWidth() - roleName.GetWidth() - 5, 15);
         }
     }
     if ((flag + "星星").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         // 添加脚本事件标记(需要点击后执行)
         SetScrFlag(true);
         type = 1;
         return(false);
     }
     else if ((flag + "去死吧,星星").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         type = 0;
     }
     else if ((flag + "关于天才").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         message.SetVisible(false);
         SetScrFlag(true);
         // 强行锁定脚本
         SetLocked(true);
         yes       = new LButton("assets/dialog_yes.png", 112, 33);
         yes.Tag   = this;
         yes.Click = new YesClick();
         CenterOn(yes);
         Add(yes);
         return(false);
     }
     return(true);
 }
        /// <summary>
        ///     逐个显示
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="img"></param>
        public static void DisPlayListItem(LiuXingData tag, Image img)
        {
            if (tag == null) return;
            // 磁贴方块
            var cellpal = new EPanel
                {
                    Size = new Size(406, 210),
                    BackColor = Color.White,
                    Tag = tag
                };
            PublicStatic.LiuXingCon.Controls.Add(cellpal);

            if (!string.IsNullOrEmpty(tag.Cos))
            {
                new HDarge(
                    cellpal,
                    tag.Cos,
                    new Font(PublicStatic.SegoeFont, 12F),
                    new Size(40, 25),
                    new Point(-2, 44 + 24 + 45 + 25 + 20 - 135),
                    Color.FromArgb(248, 248, 248), Color.FromArgb(0, 122, 204),
                    ContentAlignment.MiddleCenter, AnchorStyles.Top
                    );
            }
            // 方块内海报
            if (img != null)
            {
                var cellimg = new EPicBox
                    {
                        Size = new Size(150, 210),
                        BackColor = Color.White,
                        Image = img,
                        SizeMode = PictureBoxSizeMode.StretchImage
                    };
                cellpal.Controls.Add(cellimg);
            }
            // 方块内文字
            string tempname = tag.Name;
            if (!string.IsNullOrEmpty(tempname))
            {
                if (tempname.Contains("/"))
                {
                    tempname = tempname.Split("/".ToCharArray())[0];
                }
                new HDarge(
                    cellpal,
                    tempname,
                    new Font(PublicStatic.SegoeFont, 22F),
                    new Size(244, 42),
                    new Point(150, 10),
                    Color.FromArgb(0, 122, 204), Color.Transparent,
                    ContentAlignment.BottomCenter, AnchorStyles.Top
                    );
            }
            new HDarge(
                cellpal,
                "",
                new Font(PublicStatic.SegoeFont, 14F),
                new Size(240, 1),
                new Point(150 + 8, 48 + 10),
                Color.Transparent, Color.FromArgb(90, 122, 204),
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );
            new HDarge(
                cellpal,
                "主演:" + tag.Car,
                new Font(PublicStatic.SegoeFont, 12F),
                new Size(248, 45),
                new Point(150 + 6, 44 + 24),
                Color.FromArgb(60, 60, 60), Color.Transparent,
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );
            new HDarge(
                cellpal,
                "年代:" + tag.Tim,
                new Font(PublicStatic.SegoeFont, 12F),
                new Size(120, 25),
                new Point(150 + 6, 44 + 24 + 45),
                Color.FromArgb(60, 60, 60), Color.Transparent,
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );
            new HDarge(
                cellpal,
                "地区:" + tag.Loc,
                new Font(PublicStatic.SegoeFont, 12F),
                new Size(120, 25),
                new Point(150 + 6 + 120, 44 + 24 + 45),
                Color.FromArgb(60, 60, 60), Color.Transparent,
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );
            new HDarge(
                cellpal,
                "类型:" + tag.Typ,
                new Font(PublicStatic.SegoeFont, 12F),
                new Size(120, 25),
                new Point(150 + 6, 44 + 24 + 45 + 25),
                Color.FromArgb(60, 60, 60), Color.Transparent,
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );
            new HDarge(
                cellpal,
                "更新:" + tag.Upt,
                new Font(PublicStatic.SegoeFont, 12F),
                new Size(120, 25),
                new Point(150 + 6 + 120, 44 + 24 + 45 + 25),
                Color.FromArgb(60, 60, 60), Color.Transparent,
                ContentAlignment.MiddleLeft, AnchorStyles.Top
                );

            // 方块内按钮
            string temphds = tag.HDs;
            if (string.IsNullOrEmpty(temphds)) return;
            var playbtn = new LButton
                (
                cellpal,
                1,
                temphds,
                new Font(PublicStatic.SegoeFont, 12.5F),
                new Size(101, 32),
                new Point(150 + 152, 40 + 25*5 + 2*5),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(248, 248, 248),
                Color.FromArgb(248, 248, 248),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(248, 248, 248),
                AnchorStyles.Top
                );
            var copybtn = new LButton
                (
                cellpal,
                1,
                "复制链接",
                new Font(PublicStatic.SegoeFont, 12.5F),
                new Size(101, 32),
                new Point(150 + 152 - 101 - 8, 40 + 25*5 + 2*5),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(248, 248, 248),
                Color.FromArgb(248, 248, 248),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(0, 122, 204),
                Color.FromArgb(248, 248, 248),
                AnchorStyles.Top
                );
            copybtn.MouseClick += Copybtn_MouseClick;
            playbtn.MouseClick += Playbtn_MouseClick;

            if (string.IsNullOrEmpty(PublicStatic.SearchBox.Text))
            {
                PublicStatic.LiuXingCon.Focus();
            }
        }