xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
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
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public class SceneControlZone :FrameLayout
    {
        Scene scene;
        Button btnIcon;
        Button btnName;
        Button btnFromFloor;
        Button btnCollectionIcon;
 
        public SceneControlZone(Scene inParScene)
        {
            scene = inParScene;
            Gravity = Gravity.CenterHorizontal;
            Width = Application.GetRealWidth(343);
            Height = Application.GetRealHeight(65);
            Radius = (uint)Application.GetMinRealAverage(12);
            BorderColor = 0x00FFFFFF;
            BorderWidth = 1;
            BackgroundColor = CSS_Color.MainBackgroundColor;
            Tag = "Scene-" + scene.sid;
        }
 
 
        /// <summary>
        /// 加载功能类型控制卡片
        /// </summary>
        public void LoadView()
        {
            btnIcon = new Button()
            {
                X = Application.GetRealWidth(10),
                Y = Application.GetRealHeight(15),
                Width = Application.GetRealWidth(32),
                Height = Application.GetRealWidth(32),
            };
            this.AddChidren(btnIcon);
 
            btnName = new Button()
            {
                X = Application.GetRealWidth(8 + 10 + 32),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(24),
                Text = scene.name,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
            this.AddChidren(btnName);
 
            btnFromFloor = new Button()
            {
                X = Application.GetRealWidth(8 + 10 + 32),
                Y = Application.GetRealHeight(10 + 24),
                Width = Application.GetRealWidth(200),
                Height = Application.GetRealHeight(18),
                Text = scene.GetRoomListName(),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            this.AddChidren(btnFromFloor);
 
            btnCollectionIcon = new Button()
            {
                X = Application.GetRealWidth(299),
                Y = Application.GetRealHeight(10),
                Width = Application.GetMinRealAverage(40),
                Height = Application.GetMinRealAverage(40),
                SelectedImagePath = "Collection/CollectionIcon.png",
                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                IsSelected = scene.collect
            };
            this.AddChidren(btnCollectionIcon);
 
            btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
            if (scene.sceneType == SceneType.MovieScene)
            {
                Button movieIcon = new Button()
                {
                    X = Application.GetRealWidth(52),
                    Y = Application.GetRealHeight(14),
                    Width = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(16),
                    UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png",
                };
                this.AddChidren(movieIcon);
                btnName.X = Application.GetRealWidth(52 + 16);
            }
            //加载场景控制事件
            LoadEvent_ControlScene(btnName, btnFromFloor, scene);
 
            LoadEvent_FunctionCollection(btnCollectionIcon, scene);
        }
 
 
        /// <summary>
        /// 加载功能收藏按钮事件
        /// </summary>
        void LoadEvent_FunctionCollection(Button btnCollectionIcon, Scene scene)
        {
            btnCollectionIcon.MouseUpEventHandler += (sender, e) =>
            {
                btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected;
                scene.CollectScene();
            };
        }
        /// <summary>
        /// 加载场景控制事件
        /// </summary>
        void LoadEvent_ControlScene(Button btnName, Button btnFromFloor, Scene scene)
        {
            EventHandler<MouseEventArgs> upEvent = (sender, e) => {
                DriverLayer.Control.Ins.ControlScene(scene);
                string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
                new PublicAssmebly().TipMsgAutoClose(msg, false);
            };
            btnName.MouseUpEventHandler = upEvent;
            btnFromFloor.MouseUpEventHandler = upEvent;
            this.MouseUpEventHandler = upEvent;
        }
 
 
    }
}