private UITextureAtlas GetUiAtlas() { if (guiAtlas_ != null) { return(guiAtlas_); } // Create base atlas with backgrounds and no foregrounds var futureAtlas = new AtlasBuilder( atlasName: "SpeedLimits_Atlas", loadingPath: "SpeedLimits", sizeHint: new IntVector2(512)); // Merge names of all button sprites atlasBuilder foreach (string prefix in new[] { "MphToggle", "EditSegments", "EditLanes", "EditDefaults" }) { ButtonSkin skin = ButtonSkin.CreateSimple( foregroundPrefix: prefix, backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanActivate(background: false) .CanHover(foreground: false); // Create keysets for lane arrow button icons and merge to the shared atlas skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, spriteSize: new IntVector2(50)); } // Load actual graphics into an atlas return(futureAtlas.CreateAtlas()); }
private UITextureAtlas GetAtlas() { if (laneArrowButtonAtlas_ != null) { return(laneArrowButtonAtlas_); } // Create base atlas with backgrounds and no foregrounds ButtonSkin backgroundOnlySkin = ButtonSkin.CreateSimple( foregroundPrefix: "LaneArrow", backgroundPrefix: "LaneArrow") .CanHover(foreground: false) .CanActivate(foreground: false) .NormalForeground(false); var futureAtlas = new AtlasBuilder( atlasName: "TMPE_LaneArrowsTool_Atlas", loadingPath: "LaneArrows", sizeHint: new IntVector2(256)); backgroundOnlySkin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, spriteSize: new IntVector2(64)); // Merge names of all foreground sprites for 3 directions into atlasKeySet foreach (string prefix in new[] { "LaneArrowLeft", "LaneArrowRight", "LaneArrowForward" }) { ButtonSkin skin = ButtonSkin.CreateSimple( foregroundPrefix: prefix, backgroundPrefix: string.Empty) .CanActivate(background: false); // Create keysets for lane arrow button icons and merge to the shared atlas skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, spriteSize: new IntVector2(64)); } // Load actual graphics into an atlas laneArrowButtonAtlas_ = futureAtlas.CreateAtlas(); return(laneArrowButtonAtlas_); }