wei
2021-07-05 992cc7d4433f8f9e9b0a930ec095973e056abe1c
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 新建场景菜单界面
    /// </summary>
    public partial class NewSceneMenuListPage : FrameLayout
    {
        FrameLayout bodyView;
        Button btnAddSceneBg;
        Button btnCatchSceneBg;
        Button btnMovieSceneBg;
        Action action;
        public NewSceneMenuListPage(Action act)
        {
            action = act;
            bodyView = this;
        }
 
 
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView();
 
            #region 添加场景
            FrameLayout addSceneView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(67),
                Width = Application.GetRealWidth(361),
                Height = Application.GetRealWidth(202),
                Radius = (uint)Application.GetRealWidth(12),
            };
            bodyView.AddChidren(addSceneView);
 
            ImageView addSceneImageView = new ImageView()
            {
                Gravity = Gravity.CenterHorizontal,
                Radius = (uint)Application.GetRealWidth(12),
                ImagePath = "Intelligence/CreateScene1Bg.png",
            };
            addSceneView.AddChidren(addSceneImageView);
 
            btnAddSceneBg = new Button()
            {
                Radius = (uint)Application.GetRealWidth(12),
            };
            addSceneView.AddChidren(btnAddSceneBg);
 
            Button btnAddSceneText = new Button()
            {
                Y = Application.GetRealWidth(126),
                Height = Application.GetRealWidth(68),
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                TextAlignment = TextAlignment.Center,
                TextID = StringId.AddScene,
            };
            addSceneView.AddChidren(btnAddSceneText);
            #endregion
 
 
            if (DB_ResidenceData.Instance.GatewayType == 0) { }
            else
            {
                #region 捕获场景
                FrameLayout catchSceneView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = addSceneView.Bottom,//+ Application.GetRealWidth(10),
                    Width = Application.GetRealWidth(361),
                    Height = Application.GetRealWidth(202),
                    Radius = (uint)Application.GetRealWidth(12),
                };
                bodyView.AddChidren(catchSceneView);
 
                ImageView catchSceneImageView = new ImageView()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Radius = (uint)Application.GetRealWidth(12),
                    ImagePath = "Intelligence/CreateScene2Bg.png",
                };
                catchSceneView.AddChidren(catchSceneImageView);
 
                btnCatchSceneBg = new Button()
                {
                    Radius = (uint)Application.GetRealWidth(12),
                };
                catchSceneView.AddChidren(btnCatchSceneBg);
 
                Button btnCatchSceneText = new Button()
                {
                    Y = Application.GetRealWidth(126),
                    Height = Application.GetRealWidth(68),
                    TextColor = CSS_Color.MainBackgroundColor,
                    TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                    TextAlignment = TextAlignment.Center,
                    TextID = StringId.CatchScene,
                };
                catchSceneView.AddChidren(btnCatchSceneText);
                #endregion
            }
 
            /*
            #region 电影场景
            FrameLayout movieSceneView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = catchSceneView.Bottom ,//+ Application.GetRealHeight(10),
                Width = Application.GetRealWidth(361),
                Height = Application.GetRealWidth(202),
                Radius = (uint)Application.GetRealWidth(12),
            };
            bodyView.AddChidren(movieSceneView);
 
            ImageView movieSceneImageView = new ImageView()
            {
                Gravity = Gravity.CenterHorizontal,
                Radius = (uint)Application.GetRealWidth(12),
                ImagePath = "Intelligence/CreateScene3Bg.png",
            };
            movieSceneView.AddChidren(movieSceneImageView);
 
            btnMovieSceneBg = new Button()
            {
                Radius = (uint)Application.GetRealWidth(12),
            };
            movieSceneView.AddChidren(btnMovieSceneBg);
 
            Button btnMovieSceneText = new Button()
            {
                Y = Application.GetRealWidth(126),
                Height = Application.GetRealWidth(68),
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                TextAlignment = TextAlignment.Center,
                TextID = StringId.MovieScene,
            };
            movieSceneView.AddChidren(btnMovieSceneText);
            #endregion
            */
 
            LoadEventList();
        }
    }
    //----------------
    public partial class NewSceneMenuListPage
    {
 
        void LoadEventList()
        {
            LoadEvent_SkipAddScenePage();
            if (DB_ResidenceData.Instance.GatewayType != 0)
            {
                LoadEvent_SkipCatchScenePage();
            }
        }
 
        /// <summary>
        /// 跳转创建场景界面
        /// </summary>
        void LoadEvent_SkipAddScenePage()
        {
            btnAddSceneBg.MouseUpEventHandler = (sender, e) =>
            {
                Action backAction = () => {
                    this.RemoveFromParent();
                    action();
                };
                var scene = new Scene() { roomIds = new System.Collections.Generic.List<string>() { "" } };
                scene.NewSid();
                scene.name = Language.StringByID(StringId.Scene) + " " + (1 + FunctionList.List.scenes.Count).ToString();
                var aep = new SceneAddPage(scene,backAction);
                MainPage.BasePageView.AddChidren(aep);
                aep.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
 
        /// <summary>
        /// 跳转捕获场景界面
        /// </summary>
        void LoadEvent_SkipCatchScenePage()
        {
            btnCatchSceneBg.MouseUpEventHandler = (sener, e) => {
                Action backAction = () => {
                    this.RemoveFromParent();
                    action();
                };
                var scene = new Scene() { roomIds = new System.Collections.Generic.List<string>() { "" } };
                scene.NewSid();
                scene.name = Language.StringByID(StringId.Scene) + " " + (1 + FunctionList.List.scenes.Count).ToString();
                var aep = new CatchSceneAddPage(scene, backAction);
                MainPage.BasePageView.AddChidren(aep);
                aep.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
    }
}