private void HouseSelected(int house) { if (ActiveEntity == null || TS1NeighSelector == null) { return; } vm.SendCommand(new VMNetDialogResponseCmd { ActorUID = ActiveEntity.PersistID, ResponseCode = (byte)((house > 0) ? 1 : 0), ResponseText = house.ToString() }); Parent.Remove(TS1NeighSelector); if (vm.SpeedMultiplier == 0) { vm.SpeedMultiplier = 1; } TS1NeighSelector = null; }
void vm_OnDialog(FSO.SimAntics.Model.VMDialogInfo info) { if (info != null && ((info.DialogID == LastDialogID && info.DialogID != 0 && info.Block) || info.Caller != null && info.Caller != ActiveEntity)) { return; } //return if same dialog as before, or not ours if ((info == null || info.Block) && BlockingDialog != null) { //cancel current dialog because it's no longer valid UIScreen.RemoveDialog(BlockingDialog); LastDialogID = 0; BlockingDialog = null; } if (info == null) { return; //return if we're just clearing a dialog. } var options = new UIAlertOptions { Title = info.Title, Message = info.Message, Width = 325 + (int)(info.Message.Length / 3.5f), Alignment = TextAlignment.Left, TextSize = 12 }; if (info.Block && vm.TS1) { vm.SpeedMultiplier = 0; } var b0Event = (info.Block) ? new ButtonClickDelegate(DialogButton0) : null; var b1Event = (info.Block) ? new ButtonClickDelegate(DialogButton1) : null; var b2Event = (info.Block) ? new ButtonClickDelegate(DialogButton2) : null; VMDialogType type = (info.Operand == null) ? VMDialogType.Message : info.Operand.Type; switch (type) { default: case VMDialogType.Message: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) }; break; case VMDialogType.YesNo: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes), new UIAlertButton(UIAlertButtonType.No, b1Event, info.No), }; break; case VMDialogType.YesNoCancel: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes), new UIAlertButton(UIAlertButtonType.No, b1Event, info.No), new UIAlertButton(UIAlertButtonType.Cancel, b2Event, info.Cancel), }; break; case VMDialogType.TextEntry: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) }; options.TextEntry = true; break; case VMDialogType.NumericEntry: if (!vm.TS1) { goto case VMDialogType.TextEntry; } else { goto case VMDialogType.TS1Neighborhood; } case VMDialogType.TS1Vacation: case VMDialogType.TS1Neighborhood: case VMDialogType.TS1StudioTown: case VMDialogType.TS1Magictown: TS1NeighSelector = new UINeighborhoodSelectionPanel((ushort)VMDialogPrivateStrings.TypeToNeighID[type]); Parent.Add(TS1NeighSelector); TS1NeighSelector.OnHouseSelect += HouseSelected; return; case VMDialogType.FSOColor: options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes), new UIAlertButton(UIAlertButtonType.Cancel, b1Event, info.Cancel) }; options.Color = true; break; } var alert = UIScreen.GlobalShowAlert(options, true); if (info.Block) { BlockingDialog = alert; LastDialogID = info.DialogID; } 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); } }