Exemple #1
0
        private void PurchaseErrorHandler(string name, byte[] type)
        {
            string title   = GameFacade.Strings.GetString("264", "5"); // "Purchase Item"
            String message = "";

            // I already own this outfit - should do a custom error message but that means a new .cst entry...
            if (type[0] == 0)
            {
                message = GameFacade.Strings.GetString("264", "10"); // "You have no more room in your Backpack"
            }
            else if (type[0] == 1)
            // I already own 5 outfits of this type
            {
                message = GameFacade.Strings.GetString("264", "10"); // "You have no more room in your Backpack"
            }
            // An unknown purchase error occured, probably not enough money suddenly
            else
            {
                message = GameFacade.Strings.GetString("264", "9"); // "You can't afford that Item."
            }
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = title,
                Message = message,
                Buttons = UIAlertButton.Ok((btn) =>
                {
                    UIScreen.RemoveDialog(alert);
                }),
                Alignment = TextAlignment.Center
            }, true);
        }
        /**
         * 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);
            }
        }
Exemple #3
0
        private void WithdrawPrompt()
        {
            // show an alert that asks the user how much to withdraw from the machine
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize = 12,
                Title    = GameFacade.Strings.GetString("f110", "3") + " " + GameFacade.Strings.GetString("f110", "5"), // "Withdraw Simoleons"
                // "This object is currently stocked with: $%d" \n \n
                Message = GameFacade.Strings.GetString("f110", "6").Replace("%d", "" + ObjectBalance) + System.Environment.NewLine +
                          // "For players to use this object you must maintain a minimum balance of: $%d" \n \n
                          System.Environment.NewLine + GameFacade.Strings.GetString("f110", "8").Replace("%d", "" + ObjectMinimumBalance) +
                          // "How much would you like to withdraw?"
                          System.Environment.NewLine + System.Environment.NewLine + GameFacade.Strings.GetString("f110", "9"),
                Alignment = TextAlignment.Left,
                TextEntry = true,
                MaxChars  = 6,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UserInputHandler("w", alert.ResponseText.Trim());
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
        }
 public void MessageReceived(AriesClient client, object message)
 {
     if (message is RequestClientSession ||
         message is HostOnlinePDU || message is ServerByePDU)
     {
         this.AsyncProcessMessage(message);
     }
     else if (message is AnnouncementMsgPDU)
     {
         GameThread.InUpdate(() =>
         {
             var msg       = (AnnouncementMsgPDU)message;
             UIAlert alert = null;
             alert         = UIScreen.GlobalShowAlert(new UIAlertOptions()
             {
                 Title   = GameFacade.Strings.GetString("195", "30") + GameFacade.CurrentCityName,
                 Message = GameFacade.Strings.GetString("195", "28") + msg.SenderID.Substring(2) + "\r\n"
                           + GameFacade.Strings.GetString("195", "29") + msg.Subject + "\r\n"
                           + msg.Message,
                 Buttons   = UIAlertButton.Ok((btn) => UIScreen.RemoveDialog(alert)),
                 Alignment = TextAlignment.Left
             }, true);
         });
     }
     else if (message is GlobalTuningUpdate)
     {
         var msg = (message as GlobalTuningUpdate);
         DynamicTuning.Global = msg.Tuning;
         Content.Content.Get().Upgrades.LoadNetTuning(msg.ObjectUpgrades);
     }
     else if (message is ChangeRoommateResponse)
     {
     }
 }
 public void RejectUpdate()
 {
     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);
                     Continue(true);
                     //View.LoginDialog.Visible = true;
                     //View.LoginProgress.Visible = true;
                 })
             }, true);
         }
         else
         {
             Continue(false);
             //View.LoginDialog.Visible = true;
             //View.LoginProgress.Visible = true;
             //Regulator.AsyncReset();
         }
     });
 }
Exemple #6
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);
 }
Exemple #7
0
        void BtnPurchase_OnButtonClick(UIElement button)
        {
            var selectedOutfit = GetSelectedOutfit();

            if (selectedOutfit == null)
            {
                return;
            }

            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = GameFacade.Strings.GetString("264", "5"),
                Message = GameFacade.Strings.GetString("264", "6"),
                Buttons = UIAlertButton.YesNoCancel(
                    yes => {
                    Send("rack_purchase", selectedOutfit.outfit_id.ToString() + ",true");
                    UIScreen.RemoveDialog(alert);
                },
                    no => {
                    Send("rack_purchase", selectedOutfit.outfit_id.ToString() + ",false");
                    UIScreen.RemoveDialog(alert);
                },
                    cancel => { UIScreen.RemoveDialog(alert); }
                    ),
                Alignment = TextAlignment.Left
            }, true);
        }
Exemple #8
0
        public void MessageReceived(AriesClient client, object message)
        {
            if (message is FindAvatarResponse)
            {
                var loc = (FindAvatarResponse)message;
                GameThread.InUpdate(() =>
                {
                    switch (loc.Status)
                    {
                    case FindAvatarResponseStatus.FOUND:
                        View.FindController <CoreGameScreenController>()?.ShowLotPage(loc.LotId & 0x3FFFFFFF);    //ignore transient part
                        break;

                    default:
                        if (loc.Status == FindAvatarResponseStatus.PRIVACY_ENABLED)
                        {
                            loc.Status = FindAvatarResponseStatus.NOT_ON_LOT;
                        }
                        UIAlert alert = null;
                        alert         = UIScreen.GlobalShowAlert(new UIAlertOptions()
                        {
                            Title     = "",
                            Message   = GameFacade.Strings.GetString("189", (49 + (int)loc.Status).ToString()),
                            Buttons   = UIAlertButton.Ok((btn) => UIScreen.RemoveDialog(alert)),
                            Alignment = TextAlignment.Left
                        }, true);
                        break;
                    }
                });
            }
        }
 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));
 }
        /*
         * Displays a UIAlert if the players solved the maze (win) or ran out of time (loss)
         */
        private void ShowResultAlertHandler(string evt, byte[] result)
        {
            var randomMessageString   = Rand.Next(0, 5);
            var successOrFailureTitle = 28; // "Success"

            if (result[0] == 0)             // loss
            {
                randomMessageString  += 17; // the loss strings start at 17 in f112
                successOrFailureTitle = 27; // "Failure"
            }
            else // win
            {
                randomMessageString += 22; // the win strings start at 22
            }
            if (Alert != null)
            {
                UIScreen.RemoveDialog(Alert);
            }
            Alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize  = 12,
                Title     = GameFacade.Strings.GetString("f112", successOrFailureTitle + ""),
                Message   = GameFacade.Strings.GetString("f112", randomMessageString + ""),
                Alignment = TextAlignment.Center,
                TextEntry = false,
                Buttons   = UIAlertButton.Ok(
                    ok =>
                {
                    UIScreen.RemoveDialog(Alert);
                    Alert = null;
                }),
            }, true);
        }
