using System;
|
using HDL_ON.UI.Music;
|
using Shared;
|
namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
|
{
|
public class NumberFrameLayout
|
{
|
public NumberFrameLayout()
|
{
|
}
|
private uint UpBackgroundColor = MusicColor.WhiteColor;
|
private uint DownBackgroundColor = 0xff454635;
|
private Action<Button> action = null;
|
public FrameLayout layout = new FrameLayout
|
{
|
|
Height = Application.GetRealHeight(368),
|
Width = Application.GetRealWidth(343),
|
Radius = (uint)Application.GetRealHeight(17),
|
BackgroundColor = MusicColor.WhiteColor,
|
};
|
|
Button btn1 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "1",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn2 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "2",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn3 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "3",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn4 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "4",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn5 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "5",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn6 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "6",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
|
Button btn7 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "7",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn8 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "8",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn9 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "9",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
Button btn0 = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "0",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
|
Button btn = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
Text = "-/--",
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
};
|
|
Button btn_jia = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
TextID = StringId.pindaojia,
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
|
|
};
|
|
Button btn_jian = new Button
|
{
|
Width = Application.GetRealWidth(78),
|
Height = Application.GetRealHeight(84),
|
TextID = StringId.pindaojian,
|
TextSize = TextSize.Text20,
|
TextColor = MusicColor.TextColor,
|
TextAlignment = TextAlignment.Center,
|
IsBold = true,
|
|
|
};
|
|
/// <summary>
|
/// 添加布局
|
/// </summary>
|
/// <param name="parent"></param>
|
public void AddView(FrameLayout parent)
|
{
|
parent.AddChidren(layout);
|
layout.AddChidren(btn1);
|
layout.AddChidren(btn2);
|
layout.AddChidren(btn3);
|
layout.AddChidren(btn4);
|
layout.AddChidren(btn5);
|
layout.AddChidren(btn6);
|
layout.AddChidren(btn7);
|
layout.AddChidren(btn8);
|
layout.AddChidren(btn9);
|
layout.AddChidren(btn0);
|
layout.AddChidren(btn);
|
layout.AddChidren(btn_jia);
|
layout.AddChidren(btn_jian);
|
|
btn1.Y = Application.GetRealHeight(16);
|
btn1.X = Application.GetRealWidth(16);
|
btn2.Y = Application.GetRealHeight(16);
|
btn2.X = btn1.Right;
|
btn3.Y = Application.GetRealHeight(16);
|
btn3.X = btn2.Right;
|
btn_jia.Y = Application.GetRealHeight(16);
|
btn_jia.X = btn3.Right;
|
|
btn4.Y = btn1.Bottom;
|
btn4.X = Application.GetRealWidth(16);
|
btn5.Y = btn2.Bottom;
|
btn5.X = btn4.Right;
|
btn6.Y = btn3.Bottom;
|
btn6.X = btn5.Right;
|
btn_jian.Y = btn_jia.Bottom;
|
btn_jian.X = btn6.Right;
|
|
btn7.Y = btn6.Bottom;
|
btn7.X = Application.GetRealWidth(16);
|
btn8.Y = btn5.Bottom;
|
btn8.X = btn7.Right;
|
btn9.Y = btn6.Bottom;
|
btn9.X = btn8.Right;
|
btn.Y = btn_jian.Bottom;
|
btn.X = btn9.Right;
|
|
btn0.Y = btn8.Bottom;
|
btn0.X = Application.GetRealWidth(16 + 78);
|
|
btn1.MouseDownEventHandler += (sen, e) => ClickListener(btn1);
|
|
btn2.MouseDownEventHandler += (sen, e) => ClickListener(btn2);
|
|
btn3.MouseDownEventHandler += (sen, e) => ClickListener(btn3);
|
|
btn4.MouseDownEventHandler += (sen, e) => ClickListener(btn4);
|
|
btn5.MouseDownEventHandler += (sen, e) => ClickListener(btn5);
|
|
btn6.MouseDownEventHandler += (sen, e) => ClickListener(btn6);
|
|
btn7.MouseDownEventHandler += (sen, e) => ClickListener(btn7);
|
|
btn8.MouseDownEventHandler += (sen, e) => ClickListener(btn8);
|
|
btn9.MouseDownEventHandler += (sen, e) => ClickListener(btn9);
|
|
btn0.MouseDownEventHandler += (sen, e) => ClickListener(btn0);
|
|
btn.MouseDownEventHandler += (sen, e) => ClickListener(btn);
|
|
btn_jia.MouseDownEventHandler += (sen, e) => ClickListener(btn_jia);
|
|
btn_jian.MouseDownEventHandler += (sen, e) => ClickListener(btn_jian);
|
|
|
}
|
|
private void ClickListener(Button button)
|
{
|
if (button == null)
|
{
|
return;
|
}
|
button.BackgroundColor = DownBackgroundColor;
|
action?.Invoke(button);
|
button.MouseUpEventHandler += (sen, e) =>
|
{
|
button.BackgroundColor = UpBackgroundColor;
|
};
|
}
|
|
|
/// <summary>
|
/// 事件监听方法
|
/// </summary>
|
/// <param name="action">回调(点击控件对象</param>
|
public void SetClickListener(Action<Button> action)
|
{
|
this.action = action;
|
}
|
|
}
|
}
|