protected override bool OnHotkeyActivated(KeyInput e) { var player = world.RenderPlayer ?? world.LocalPlayer; var harvesters = world.ActorsHavingTrait <Harvester>() .Where(a => a.IsInWorld && a.Owner == player) .ToList(); if (!harvesters.Any()) { return(true); } var next = harvesters .SkipWhile(b => !selection.Contains(b)) .Skip(1) .FirstOrDefault(); if (next == null) { next = harvesters.First(); } selection.Combine(world, new Actor[] { next }, false, true); viewport.Center(selection.Actors); return(true); }
protected override bool OnHotkeyActivated(KeyInput e) { var player = world.RenderPlayer ?? world.LocalPlayer; var facilities = world.ActorsHavingTrait <Production>() .Where(a => a.Owner == player && a.OccupiesSpace != null && !a.Info.HasTraitInfo <BaseBuildingInfo>() && a.TraitsImplementing <Production>().Any(t => !t.IsTraitDisabled)) .OrderBy(f => f.TraitsImplementing <Production>().First(t => !t.IsTraitDisabled).Info.Produces.First()) .ToList(); if (!facilities.Any()) { return(true); } var next = facilities .SkipWhile(b => !selection.Contains(b)) .Skip(1) .FirstOrDefault(); if (next == null) { next = facilities.First(); } Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", clickSound, null); selection.Combine(world, new Actor[] { next }, false, true); viewport.Center(selection.Actors); return(true); }
protected override bool OnHotkeyActivated(KeyInput e) { if (radarPings == null || radarPings.LastPingPosition == null) { return(true); } viewport.Center(radarPings.LastPingPosition.Value); return(true); }
protected override bool OnHotkeyActivated(KeyInput e) { var player = world.RenderPlayer ?? world.LocalPlayer; var bases = world.ActorsHavingTrait <BaseBuilding>() .Where(a => a.Owner == player) .ToList(); // If no BaseBuilding exist pick the first selectable Building. if (!bases.Any()) { var building = world.ActorsHavingTrait <Building>() .FirstOrDefault(a => a.Owner == player && a.Info.HasTraitInfo <SelectableInfo>()); // No buildings left if (building == null) { return(true); } selection.Combine(world, new Actor[] { building }, false, true); viewport.Center(selection.Actors); return(true); } var next = bases .SkipWhile(b => !selection.Contains(b)) .Skip(1) .FirstOrDefault(); if (next == null) { next = bases.First(); } selection.Combine(world, new Actor[] { next }, false, true); viewport.Center(selection.Actors); return(true); }
internal PhysicalLayoutManager(Context context, VirtualLayoutManager virtualLayout) { _context = context; _virtualLayout = virtualLayout; _viewByAdaptorPosition = new Dictionary <int, AndroidView>(); _visibleAdapterPosition = new HashSet <int>(); _samples = Enumerable.Repeat(IntVector.Origin, s_samplesCount).ToList(); _deferredLayout = new Queue <Action <Recycler, State> >(); _scroller = new SeekAndSnapScroller( context: context, vectorToPosition: adapterPosition => { var end = virtualLayout.LayoutItem(_positionOrigin, adapterPosition).Center(); var begin = Viewport.Center(); return(end - begin); } ); Reset(0); }
public static void MoveViewport(float2 loc) { viewport.Center(loc); }
protected override bool OnHotkeyActivated(KeyInput e) { viewport.Center(selection.Actors); return(true); }