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); TS1NeighSelector = null; }
public UINeighbourhoodSwitcher(UINeighborhoodSelectionPanel panel, ushort mode, bool moveIn) { Panel = panel; SetMode(mode, moveIn); }
void vm_OnDialog(FSO.SimAntics.Model.VMDialogInfo info) { if (info != null && ((info.DialogID == LastDialogID && info.DialogID != 0 && info.Block))) { 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 }; 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); ((TS1GameScreen)Parent).Bg.Visible = true; ((TS1GameScreen)Parent).LotControl.Visible = false; TS1NeighSelector.OnHouseSelect += HouseSelected; return; } var alert = new UIMobileAlert(options); UIScreen.GlobalShowDialog(alert, 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, 256, 256); } }
void vm_OnDialog(FSO.SimAntics.Model.VMDialogInfo info) { if (info != null && ((info.DialogID == LastDialogID && info.DialogID != 0 && info.Block))) { 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 }; 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); ((TS1GameScreen)Parent).Bg.Visible = true; ((TS1GameScreen)Parent).LotControl.Visible = false; TS1NeighSelector.OnHouseSelect += HouseSelected; return; case VMDialogType.TS1PhoneBook: var phone = new UICallNeighborAlert(((VMAvatar)info.Caller).GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.NeighborId), vm); BlockingDialog = phone; UIScreen.GlobalShowDialog(phone, true); phone.OnResult += (result) => { vm.SendCommand(new VMNetDialogResponseCmd { ActorUID = info.Caller.PersistID, ResponseCode = (byte)((result > 0) ? 1 : 0), ResponseText = result.ToString() }); BlockingDialog = null; }; return; case VMDialogType.TS1PetChoice: case VMDialogType.TS1Clothes: var ts1categories = new string[] { "b", "f", "s", "l", "w", "h" }; var pet = type == VMDialogType.TS1PetChoice; var stackObj = info.Caller.Thread.Stack.Last().StackObject; var skin = new UISelectSkinAlert(pet?null:(info.Caller as VMAvatar), pet?((stackObj as VMAvatar).IsCat?"cat":"dog"):ts1categories[info.Caller.Thread.TempRegisters[0]], vm); BlockingDialog = skin; UIScreen.GlobalShowDialog(skin, true); skin.OnResult += (result) => { vm.SendCommand(new VMNetDialogResponseCmd { ActorUID = info.Caller.PersistID, ResponseCode = (byte)((result > -1)?1:0), ResponseText = result.ToString() }); BlockingDialog = null; }; return; } var alert = new UIMobileAlert(options); UIScreen.GlobalShowDialog(alert, 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, 256, 256); } }
public UINeighbourhoodSwitcher(UINeighborhoodSelectionPanel panel, ushort mode) { Panel = panel; SetMode(mode); }