using HDL_ON.UI.CSS;
|
using Shared;
|
using System;
|
namespace HDL_ON.UI
|
{
|
/// <summary>
|
/// 图库界面
|
/// </summary>
|
public class GalleryPage : FrameLayout
|
{
|
FrameLayout bodyView;
|
VerticalScrolViewLayout contentView;
|
|
string lastPath;
|
|
Action<string> backAction;
|
|
public GalleryPage(string lastPath,Action<string> action)
|
{
|
bodyView = this;
|
this.lastPath = lastPath;
|
backAction = action;
|
}
|
|
public void LoadPage(bool loadSceneGallery)
|
{
|
bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
|
new TopViewDiv(bodyView, Language.StringByID(StringId.DefaultGallery)).LoadTopView();
|
|
|
contentView = new VerticalScrolViewLayout()
|
{
|
Y = Application.GetRealHeight(64),
|
Height = Application.GetRealHeight(603),
|
};
|
bodyView.AddChidren(contentView);
|
|
if(loadSceneGallery)
|
{
|
LoadSceneGallery();
|
}
|
}
|
/// <summary>
|
/// 加载场景图库
|
/// </summary>
|
void LoadSceneGallery()
|
{
|
contentView.RemoveAll();
|
|
|
FrameLayout sceneImageRow = new FrameLayout()
|
{
|
Height = Application.GetRealWidth(128),
|
};
|
for (int i = 0; i < 10; i++)
|
{
|
string curImagePath = $"Intelligence/Gallery/scenebg{i + 1}.png";
|
|
var sceneImageView = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(172),
|
Height = Application.GetRealWidth(128),
|
BackgroundImagePath = curImagePath,
|
};
|
if (i % 2 == 0)
|
{
|
sceneImageRow = new FrameLayout()
|
{
|
Height = Application.GetRealWidth(128),
|
};
|
contentView.AddChidren(new Button() { Height = Application.GetRealWidth(12) });
|
contentView.AddChidren(sceneImageRow);
|
sceneImageView.X = Application.GetRealWidth(10);
|
sceneImageRow.AddChidren(sceneImageView);
|
}
|
else
|
{
|
sceneImageView.X = Application.GetRealWidth(194);
|
sceneImageRow.AddChidren(sceneImageView);
|
}
|
if (lastPath == curImagePath)
|
{
|
var btnLastChooseTip = new Button()
|
{
|
X = Application.GetRealWidth(146),
|
Y = Application.GetRealWidth(6),
|
Width = Application.GetRealWidth(20),
|
Height = Application.GetRealWidth(20),
|
UnSelectedImagePath = "Intelligence/Gallery/chooseTipIcon.png",
|
};
|
sceneImageView.AddChidren(btnLastChooseTip);
|
}
|
|
sceneImageView.MouseUpEventHandler = (sender, e) => {
|
this.RemoveFromParent();
|
backAction(curImagePath);
|
};
|
}
|
|
}
|
|
|
}
|
}
|