Exemplo n.º 1
0
 public override bool CloseAttempt()
 {
     GameThread.NextUpdate(x =>
     {
         if (CloseAlert == null)
         {
             var canSave = vm != null;
             CloseAlert  = new UIMobileAlert(new FSO.Client.UI.Controls.UIAlertOptions
             {
                 Title   = GameFacade.Strings.GetString("153", "1"),             //quit?
                 Message = GameFacade.Strings.GetString("153", canSave?"6":"2"), //are you sure (2), save before quitting (3)
                 Buttons =
                     canSave?
                     UIAlertButton.YesNoCancel(
                         (b) => { Save(); GameFacade.Game.Exit(); },
                         (b) => { GameFacade.Game.Exit(); },
                         (b) => { CloseAlert.Close(); CloseAlert = null; }
                         )
                 :
                     UIAlertButton.YesNo(
                         (b) => { GameFacade.Game.Exit(); },
                         (b) => { CloseAlert.Close(); CloseAlert = null; }
                         )
             });
             GlobalShowDialog(CloseAlert, true);
         }
     });
     return(false);
 }
Exemplo n.º 2
0
 private void GoBack(UIElement button)
 {
     if (Mode == UICASMode.FamilyEdit)
     {
         if (ConfirmDialog == null)
         {
             ConfirmDialog = new UIMobileAlert(new UIAlertOptions()
             {
                 Title   = GameFacade.Strings.GetString("129", "7"),
                 Message = GameFacade.Strings.GetString("129", "8"),
                 Buttons = UIAlertButton.YesNo(
                     (ybtn) => { ConfirmDialog.Close(); GoBack(ybtn); ConfirmDialog = null; },
                     (nbtn) => { ConfirmDialog.Close(); ConfirmDialog = null; }
                     )
             });
             UIScreen.GlobalShowDialog(ConfirmDialog, true);
             return;
         }
         else
         {
             ClearFamily();
         }
     }
     SetMode((UICASMode)(((int)Mode) - 1));
 }
Exemplo n.º 3
0
        /**
         * UI Events
         */

        private void BtnDelete_OnButtonClick(Framework.UIElement button)
        {
            if (OutfitBrowser.DataProvider == null)
            {
                return;
            }

            var index = OutfitBrowser.SelectedIndex;

            if (index >= 0 && index < OutfitBrowser.DataProvider.Count)
            {
                var outfit = (VMGLOutfit)((UIGridViewerItem)OutfitBrowser.DataProvider[index]).Data;
                if (outfit == null)
                {
                    return;
                }

                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = GameFacade.Strings.GetString("266", "7"),
                    Message = GameFacade.Strings.GetString("266", "8"),
                    Buttons = UIAlertButton.YesNo(
                        yes => {
                        Send("dresser_delete_outfit", outfit.outfit_id.ToString());
                        UIScreen.RemoveDialog(alert);
                    },
                        no => {
                        UIScreen.RemoveDialog(alert);
                    }
                        ),
                    Alignment = TextAlignment.Left
                }, true);
            }
        }
Exemplo n.º 4
0
        public void NeighSelection(NeighSelectionMode mode)
        {
            var nbd = (ushort)((mode == NeighSelectionMode.MoveInMagic) ? 7 : 4);

            TS1NeighPanel = new UINeighborhoodSelectionPanel(nbd);
            var switcher = new UINeighbourhoodSwitcher(TS1NeighPanel, nbd, mode != NeighSelectionMode.Normal);

            TS1NeighPanel.OnHouseSelect += (house) =>
            {
                if (MoveInFamily != null)
                {
                    //move them in first
                    //confirm it
                    UIMobileAlert confirmDialog = null;
                    confirmDialog = new UIMobileAlert(new UIAlertOptions()
                    {
                        Title   = GameFacade.Strings.GetString("132", "0"),
                        Message = GameFacade.Strings.GetString("132", "1"),
                        Buttons = UIAlertButton.YesNo((b) =>
                        {
                            confirmDialog.Close();
                            MoveInAndPlay((short)house, MoveInFamily.Value, switcher);
                        },
                                                      (b) => confirmDialog.Close())
                    });
                    UIScreen.GlobalShowDialog(confirmDialog, true);
                }
                else
                {
                    PlayHouse((short)house, switcher);
                }
            };
            Add(TS1NeighPanel);
            Add(switcher);
        }
