Beispiel #1
0
        public UIUpgradeList(UILotControl parent)
        {
            LotParent = parent;
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            Background   = new UIImage(ui.Get("up_background.png").Get(gd)).With9Slice(0, 0, 40, 90);
            Background.X = 191;
            Background.BlockInput();
            Add(Background);

            TitleLabel              = new UILabel();
            TitleLabel.Caption      = "Congratulations! This object is fully upgraded.";
            TitleLabel.CaptionStyle = TextStyle.Create(Color.White, 12, true);
            TitleLabel.Position     = new Vector2(557, 16);
            TitleLabel.Size         = new Vector2(1, 1);
            TitleLabel.Alignment    = TextAlignment.Right | TextAlignment.Top;
            Add(TitleLabel);

            Thermometer                 = new UIUpgradeThermo();
            Thermometer.Position        = new Vector2(549, -73);
            Thermometer.OnHoveredLevel += Hover;
            Thermometer.OnClickedLevel += Click;
            Add(Thermometer);

            BackgroundHeight = 110;
            HidePct          = 1;
        }
Beispiel #2
0
        public UIUpgradeItem(UILotControl parent, VMEntity ent, int level)
        {
            LotParent = parent;
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            Entity = ent;
            Level  = level;

            Background = new UIImage(ui.Get(((level % 2) == 0) ? "up_item_panel.png" : "up_item_panel_alt.png").Get(gd));
            Add(Background);

            Title              = new UILabel();
            Title.Alignment    = TextAlignment.Right | TextAlignment.Top;
            Title.CaptionStyle = TextStyle.Create(Color.White, 12, true);
            Title.Position     = new Vector2(512, 12);
            Title.Size         = Vector2.One;
            Add(Title);

            TitlePrice              = new UILabel();
            TitlePrice.Position     = new Microsoft.Xna.Framework.Vector2(512, 12);
            TitlePrice.CaptionStyle = TextStyle.Create(new Color(115, 255, 115), 12, true);
            TitlePrice.Alignment    = TextAlignment.Right | TextAlignment.Top;
            TitlePrice.Size         = Vector2.One;
            Add(TitlePrice);

            Description              = new UILabel();
            Description.Position     = new Vector2(512, 31);
            Description.CaptionStyle = TextStyle.Create(TextStyle.DefaultLabel.Color, 9, true);
            Description.Alignment    = TextAlignment.Right | TextAlignment.Top;
            Description.Size         = Vector2.One;
            Add(Description);

            Ads              = new UILabel();
            Ads.Position     = new Vector2(512, 47);
            Ads.CaptionStyle = TextStyle.Create(Color.White, 9, true);
            Ads.Alignment    = TextAlignment.Right | TextAlignment.Top;
            Ads.Size         = Vector2.One;
            Add(Ads);

            UpgradedTick          = new UIImage(ui.Get("up_tick.png").Get(gd));
            UpgradedTick.Position = new Vector2(494, 12);
            Add(UpgradedTick);

            Render();
            Size = new Vector2(Background.Width, Background.Height);

            ClickHandler = ListenForMouse(new Rectangle(6, 6, (int)Background.Width - 12, (int)Background.Height - 12), MouseHandler);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;
            Title = "Manual UI";

            var frame = View.Frame;

            // Create a heading using the "h1" css style
            _heading = TextStyle.Create <UILabel> ("h1", "Hello World");
            var headingFrame = _heading.Frame = new CGRect(20f, 120f, frame.Width - 40f, 60f);

            Add(_heading);

            // Create a subheading using the "h2" css style with a custom tag
            _subtitle = TextStyle.Create <UILabel> ("h2", "This is a <spot>subtitle</spot>", new List <CssTagStyle> ()
            {
                new CssTagStyle("spot")
                {
                    CSS = "spot{color:" + Colors.SpotColor.ToHex() + "}"
                }
            });
            var subtitleFrame = _subtitle.Frame = new CGRect(headingFrame.X, headingFrame.Bottom, headingFrame.Width, 40f);

            Add(_subtitle);

            // Create a text entry field
            _textEntry                    = TextStyle.Create <UITextField> ("body");
            _textEntry.Frame              = new CGRect(subtitleFrame.X, subtitleFrame.Bottom, subtitleFrame.Width, 40);
            _textEntry.Layer.BorderColor  = Colors.Grey.CGColor;
            _textEntry.Layer.BorderWidth  = .5f;
            _textEntry.Layer.CornerRadius = 6f;
            _textEntry.Placeholder        = "Type Here";
            _textEntry.LeftViewMode       = UITextFieldViewMode.Always;
            _textEntry.LeftView           = new UIView()
            {
                Frame = new CGRect(0, 0, 6, 6)
            };

            Add(_textEntry);
        }