Exemple #11
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);
        }
        void DepositPrompt()
        {
            // show an alert that asks the user how much to deposit into the machine
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize = 12,
                Title    = GameFacade.Strings.GetString("f110", "4") + " " + GameFacade.Strings.GetString("f110", "5"), // "Deposit Simoleons"
                // "This object is currently stocked with: $%d" \n \n
                Message = GameFacade.Strings.GetString("f110", "6").Replace("%d", "" + ObjectBalance) + Environment.NewLine +
                          // "For players to use this object you must maintain a minimum balance of: $%d" \n \n
                          Environment.NewLine + GameFacade.Strings.GetString("f110", "8").Replace("%d", "" + ObjectMinimumBalance) +
                          // "How much would you like to deposit?"
                          Environment.NewLine + Environment.NewLine + GameFacade.Strings.GetString("f110", "10") +
                          // "(This object cannot hold more than: $%d)"
                          Environment.NewLine + Environment.NewLine + "(" +
                          GameFacade.Strings.GetString("f110", "7").Replace("%d", "" + ObjectMaximumBalance) + ")",
                Alignment = TextAlignment.Left,
                TextEntry = true,
                MaxChars  = 6,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UserInputHandler("d", alert.ResponseText.Trim());
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
        }
 /// <summary>
 /// When something goes very wrong, e.g. the server connection drops
 /// This method should be used. The game controller will tell the user
 /// and then work to clean everything up
 /// </summary>
 public void FatalError(string errorTitle, string errorMessage)
 {
     var alert = UIScreen.GlobalShowAlert(new UI.Controls.UIAlertOptions {
         Message = errorMessage,
         Title   = errorTitle,
         Buttons = UIAlertButton.Ok(x => Disconnect())
     }, true);
 }
        private void Regulator_OnError(object data)
        {
            //UIScreen.RemoveDialog(View);
            GameThread.InUpdate(() =>
            {
                GameFacade.Cursor.SetCursor(CursorType.Normal);

                var errorTitle = GameFacade.Strings.GetString("211", "45");
                var errorBody  = GameFacade.Strings.GetString("211", "45");

                if (data is FindLotResponseStatus)
                {
                    var status = (FindLotResponseStatus)data;

                    switch (status)
                    {
                    case FindLotResponseStatus.NOT_OPEN:
                    case FindLotResponseStatus.NOT_PERMITTED_TO_OPEN:
                        errorTitle = GameFacade.Strings.GetString("211", "7");
                        errorBody  = GameFacade.Strings.GetString("211", "8");
                        break;

                    case FindLotResponseStatus.NO_CAPACITY:
                        errorTitle = GameFacade.Strings.GetString("211", "11");
                        errorBody  = GameFacade.Strings.GetString("211", "12");
                        break;

                    case FindLotResponseStatus.CLAIM_FAILED:
                        errorTitle = GameFacade.Strings.GetString("211", "45");
                        errorBody  = GameFacade.Strings.GetString("211", "41");
                        break;

                    case FindLotResponseStatus.NO_ADMIT:
                        errorTitle = GameFacade.Strings.GetString("211", "45");
                        errorBody  = GameFacade.Strings.GetString("211", "42");
                        break;

                    default:
                        break;
                    }
                }

                UIAlert alert = null;
                alert         = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = errorTitle,
                    Message = errorBody,
                    Buttons = UIAlertButton.Ok(x =>
                    {
                        UIScreen.RemoveDialog(View);
                        UIScreen.RemoveDialog(alert);
                    })
                }, true);
            });
        }
