Пример #1
0
        private static UITextureAtlas GetStylesIcons()
        {
            SpriteNames = new Dictionary <Style.StyleType, string>()
            {
                { Style.StyleType.LineSolid, nameof(Style.StyleType.LineSolid) },
                { Style.StyleType.LineDashed, nameof(Style.StyleType.LineDashed) },
                { Style.StyleType.LineDoubleSolid, nameof(Style.StyleType.LineDoubleSolid) },
                { Style.StyleType.LineDoubleDashed, nameof(Style.StyleType.LineDoubleDashed) },
                { Style.StyleType.LineSolidAndDashed, nameof(Style.StyleType.LineSolidAndDashed) },
                { Style.StyleType.StopLineSolid, nameof(Style.StyleType.StopLineSolid) },
                { Style.StyleType.StopLineDashed, nameof(Style.StyleType.StopLineDashed) },
                { Style.StyleType.StopLineDoubleSolid, nameof(Style.StyleType.StopLineDoubleSolid) },
                { Style.StyleType.StopLineDoubleDashed, nameof(Style.StyleType.StopLineDoubleDashed) },
                { Style.StyleType.FillerStripe, nameof(Style.StyleType.FillerStripe) },
                { Style.StyleType.FillerGrid, nameof(Style.StyleType.FillerGrid) },
                { Style.StyleType.FillerSolid, nameof(Style.StyleType.FillerSolid) },
                { Style.StyleType.FillerChevron, nameof(Style.StyleType.FillerChevron) },
                { Style.StyleType.CrosswalkExistent, nameof(Style.StyleType.CrosswalkExistent) },
                { Style.StyleType.CrosswalkZebra, nameof(Style.StyleType.CrosswalkZebra) },
                { Style.StyleType.CrosswalkDoubleZebra, nameof(Style.StyleType.CrosswalkDoubleZebra) },
                { Style.StyleType.CrosswalkParallelSolidLines, nameof(Style.StyleType.CrosswalkParallelSolidLines) },
                { Style.StyleType.CrosswalkParallelDashedLines, nameof(Style.StyleType.CrosswalkParallelDashedLines) },
                { Style.StyleType.CrosswalkLadder, nameof(Style.StyleType.CrosswalkLadder) },
                { Style.StyleType.CrosswalkSolid, nameof(Style.StyleType.CrosswalkSolid) },
            };

            var atlas = TextureUtil.GetAtlas(nameof(StylesAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("Styles.png", nameof(StylesAtlas), 19, 19, SpriteNames.Values.ToArray());
            }

            return(atlas);
        }
Пример #2
0
        private static UITextureAtlas GetLaneIcons()
        {
            Log.Debug("BaseEditor.GetLaneIcons() called");
            LaneSpriteNames = new Dictionary <LaneType, string>()
            {
                { LaneType.Bicycle, nameof(LaneType.Bicycle) },
                { LaneType.Car, nameof(LaneType.Car) },
                { LaneType.Tram, nameof(LaneType.Tram) },
                { LaneType.Pedestrian, nameof(LaneType.Pedestrian) },
                { LaneType.Cablecar, nameof(LaneType.Cablecar) },
                { LaneType.Monorail, nameof(LaneType.Monorail) },
                { LaneType.Metro, nameof(LaneType.Metro) },
                { LaneType.Trolleybus, nameof(LaneType.Trolleybus) },
                { LaneType.Train, nameof(LaneType.Train) },
                { LaneType.Parking, nameof(LaneType.Parking) },
                { LaneType.None, nameof(LaneType.None) },
                { LaneType.Multiple, nameof(LaneType.Multiple) },
            };

            var atlas = TextureUtil.GetAtlas(nameof(LaneAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("laneTypes.png", nameof(LaneAtlas), 64, 64, LaneSpriteNames.Values.ToArray());
            }

            return(atlas);
        }
Пример #3
0
        private static UITextureAtlas GetStylesIcons()
        {
            SpriteNames = new Dictionary <Style.StyleType, string>()
            {
                { Style.StyleType.LineSolid, nameof(Style.StyleType.LineSolid) },
                { Style.StyleType.LineDashed, nameof(Style.StyleType.LineDashed) },
                { Style.StyleType.LineDoubleSolid, nameof(Style.StyleType.LineDoubleSolid) },
                { Style.StyleType.LineDoubleDashed, nameof(Style.StyleType.LineDoubleDashed) },
                { Style.StyleType.LineSolidAndDashed, nameof(Style.StyleType.LineSolidAndDashed) },
                { Style.StyleType.StopLineSolid, nameof(Style.StyleType.StopLineSolid) },
                { Style.StyleType.StopLineDashed, nameof(Style.StyleType.StopLineDashed) },
                { Style.StyleType.FillerStripe, nameof(Style.StyleType.FillerStripe) },
                { Style.StyleType.FillerGrid, nameof(Style.StyleType.FillerGrid) },
                { Style.StyleType.FillerSolid, nameof(Style.StyleType.FillerSolid) },
                { Style.StyleType.StopLineDoubleSolid, nameof(Style.StyleType.StopLineDoubleSolid) },
                { Style.StyleType.StopLineDoubleDashed, nameof(Style.StyleType.StopLineDoubleDashed) },
            };

            var atlas = TextureUtil.GetAtlas(nameof(StylesAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("Styles.png", nameof(StylesAtlas), 19, 19, SpriteNames.Values.ToArray());
            }

            return(atlas);
        }
Пример #4
0
        private static UITextureAtlas GetResizeIcon()
        {
            var atlas = TextureUtil.GetAtlas(nameof(ResizeAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("resize.png", nameof(ResizeAtlas), 9, 9, new string[] { "resize" }, space: 2);
            }

            return(atlas);
        }
Пример #5
0
        private static UITextureAtlas GetStylesIcons()
        {
            var spriteNames = new string[] { "Item" };

            var atlas = TextureUtil.GetAtlas(nameof(ItemAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("ListItem.png", nameof(ItemAtlas), 21, 26, spriteNames, new RectOffset(1, 1, 1, 1));
            }

            return(atlas);
        }
        public override void Start()
        {
            base.Start();
            Log.Info("NodeControllerButton.Start() is called.");

            name            = "NodeControllerButton";
            playAudioEvents = true;
            tooltip         = "Node Controller\nALT+CLICK: Select segment ends.";

            var builtinTabstrip = UIUtils.Instance.FindComponent <UITabstrip>("ToolMode", GetContainingPanel(), UIUtils.FindOptions.None);

            AssertNotNull(builtinTabstrip, "builtinTabstrip");

            UIButton tabButton = (UIButton)builtinTabstrip.tabs[0];

            string[] spriteNames = new string[]
            {
                NodeControllerButtonBg,
                NodeControllerButtonBgActive,
                NodeControllerButtonBgHovered,
                NodeControllerIcon,
                NodeControllerIconActive
            };

            var atlas = TextureUtil.GetAtlas(AtlasName);

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("sprites.png", AtlasName, SIZE, SIZE, spriteNames);
            }

            Log.Debug("atlas name is: " + atlas.name);
            this.atlas = atlas;

            Deactivate();
            hoveredBgSprite = NodeControllerButtonBgHovered;


            relativePosition = RELATIVE_POSITION;
            size             = new Vector2(SIZE, SIZE);
            Show();
            Log.Info("NodeControllerButton created sucessfully.");
            Unfocus();
            Invalidate();
            //if (parent.name == "RoadsOptionPanel(RoadOptions)") {
            //    Destroy(Instace); // destroy old instance after cloning
            //}
            Instace = this;
        }
Пример #7
0
        public UITextureAtlas SetupSprites()
        {
            string[] spriteNames = new string[] { "background" };
            var      _atlas      = TextureUtil.GetAtlas(AtlasName);

            if (_atlas == UIView.GetAView().defaultAtlas)
            {
                var texture = TextureUtil.GetTextureFromAssemblyManifest(SPRITES_FILE_NAME);
                _atlas = TextureUtil.CreateTextureAtlas(texture, AtlasName, spriteNames);
                _atlas.sprites[0].border = new RectOffset(8, 8, 13, 8);
            }

            Log.Debug("atlas name is: " + _atlas.name, false);
            atlas            = _atlas;
            backgroundSprite = "background";
            return(_atlas);
        }
Пример #8
0
        private static UITextureAtlas GetAtlas()
        {
            var spriteNames = new string[]
            {
                "TextFieldPanel",
                "TextFieldPanelHovered",
                "TextFieldPanelFocus",
                "EmptySprite"
            };

            var atlas = TextureUtil.GetAtlas(nameof(EditorItemAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("TextFieldPanel.png", nameof(EditorItemAtlas), 32, 32, spriteNames, new RectOffset(4, 4, 4, 4), 2);
            }

            return(atlas);
        }
Пример #9
0
        public void SetupSprites()
        {
            TextureUtil.EmbededResources = false;
            try {
                string[] spriteNames = new string[] {
                    nameof(DownloadStatus.Gone),
                    nameof(DownloadStatus.NotDownloaded),
                    nameof(DownloadStatus.PartiallyDownloaded),
                    nameof(DownloadStatus.OutOfDate),
                    bgSpriteHoveredName,
                    bgSpritePressedName,
                };
                atlas = atlas_ ??= TextureUtil.CreateTextureAtlas("Resources/Status.png", AtlasName, spriteNames);

                hoveredBgSprite = bgSpriteHoveredName;
                pressedBgSprite = bgSpritePressedName;
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Пример #10
0
        public override void Start()
        {
            Log.Debug("PathManagerExtendedButton.Start()");

            base.Start();
            name            = nameof(PathManagerExtendedButton);
            playAudioEvents = true;

            if (!(UIUtils.FindComponent <UITabstrip>("ToolMode", GetContainingPanel(), UIUtils.FindOptions.None) is UITabstrip builtinTabstrip))
            {
                return;
            }

            string[] spriteNames = new string[]
            {
                ButtonBg,
                ButtonBgActive,
                ButtonBgHovered,
                Icon,
                IconActive,
                IconHovered
            };

            atlas = TextureUtil.GetAtlas(AtlasName);
            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("sprites.png", AtlasName, buttonSize, buttonSize, spriteNames);
            }

            Deactivate();
            hoveredBgSprite = ButtonBgHovered;
            hoveredFgSprite = IconHovered;

            relativePosition = buttonPosition;
            size             = new Vector2(buttonSize, buttonSize);
            Show();
            Unfocus();
            Invalidate();

            Instance = this;
        }
Пример #11
0
        private static UITextureAtlas GetStylesIcons()
        {
            var spriteNames = new string[]
            {
                "Hovered",
                "_",
                "AddTemplate",
                "ApplyTemplate",
                "Copy",
                "Paste",
                "SetDefault",
                "UnsetDefault",
            };

            var atlas = TextureUtil.GetAtlas(nameof(ButtonAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("Buttons.png", nameof(ButtonAtlas), 25, 25, spriteNames, new RectOffset(2, 2, 2, 2));
            }

            return(atlas);
        }
Пример #12
0
        private static UITextureAtlas GetDirectionIcons()
        {
            Log.Debug("BaseEditor.GetDirectionIcons() called");
            DirectionSpriteNames = new Dictionary <NetInfo.Direction, string>()
            {
                { NetInfo.Direction.None, "DirectionNone" },
                { NetInfo.Direction.Forward, "DirectionForward" },
                { NetInfo.Direction.Backward, "DirectionBackward" },
                { NetInfo.Direction.Both, "DirectionBoth" },
                { NetInfo.Direction.Avoid, "DirectionAvoid" },
                { NetInfo.Direction.AvoidForward, "DirectionAvoidForward" },
                { NetInfo.Direction.AvoidBackward, "DirectionAvoidBackward" },
                { NetInfo.Direction.AvoidBoth, "DirectionAvoidBoth" },
            };

            var atlas = TextureUtil.GetAtlas(nameof(DirectionAtlas));

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("directions.png", nameof(DirectionAtlas), 64, 64, DirectionSpriteNames.Values.ToArray());
            }

            return(atlas);
        }
Пример #13
0
        public override void Start()
        {
            base.Start();
            Log.Info("GoToButton.Start() is called.");

            playAudioEvents = true;
            tooltip         = "Go to network";

            string[] spriteNames = new string[]
            {
                GoToButtonBg,
                GoToButtonBgHovered,
                GoToButtonBgPressed,
                GotoIcon,
            };

            var atlas = TextureUtil.GetAtlas(AtlasName);

            if (atlas == UIView.GetAView().defaultAtlas)
            {
                atlas = TextureUtil.CreateTextureAtlas("goto.png", AtlasName, SIZE, SIZE, spriteNames);
            }

            Log.Debug("atlas name is: " + atlas.name);
            this.atlas = atlas;

            hoveredBgSprite = GoToButtonBgHovered;
            pressedBgSprite = GoToButtonBgPressed;
            normalBgSprite  = focusedBgSprite = disabledBgSprite = GoToButtonBg;
            normalFgSprite  = focusedFgSprite = disabledFgSprite = hoveredFgSprite = pressedFgSprite = GotoIcon;

            Show();
            Unfocus();
            Invalidate();
            Log.Info("GoToButton created sucessfully.");
        }
Пример #14
0
        private static UITextureAtlas GetAtlas()
        {
            var atlas = TextureUtil.CreateTextureAtlas("slider.png", nameof(ColorPropertyPanel), 18, 200, new string[] { "OpacitySlider" });

            return(atlas);
        }