private void OnCashoutButtonClick(UIElement targetButton) { if (InputAllowed) { InputAllowed = false; // show an alert that asks the user if they want to make a desposit or a withdrawal UIAlert alert = null; alert = UIScreen.GlobalShowAlert(new UIAlertOptions() { TextSize = 12, Title = GameFacade.Strings.GetString("f110", "1"), // "Owner Transactions" Message = GameFacade.Strings.GetString("f110", "2"), // "What would you like to do?" Alignment = TextAlignment.Center, TextEntry = false, Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, ((btn1) => { DepositPrompt(); UIScreen.RemoveDialog(alert); }), GameFacade.Strings.GetString("f110", "4")), // "Deposit" new UIAlertButton(UIAlertButtonType.Cancel, ((btn2) => { WithdrawPrompt(); UIScreen.RemoveDialog(alert); }), GameFacade.Strings.GetString("f110", "3")) // "Withdraw" } }, true); } }
public void SaveAndGo() { if (GameObject.Find("Name").GetComponentInChildren <UIInput>().value == string.Empty) { UIAlert a = UIAlert.create("Need Player Name", "Please input player's name."); a.padding = new Vector2(10f, 10f); a.Add <UIButton>("UIAlert-Button-Template").onClick.Add(new EventDelegate(() => a.Close(true))); a.Show(); return; } //GameObject.Find("Name").GetComponentInChildren<UIInput>().Submit(); //UILabel[] attrs = GameObject.Find("RerollBtn").GetComponent<GetRandomAttr>().attrs; //for (int i = 0; i < attrs.Length; i++) //{ // attrs[i].GetComponent<LabelSaveAs>().Save(); //} Status s = new Status(); s.name = GameObject.Find("Name").GetComponentInChildren <UIInput>().value; s.level = 1; s.curExp = 0; s.expToLevel = 100; s.maxHp = s.curHp = 100; s.strength = int.Parse(GameObject.Find("strValue").GetComponent <UILabel>().text); s.agility = int.Parse(GameObject.Find("agiValue").GetComponent <UILabel>().text); s.intelligent = int.Parse(GameObject.Find("intValue").GetComponent <UILabel>().text); s.Save(); SceneManager.LoadScene("InVilleage"); }
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); }
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(); } }); }
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); }
private void RateSwitch(UIElement button) { if (MayorIsMe || GameFacade.EnableMod) { CurrentMayorTab = UINeighMayorTabMode.Actions; Redraw(); } else { FindController <CoreGameScreenController>()?.NeighborhoodProtocol?.BeginRating (CurrentNeigh.Value?.Id ?? 0, CurrentNeigh.Value?.Neighborhood_MayorID ?? 0, (success) => { if (success == Server.Protocol.Electron.Packets.NhoodResponseCode.SUCCESS) { UIAlert.Alert("", GameFacade.Strings.GetString("f115", "97"), true); } GameThread.SetTimeout(() => { RefreshMayor(); }, 500); }); } }
private void OnSelectAvatar() { UStaticWebRequests.DoSelectAvatar(UILogin.CachedUsername, UILogin.token , (Action <JObject>)((jsel) => { base.OnUnloadThis(); URemoteData.OnReceiveAvatarData(jsel["avatar"].ToString()); AHotBase.LoadUI <UIMain>(); }), (Action <string>)((err) => { if (err == "3") { base.OnUnloadThis(); AHotBase.LoadUI <UICreateAvatar>(); } else { UIAlert.Show("选择角色失败," + err); } }), (err) => { UIAlert.Show("选择角色失败," + err); }); }
public void MessageReceived(AriesClient client, object message) { if (message is MailResponse msg) { GameThread.NextUpdate(x => { switch (msg.Type) { case MailResponseType.NEW_MAIL: case MailResponseType.POLL_RESPONSE: case MailResponseType.SEND_SUCCESS: //cool. we got mail, or got the mail we sent back. if (msg.Messages.Length == 0) { return; //didnt actually get anything } foreach (var mail in msg.Messages) { InboxStore.Save(mail); } View.UpdateInbox(); if (msg.Type == MailResponseType.POLL_RESPONSE) { //show a message indicating we recieved new mail while we were offline. UIAlert alert = null; alert = UIScreen.GlobalShowAlert(new UIAlertOptions { Title = GameFacade.Strings.GetString("225", "1"), Message = GameFacade.Strings.GetString("225", msg.Messages.Length > 1 ? "3" : "2", new string[] { msg.Messages.Length.ToString() }), Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, btn => { //show the inbox ((CoreGameScreen)UIScreen.Current).OpenInbox(); UIScreen.RemoveDialog(alert); }), new UIAlertButton(UIAlertButtonType.No, btn => { UIScreen.RemoveDialog(alert); }) } }, true); } if (msg.Type != MailResponseType.SEND_SUCCESS) { //alert user that mail has been recieved via sound and flashing icon HIT.HITVM.Get.PlaySoundEvent(UISounds.LetterRecieve); ((CoreGameScreen)UIScreen.Current).FlashInbox(true); } else { HIT.HITVM.Get.PlaySoundEvent(UISounds.LetterSend); } break; } }); } }
private void SpecialResult(NhoodResponseCode code) { SpecialButton.Disabled = false; if (code == NhoodResponseCode.SUCCESS) { string title = GameFacade.Strings.GetString("f118", "1"); string message = ""; switch (SpecialType) { case MessageSpecialType.Nominate: message = GameFacade.Strings.GetString("f118", "16"); break; case MessageSpecialType.Vote: message = GameFacade.Strings.GetString("f118", "11"); break; case MessageSpecialType.AcceptNomination: message = GameFacade.Strings.GetString("f118", "19"); break; } UIAlert.Alert(title, message, true); } }
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); }
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; } }); } }
protected override void InitComponents() { UStaticWebRequests.DoSelectAvatar(UILogin.CachedUsername, UILogin.token , (jres) => { var data = new UMRemoteAvatarData(); data.OnFormat(jres); UMRemoteDataManager.Instance.OnAdd(data); UnloadThis(); LoadAnother <UMUIMain>(); }, (err) => { if (err == "3") { UnloadThis(); LoadAnother <UMUICreateAvatar>(); } else { UIAlert.Show("选择角色失败," + err); } }, (err) => { UIAlert.Show("选择角色失败," + err); }); }
/* * 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); }
public void ShowCreationProgressBar(bool show) { if (show) { if (_ProgressAlert == null) { _ProgressAlert = UIScreen.GlobalShowAlert(new UIAlertOptions { Message = "", Buttons = new UIAlertButton[] { }, //TODO: Find something in string tables? Title = "Buy Property", ProgressBar = true, Width = 300 }, true); } } else { if (_ProgressAlert != null) { UIScreen.RemoveDialog(_ProgressAlert); _ProgressAlert = null; } } }
public void MouseUp(UpdateState state) { MouseIsDown = false; if (Holding != null && Holding.Clicked) { if (Holding.CanPlace == VMPlacementError.Success) { //ExecuteEntryPoint(11); //User Placement var putDown = Holding; var pos = Holding.Group.BaseObject.Position; var badCategory = ((Holding.Group.BaseObject as VMGameObject)?.Disabled ?? 0).HasFlag(VMGameObjectDisableFlags.LotCategoryWrong); if (Holding.IsBought) { HITVM.Get().PlaySoundEvent(UISounds.ObjectMovePlace); vm.SendCommand(new VMNetMoveObjectCmd { ObjectID = Holding.MoveTarget, dir = Holding.Dir, level = pos.Level, x = pos.x, y = pos.y }); } else { if (badCategory) { Locked = true; UIAlert.YesNo(GameFacade.Strings.GetString("245", "5"), GameFacade.Strings.GetString("245", (Holding.InventoryPID > 0)?"7":"6"), true, (confirm) => { Locked = false; if (!confirm) return; HITVM.Get().PlaySoundEvent(UISounds.ObjectPlace); if (Holding.InventoryPID > 0) InventoryPlaceHolding(); else BuyHolding(); ClearSelected(); OnPutDown?.Invoke(putDown, state); //call this after so that buy mode etc can produce more. }); return; } else { HITVM.Get().PlaySoundEvent(UISounds.ObjectPlace); if (Holding.InventoryPID > 0) InventoryPlaceHolding(); else BuyHolding(); } } ClearSelected(); OnPutDown?.Invoke(putDown, state); //call this after so that buy mode etc can produce more. } else { } } state.UIState.TooltipProperties.Show = false; state.UIState.TooltipProperties.Opacity = 0; ShowTooltip = false; }
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 SpawnEnemies() { int enemy_count = Random.Range(MinEnemyCount, MaxEnemyCount + 1); for (int i = 0; i < enemy_count; i++) { Enemy new_enemy = Instantiate(EnemyPrefab); int start, end; do { start = Random.Range(0, roomCount); } while (start == spawnRoomIndex); do { end = Random.Range(0, roomCount); } while (end == spawnRoomIndex || end == start); new_enemy.GeneratePatrolPath(start, end); new_enemy.MoveToStartOfPatrol(); new_enemy.StartPatrolPath(); enemies.Add(new_enemy); UIAlert new_alert = Instantiate(AlertPrefab); new_alert.transform.SetParent(AlertCanvas, false); new_alert.Setup(new_enemy); alerts.Add(new_alert); } }
public void MakePost(string title, string message, uint lotID, bool system) { View.Post.Lock(); Actions?.MakePost(NhoodID, title, message, lotID, system, (result) => { if (result == BulletinResponseType.SUCCESS) { var posts = Actions.BulletinBoard; if (posts != null && Actions.CreatedMessage != null) { var newPosts = posts.ToList(); newPosts.Insert(0, Actions.CreatedMessage); posts = newPosts.ToArray(); Actions.BulletinBoard = posts; View.Board.InitBulletinItems(posts); } UIAlert.Alert("", GameFacade.Strings.GetString("f121", "3", new string[] { View.Post.IsMayor ? "1" : "3" }), true); View.Return(); } else { View.Post.Unlock(); } }); }
public void Focus() { UIAlert.CloseAll(true); UIAlert alert1 = UIAlert.create("Alert 1", this.message); alert1.padding = new Vector2(10.0f, 10.0f); alert1.Add <UIButton>("UIAlert-Button-Template").onClick.Add(new EventDelegate(() => { alert1.Close(true); })); alert1.Show(new Vector2(-200.0f, 0.0f)); UIAlert alert2 = UIAlert.create("Focused Alert", this.message); alert2.padding = new Vector2(10.0f, 10.0f); alert2.Add <UIButton>("UIAlert-Button-Template").onClick.Add(new EventDelegate(() => { alert2.Close(true); })); alert2.Add <UIButton>("UIAlert-Button-Template").onClick.Add(new EventDelegate(() => { alert2.Close(true); })); alert2.Show(new Vector2(200.0f, 0.0f)); }
// private IEnumerator DelayInit() { // skip a frame yield return null; // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; // // // CKinect.GestureManager gestureManager = CKinect.GestureManager.Instance; // // if (gestureManager == null) // { // Debug.LogError("The 'KinectGestureManager' not Instance!"); // yield break; // } // // gestureManager.OnGesture += this.OnGesture; // // gestureManager.AddGestureByName(m_WaveLeftGestureName); // gestureManager.AddGestureByName(m_WaveRightGestureName); m_bInit = 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) { } }
/** * 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); } }
private void OnSelectAvatar() { UStaticWebRequests.DoSelectAvatar(UILogin.CachedUsername, UILogin.token , (jsel) => { OnUnloadThis(); URemoteData.OnReceiveAvatarData(jsel["avatar"].ToString()); LoadAnotherUI <UIMain>(); }, (err) => { if (err == "3") { OnUnloadThis(); LoadAnotherUI <UICreateAvatar>(); } else { UIAlert.Show("选择角色失败," + err); } }, (err) => { UIAlert.Show("选择角色失败," + err); }); }
protected override void InitComponents() { FindWidget <Text>("textAvatarname").text = URemoteData.AvatarName; FindWidget <Text>("textLevel").text = URemoteData.AvatarLevel; expProgress = FindWidget <Image>("expProgress"); textExp = FindWidget <Text>("textExp"); textExp.text = ""; inputAnswer = FindWidget <InputField>("inputAnswer"); btnGetQuestion = FindWidget <Button>("btnGetQuestion"); btnGetQuestion.onClick.AddListener(() => { btnGetQuestion.gameObject.SetActive(false); UStaticWebRequests.OnWebRequest("Question/GetOne", "username="******"&token=" + UILogin.token, jobj => { ShowWidget("question", true); FindWidget <Text>("textQuestion").text = jobj["q"].ToString(); }, jfail => { ShowWidget("question", false); btnGetQuestion.gameObject.SetActive(true); }); }); ShowWidget("question", false); btnAnswer = FindWidget <Button>("btnAnswer"); btnAnswer.onClick.AddListener(() => { if (string.IsNullOrEmpty(inputAnswer.text)) { return; } UStaticWebRequests.OnWebRequest("Question/Answer", "username="******"&token=" + UILogin.token + "&answer=" + inputAnswer.text, jobj => { if (jobj.ContainsKey("avatar")) { ShowWidget("question", false); URemoteData.OnReceiveAvatarData(jobj["avatar"].ToString()); UIAlert.Show("回答正确!"); btnGetQuestion.gameObject.SetActive(true); } else { UIAlert.Show("回答错误,再好好想想吧。"); } }, jfail => { UIAlert.Show("回答错误,再好好想想吧。"); }); }); URemoteData.ListeningParam(InfoNameDefs.CurExp, ShowCurExp); URemoteData.ListeningParam(InfoNameDefs.MaxExp, ShowCurExp); ShowCurExp(); }
public static UIAlert ShowAlert(UIAlertOptions options, bool modal) { var alert = new UIAlert(options); ShowDialog(alert, modal); alert.CenterAround(UIScreen.Current); return(alert); }
private void HandleLoadErrors() { UIAlert.Alert("Lot Load Error", $"An error occurred loading lot state. It is not recommended that you continue, as you will desync from the server repeatedly. \n\n" + $"Errors: \n{String.Join("\n", vm.LoadErrors.Select(x => x.ToString()))}\n\n" + $"Your best bet is reinstalling FreeSO or The Sims Online. If this appears repeatedly, you definitely have an issue. You should also post this message on discord.", true); vm.LoadErrors.Clear(); }
public static UIAlert GlobalShowAlert(UIAlertOptions options, bool modal) { var alert = new UIAlert(options); GlobalShowDialog(alert, modal); alert.CenterAround(UIScreen.Current, -(int)UIScreen.Current.X * 2, -(int)UIScreen.Current.Y * 2); return(alert); }
public void ChangeCategory(UIElement elem) { SeatingButton.Selected = false; SurfacesButton.Selected = false; DecorativeButton.Selected = false; ElectronicsButton.Selected = false; AppliancesButton.Selected = false; SkillButton.Selected = false; LightingButton.Selected = false; MiscButton.Selected = false; PetsButton.Selected = false; InventoryButton.Selected = false; UIButton button = (UIButton)elem; button.Selected = true; SetMode((elem == InventoryButton) ? 2 : 1); if (elem == InventoryButton) { if (CurrentCategory != CurrentInventory && LotController.ObjectHolder.DonateMode) { UIAlert.Alert(GameFacade.Strings.GetString("f114", "2"), GameFacade.Strings.GetString("f114", "3"), true); } CurrentCategory = CurrentInventory; } else { if (!CategoryMap.ContainsKey(button)) { return; } CurrentCategory = UICatalog.Catalog[CategoryMap[button]]; } Catalog.SetCategory(CurrentCategory); int total = Catalog.TotalPages(); OldSelection = -1; ProductCatalogSlider.MaxValue = total - 1; ProductCatalogSlider.Value = 0; InventoryCatalogRoommateSlider.MaxValue = total - 1; InventoryCatalogRoommateSlider.Value = 0; InventoryCatalogVisitorSlider.MaxValue = total - 1; InventoryCatalogVisitorSlider.Value = 0; ProductCatalogNextPageButton.Disabled = (total == 1); InventoryCatalogRoommateNextPageButton.Disabled = (total == 1); InventoryCatalogVisitorNextPageButton.Disabled = (total == 1); ProductCatalogPreviousPageButton.Disabled = true; InventoryCatalogRoommatePreviousPageButton.Disabled = true; InventoryCatalogVisitorPreviousPageButton.Disabled = true; return; }
public void Alert(string message, UnityAction callback = null) //回调方法 { GameObject page = Load(AllPaths.Instance.Reg_logPrefabs + "Alert"); UIAlert script = page.GetComponent <UIAlert>(); script.Message.text = message; script.Callback = callback; }
protected override void InitComponents() { var inputUsername = FindWidget <InputField>("inputUsername"); if (!string.IsNullOrEmpty(CachedUsername)) { inputUsername.text = CachedUsername; } var inputPassword = FindWidget <InputField>("inputPassword"); var btnLogin = FindWidget <Button>("btnLogin"); btnLogin.onClick.AddListener(() => { if (string.IsNullOrEmpty(inputUsername.text)) { return; } if (string.IsNullOrEmpty(inputPassword.text)) { return; } btnLogin.enabled = false; var username = inputUsername.text; var password = inputPassword.text; UStaticWebRequests.DoLogin(username, Utils.MD5Hash(password), (jres) => { btnLogin.enabled = true; CachedUsername = jres["username"].ToString(); token = jres["token"].ToString(); UnloadThis(); LoadAnother <UIMain>(); } , (err) => { btnLogin.enabled = true; UIAlert.Show("登录失败," + err); } , (error) => { btnLogin.enabled = true; UIAlert.Show("登录失败,网络错误:" + error); }); }); var btnRegister = FindWidget <Button>("btnRegister"); btnRegister.onClick.AddListener(() => { UnloadThis(); LoadAnother <UIRegister>(); }); }
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); }); }
private IEnumerator DelayInit() { // yield return null; // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; // m_AlertHandUp = UIAlertManager.Instance.GetAlert( m_IDAlertHandUp ); if( m_AlertHandUp == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWaveHand:" + m_IDAlertHandUp, this ); yield break; } m_AlertHandUp.OnClose = this.OnCloseAlertWaveHand; // CKinect.CursorController.Instance.DisableCursor(); if( m_bPlayMoiveOnStart ) { HoldBodyTexture(); ActiveMoive(); PlayMoive(); } else { HoldMoive(); ActiveBodyTexture(); } m_AlertWelcome.Show(1.0f); // m_bInited = true; }
// private IEnumerator DelayInit() { // skip a frame yield return null; // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; m_AlterDrag = UIAlertManager.Instance.GetAlert( m_IDAlterDrag ); if( m_AlterDrag == null) { Debug.LogError( " There's not a UIAlter -- IDAlterDrag:" + m_IDAlterDrag,this); yield break; } m_AlertAutoPlay = UIAlertManager.Instance.GetAlert( m_IDAlterAutoPlay ); if( m_AlertAutoPlay == null) { Debug.LogError( " There's not a UIAlter -- IDAlterAutoPlay:" + m_IDAlterAutoPlay,this); yield break; } m_BtnCloseScene.OnClicked = this.OnBtnCloseSceneClick; m_WidgetMore.OnOpen = OnMoreOpen; m_WidgetMore.OnCloseFinish = OnMoreCloseFinish; yield return new WaitForEndOfFrame(); // m_AlertWelcome.Show( 1.0f ); m_bInited = true; }
// private IEnumerator DelayInit() { // skip a frame yield return null; // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; m_bInit = true; }
public void Show(int buttons, UIAlert.Layout layout = UIAlert.Layout.HORIZONTAL) { UIAlert.CloseAll(true); UIAlert alert = UIAlert.create(this.title, this.message, layout); alert.padding = new Vector2(10.0f, 10.0f); for(int i=0; i<buttons; i++) { alert.Add<UIButton>("UIAlert-Button-Template").onClick.Add(new EventDelegate(() => { alert.Close(true); })); } alert.Show (); }
// private IEnumerator DelayInit() { yield return null; // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; // m_AlertHintDrag = UIAlertManager.Instance.GetAlert( m_IDAlertHintDrag ); if( m_AlertHintDrag == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertHintDrag:" + m_IDAlertHintDrag, this ); yield break; } m_AlertHintDrag.OnClose = this.OnCloseAlertHintDrag; // m_AlertHint = UIAlertManager.Instance.GetAlert( m_IDAlertHint ); if( m_AlertHint == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertHint:" + m_IDAlertHint, this ); yield break; } // m_AlertHint.OnClose = this.OnCloseAlertHint; // IndicatorManager.Instance.OnHoverOver = this.OnIndicatorHoverOver; IndicatorManager.Instance.OnHoverOut = this.OnIndicatorHoverOut; m_bInit = true; }
private IEnumerator DelayInit() { yield return null; // OverGameObject instace = OverGameObject.Instace; // // if(instace != null) // { // instace.OnOverGameObject += OnOverGameObject; // } m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; m_AlertDrag = UIAlertManager.Instance.GetAlert( m_IDAlertDrag ); if( m_AlertDrag == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertDrag:" + m_IDAlertDrag, this ); yield break; } m_AlertSelectMenu = UIAlertManager.Instance.GetAlert( m_IDAlertSelectMenu ); if( m_AlertSelectMenu == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertSelectMenu:" + m_IDAlertSelectMenu, this ); yield break; } m_AlterOtherRoom = UIAlertManager.Instance.GetAlert( m_IDAlertOtherRoom ); if( m_AlterOtherRoom == null ) { Debug.LogError( "There's not a UIAlert -- m_IDAlertOtherRoom:" + m_IDAlertOtherRoom, this ); yield break; } m_bInited = true; }
// private IEnumerator DelayInit() { // skip a frame yield return null; // // // CKinect.GestureManager gestureManager = CKinect.GestureManager.Instance; // // // // if( gestureManager == null ) // { // Debug.LogError( "The 'KinectGestureManager' not Instance!", this ); // yield break; // } // // gestureManager.OnGesture += this.OnGesture; // // gestureManager.AddGestureByName(m_WaveLeftGestureName); // gestureManager.AddGestureByName(m_WaveRightGestureName); // m_AlertWelcome = UIAlertManager.Instance.GetAlert( m_IDAlertWelcome ); if( m_AlertWelcome == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWelcome:" + m_IDAlertWelcome, this ); yield break; } // m_AlertWelcome.OnClose = this.OnCloseAlertWelcome; // m_AlertWaveHand = UIAlertManager.Instance.GetAlert( m_IDAlertWaveHand ); if( m_AlertWaveHand == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertWaveHand:" + m_IDAlertWaveHand, this ); yield break; } m_AlertWaveHand.OnClose = this.OnCloseAlertWaveHand; // m_AlertSelect = UIAlertManager.Instance.GetAlert( m_IDAlertSelect ); if( m_AlertSelect == null ) { Debug.LogError( "There's not a UIAlert -- IDAlertSelect:" + m_IDAlertSelect, this ); yield break; } m_AlertSelect.OnClose = this.OnCloseAlertSelect; // m_GridApartmentLayout.gameObject.SetActive( false ); // m_bInit = true; }