Exemple #15
0
        public void BeginUpdate()
        {
            Updating = true;
            var progress = new UILoginProgress()
            {
                Caption = GameFacade.Strings.GetString("f101", "18")
            };

            GlobalShowDialog(progress, true);

            var  file  = File.Open("Content/Patch/1239toNI.tsop", FileMode.Open, FileAccess.Read, FileShare.Read);
            TSOp patch = new TSOp(file);

            var content   = Content.Content.Get();
            var patchPath = Path.GetFullPath(Path.Combine(content.BasePath, "../"));

            Task.Run(() => patch.Apply(patchPath, patchPath, (string message, float pct) =>
            {
                GameThread.InUpdate(() =>
                {
                    if (pct == -1)
                    {
                        UIScreen.GlobalShowAlert(new UIAlertOptions
                        {
                            Title   = GameFacade.Strings.GetString("f101", "19"),
                            Message = GameFacade.Strings.GetString("f101", "20", new string[] { message }),
                            Buttons = UIAlertButton.Ok(y =>
                            {
                                RestartGame();
                            })
                        }, true);
                    }
                    else
                    {
                        progress.Progress        = pct * 100;
                        progress.ProgressCaption = message;
                    }
                });
            })).ContinueWith((task) =>
            {
                GameThread.InUpdate(() =>
                {
                    UIScreen.RemoveDialog(progress);
                    UIScreen.GlobalShowAlert(new UIAlertOptions
                    {
                        Title   = GameFacade.Strings.GetString("f101", "3"),
                        Message = GameFacade.Strings.GetString("f101", "13"),
                        Buttons = UIAlertButton.Ok(y =>
                        {
                            RestartGame();
                        })
                    }, true);
                });
            });
        }