Beispiel #4
0
        /// <summary>
        /// Initializes static designer context.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        public static void InitializeContext(IServiceProvider serviceProvider)
        {
            // Editor

            Editor = serviceProvider.GetService <ProjectEditor>();

            // Recent Projects

            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test1", "Test1.project"));
            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test2", "Test2.project"));

            // New Project

            Editor.OnNewProject();

            // Transform

            Transform = MatrixObject.Identity;

            // Data

            var db      = Database.Create("Db");
            var fields  = new string[] { "Column0", "Column1" };
            var columns = ImmutableArray.CreateRange(fields.Select(c => Column.Create(db, c)));

            db.Columns = columns;
            var values = Enumerable.Repeat("<empty>", db.Columns.Length).Select(c => Value.Create(c));
            var record = Record.Create(
                db,
                ImmutableArray.CreateRange(values));

            db.Records       = db.Records.Add(record);
            db.CurrentRecord = record;

            Database = db;
            Data     = Context.Create(record);
            Record   = record;

            // Project

            IProjectFactory factory = new ProjectFactory();

            Project = factory.GetProject();

            Template = PageContainer.CreateTemplate();

            Page = PageContainer.CreatePage();
            var layer = Page.Layers.FirstOrDefault();

            layer.Shapes      = layer.Shapes.Add(LineShape.Create(0, 0, null, null));
            Page.CurrentLayer = layer;
            Page.CurrentShape = layer.Shapes.FirstOrDefault();
            Page.Template     = Template;

            Document = DocumentContainer.Create();
            Layer    = LayerContainer.Create();
            Options  = Options.Create();

            // State

            State = ShapeState.Create();

            // Style

            ArgbColor       = ArgbColor.Create(128, 255, 0, 0);
            ArrowStyle      = ArrowStyle.Create();
            FontStyle       = FontStyle.Create();
            LineFixedLength = LineFixedLength.Create();
            LineStyle       = LineStyle.Create();
            Style           = ShapeStyle.Create("Default");
            TextStyle       = TextStyle.Create();

            // Shapes

            Arc             = ArcShape.Create(0, 0, Style, null);
            CubicBezier     = CubicBezierShape.Create(0, 0, Style, null);
            Ellipse         = EllipseShape.Create(0, 0, Style, null);
            Group           = GroupShape.Create(Constants.DefaulGroupName);
            Image           = ImageShape.Create(0, 0, Style, null, "key");
            Line            = LineShape.Create(0, 0, Style, null);
            Path            = PathShape.Create(Style, null);
            Point           = PointShape.Create();
            QuadraticBezier = QuadraticBezierShape.Create(0, 0, Style, null);
            Rectangle       = RectangleShape.Create(0, 0, Style, null);
            Text            = TextShape.Create(0, 0, Style, null, "Text");

            // Path

            ArcSegment                 = ArcSegment.Create(PointShape.Create(), PathSize.Create(), 180, true, SweepDirection.Clockwise, true, true);
            CubicBezierSegment         = CubicBezierSegment.Create(PointShape.Create(), PointShape.Create(), PointShape.Create(), true, true);
            LineSegment                = LineSegment.Create(PointShape.Create(), true, true);
            PathFigure                 = PathFigure.Create(PointShape.Create(), false, true);
            PathGeometry               = PathGeometry.Create(ImmutableArray.Create <PathFigure>(), FillRule.EvenOdd);
            PathSize                   = PathSize.Create();
            PolyCubicBezierSegment     = PolyCubicBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            PolyLineSegment            = PolyLineSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            PolyQuadraticBezierSegment = PolyQuadraticBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true);
            QuadraticBezierSegment     = QuadraticBezierSegment.Create(PointShape.Create(), PointShape.Create(), true, true);
        }
