Пример #1
0
        public bool LoadZone(Zone zone)
        {
            var gameObject = new GameObject(Settings.Config.ScreenFont);
            var animation = new AnimatedTextSurface("default", 10, 10);
            var frame = animation.CreateFrame();
            frame.DefaultBackground = zone.DebugAppearance.Background;

            gameObject.Name = zone.Title;

            Settings.QuickEditor.TextSurface = frame;
            Settings.QuickEditor.Clear();
            Settings.QuickEditor.Print(0, 0, zone.Title, Color.DarkGray);

            gameObject.Animation = animation;
            gameObject.Position = new Point(zone.Area.Left, zone.Area.Top);
            gameObject.Update();

            var resizable = new ResizableObject<Zone>(ResizableObject.ObjectType.Zone, gameObject, zone);
            resizable.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location;
            Zones.Add(resizable);

            ZonesPanel.RebuildListBox();

            return true;
        }
        void RebuildProperties(Zone zone)
        {
            if (zone.Settings.Count == 0)
            {
                propertySurface.IsVisible = false;
            }
            else
            {
                propertySurface.IsVisible = true;
            }

            if (propertySurface.IsVisible)
            {
                var drawing = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, (zone.Settings.Count * 2) + 1);

                previousProperties = new Dictionary<string, string>();
                int y = 1;
                drawing.Print(0, 0, "Zone Settings", Settings.Green);
                foreach (var setting in zone.Settings)
                {
                    drawing.Print(0, y, setting.Key.Length > Consoles.ToolPane.PanelWidthControls ? setting.Key.Substring(0, Consoles.ToolPane.PanelWidthControls) : setting.Key, Settings.Yellow);
                    drawing.Print(1, y + 1, setting.Value.Length > Consoles.ToolPane.PanelWidthControls - 1 ? setting.Value.Substring(0, Consoles.ToolPane.PanelWidthControls - 1) : setting.Value, Settings.Grey);
                    previousProperties[setting.Key] = setting.Value;
                    y += 2;
                }

                propertySurface.TextSurface = drawing.TextSurface;
            }
        }