Exemple #16
0
        private void SetBetPrompt(bool isMinBet)
        {
            // show an alert that asks the user how much to set the min/max bet
            UIAlert alert           = null;
            string  typeConditional = "";
            string  setBet          = "";
            string  betTip          = "";

            if (Type.Equals(ManageEODObjectTypes.Roulette))
            {
                // "Roulette tables must be able to cover 35 times any bet for 4 simultaneous players, so AT LEAST 140x the maximum bet." \n \n
                typeConditional = GameFacade.Strings.GetString("f110", "16") + System.Environment.NewLine + System.Environment.NewLine +
                                  // "For example: if your maximum bet is $100, you must have AT LEAST $14000 in this object."
                                  GameFacade.Strings.GetString("f110", "17");
            }
            else if (Type.Equals(ManageEODObjectTypes.Blackjack))
            {
                // "A Blackjack payout is 3:2 or one and a half times any bet. Tables must be able to cover up to 4 blackjacks per round." \n \n
                typeConditional = GameFacade.Strings.GetString("f110", "18") + System.Environment.NewLine + System.Environment.NewLine +
                                  // "So you must stock at least 6 times the maximum bet."
                                  GameFacade.Strings.GetString("f110", "19");
            }
            if (isMinBet)
            {
                setBet = GameFacade.Strings.GetString("f110", "13"); // "Min bet"
                // "(Note: Minimum bets can't be less than $%d)"
                betTip = GameFacade.Strings.GetString("f110", "20").Replace("%d", "" + MINIMUM_BET_LIMIT);
            }
            else
            {
                setBet = GameFacade.Strings.GetString("f110", "14"); // "Max bet"
                // "(Note: Maximum bets can't be greater than $%d)"
                betTip = GameFacade.Strings.GetString("f110", "21").Replace("%d", "" + MAXIMUM_BET_LIMIT);
            }
            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize = 12,
                Title    = GameFacade.Strings.GetString("f110", "15") + setBet, // "Edit Min/Max bet"
                // "This object is currently stocked with: $%d" \n \n
                Message = GameFacade.Strings.GetString("f110", "6").Replace("%d", "" + ObjectBalance) + System.Environment.NewLine +
                          System.Environment.NewLine + typeConditional + System.Environment.NewLine + System.Environment.NewLine +
                          // "What would you like to set as your " + "Min/Max bet?" \n \n Tip
                          GameFacade.Strings.GetString("f110", "22") + setBet + "?" + System.Environment.NewLine + System.Environment.NewLine + betTip,
                Alignment = TextAlignment.Left,
                TextEntry = true,
                MaxChars  = 4,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UserInputHandler(setBet[2] + "", alert.ResponseText.Trim()); // 'x' for maximum, 'n' for minimum
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
        }
        private void Regulator_OnError(object data)
        {
            var errorTitle = GameFacade.Strings.GetString("211", "45");
            var errorBody  = GameFacade.Strings.GetString("211", "45");

            if (data is NhoodResponse)
            {
                var response = data as NhoodResponse;
                if (response.Code == NhoodResponseCode.NHOOD_GAMEPLAY_BAN)
                {
                    //print message and end date
                    errorTitle = GameFacade.Strings.GetString("f117", "1");
                    errorBody  = GameFacade.Strings.GetString("f117", ((int)response.Code + 1).ToString(),
                                                              new string[] {
                        ClientEpoch.DHMRemaining(response.BanEndDate),
                        response.Message
                    });
                }
                else if (response.Code == NhoodResponseCode.UNKNOWN_ERROR)
                {
                    errorTitle = GameFacade.Strings.GetString("f117", "1");
                    errorBody  = GameFacade.Strings.GetString("f117", "23");
                    if (response.Message != "")
                    {
                        errorBody += "\n\n" + response.Message;
                    }
                }
                else
                {
                    errorTitle = GameFacade.Strings.GetString("f117", "1");
                    errorBody  = GameFacade.Strings.GetString("f117", ((int)response.Code + 1).ToString());
                }
                LastMessage = response.Message;
                ResolveCallbacks(response.Code);
            }
            else
            {
                ResolveCallbacks(NhoodResponseCode.UNKNOWN_ERROR);
            }

            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = errorTitle,
                Message = errorBody,
                Buttons = UIAlertButton.Ok(x => {
                    UIScreen.RemoveDialog(BlockingDialog);
                    UIScreen.RemoveDialog(alert);
                }),
                AllowEmojis = true
            }, true);
        }
        private void ShowRestartWarning()
        {
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Message = GameFacade.Strings.GetString("f103", "25"),
                Buttons = UIAlertButton.Ok(x => {
                    UIScreen.RemoveDialog(alert);
                })
            }, true);
        }
        private void Regulator_OnError(object data)
        {
            var errorTitle = GameFacade.Strings.GetString("211", "45");
            var errorBody  = GameFacade.Strings.GetString("211", "45");

            if (data is BulletinResponse)
            {
                var response = data as BulletinResponse;
                if (response.Type == BulletinResponseType.SEND_FAIL_GAMEPLAY_BAN)
                {
                    //print message and end date
                    errorTitle = GameFacade.Strings.GetString("f117", "1");
                    errorBody  = GameFacade.Strings.GetString("f117", "18",
                                                              new string[] {
                        ClientEpoch.DHMRemaining(response.BanEndDate),
                        response.Message
                    });
                }
                else if (response.Type == BulletinResponseType.FAIL_UNKNOWN)
                {
                    errorTitle = GameFacade.Strings.GetString("f121", "1");
                    errorBody  = GameFacade.Strings.GetString("f121", "2");
                    if (response.Message != "")
                    {
                        errorBody += "\n\n" + response.Message;
                    }
                }
                else
                {
                    errorTitle = GameFacade.Strings.GetString("f121", "1");
                    errorBody  = GameFacade.Strings.GetString("f121", ((int)response.Type + 1).ToString(), new string[] { "3", "1" });
                }
                ResolveCallbacks(response.Type);
            }
            else
            {
                ResolveCallbacks(BulletinResponseType.FAIL_UNKNOWN);
            }

            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                Title   = errorTitle,
                Message = errorBody,
                Buttons = UIAlertButton.Ok(x => {
                    UIScreen.RemoveDialog(BlockingDialog);
                    UIScreen.RemoveDialog(alert);
                }),
                AllowEmojis = true
            }, true);
        }
        public void AcceptUpdate(UpdatePath path)
        {
            UIScreen.RemoveDialog(_UpdaterAlert);

            try
            {
                if (path.FullZipStart)
                {
                    System.IO.File.WriteAllText("PatchFiles/clean.txt", "CLEAN");
                }
                else
                {
                    System.IO.File.Delete("PatchFiles/clean.txt");
                }
            } catch
            {
            }

            var downloader = new UIWebDownloaderDialog(GameFacade.Strings.GetString("f101", "1"), BuildFiles(path));

            downloader.OnComplete += (bool success) => {
                UIScreen.RemoveDialog(downloader);
                if (success)
                {
                    _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
                    {
                        Title   = GameFacade.Strings.GetString("f101", "3"),
                        Message = GameFacade.Strings.GetString("f101", "13"),
                        Buttons = UIAlertButton.Ok(y =>
                        {
                            UIScreen.RemoveDialog(_UpdaterAlert);
                            RestartGamePatch();
                        })
                    }, true);
                }
                else
                {
                    UIScreen.GlobalShowAlert(new UIAlertOptions
                    {
                        Title   = GameFacade.Strings.GetString("f101", "30"),
                        Message = GameFacade.Strings.GetString("f101", "28"),
                        Buttons = UIAlertButton.Ok(y =>
                        {
                            Continue(false);
                        })
                    }, true);
                }
            };
            GameThread.NextUpdate(y => UIScreen.GlobalShowDialog(downloader, true));
        }
