public override void OnInspectorGUI() { PopupAction pa = target as PopupAction; pa.fullscreenResolution = EditorGUILayout.Toggle("Full-screen Resolution:", pa.fullscreenResolution); pa.fullscreenMod = EditorGUILayout.Toggle("Display Mode:", pa.fullscreenMod); pa.textureQuality = EditorGUILayout.Toggle("Texture Quality:", pa.textureQuality); pa.anisoQuality = EditorGUILayout.Toggle("Anisotropic Quality:", pa.anisoQuality); pa.waterQuality = EditorGUILayout.Toggle("Water Quality:", pa.waterQuality); pa.terrainQuality = EditorGUILayout.Toggle("Terrain Quality:", pa.terrainQuality); pa.lightingMethod = EditorGUILayout.Toggle("Lighting Method:", pa.lightingMethod); pa.shadowQuality = EditorGUILayout.Toggle("Shadow Resolution:", pa.shadowQuality); pa.vsyncCount = EditorGUILayout.Toggle("V-Sync Count:", pa.vsyncCount); pa.crosshairStyle = EditorGUILayout.Toggle("Crosshair Style:", pa.crosshairStyle); pa.fpsCounter = EditorGUILayout.Toggle("FPS Counter:", pa.fpsCounter); pa.aimingMethod = EditorGUILayout.Toggle("Aiming Method:", pa.aimingMethod); pa.speakerMode = EditorGUILayout.Toggle("Speaker Mode:", pa.speakerMode); if (pa.speakerMode) { EditorGUI.indentLevel += 1; pa.restartNote = (UILabel)EditorGUILayout.ObjectField("Restart Note:", pa.restartNote, typeof(UILabel), true); if (pa.restartNote == null) { EditorGUILayout.HelpBox("Tell user that he has to restart game to take effect.", MessageType.None); } EditorGUI.indentLevel -= 1; } if (GUI.changed) { EditorUtility.SetDirty(pa); } }
/// <summary> /// Inicjowanie podstawowych właściwości Popup-u /// </summary> /// <param name="lifeSpan">Czas, przez jaki wyświetlany jest popup-u</param> /// <param name="onOpen">Akcje wywoływane po wyświetleniu popup-u</param> /// <param name="onClick">Akcje wywoływane po naciśnięciu na popup</param> /// <param name="onClose">Akcje wywoływane po zniszczeniu popup-u</param> protected Popup(AutoCloseMode closeMode = AutoCloseMode.NewAppears, PopupAction onOpen = null, PopupAction onClose = null, PopupAction onClick = null) { CloseMode = closeMode; this.onOpen = onOpen; this.onClose = onClose; this.onClick = onClick; }
/// <summary> /// Inicjowanie popup-u typu Icon /// </summary> /// <param name="iconType">Typ ikony, jaka jest wyświetlana przez IconBox/param> /// <param name="lifeSpan">Czas wyświetlania IconBox-u</param> /// <param name="onOpen">Akcje wywoływane po wyświetleniu IconBox-u</param> /// <param name="onClick">Akcje wywoływane po naciśnięciu na IconBox</param> /// <param name="onClose">Akcje wywoływane po zniszczeniu IconBox-u</param> public IconPopup(IconPopupType iconType, PopupAction onClose = null, AutoCloseMode closeMode = AutoCloseMode.NewAppears) : base(closeMode) { this.iconType = iconType; this.onClose = onClose; onClick = Functionality.Destroy(); //Icon popup po kliknięciu jest zamykany }
public void reset() { message = string.Empty; yesAction = null; closeAction = null; data = null; closeLink = null; }
/// <summary> /// Tworzy QuestionPopup z odpowiedzią "OK" /// </summary> /// <param name="question">Pytanie, które ma zostać wyświetlone użytkownikowi</param> /// <param name="okAction">Akcja wywoływana po naciśnięciu przycisku "Ok"</param> /// <returns>>QuestionPopup z odpowiedzią "Ok"</returns> public static QuestionPopup CreateOkDialog(string question, PopupAction okAction = null) { QuestionPopup popup = new QuestionPopup(question); popup.AddButton("OK", Functionality.Destroy()); popup.onClose += okAction; return(popup); }
/// <summary> /// Wyświetla wiadomość debugowania w konsoli /// </summary> /// <param name="message">Wiadomość do wyświetlenia przez akcje</param> /// <returns>Akcja wyświetlająca wiadomość debugowania w konsoli</returns> public static PopupAction DebugMeesage(string message) { PopupAction debugMessage = delegate(Popup source) { Debug.Log("Źródło: " + source + "; Wiadomość: " + message); }; return(debugMessage); }
/// <summary> /// Dodaje przekazany popup do kolejki wyświetlania /// </summary> /// <param name="popup">Popup, który ma zostać dodany do kolejki wyświetlania</param> /// <returns>Akcja dodająca nowy popup do kolejki wyświetlania</returns> public static PopupAction Show(Popup popup) { PopupAction show = delegate(Popup source) { PopupSystem.instance.AddPopup(popup); }; return(show); }
/// <summary> /// Zamyka box-a zaaierającego popup źródłowy /// </summary> /// <returns></returns> public static PopupAction Destroy() { PopupAction destroy = delegate(Popup source) { PopupSystem.instance.ClosePopup(source); }; return(destroy); }
private void AddPopupAction(PopupAction actionType, string popupName, float delay = 0.0f) { _popupActions.Enqueue(new PopupActionData { actionType = actionType, popupName = popupName, delay = delay }); }
/// <summary> /// Dodaje wskazany popup do kolejki wyświetlania i zamyka box-a z popup-em źródłowym /// </summary> /// <param name="popup">Popup, który ma zostać dodany do kolejki wyświetlania</param> /// <returns>Akcja dodająca nowy popup do kolejki wyświetlania i zamykająca popup źródłowy/returns> public static PopupAction ShowAndDestroy(Popup popup) { PopupAction showAndDestroy = delegate(Popup source) { PopupSystem.instance.AddPopup(popup); PopupSystem.instance.ClosePopup(source); }; return(showAndDestroy); }
/// <summary> /// Dodaje przycisk, który zostanie wyświetlony przez QuestionBox-a /// </summary> /// <param name="name"></param> /// <param name="clickAction"></param> public void AddButton(string name, PopupAction clickAction = null) { if (buttons.Count >= Keys.Popups.QUESTIONBOX_BUTTONS_AMOUNT) { Debug.LogError("Nie można dodać więcej przycisków dla QuestionPopup-u o treści: " + message); return; } buttons.Add(Tuple.Create(name, clickAction)); }
private static void ContentPageTapCommand(object obj) { if (popupAction == null) { HideCurrentContextMenu(); } else { ProcessPositionAndShowPopup(popupAction); popupAction = null; } }
/// <summary> /// Tworzy QuestionPopup z dwoma odpowiedziami: "Tak" i "Nie" /// </summary> /// <param name="question">Pytanie, które ma zostać wyświetlone użytkownikowi</param> /// <param name="yesAction">Akcja wywoływana po wciśnięciu przycisku "Tak"</param> /// <param name="noAction">Akcja wywoływana po wciśnięciu przycisku "Nie"</param> /// <returns>QuestionPopup z odpowiedziami "Tak" "Nie"</returns> public static QuestionPopup CreateYesNoDialog(string question, PopupAction yesAction = null, PopupAction noAction = null) { QuestionPopup popup = new QuestionPopup(question); yesAction += delegate(Popup source) { source.onClose = null; Functionality.Destroy().Invoke(source); }; popup.onClose += noAction; popup.AddButton(SettingsController.instance.languageController.GetWord("YES"), yesAction); popup.AddButton(SettingsController.instance.languageController.GetWord("NO"), Functionality.Destroy()); return(popup); }
public static void Show(String popupAutomationId, Rect rect, LayoutAlignment horizontalLayoutAlignment = LayoutAlignment.Start, Boolean outsideRectHorizontally = false, LayoutAlignment verticalLayoutAlignment = LayoutAlignment.End, Boolean outsideRectVertically = true, Point translation = default, int delay = -1) { // NOT NECESSARY TO BE ON MAIN THREAD PopupAction popupAction = new PopupAction { PopupAutomationId = popupAutomationId, LinkedToAutomationId = null, Rect = rect, OutsideRectHorizontally = outsideRectHorizontally, OutsideRectVertically = outsideRectVertically, HorizontalLayoutAlignment = horizontalLayoutAlignment, VerticalLayoutAlignment = verticalLayoutAlignment, Translation = translation, Delay = delay }; PrepareToShow(popupAction); }
public void setData(UISystemPopup.PopupType type, string msg = "", PopupAction yesAction = null, PopupAction closeAction = null, params object[] dataParmas) { popupType = type; message = msg; this.yesAction = yesAction; this.closeAction = closeAction; data = dataParmas; if (data != null && data.Length > 0) { if (data[0].ToString().StartsWith(UISystemPopup.WEB_LINK_HEADER)) { closeLink = data[0].ToString().Substring(2); } else { closeLink = null; } } else { closeLink = null; } }
/// <summary> /// Initialize script, styles and colors /// </summary> public PopupWin() { // {0} = E5EDFA - popupBackground // {1} = 455690 - popupBorderDark // {2} = A6B4CF - popupBorderLight // {3} = 728EB8 - cntBorderDark // {4} = B9C9EF - cntBorderLight // {5} = E9EFF9 - cntBackground // {6} = E0E9F8 - gradientStart // {7} = FFFFFF - gradientEnd // {8} = 1F336B - textColor // {9} = 6A87B2 - xButton // {10}= 45638F - xButtonOver divDesign = @"background:#{0}; border-right:1px solid #{1}; border-bottom:1px solid #{1}; border-left:1px solid #{2}; border-top:1px solid #{2}; position:absolute; z-index:9999; "; cntStyle = @"border-left:1px solid #{3}; border-top:1px solid #{3}; border-bottom:1px solid #{4}; border-right:1px solid #{4}; background:#{5}; padding:2px; overflow:hidden; text-align:center; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FF{6}', EndColorStr='#FF{7}');"; cntStyleI = @"position:absolute; left:2px; width:{0}px; top:20px; height:{1}px;"; cntStyleN = @"position:absolute; left:2px; width:{0}px; top:20px; height:{1}px;"; aStyle = @"font:12px arial,sans-serif; color:#{8}; text-decoration:none;"; aCommands = @"onmouseover=""style.textDecoration='underline';"" onmouseout=""style.textDecoration='none';"" href=""[cmd]"""; hdrStyle = @"position:absolute; left:2px; width:[wid]px; top:2px; height:14px; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FF{6}', EndColorStr='#FF{7}');"; title = "Title here"; msg = "Message to show in popup"; fullmsg = "Text to display in new window."; closeHtml = @"<span style=""position:absolute; right:0px; top:0px; cursor:pointer; color:#{9}; font:bold 12px arial,sans-serif; position:absolute; right:3px;"" onclick=""[id]espopup_Close()"" onmousedown=""event.cancelBubble=true;"" onmouseover=""style.color='#{10}';"" onmouseout=""style.color='#{9}';"">X</span>"; sPopup = "<head><title>{1}</title><style type=\\\"text/css\\\">{2}</style></head>" + "<body><h1>{1}</h1><p>{0}</p></body>"; spopStyle = "body {" + " background:#[gs]; padding:5px;" + " filter:progid:DXImageTransform.Microsoft.Gradient(" + " GradientType=0,StartColorStr='#FF[gs]', EndColorStr='#FF[ge]');" + " }" + " h1 {" + " font:bold 16px arial,sans-serif; color:#[clr]; " + " text-align:center; margin:0px;" + " }" + " p {" + " font:14px arial,sans-serif; color:#[clr];" + " }"; ColorStyle = PopupColorStyle.Blue; xOffset = yOffset = 15; popDock = PopupDocking.BottomRight; iHide = 5000; winSize = new Size(400, 250); Width = new Unit("200px"); Height = new Unit("100px"); startTime = 1000; popAction = PopupAction.MessageWindow; }
public static void SetPopupAction(Button button, PopupAction value) { button.SetValue(PopupActionProperty, value); }
/// <summary> /// Initialize script, styles and colors /// </summary> public Popup() { // {0} = E5EDFA - popupBackground // {1} = 455690 - popupBorderDark // {2} = A6B4CF - popupBorderLight // {3} = 728EB8 - cntBorderDark // {4} = B9C9EF - cntBorderLight // {5} = E9EFF9 - cntBackground // {6} = E0E9F8 - gradientStart // {7} = FFFFFF - gradientEnd // {8} = 1F336B - textColor // {9} = 6A87B2 - xButton // {10}= 45638F - xButtonOver divDesign=@"background:#{0}; border-right:1px solid #{1}; border-bottom:1px solid #{1}; border-left:1px solid #{2}; border-top:1px solid #{2}; position:absolute; z-index:9999; "; cntStyle=@"border-left:1px solid #{3}; border-top:1px solid #{3}; border-bottom:1px solid #{4}; border-right:1px solid #{4}; background:#{5}; padding:2px; overflow:hidden; text-align:center; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FF{6}', EndColorStr='#FF{7}');"; cntStyleI=@"position:absolute; left:2px; width:{0}px; top:20px; height:{1}px;"; cntStyleN=@"position:absolute; left:2px; width:{0}px; top:20px; height:{1}px;"; aStyle=@"font:12px arial,sans-serif; color:#{8}; text-decoration:none;"; aCommands=@"onmouseover=""style.textDecoration='underline';"" onmouseout=""style.textDecoration='none';"" href=""[cmd]"""; hdrStyle=@"position:absolute; left:2px; width:[wid]px; top:2px; height:14px; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FF{6}', EndColorStr='#FF{7}');"; title="Title here"; msg="Message to show in popup"; fullmsg="Text to display in new window."; closeHtml=@"<span style=""position:absolute; right:0px; top:0px; cursor:pointer; color:#{9}; font:bold 12px arial,sans-serif; position:absolute; right:3px;"" onclick=""[id]espopup_Close()"" onmousedown=""event.cancelBubble=true;"" onmouseover=""style.color='#{10}';"" onmouseout=""style.color='#{9}';"">X</span>"; sPopup="<head><title>{1}</title><style type=\\\"text/css\\\">{2}</style></head>"+ "<body><h1>{1}</h1><p>{0}</p></body>"; spopStyle="body {"+ " background:#[gs]; padding:5px;"+ " filter:progid:DXImageTransform.Microsoft.Gradient("+ " GradientType=0,StartColorStr='#FF[gs]', EndColorStr='#FF[ge]');"+ " }"+ " h1 {"+ " font:bold 16px arial,sans-serif; color:#[clr]; "+ " text-align:center; margin:0px;"+ " }"+ " p {"+ " font:14px arial,sans-serif; color:#[clr];"+ " }"; ColorStyle=PopupColorStyle.Blue; xOffset=yOffset=15; popDock=PopupDocking.BottomRight; iHide=5000; winSize=new Size(400,250); Width=new Unit("200px"); Height=new Unit("100px"); startTime=1000; popAction=PopupAction.MessageWindow; }
/// <summary> /// Funkcja czyszcząca delegaty. Trzeba ją wywołać przed zniszczeniem obiektu /// </summary> public virtual void ClearDelegates() { onClick = null; onOpen = null; onClose = null; }
/// <summary> /// Inicjowanie popup-u typu Question /// </summary> /// <param name="message">Wiadomość, wyświetlana przez InfoBox</param> /// <param name="lifeSpan">Czas wyświetlania InfoBox-u</param> /// <param name="onOpen">Akcje wywoływane po wyświetleniu InfoBox-u</param> /// <param name="onClick">Akcje wywoływane po naciśnięciu na InfoBox</param> /// <param name="onClose">Akcje wywoływane po zniszczeniu InfoBox-u</param> public QuestionPopup(string message, PopupAction onOpen = null, PopupAction onClose = null, PopupAction onClick = null) : base(AutoCloseMode.NewAppears, onOpen, onClose, onClick) { this.message = message; buttons = new List <Tuple <string, PopupAction> >(); }
/// <summary> /// CommandParameters /// </summary> public CommandParameters(WaitFor waitFor, PopupAction popupAction) { this.WaitFor = waitFor; this.PopupAction = popupAction; }
private static void ProcessPositionAndShowPopup(PopupAction newPopupAction) { if (newPopupAction == null) { return; } // NECESSARY TO BE ON MAIN THREAD if (!MainThread.IsMainThread) { MainThread.BeginInvokeOnMainThread(() => ProcessPositionAndShowPopup(newPopupAction)); return; } // Get ContentPage MultiPlatformApplication.Controls.CtrlContentPage contentPage = GetCurrentContentPage(); // Get the View of the popup View view = GetView(newPopupAction.PopupAutomationId, contentPage); if (view == null) { return; } // Get Rect of the linked element (if any) if (!String.IsNullOrEmpty(newPopupAction.LinkedToAutomationId)) { newPopupAction.Rect = GetRectOfView(contentPage, newPopupAction.LinkedToAutomationId); } // If no Rect is defined, we use the Content Page Bounds if (newPopupAction.Rect.IsEmpty) { newPopupAction.Rect = contentPage.Bounds; } if (popupAction.PopupType != PopupType.ContextMenu) { if (String.IsNullOrEmpty(newPopupAction.LinkedToAutomationId)) { // Set X and Y Constraints RelativeLayout.SetXConstraint(view, Constraint.Constant(0)); RelativeLayout.SetYConstraint(view, Constraint.Constant(0)); // Set Width and HeightConstraints RelativeLayout.SetWidthConstraint(view, Constraint.RelativeToParent((rl) => { return(rl.Width); })); RelativeLayout.SetHeightConstraint(view, Constraint.RelativeToParent((rl) => { return(rl.Height); })); } else { Rect rect = GetRectOfView(newPopupAction.LinkedToAutomationId); // Set X and Y Constraints RelativeLayout.SetXConstraint(view, Constraint.Constant(rect.X)); RelativeLayout.SetYConstraint(view, Constraint.Constant(rect.Y)); // Set Width and HeightConstraints RelativeLayout.SetWidthConstraint(view, Constraint.Constant(rect.Width)); RelativeLayout.SetHeightConstraint(view, Constraint.Constant(rect.Height)); // Add to the list of Activity Indicator if (!activityIndicatorList.ContainsKey(popupAction.PopupAutomationId)) { activityIndicatorList.Add(popupAction.PopupAutomationId, popupAction); } } if (popupAction.PopupType == PopupType.Information) { // We display an Information popup. Do we have to hide it after a delay ? if (newPopupAction.Delay > 0) { Device.StartTimer(TimeSpan.FromMilliseconds(newPopupAction.Delay), () => { HideInternal(newPopupAction.PopupAutomationId); return(false); }); } } // Show popup view.IsVisible = true; contentPage.GetRelativeLayout().RaiseChild(view); } else { // Calculate the new position of the Popup double X = 0, Y = 0; X = GetXPosition(contentPage, view, newPopupAction.HorizontalLayoutAlignment, newPopupAction.Rect, newPopupAction.OutsideRectHorizontally, popupAction.Translation.X); Y = GetYPosition(contentPage, view, newPopupAction.VerticalLayoutAlignment, newPopupAction.Rect, newPopupAction.OutsideRectVertically, popupAction.Translation.Y); // Are we dealing with a Context Menu ? if (newPopupAction.PopupType == PopupType.ContextMenu) { // Hide previous context menu - if any (only one can be display in same time) HideInternal(previousContextMenuActionDisplayed?.PopupAutomationId); // Store context menu previousContextMenuActionDisplayed = newPopupAction; } // Set X and Y Constraints RelativeLayout.SetXConstraint(view, Constraint.RelativeToParent((rl) => X)); RelativeLayout.SetYConstraint(view, Constraint.RelativeToParent((rl) => Y)); // Show popup view.IsVisible = true; contentPage.GetRelativeLayout().RaiseChild(view); } }
private static void PrepareToShow(PopupAction newPopupAction) { // NECESSARY TO BE ON MAIN THREAD if (!MainThread.IsMainThread) { MainThread.BeginInvokeOnMainThread(() => PrepareToShow(newPopupAction)); return; } ContentPage contentPage = GetCurrentContentPage(); View view = GetView(newPopupAction.PopupAutomationId, contentPage); if (view != null) { // Get PopupType newPopupAction.PopupType = GetType(view); newPopupAction.Date = DateTime.UtcNow; // Check if this popup is known String id = view.Id.ToString(); if (!popupList.ContainsKey(id)) { return; } if (newPopupAction.PopupType != PopupType.ContextMenu) { // Store the popup action popupAction = newPopupAction; ContentPageTapCommand(null); } else { PopupAction currentContextMenuDisplayed = previousContextMenuActionDisplayed; HideCurrentContextMenu(); // Se store the popup type newPopupAction.PopupType = popupList[id]; // If we ask to show the context menu currently displayed, we hide it instead if (currentContextMenuDisplayed?.PopupAutomationId == newPopupAction.PopupAutomationId) { // We also need to check if it's the same place or not linked to the same element if (((currentContextMenuDisplayed.LinkedToAutomationId == newPopupAction.LinkedToAutomationId) && (!String.IsNullOrEmpty(newPopupAction.LinkedToAutomationId))) || ((currentContextMenuDisplayed.Rect == newPopupAction.Rect) && (!newPopupAction.Rect.IsEmpty))) { TimeSpan duration = newPopupAction.Date - currentContextMenuDisplayed.Date; if (duration.TotalMilliseconds < 250) { previousContextMenuActionDisplayed = null; return; } } } // Store the popup action popupAction = newPopupAction; // Add Tap gesture on content page - if necessary AddTapGestureToContentPage(contentPage); // On Desktop platform (at least in UWP) there is event propagation so we don't need to call directly ContentPageTapCommand if (!Helper.IsDesktopPlatform()) { ContentPageTapCommand(null); } } } }
/// <summary> /// Empty constructor for serialization /// </summary> public BrowserCommandHandler() { _requiresElementFound = false; _popupAction = PopupAction.None; }