Exemplo n.º 5
0
        private void AddDonator(uint donator, string name)
        {
            LotControl.vm.TSOState.Names.Precache(LotControl.vm, donator);

            if (Community)
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Message = GameFacade.Strings.GetString("f114", "7", new string[] { name }),
                    Buttons = UIAlertButton.YesNo(
                        (btn) =>
                    {
                        LotControl.vm.SendCommand(new VMChangePermissionsCmd
                        {
                            TargetUID = donator,
                            Level     = VMTSOAvatarPermissions.Roommate,
                        });
                        UIScreen.RemoveDialog(alert);
                    },
                        (btn) => { UIScreen.RemoveDialog(alert); }
                        )
                }, true);
            }
            else
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = GameFacade.Strings.GetString("208", "5"),
                    Message = GameFacade.Strings.GetString("208", "6"),
                    Buttons = new UIAlertButton[] {
                        new UIAlertButton(UIAlertButtonType.Yes, (btn) => {
                            var screen = UIScreen.Current as CoreGameScreen;
                            if (screen != null)
                            {
                                screen.PersonPage.FindController <PersonPageController>().ChangeRoommate(
                                    ChangeRoommateType.INVITE,
                                    donator,
                                    screen.FindController <CoreGameScreenController>().GetCurrentLotID());
                            }

                            UIScreen.RemoveDialog(alert);
                        }),
                        new UIAlertButton(UIAlertButtonType.No, (btn) => UIScreen.RemoveDialog(alert))
                    },
                }, true);
            }
        }
Exemplo n.º 6
0
        public void ShowUpdateDialog(UpdatePath path)
        {
            var targVer = path.Path.Last();

            _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
            {
                Title   = GameFacade.Strings.GetString("f101", "21"),
                Message = GameFacade.Strings.GetString("f101", "22", new string[] { targVer.version_name, GlobalSettings.Default.ClientVersion, GetPathString(path) }),
                Width   = 500,
                Buttons = UIAlertButton.YesNo(x =>
                {
                    AcceptUpdate(path);
                },
                                              x =>
                {
                    RejectUpdate();
                })
            }, true);
        }
Exemplo n.º 7
0
        private void Accept(UIElement button)
        {
            switch (Mode)
            {
            case UICASMode.SimEdit:
                //add or replace the sim in the family
                AcceptMember();
                break;

            case UICASMode.FamilyEdit:
                //add or replace the family in the neighbourhood
                //need to generate an actual FAMI and save it for this
                if (ConfirmDialog == null)
                {
                    ConfirmDialog = new UIMobileAlert(new UIAlertOptions()
                    {
                        Title   = GameFacade.Strings.GetString("129", "13"),
                        Message = GameFacade.Strings.GetString("129", "14"),
                        Buttons = UIAlertButton.YesNo(
                            (ybtn) => { ConfirmDialog.Close(); Accept(ybtn); ConfirmDialog = null; },
                            (nbtn) => { ConfirmDialog.Close(); ConfirmDialog = null; }
                            )
                    });
                    UIScreen.GlobalShowDialog(ConfirmDialog, true);
                    return;
                }
                else
                {
                    SaveFamily();
                }
                break;

            case UICASMode.FamilySelect:
                //accept button here is move in. notify the neighbourhood screen that we're moving in now.
                MoveInFamily = FamiliesPanel.Families[FamiliesPanel.Selection].ChunkID;
                break;
            }
            SetMode((UICASMode)(((int)Mode) - 1));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Stock the selected outfit
        /// </summary>
        /// <param name="button"></param>
        private void BtnStock_OnButtonClick(Framework.UIElement button)
        {
            var selectedOutfit = GetSelectedOwnerOutfit();

            if (selectedOutfit == null)
            {
                return;
            }

            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = GameFacade.Strings.GetString("265", "7"),
                Message = GameFacade.Strings.GetString("265", "8"),
                Buttons = UIAlertButton.YesNo(yes => {
                    Send("rackowner_stock", selectedOutfit.AssetID.ToString());
                    UIScreen.RemoveDialog(alert);
                }, no => { UIScreen.RemoveDialog(alert); }),
                Alignment = TextAlignment.Left
            }, true);
        }
