public void Update(TSO.Common.rendering.framework.model.UpdateState state) { foreach (var scene in Scenes) { scene.Update(state); } foreach (var scene in External) { scene.Update(state); } }
/// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(TSO.Simantics.VM vm, World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); testimg = new UIImage(); testimg.X = 20; testimg.Y = 20; this.Add(testimg); Queue = new UIInteractionQueue(ActiveEntity); this.Add(Queue); }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { base.Update(state); if (SelectedAvatar != null) UpdateMotives(); }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { base.Update(state); vm.Update(state.Time); }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { int min = NetworkFacade.ServerTime.Minute; int hour = NetworkFacade.ServerTime.Hour; if (Game.InLot) //if ingame, use time from ingame clock (should be very close to server time anyways, if we set the game pacing up right...) { min = Game.vm.Context.Clock.Minutes; hour = Game.vm.Context.Clock.Hours; } string suffix = (hour > 11) ? "pm" : "am"; hour %= 12; if (hour == 0) hour = 12; TimeText.Caption = hour.ToString() + ":" + ZeroPad(min.ToString(), 2) + " " + suffix; base.Update(state); }
/// <summary> /// Updates this Avatar instance. /// </summary> /// <param name="state">An UpdateState instance.</param> public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { }
/// <summary> /// Creates a new UILotControl instance. /// </summary> /// <param name="vm">A SimAntics VM instance.</param> /// <param name="World">A World instance.</param> public UILotControl(TSO.Simantics.VM vm, World World) { this.vm = vm; this.World = World; ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); MouseEvt = this.ListenForMouse(new Microsoft.Xna.Framework.Rectangle(0, 0, GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight), OnMouse); testimg = new UIImage(); testimg.X = 20; testimg.Y = 20; this.Add(testimg); Queue = new UIInteractionQueue(ActiveEntity); this.Add(Queue); ObjectHolder = new UIObjectHolder(vm, World, this); QueryPanel = new UIQueryPanel(World); QueryPanel.OnSellBackClicked += ObjectHolder.SellBack; QueryPanel.X = 177; QueryPanel.Y = GlobalSettings.Default.GraphicsHeight - 228; this.Add(QueryPanel); vm.OnDialog += vm_OnDialog; }
void vm_OnDialog(TSO.Simantics.model.VMDialogInfo info) { var alert = UIScreen.ShowAlert(new UIAlertOptions { Title = info.Title, Message = info.Message, Width = 325+(int)(info.Message.Length/3.5f), Alignment = TextAlignment.Left, TextSize = 12 }, true); var entity = info.Icon; if (entity is VMGameObject) { var objects = entity.MultitileGroup.Objects; ObjectComponent[] objComps = new ObjectComponent[objects.Count]; for (int i = 0; i < objects.Count; i++) { objComps[i] = (ObjectComponent)objects[i].WorldUI; } var thumb = World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice); alert.SetIcon(thumb, 110, 110); } }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { base.Update(state); if (m_BgGrow < 1) { m_BgGrow += 1.0 / 30.0; HeadCamera.Zoom = (float)m_BgGrow; m_Bg.SetSize((float)m_BgGrow * 200, (float)m_BgGrow * 200); m_Bg.X = (float)m_BgGrow * (-100); m_Bg.Y = (float)m_BgGrow * (-100); } RotateHeadCam(GlobalPoint(new Vector2(state.MouseState.X, state.MouseState.Y))); }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { base.Update(state); if (ActiveEntity == null || ActiveEntity.Dead) { ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); //try and hook onto a sim if we have none selected. Queue.QueueOwner = ActiveEntity; } if (Visible) { if (ShowTooltip) GameFacade.Screens.TooltipProperties.UpdateDead = false; var scrolled = World.TestScroll(state); if (MouseIsOn && ActiveEntity != null) { if (state.MouseState.X != OldMX || state.MouseState.Y != OldMY) { OldMX = state.MouseState.X; OldMY = state.MouseState.Y; var newHover = World.GetObjectIDAtScreenPos(state.MouseState.X, state.MouseState.Y, GameFacade.GraphicsDevice); if (newHover == 0) newHover = ActiveEntity.ObjectID; if (ObjectHover != newHover) { ObjectHover = newHover; if (ObjectHover > 0) { var menu = vm.GetObjectById(ObjectHover).GetPieMenu(vm, ActiveEntity); InteractionsAvailable = (menu.Count > 0); } } } } else { ObjectHover = 0; } if (!scrolled) { //set cursor depending on interaction availability CursorType cursor; if (ObjectHover == 0) { cursor = CursorType.LiveNothing; } else { if (InteractionsAvailable) { if (vm.GetObjectById(ObjectHover) is VMAvatar) cursor = CursorType.LivePerson; else cursor = CursorType.LiveObjectAvail; } else { cursor = CursorType.LiveObjectUnavail; } } CursorManager.INSTANCE.SetCursor(cursor); } //set cutaway around mouse var cuts = vm.Context.Blueprint.Cutaway; Rectangle newCut; if (WallsMode == 0){ newCut = new Rectangle(-1, -1, 1024, 1024); //cut all; walls down. } else if (WallsMode == 1) { var mouseTilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y + 128)); newCut = new Rectangle((int)(mouseTilePos.X - 1.5), (int)(mouseTilePos.Y - 1.5), 4, 4); } else { newCut = new Rectangle(0, 0, 0, 0); //walls up or roof } if (!newCut.Equals(MouseCutRect)) { if (cuts.Contains(MouseCutRect)) cuts.Remove(MouseCutRect); MouseCutRect = newCut; cuts.Add(MouseCutRect); vm.Context.Blueprint.Damage.Add(new tso.world.model.BlueprintDamage(tso.world.model.BlueprintDamageType.WALL_CUT_CHANGED)); } } }
public override void Update(TSO.Common.rendering.framework.model.UpdateState state) { base.Update(state); if (ZoomLevel > 3 && CityRenderer.m_Zoomed != (ZoomLevel == 4)) ZoomLevel = (CityRenderer.m_Zoomed) ? 4 : 5; if (InLot) //if we're in a lot, use the VM's more accurate time! CityRenderer.SetTimeOfDay((vm.Context.Clock.Hours / 24.0) + (vm.Context.Clock.Minutes / 1440.0) + (vm.Context.Clock.Seconds / 86400.0)); if (vm != null) vm.Update(state.Time); }
public override void Init(TSO.Simantics.VMContext context) { ((ObjectComponent)WorldUI).ObjectID = ObjectID; if (Slots != null && Slots.Slots.ContainsKey(0)) { SlotContainees = new VMEntity[Slots.Slots[0].Count]; ((ObjectComponent)WorldUI).ContainerSlots = Slots.Slots[0]; } base.Init(context); }