Inheritance: Consoles.ITextSurfaceRendered
Exemple #1
0
        public BoxTool()
        {
            animSinglePoint = new AnimatedTextSurface("single", 1, 1, Settings.Config.ScreenFont);
            var _frameSinglePoint = animSinglePoint.CreateFrame();
            _frameSinglePoint[0].GlyphIndex = 42;

            frameEffect = new SadConsole.Effects.Fade()
            {
                UseCellBackground = true,
                FadeForeground = true,
                FadeDuration = 1f,
                AutoReverse = true
            };

            _settingsPanel = new BoxToolPanel();

            ControlPanels = new CustomPanel[] { _settingsPanel };

            //
            Brush = new SadConsole.Game.GameObject();
            Brush.Font = Settings.Config.ScreenFont;
            AnimatedTextSurface animation = new AnimatedTextSurface("single", 1, 1, Settings.Config.ScreenFont);
            animation.CreateFrame()[0].GlyphIndex = 42;
            Brush.Animations.Add(animation.Name, animation);
            Brush.Animation = animation;
        }
        public HotspotTool()
        {
            //_mouseOverObjectPanel = new DisplayObjectToolPanel("Mouse Object");

            //ControlPanels = new CustomPanel[] { _panel, _mouseOverObjectPanel };
            ControlPanels = new CustomPanel[] { };

            Brush = new SadConsole.Game.GameObject(Settings.Config.ScreenFont);
            Brush.Animation = new AnimatedTextSurface("default", 1, 1);
            Brush.Animation.CreateFrame();
            Brush.IsVisible = false;
        }
        public PreviewAnimationPopup(AnimatedTextSurface animation)
            : base(animation.Width + 2, animation.Height + 4)
        {
            textSurface.Font = Settings.Config.ScreenFont;
            this.animation = animation;

            CloseOnESC = true;
            entity = new GameObject(Settings.Config.ScreenFont);
            entity.Position = new Point(1, 1);
            entity.Animation = animation;
            animation.Restart();
            entity.Animation.Start();

            restartAnimation = new Button(animation.Width, 1);
            restartAnimation.Text = "Restart";
            restartAnimation.Position = new Point(1, textSurface.Height - 2);
            restartAnimation.ButtonClicked += (s, e) => this.animation.Restart();
            Add(restartAnimation);
        }
        public static GameObjectSerialized FromFramework(GameObject gameObject)
        {
            var serializedObject = new GameObjectSerialized()
            {
                AnimationName = gameObject.Animation != null ? gameObject.Animation.Name : "",
                Animations = new List<Consoles.AnimatedTextSurface>(gameObject.Animations.Values),
                Font = gameObject.Font,
                IsVisible = gameObject.IsVisible,
                Position = gameObject.Position,
                RepositionRects = gameObject.RepositionRects,
                UsePixelPositioning = gameObject.UsePixelPositioning,
                Name = gameObject.Name,
                RenderOffset = gameObject.RenderOffset
            };

            if (!gameObject.Animations.ContainsKey(serializedObject.AnimationName))
                serializedObject.Animations.Add(gameObject.Animation);

            return serializedObject;
        }