Exemple #21
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);
            }
        }
Exemple #22
0
        public void P_Init(string evt, string text)
        {
            var split = text.Split('\n');

            Mode            = (VMEODPermissionDoorMode)(int.Parse(split[0]));
            MaxFee          = int.Parse(split[1]);
            PermissionState = int.Parse(split[2]);
            CurDoorFee      = int.Parse(split[3]);
            Flags           = int.Parse(split[4]);

            if (Mode == VMEODPermissionDoorMode.CodeInput)
            {
                //don't open, just show a dialog.
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = GameFacade.Strings.GetString("192", "11"),
                    Message = GameFacade.Strings.GetString("192", "1"),
                    Buttons = UIAlertButton.Ok((btn) =>
                    {
                        Send("try_code", alert.ResponseText.Trim());
                        UIScreen.RemoveDialog(alert);
                    }),
                    TextEntry = true,
                    MaxChars  = 9,
                }, true);
            }
            else
            {
                Controller.ShowEODMode(new EODLiveModeOpt
                {
                    Buttons    = 0,
                    Expandable = false,
                    Height     = EODHeight.Normal,
                    Length     = EODLength.Short,
                    Timer      = EODTimer.None,
                    Tips       = EODTextTips.None
                });
            }

            UpdateState();
            UpdateFlags();
            if (Mode == VMEODPermissionDoorMode.Edit)
            {
                Send("set_state", PermissionState.ToString());
                Send("set_flags", Flags.ToString());
                Send("set_fee", CurDoorFee.ToString());
            }
        }
 public void RestartGamePatch()
 {
     try
     {
         if (FSOEnvironment.Linux)
         {
             var fsoargs = FSOEnvironment.Args;
             if (fsoargs.Length > 0)
             {
                 fsoargs = " " + fsoargs;
             }
             var args = new ProcessStartInfo("mono", "update.exe" + fsoargs);
             args.UseShellExecute = false;
             System.Diagnostics.Process.Start(args);
         }
         else
         {
             var args = new ProcessStartInfo(".\\update.exe", FSOEnvironment.Args);
             try
             {
                 System.Diagnostics.Process.Start(args);
             }
             catch (Exception)
             {
                 args.FileName = "update.exe";
                 System.Diagnostics.Process.Start(args);
             }
         }
         GameFacade.Kill();
         if (FSOEnvironment.Linux)
         {
             Environment.Exit(0);                       //we're serious
         }
     }
     catch (Exception e)
     {
         //something terrible happened :(
         _UpdaterAlert = UIScreen.GlobalShowAlert(new UIAlertOptions
         {
             Title   = GameFacade.Strings.GetString("f101", "30"),
             Message = GameFacade.Strings.GetString("f101", "31", new string[] { e.Message }),
             Buttons = UIAlertButton.Ok(y =>
             {
                 UIScreen.RemoveDialog(_UpdaterAlert);
                 Continue(false);
             })
         }, true);
     }
 }
