wxr
2020-09-09 c3e1b733fc45bd9f0b88bfb560cfa87a270b079b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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);
                };
            }
 
        }
 
 
    }
}