Exemple #5
0
        public CircleTool()
        {
            frameEffect = new SadConsole.Effects.Fade()
            {
                UseCellBackground = true,
                FadeForeground = true,
                FadeDuration = 1f,
                AutoReverse = true
            };

            // Configure the animations
            Brush = new SadConsole.Game.GameObject();
            Brush.Font = Settings.Config.ScreenFont;
            AnimatedTextSurface animation = new AnimatedTextSurface("single", 1, 1, Settings.Config.ScreenFont);
            animation.CreateFrame()[0].GlyphIndex = 42;
            Brush.Animations.Add(animation.Name, animation);

            settingsPanel = new CircleToolPanel();
            ControlPanels = new CustomPanel[] { settingsPanel, CharacterPickPanel.SharedInstance };
            ResetCircle();
        }
        public static GameObject ToFramework(GameObjectSerialized serializedObject)
        {
            var gameObject = new GameObject(serializedObject.Font);

            foreach (var item in serializedObject.Animations)
                gameObject.Animations.Add(item.Name, item);

            if (gameObject.Animations.ContainsKey(serializedObject.AnimationName))
                gameObject.Animation = gameObject.Animations[serializedObject.AnimationName];
            else
                gameObject.Animation = serializedObject.Animations[0];

            gameObject.IsVisible = serializedObject.IsVisible;
            gameObject.Position = serializedObject.Position;
            gameObject.UsePixelPositioning = serializedObject.UsePixelPositioning;
            gameObject.Name = serializedObject.Name;
            gameObject.RenderOffset = serializedObject.RenderOffset;
            gameObject.RepositionRects = serializedObject.RepositionRects;

            return gameObject;
        }
 public void SetEntity(GameObject entity)
 {
     this.entity = entity;
     RebuildListBox();
 }
        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;
        }
        public bool LoadEntity(GameObject entity)
        {
            var editor = new GameObjectEditor();
            editor.SetEntity(entity);
            editor.LinkedEditor = this;
            EditorConsoleManager.AddEditor(editor, false);

            var localEntity = new GameObject(entity.Font);

            foreach (var item in entity.Animations.Values)
                localEntity.Animations.Add(item.Name, item);

            localEntity.Animation = localEntity.Animations[entity.Animation.Name];

            localEntity.RenderOffset = consoleWrapper.Position;
            Objects.Add(new ResizableObject(ResizableObject.ObjectType.GameObject, localEntity));
            GameObjectPanel.RebuildListBox();

            localEntity.Position = entity.Position;
            localEntity.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location;

            LinkedGameObjects.Add(localEntity, entity);

            FixLinkedObjectTitles();
            return true;
        }
        public void OnSelected()
        {
            Brush = new SadConsole.Game.GameObject(Settings.Config.ScreenFont);
            Brush.Animation = new AnimatedTextSurface("default", 1, 1);
            Brush.Animation.DefaultBackground = Color.Black;
            Brush.Animation.DefaultForeground = Color.White;
            Brush.Animation.CreateFrame()[0].GlyphIndex = 42;
            Brush.IsVisible = false;
            RefreshTool();
            EditorConsoleManager.Brush = Brush;
            EditorConsoleManager.UpdateBrush();

            var editor = EditorConsoleManager.ActiveEditor as Editors.GameObjectEditor;

            if (editor != null)
                editor.ShowCenterLayer = true;
        }
 public LayeredGameObject()
 {
     SelectedSurface = new GameObject(Settings.Config.ScreenFont);
 }
Exemple #12
0
        public void OnSelected()
        {
            Brush = new SadConsole.Game.GameObject(Settings.Config.ScreenFont);
            Brush.Animation = new AnimatedTextSurface("default", 1, 1);
            Brush.Animation.CreateFrame();
            Brush.IsVisible = false;
            RefreshTool();
            EditorConsoleManager.Brush = Brush;
            EditorConsoleManager.UpdateBrush();

            EditorConsoleManager.QuickSelectPane.CommonCharacterPickerPanel_ChangedHandler(CharacterPickPanel.SharedInstance, System.EventArgs.Empty);
            CharacterPickPanel.SharedInstance.Changed += CharPanelChanged;
            EditorConsoleManager.QuickSelectPane.IsVisible = true;
        }
 public void SetEntity(GameObject entity)
 {
     this.entity = entity;
     PrintName();
     setName.IsEnabled = entity != null;
 }
 public GameObjectMeta(GameObject backingObject, bool systemLoaded)
 {
     BackingObject = backingObject;
     SystemLoaded = systemLoaded;
 }
        public void SetEntity(GameObject entity)
        {
            gameObject = entity;
            gameObject.Font = SadConsoleEditor.Settings.Config.ScreenFont;

            if (!gameObject.Animations.ContainsValue(gameObject.Animation))
                gameObject.Animation = gameObject.Animations.First().Value;

            animationPanel.SetEntity(gameObject);
            gameObjectNamePanel.SetEntity(gameObject);
            Title = entity.Name;

            SelectedAnimationChanged(gameObject.Animation);
        }
        public void New(Color foreground, Color background, int width, int height)
        {
            Reset();

            var gameObject = new GameObject(SadConsoleEditor.Settings.Config.ScreenFont);

            AnimatedTextSurface animation = new AnimatedTextSurface("default", width, height, SadConsoleEditor.Settings.Config.ScreenFont);
            animation.DefaultForeground = foreground;
            animation.DefaultBackground = background;
            animation.CreateFrame();
            animation.AnimationDuration = 1;

            gameObject.Animations[animation.Name] = animation;
            gameObject.Animation = animation;
            gameObject.Name = "game object";

            SetEntity(gameObject);
        }