Exemple #24
0
        public static UIAlert GlobalShowAnnouncement(AnnouncementMsgPDU msg)
        {
            UIAlert alert = null;

            alert = GlobalShowAlert(new UIAlertOptions()
            {
                Title   = GameFacade.Strings.GetString("195", "30") + GameFacade.CurrentCityName,
                Message = GameFacade.Strings.GetString("195", "28") + msg.SenderID.Substring(2) + "\r\n"
                          + GameFacade.Strings.GetString("195", "29") + msg.Subject + "\r\n"
                          + msg.Message,
                Buttons   = UIAlertButton.Ok((btn) => RemoveDialog(alert)),
                Alignment = TextAlignment.Left
            }, true);
            return(alert);
        }
Exemple #25
0
        public void SimpleUIAlert(string title, string message, Action action)
        {
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize  = 12,
                Title     = title,
                Message   = message,
                Alignment = TextAlignment.Center,
                TextEntry = false,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UIScreen.RemoveDialog(alert);
                    action?.Invoke();
                }),
            }, true);
        }
Exemple #26
0
 public void ReturnToNeighbourhood()
 {
     if (CloseAlert == null)
     {
         CloseAlert = new UIMobileAlert(new FSO.Client.UI.Controls.UIAlertOptions
         {
             Title   = GameFacade.Strings.GetString("153", "3"), //save
             Message = GameFacade.Strings.GetString("153", "4"), //Do you want to save the game?
             Buttons =
                 UIAlertButton.YesNoCancel(
                     (b) => { Save(); ExitLot(); CloseAlert.Close(); CloseAlert = null; },
                     (b) => { ExitLot(); CloseAlert.Close(); CloseAlert = null; },
                     (b) => { CloseAlert.Close(); CloseAlert = null; }
                     )
         });
         GlobalShowDialog(CloseAlert, true);
     }
 }
        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);
        }
Exemple #28
0
        void StalemateHandler(string evt, byte[] remainingPieces)
        {
            SetOpponentIcon(remainingPieces[0]);
            // Alert: The game is a stalemate
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize  = 12,
                Title     = TiedGameTitle,
                Message   = TiedGameMessage,
                Alignment = TextAlignment.Center,
                TextEntry = false,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
        }
Exemple #29
0
        public void DepositFailHandler(string evt, string amountString)
        {
            // show an alert that informs the user that they don't have the money to make the deposit
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize  = 12,
                Title     = GameFacade.Strings.GetString("f110", "23"),                                  // "Transaction Error"
                Message   = GameFacade.Strings.GetString("f110", "26").Replace("%d", "" + amountString), // "You don't have enough simoleons to deposit: $%d"
                Alignment = TextAlignment.Center,
                TextEntry = false,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    ResumeFromMachineBalance("resume_manage", "" + ObjectBalance);
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
        }
        public void FailureTest(string evt, string data)
        {
            UIAlert alert = null;

            alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
            {
                TextSize = 12,
                Title    = "Fail Test",
                Message  = "You failed the cooldown test." + System.Environment.NewLine +
                           "You cannot use this item until: " + data,
                Alignment = TextAlignment.Center,
                TextEntry = false,
                Buttons   = UIAlertButton.Ok((btn) =>
                {
                    UIScreen.RemoveDialog(alert);
                }),
            }, true);
            CloseInteraction();
        }