public CombatDebugOverlay(Actor self) { healthInfo = self.Info.TraitInfoOrDefault <HealthInfo>(); coords = Exts.Lazy(self.Trait <BodyOrientation>); var localPlayer = self.World.LocalPlayer; devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null; }
public SharedCargo(ActorInitializer init, SharedCargoInfo info) : base(info) { self = init.Self; Manager = self.Owner.PlayerActor.TraitsImplementing <SharedCargoManager>().Where(m => m.Info.Type == Info.ShareType).First(); Unloading = false; checkTerrainType = info.UnloadTerrainTypes.Count > 0; facing = Exts.Lazy(self.TraitOrDefault <IFacing>); }
public SupportPowerManager(ActorInitializer init) { self = init.self; DevMode = init.self.Trait <DeveloperMode>(); RadarPings = Exts.Lazy(() => init.world.WorldActor.TraitOrDefault <RadarPings>()); init.world.ActorAdded += ActorAdded; init.world.ActorRemoved += ActorRemoved; }
protected ClientTooltipRegionWidget(ClientTooltipRegionWidget other) : base(other) { Template = other.Template; TooltipContainer = other.TooltipContainer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); orderManager = other.orderManager; clientIndex = other.clientIndex; }
public EditorViewportControllerWidget(World world, WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); CurrentBrush = DefaultBrush = new EditorDefaultBrush(this, worldRenderer); editorActionManager = world.WorldActor.Trait <EditorActionManager>(); editorActionManager.OnChange += EditorActionManagerOnChange; }
public ObserverArmyIconsWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; GetTooltipUnit = () => TooltipUnit; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); }
public ViewportControllerWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); resourceLayer = world.WorldActor.TraitOrDefault <ResourceLayer>(); }
public DeployToUpgrade(Actor self, DeployToUpgradeInfo info) { this.self = self; this.info = info; manager = self.Trait <UpgradeManager>(); checkTerrainType = info.AllowedTerrainTypes.Count > 0; canTurn = self.Info.HasTraitInfo <IFacingInfo>(); body = Exts.Lazy(self.TraitOrDefault <ISpriteBody>); }
public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary <string, Animation>(); tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); }
public ProductionQueueOrBuildingPickerFromSelection(World world, ProductionQueueOrBuildingPickerFromSelectionInfo info) { this.world = world; tabsWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionTabsWidget) as ProductionTabsWidget); paletteWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionPaletteWidget) as ProductionPaletteWidget); buildSelectWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.BuildSelectPalette) as BuildSelectPaletteWidget); productionParentWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionParent)); buildingCancelWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.BuildingCancel)); }
public SupportPowerManager(ActorInitializer init) { Self = init.Self; TechTree = Self.Trait <TechTree>(); RadarPings = Exts.Lazy(() => init.World.WorldActor.TraitOrDefault <RadarPings>()); init.World.ActorAdded += ActorAdded; init.World.ActorRemoved += ActorRemoved; }
protected MapPreviewWidget(MapPreviewWidget other) : base(other) { Preview = other.Preview; SpawnOccupants = other.SpawnOccupants; ShowSpawnPoints = other.ShowSpawnPoints; TooltipTemplate = other.TooltipTemplate; TooltipContainer = other.TooltipContainer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); }
public ObserverProductionIconsWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary <ProductionQueue, Animation>(); GetTooltipIcon = () => TooltipIcon; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); iconSize = new float2(IconWidth, IconHeight); }
public ViewportControllerWidget(ModData modData, World world, WorldRenderer worldRenderer) { this.modData = modData; this.world = world; this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); resourceRenderers = world.WorldActor.TraitsImplementing <ResourceRenderer>().ToArray(); }
public SupportPowersWidget(World world, WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; spm = world.LocalPlayer.PlayerActor.Trait <SupportPowerManager>(); tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); icon = new Animation(world, "icon"); clock = new Animation(world, "clock"); }
public CombatDebugOverlay(Actor self) { attack = Exts.Lazy(() => self.TraitOrDefault <AttackBase>()); coords = Exts.Lazy(() => self.Trait <IBodyOrientation>()); health = Exts.Lazy(() => self.TraitOrDefault <Health>()); var localPlayer = self.World.LocalPlayer; devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null; }
public ShpTSReader(Stream stream) { stream.ReadUInt16(); var width = stream.ReadUInt16(); var height = stream.ReadUInt16(); var size = new Size(width, height); var frameCount = stream.ReadUInt16(); for (var i = 0; i < frameCount; i++) { frames.Add(new FrameHeader(stream, size)); } for (var i = 0; i < frameCount; i++) { var f = frames[i]; if (f.FileOffset == 0) { continue; } stream.Position = f.FileOffset; // Uncompressed if (f.Format == 1 || f.Format == 0) { f.Data = stream.ReadBytes(f.Size.Width * f.Size.Height); } // Uncompressed scanlines else if (f.Format == 2) { f.Data = new byte[f.Size.Width * f.Size.Height]; for (var j = 0; j < f.Size.Height; j++) { var length = stream.ReadUInt16() - 2; stream.Read(f.Data, f.Size.Width * j, length); } } // RLE-zero compressed scanlines else if (f.Format == 3) { f.Data = new byte[f.Size.Width * f.Size.Height]; for (var j = 0; j < f.Size.Height; j++) { var length = stream.ReadUInt16() - 2; Format2.DecodeInto(stream.ReadBytes(length), f.Data, j * f.Size.Width); } } } spriteFrames = Exts.Lazy(() => frames.Cast <ISpriteFrame>()); }
public MapPreviewWidget() { tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); spawnClaimed = ChromeProvider.GetImage("lobby-bits", "spawn-claimed"); spawnUnclaimed = ChromeProvider.GetImage("lobby-bits", "spawn-unclaimed"); spawnFont = Game.Renderer.Fonts[ChromeMetrics.Get <string>("SpawnFont")]; spawnColor = ChromeMetrics.Get <Color>("SpawnColor"); spawnContrastColor = ChromeMetrics.Get <Color>("SpawnContrastColor"); spawnLabelOffset = ChromeMetrics.Get <int2>("SpawnLabelOffset"); }
public CombatDebugOverlay(Actor self) { healthInfo = self.Info.TraitInfoOrDefault <HealthInfo>(); blockInfo = self.Info.TraitInfoOrDefault <BlocksProjectilesInfo>(); attack = Exts.Lazy(() => self.TraitOrDefault <AttackBase>()); coords = Exts.Lazy(() => self.Trait <BodyOrientation>()); var localPlayer = self.World.LocalPlayer; devMode = localPlayer != null?localPlayer.PlayerActor.Trait <DeveloperMode>() : null; }
public ObserverProductionIconsWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; clocks = new Dictionary <ProductionQueue, Animation>(); timestep = world.IsReplay ? world.WorldActor.Trait <MapOptions>().GameSpeed.Timestep : world.Timestep; GetTooltipIcon = () => TooltipIcon; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); iconSize = new float2(IconWidth, IconHeight); }
public SoundInfo(MiniYaml y) { FieldLoader.Load(this, y); Variants = Load(y, "Variants"); Prefixes = Load(y, "Prefixes"); Voices = Load(y, "Voices"); Notifications = Load(y, "Notifications"); VoicePools = Exts.Lazy(() => Voices.ToDictionary(a => a.Key, a => new SoundPool(a.Value))); NotificationsPools = Exts.Lazy(() => Notifications.ToDictionary(a => a.Key, a => new SoundPool(a.Value))); }
public SupportPowersWidget(ModData modData, World world, WorldRenderer worldRenderer) { this.modData = modData; this.worldRenderer = worldRenderer; GetTooltipIcon = () => TooltipIcon; spm = world.LocalPlayer.PlayerActor.Trait <SupportPowerManager>(); tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); clock = new Animation(world, ClockAnimation); }
public ResourceCollector(Actor self, ResourceCollectorInfo info) : base(info) { this.info = info; Ticks = info.InitialDelay; resourceLayer = self.World.WorldActor.Trait <UndergroundResourceLayer>(); building = self.Trait <Building>(); rallyPoint = Exts.Lazy(() => self.IsDead ? null : self.TraitOrDefault <RallyPoint>()); }
protected LabelWithTooltipWidget(LabelWithTooltipWidget other) : base(other) { TooltipTemplate = other.TooltipTemplate; TooltipContainer = other.TooltipContainer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); GetTooltipText = other.GetTooltipText; }
public AttackGarrisoned(Actor self, AttackGarrisonedInfo info) : base(self, info) { Info = info; coords = Exts.Lazy(() => self.Trait <BodyOrientation>()); armaments = new List <Armament>(); muzzles = new List <AnimationWithOffset>(); paxFacing = new Dictionary <Actor, IFacing>(); paxPos = new Dictionary <Actor, IPositionable>(); paxRender = new Dictionary <Actor, RenderSprites>(); }
public D2ImageWidget(World world, WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; GetImageName = () => ImageName; GetImageCollection = () => ImageCollection; GetPaletteName = () => PaletteName; GetTooltipText = () => TooltipText; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); }
public ProductionPaletteWidget(OrderManager orderManager, World world, WorldRenderer worldRenderer) { this.orderManager = orderManager; World = world; this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); cantBuild = new Animation(world, NotBuildableAnimation); cantBuild.PlayFetchIndex(NotBuildableSequence, () => 0); clock = new Animation(world, ClockAnimation); }
public EditorViewportControllerWidget(World world, WorldRenderer worldRenderer) { this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); CurrentBrush = DefaultBrush = new EditorDefaultBrush(this, worldRenderer); editorActionManager = world.WorldActor.Trait <EditorActionManager>(); editorActionManager.OnChange += EditorActionManagerOnChange; // Allow zooming out to full map size worldRenderer.Viewport.UnlockMinimumZoom(0.25f); }
public ProductionPaletteWidget(OrderManager orderManager, World world, WorldRenderer worldRenderer) { this.orderManager = orderManager; this.World = world; this.worldRenderer = worldRenderer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); cantBuild = new Animation(world, "clock"); cantBuild.PlayFetchIndex("idle", () => 0); clock = new Animation(world, "clock"); }
public SequenceProvider(IReadOnlyFileSystem fileSystem, ModData modData, TileSet tileSet, MiniYaml additionalSequences) { this.modData = modData; this.tileSet = tileSet; sequences = Exts.Lazy(() => { using (new Support.PerfTimer("LoadSequences")) return(Load(fileSystem, additionalSequences)); }); spriteCache = Exts.Lazy(() => new SpriteCache(fileSystem, modData.SpriteLoaders, new SheetBuilder(SheetT.Indexed))); }