Beispiel #5
0
        /// <summary>
        /// Initializes static designer context.
        /// </summary>
        /// <param name="renderer">The design time renderer instance.</param>
        /// <param name="clipboard">The design time clipboard instance.</param>
        /// <param name="jsonSerializer">The design time Json serializer instance.</param>
        /// <param name="xamlSerializer">The design time Xaml serializer instance.</param>
        /// <returns>The new instance of the <see cref="DesignerContext"/> class.</returns>
        public static void InitializeContext(ShapeRenderer renderer, ITextClipboard clipboard, ITextSerializer jsonSerializer, ITextSerializer xamlSerializer)
        {
            // Editor

            Editor = new ProjectEditor()
            {
                CurrentTool     = Tool.Selection,
                CurrentPathTool = PathTool.Line,
                CommandManager  = new DesignerCommandManager(),
                Renderers       = new ShapeRenderer[] { renderer },
                ProjectFactory  = new ProjectFactory(),
                TextClipboard   = clipboard,
                JsonSerializer  = jsonSerializer,
                XamlSerializer  = xamlSerializer
            }.Defaults();

            // Recent Projects
            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test1", "Test1.project"));
            Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test2", "Test2.project"));

            // Commands

            Editor.InitializeCommands();
            InitializeCommands(Editor);
            Editor.CommandManager.RegisterCommands();

            // New Project

            Editor.OnNew(null);

            // Data

            var db      = XDatabase.Create("Db");
            var fields  = new string[] { "Column0", "Column1" };
            var columns = ImmutableArray.CreateRange(fields.Select(c => XColumn.Create(db, c)));

            db.Columns = columns;
            var values = Enumerable.Repeat("<empty>", db.Columns.Length).Select(c => XValue.Create(c));
            var record = XRecord.Create(
                db,
                db.Columns,
                ImmutableArray.CreateRange(values));

            db.Records       = db.Records.Add(record);
            db.CurrentRecord = record;

            Database = db;
            Data     = XContext.Create(record);
            Record   = record;

            // Project

            IProjectFactory factory = new ProjectFactory();

            Project = factory.GetProject();

            Template = XContainer.CreateTemplate();

            Page = XContainer.CreatePage();
            var layer = Page.Layers.FirstOrDefault();

            layer.Shapes      = layer.Shapes.Add(XLine.Create(0, 0, null, null));
            Page.CurrentLayer = layer;
            Page.CurrentShape = layer.Shapes.FirstOrDefault();
            Page.Template     = Template;

            Document = XDocument.Create();
            Layer    = XLayer.Create();
            Options  = XOptions.Create();

            // State

            State = ShapeState.Create();

            // Style

            ArgbColor       = ArgbColor.Create();
            ArrowStyle      = ArrowStyle.Create();
            FontStyle       = FontStyle.Create();
            LineFixedLength = LineFixedLength.Create();
            LineStyle       = LineStyle.Create();
            Style           = ShapeStyle.Create("Default");
            TextStyle       = TextStyle.Create();

            // Shapes

            Arc             = XArc.Create(0, 0, Style, null);
            CubicBezier     = XCubicBezier.Create(0, 0, Style, null);
            Ellipse         = XEllipse.Create(0, 0, Style, null);
            Group           = XGroup.Create(Constants.DefaulGroupName);
            Image           = XImage.Create(0, 0, Style, null, "key");
            Line            = XLine.Create(0, 0, Style, null);
            Path            = XPath.Create("Path", Style, null);
            Point           = XPoint.Create();
            QuadraticBezier = XQuadraticBezier.Create(0, 0, Style, null);
            Rectangle       = XRectangle.Create(0, 0, Style, null);
            Text            = XText.Create(0, 0, Style, null, "Text");

            // Path

            ArcSegment                 = XArcSegment.Create(XPoint.Create(), XPathSize.Create(), 180, true, XSweepDirection.Clockwise, true, true);
            CubicBezierSegment         = XCubicBezierSegment.Create(XPoint.Create(), XPoint.Create(), XPoint.Create(), true, true);
            LineSegment                = XLineSegment.Create(XPoint.Create(), true, true);
            PathFigure                 = XPathFigure.Create(XPoint.Create(), false, true);
            PathGeometry               = XPathGeometry.Create(ImmutableArray.Create <XPathFigure>(), XFillRule.EvenOdd);
            PathSize                   = XPathSize.Create();
            PolyCubicBezierSegment     = XPolyCubicBezierSegment.Create(ImmutableArray.Create <XPoint>(), true, true);
            PolyLineSegment            = XPolyLineSegment.Create(ImmutableArray.Create <XPoint>(), true, true);
            PolyQuadraticBezierSegment = XPolyQuadraticBezierSegment.Create(ImmutableArray.Create <XPoint>(), true, true);
            QuadraticBezierSegment     = XQuadraticBezierSegment.Create(XPoint.Create(), XPoint.Create(), true, true);
        }
        public void Init(GraphicsDevice gd)
        {
            if (Ready)
            {
                return;
            }
            Background = LoadFile(gd, "IDERes/bg.png");
            DiagTile   = LoadFile(gd, "IDERes/diagbg.png");

            TrueNode  = LoadFile(gd, "IDERes/true.png");
            FalseNode = LoadFile(gd, "IDERes/false.png");
            DoneNode  = LoadFile(gd, "IDERes/done.png");

            Node             = LoadFile(gd, "IDERes/nodeFG.png");
            NodeOutline      = LoadFile(gd, "IDERes/nodeBG.png");
            ArrowHead        = LoadFile(gd, "IDERes/arrowFG.png");
            ArrowHeadOutline = LoadFile(gd, "IDERes/arrowBG.png");

            TrueReturn  = LoadFile(gd, "IDERes/trueReturn.png");
            FalseReturn = LoadFile(gd, "IDERes/falseReturn.png");

            Breakpoint   = LoadFile(gd, "IDERes/breakpoint.png");
            CurrentArrow = LoadFile(gd, "IDERes/current.png");

            ViewBG = LoadFile(gd, "IDERes/viewBG.png");

            CommentBox    = LoadFile(gd, "IDERes/tree/comment_box.png");
            CommentBubble = LoadFile(gd, "IDERes/tree/comment_bubble.png");
            GotoBox       = LoadFile(gd, "IDERes/tree/goto_box.png");
            LabelBox      = LoadFile(gd, "IDERes/tree/label_box.png");

            Indexed = new Texture2D[IndexedLoad.Length];
            for (int i = 0; i < IndexedLoad.Length; i++)
            {
                Indexed[i] = LoadFile(gd, "IDERes/" + IndexedLoad[i]);
            }

            WhiteTex = TextureUtils.TextureFromColor(gd, Color.White);

            //prepare fonts
            var style = TextStyle.Create(new Color(70, 70, 55), 12);

            style.Font              = FSO.Client.GameFacade.EdithFont;
            style.VFont             = FSO.Client.GameFacade.EdithVectorFont;
            style.Size              = 12;
            style.HighlightedColor  = new Color(221, 221, 221);
            style.SelectionBoxColor = style.HighlightedColor;
            style.SelectedColor     = style.Color;
            style.CursorColor       = style.Color;
            CommentStyle            = style;

            style                   = style.Clone();
            style.Color             = Color.White;
            style.HighlightedColor  = new Color(102, 102, 102);
            style.SelectionBoxColor = style.HighlightedColor;
            style.SelectedColor     = style.Color;
            style.CursorColor       = style.Color;
            style.Size              = 14;
            TitleStyle              = style;

            Ready = true;
        }