Exemplo n.º 9
0
        private void BtnDelete_OnButtonClick(UIElement button)
        {
            var selectedOutfit = GetSelectedOutfit();

            if (selectedOutfit == null)
            {
                return;
            }

            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = GameFacade.Strings.GetString("265", "9"),
                Message = GameFacade.Strings.GetString("265", "10"),
                Buttons = UIAlertButton.YesNo(yes => {
                    Send("rackowner_delete", selectedOutfit.outfit_id.ToString());
                    UIScreen.RemoveDialog(alert);
                }, no => { UIScreen.RemoveDialog(alert); }),
                Alignment = TextAlignment.Left
            }, true);
        }
Exemplo n.º 10
0
        public void Evict(FAMI family)
        {
            if (family == null)
            {
                return;
            }
            var           familyName  = family.ChunkParent.Get <FAMs>(family.ChunkID)?.GetString(0) ?? "selected";
            UIMobileAlert evictDialog = null;

            evictDialog = new UIMobileAlert(new UIAlertOptions()
            {
                Title   = GameFacade.Strings.GetString("131", "2"),
                Message = GameFacade.Strings.GetString("131", "3", new string[] {
                    familyName.ToString(),
                    "§" + (family.ValueInArch + family.Budget).ToString("##,#0")
                }
                                                       ),
                Buttons = UIAlertButton.YesNo(
                    (b) => { evictDialog.Close(); ((TS1GameScreen)UIScreen.Current).EvictLot(family, (short)HouseID); },
                    (b) => { evictDialog.Close(); }
                    )
            });
            UIScreen.GlobalShowDialog(evictDialog, true);
        }
Exemplo n.º 11
0
        public void DoUpdate(string branch, string version, string url)
        {
            View.LoginDialog.Visible   = false;
            View.LoginProgress.Visible = false;

            var str = GlobalSettings.Default.ClientVersion;

            var    split     = str.LastIndexOf('-');
            int    verNum    = 0;
            string curBranch = str;

            if (split != -1)
            {
                int.TryParse(str.Substring(split + 1), out verNum);
                curBranch = str.Substring(0, split);
            }

            _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
            {
                Title   = GameFacade.Strings.GetString("f101", "3"),
                Message = GameFacade.Strings.GetString("f101", "4", new string[] { version, branch, verNum.ToString(), curBranch }),
                Width   = 500,
                Buttons = UIAlertButton.YesNo(x =>
                {
                    UIScreen.RemoveDialog(_UpdaterAlert);
                    var downloader = new UIWebDownloaderDialog(GameFacade.Strings.GetString("f101", "1"), new DownloadItem[]
                    {
                        new DownloadItem {
                            Url      = url,
                            DestPath = "PatchFiles/patch.zip",
                            Name     = GameFacade.Strings.GetString("f101", "10")
                        }
                    });
                    downloader.OnComplete += (bool success) => {
                        UIScreen.RemoveDialog(downloader);
                        UIScreen.GlobalShowAlert(new UIAlertOptions
                        {
                            Title   = GameFacade.Strings.GetString("f101", "3"),
                            Message = GameFacade.Strings.GetString("f101", "13"),
                            Buttons = UIAlertButton.Ok(y =>
                            {
                                RestartGamePatch();
                            })
                        }, true);
                    };
                    GameThread.NextUpdate(y => UIScreen.GlobalShowDialog(downloader, true));
                },
                                              x =>
                {
                    GameThread.NextUpdate(state =>
                    {
                        UIScreen.RemoveDialog(_UpdaterAlert);
                        if (state.ShiftDown)
                        {
                            _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
                            {
                                Title   = GameFacade.Strings.GetString("f101", "11"),
                                Message = GameFacade.Strings.GetString("f101", "12"),
                                Width   = 500,
                                Buttons = UIAlertButton.Ok(y =>
                                {
                                    Regulator.AsyncTransition("AvatarData");
                                    UIScreen.RemoveDialog(_UpdaterAlert);
                                    View.LoginDialog.Visible   = true;
                                    View.LoginProgress.Visible = true;
                                })
                            }, true);
                        }
                        else
                        {
                            View.LoginDialog.Visible   = true;
                            View.LoginProgress.Visible = true;
                            Regulator.AsyncReset();
                        }
                    });
                })
            }, true);
        }