public void ShowPopup(PopupType showingPopup, bool isQueued = false) { if (IsInPopupDic(showingPopup) == false) { Debug.LogError("This PopupType is Not Impl!!"); return; } if (isQueued == true) { if (popupStack.Count > 0) { popupQueue.Enqueue(showingPopup); return; } } else { if (IsOverlapPopup(showingPopup)) { return; } if (isTransition == true) { return; } } StartCoroutine(ShowPopupRoutine(showingPopup)); }
public static State RemoveOpenedPopup(PopupType popupType, State state) { var openPopups = GetOpenPopups(state); openPopups.Remove(popupType); return(UpdateOpenPopups(openPopups, state)); }
private PopupBase PresentPopup(PopupType type) { if (popupDictionary.ContainsKey(type)) { return(popupDictionary[type].GetComponent <PopupBase>()); } Transform popup; switch (type) { case PopupType.SearchOpponent: popup = Instantiate(SearchingPopupTransform, transform); break; case PopupType.Settings: popup = Instantiate(SettingsPopupTransform, transform); break; default: throw new Exception("Invalid Popup Type"); } var popupBase = popup.GetComponent <PopupBase>(); popupDictionary[type] = popupBase; return(popupBase); }
public Popup(View content, Page page) { this.content = content; InitializeComponent(); if (content is PopupComponent) { type = ((PopupComponent)content).GetPopupType(); } else { type = PopupType.INFO; } if (type == PopupType.INFO) { AbsoluteLayout.SetLayoutBounds(frame, new Rectangle(0.5, 0.5, 0.8, 0.3)); } else if (type == PopupType.INPUT) { AbsoluteLayout.SetLayoutBounds(frame, new Rectangle(0.5, 0.3, 0.8, 0.6)); } pop.Children.Add(content); TapGestureRecognizer tap = new TapGestureRecognizer(); tap.Tapped += (s, e) => {}; pop.GestureRecognizers.Add(tap); TapGestureRecognizer tap1 = new TapGestureRecognizer(); tap1.Tapped += (s, e) => { try { Run(); } catch { } }; abs.GestureRecognizers.Add(tap1); }
void ClosePopupScreen(PopupType _popupToClose) { PopupView view = _popups.Find(x => (x._type == _popupToClose)).view; view.Hide(EnableDirection.Forward); _allOpenedPopups.Remove(_popupToClose); }
public void OpenPopupScreen(PopupType _popupToOpen) { PopupView view = _popups.Find(x => (x._type == _popupToOpen)).view; view.Show(EnableDirection.Forward); _allOpenedPopups.Add(_popupToOpen); }
public XwtThemedPopup(PopupType type) : base(type) { base.Content = container = new XwtPopoverCanvas(); BackgroundColor = Xwt.Drawing.Colors.Transparent; Decorated = true; Theme.TargetPosition = CurrentPosition; }
public static PopupWindow <T> Show <T>(PopupType type, T data) where T : class { var target = inst.windows.FirstOrDefault(val => val.type == type); if (target != null) { if (inst.current.value != PopupType.None) { inst.currentView.Hide(); } target.Show(true, data); inst.current.value = type; inst.connection = target.closed.Listen(() => { inst.currentView.Hide(); inst.current.value = PopupType.None; }); inst.currentView = target; return((PopupWindow <T>)target); } return(null); }
public void Init(PopupType type, string msg, string titleText = null, PopupMessageCompleteDelegate _onConfirmedCallBack = null) { SetupTitle(type, titleText); message.text = msg; onConfirmedCallBack = _onConfirmedCallBack; }
protected void SetupTitle(PopupType type, string titleStr) { // Setup text. if (string.IsNullOrEmpty(titleStr)) { title.text = type.ToString(); } else { title.text = titleStr; } // Setup color. switch (type) { case PopupType.Info: title.color = infoColor; break; case PopupType.Warning: title.color = warningColor; break; case PopupType.Error: title.color = errorColor; break; } }
public void Setup(PopupType popupType) { switch (popupType) { case PopupType.HIT: textMesh.SetText("HIT!"); textMesh.fontSize = 5; textColor = new Color(1f, 197f / 255f, 0f); audioSource.clip = hitClip; break; case PopupType.CRITICAL: textMesh.SetText("CRITICAL!"); textMesh.fontSize = 7; textColor = new Color(1f, 55f / 255f, 0f); audioSource.clip = criticalHitClip; break; case PopupType.MISS: textMesh.SetText("MISS~"); textMesh.fontSize = 5; textColor = new Color(233f / 255f, 122f / 255f, 216f / 255f); break; } textMesh.color = textColor; disappearTimer = DISAPPEAR_TIMER_MAX; sortingOrder++; textMesh.sortingOrder = sortingOrder; moveVector = new Vector3(0.7f, 1f) * 2f; }
private void ShowPopup(PopupType pType, Popup popupToShow, PopupData data, bool hidePrev) { if (popupToShow != null) { popupToShow.Show(pType, data); } }
public void ShowCustomizePopup(PopupType _type, string title, string content, PopupShowType option = PopupShowType.ReplaceCurrent, Action onYes = null, Action onNo = null, Action other = null) { if (_type == PopupType.Ok || _type == PopupType.YesNo || _type == PopupType.Customize) { var _popup = (CustomizePopup)GetPopup(PopupType.Customize); if (_type == PopupType.Ok) { _popup.InitCustomizePopup(title, content, onYes); } else if (_type == PopupType.YesNo) { _popup.InitCustomizePopup(title, content, onYes, onNo); } else { _popup.InitCustomizePopup(title, content, onYes, onNo, other); } ShowPopup(_popup, option); } else { ShowPopup(_type, option); Debug.LogWarning("please use ShowPopup(PopupType type, PopupShowType option = PopupShowType.ReplaceCurrent),Not custom"); } }
public void OpenPopup(PopupType popupType, BasePopupData data /*,bool isSingleOnScreen = false*/) { _canvas = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>(); PopupData popupData = _popupDataList.popupDataList.Find(x => x.popupType == popupType); if (popupData == null) { Debug.LogError("PopupManager:OpenPopup The popup " + popupType.ToString() + "you are trying to open doesn`t exist."); return; } // if (isSingleOnScreen) //{ // CloseAllMenus(); //} //ifatuTODO - check if this is needed or corect //Destroy(_currentMenu); //_currentMenu = null; _currentPopup = Instantiate(popupData.popupPrefab, transform.position, Quaternion.identity); _currentPopup.Init(data); _currentPopup.transform.SetParent(_canvas.transform, false); // _currentMenu.transform.position = new Vector3(0, 0, 0); // _currentMenu.transform.localScale = new Vector3(1, 1, 1); _popupStack.Add(_currentPopup); }
[ClientRpc(channel = Channels.DefaultUnreliable)] // unimportant => unreliable void RpcShowDamagePopup(GameObject damageReceiver, PopupType popupType, int amount) { // spawn the damage popup (if any) and set the text // (-1 = block) if (damageReceiver != null) // still around? { Entity receiverEntity = damageReceiver.GetComponent <Entity>(); if (receiverEntity != null && receiverEntity.damagePopupPrefab != null) { // showing it above their head looks best, and we don't have to use // a custom shader to draw world space UI in front of the entity var bounds = receiverEntity.collider.bounds; Vector3 position = new Vector3(bounds.center.x, bounds.max.y, bounds.center.z); var popup = Instantiate(receiverEntity.damagePopupPrefab, position, Quaternion.identity); if (popupType == PopupType.Normal) { popup.GetComponentInChildren <TextMesh>().text = amount.ToString(); } else if (popupType == PopupType.Block) { popup.GetComponentInChildren <TextMesh>().text = "<i>Block!</i>"; } else if (popupType == PopupType.Crit) { popup.GetComponentInChildren <TextMesh>().text = amount + " Crit!"; } } } }
async void ShowWarning(string s, PopupType type = PopupType.Warning) { if (_core.TryGetUiManager(out IUiManager ui)) { await ui.ShowPopup(new WarningViewModel(s), "Login failed", type); } }
public Task <TResult> ShowPopup <TResult>( PopupViewModelBase <TResult> element, string title = null, PopupType popupType = PopupType.None, bool closable = true, bool trasnparent = true) { return(Application.Current.Dispatcher.Invoke(async() => { if (element.View.Parent != null) { ((Border)element.View.Parent).Child = null; //.Clear(); } var modal = trasnparent ? new ModalPopup(Window.GetWindow(this)) : new ModalPopup(Window.GetWindow(this), CaptureScreen(this)); modal.Closed += (oo, ee) => element.Close(); modal.PopupContent = element.View; element.Closable = closable; modal.DataContext = element; modal.PopupType = popupType; modal.Title = title ?? ""; if (!_popedElements.ContainsKey(element)) { _popedElements.Add(element, modal); } modal.Show(); var res = await element.GetTask(); HidePopup(element); return res; })); //return modal; }
public static void openFirst(PopupType type, string msg = "", PopupData.PopupAction yesAction = null, PopupData.PopupAction closeAction = null, params object[] data) { PopupData pd = getPopupDataFromPool(); pd.setData(type, msg, yesAction, closeAction, data); if (_closePopupData != null && (nowPopupData != null && nowPopupData == _closePopupData)) { nowPopupData = null; } if (nowPopupData != null) { _popups.Insert(0, nowPopupData); if (nowPopupData.popupType != pd.popupType) { UISystemPopupBase p = getPopupByType(nowPopupData.popupType); if (p != null) { p.gameObject.SetActive(false); } } nowPopupData = null; } open(pd); }
public PopupScreen(string text, Color color, PopupType type = PopupType.Ok) { IsPopup = true; pType = type; Color = color; msg = text; }
public void SpawnPopupText(Vector3 position, int value, PopupType type, string op) { GameObject popupTransform = Instantiate(popupPrefab, position, Quaternion.identity); PopupMessage popup = popupTransform.GetComponent <PopupMessage>(); popup.Setup(value, type, op); }
/* * Show Hide PopupComponents (Controllers) * */ public void Show(PopupType type, PopupDelegate deleg) { YesNoPopupActive(false); text.SetText(models[type].msg, 0.2f, 6); text.setPosion(models[type].position); Show(); popupdelegate = deleg; }
public PopupData(PopupType type, string title, string text, Manager.Callback onOk = null, Manager.Callback onCancel = null) : base() { this.title = title; this.text = text; this.type = type; this.onOk = onOk; this.onCancel = onCancel; }
public void ShowPopupText(PopupType type, Vector3 position, float damage, bool isCrit) { GameObject goPopup = Instantiate(popupTextPrefab, position, Quaternion.identity, this.transform); goPopup.name = "Popup"; goPopup.GetComponent <UIPopupText>().InitPopup(type, damage, isCrit); goPopup.SetActive(true); }
public PopupScreen(string text, Texture2D uiTexture, PopupType type = PopupType.Ok) { IsPopup = true; pType = type; Color = Color.White; msg = text; this.uiTexture = uiTexture; }
public bool isPopupShowing(PopupType _type) { if (current == null) { return(false); } return(current.popupType == _type); }
private GameObject Instantiate(PopupType popupType) { if (!Paths.ContainsKey(popupType)) { return(new GameObject()); } return(Instantiate(Resources.Load(Paths[popupType])) as GameObject); }
public static DamagePopUp Create(Vector3 position, string popupText, PopupType popupType, bool isCriticalHit = false) { Transform damagePopUpTransform = Instantiate(GameAssets.MyInstance.pfDamagePopUp, position, Quaternion.identity); DamagePopUp damagePopUp = damagePopUpTransform.GetComponent <DamagePopUp>(); damagePopUp.SetUp(popupText, popupType, isCriticalHit); return(damagePopUp); }
public void SetPopup(PopupType popupType) { _actualType = popupType; bool isConfirmation = false; bool hasExitButton = false; _titleText.StringReference.TableEntryReference = _actualType.ToString() + "_Popup_Title"; _descriptionText.StringReference.TableEntryReference = _actualType.ToString() + "_Popup_Description"; string tableEntryReferenceConfirm = PopupButtonType.Confirm + "_" + _actualType; string tableEntryReferenceCancel = PopupButtonType.Cancel + "_" + _actualType; switch (_actualType) { case PopupType.NewGame: case PopupType.BackToMenu: isConfirmation = true; _popupButton1.SetButton(tableEntryReferenceConfirm, true); _popupButton2.SetButton(tableEntryReferenceCancel, false); hasExitButton = true; break; case PopupType.Quit: isConfirmation = true; _popupButton1.SetButton(tableEntryReferenceConfirm, true); _popupButton2.SetButton(tableEntryReferenceCancel, false); hasExitButton = false; break; default: isConfirmation = false; hasExitButton = false; break; } if (isConfirmation) // needs two button : Is a decision { _popupButton1.gameObject.SetActive(true); _popupButton2.gameObject.SetActive(true); _popupButton2.Clicked += CancelButtonClicked; _popupButton1.Clicked += ConfirmButtonClicked; } else // needs only one button : Is an information { _popupButton1.gameObject.SetActive(true); _popupButton2.gameObject.SetActive(false); _popupButton1.Clicked += ConfirmButtonClicked; } _buttonClose.gameObject.SetActive(hasExitButton); if (hasExitButton) // can exit : Has to take the decision or aknowledge the information { _inputReader.MenuCloseEvent += ClosePopupButtonClicked; } }
public static PopupResult ShowMessage(string text, string caption, PopupType buttons) { if (_frmPopup == null) { _frmPopup = new frmPopup(GuiCommon.HMDevXManager); } return(_frmPopup.ShowPopup(text, caption, buttons)); }
public void Show(PopupType type) { popupLayerBase.ShowOverlay(); var popup = PresentPopup(type); popup.gameObject.SetActive(true); popup.InternalCloseDelegate = () => Hide(popup.Type); activePopup = popup; }
// ------------------------------------------------------------------------------------ // public static PopupBase createPopup(GameObject popupGameObject, PopupType popupType) { if (popupType == PopupType.LevelCompleted) { return popupGameObject.AddComponent<PopupLevelCompleted>(); } SLog.logError("PopupFactory createPopup(): unknown type == " + popupType.ToString()); return null; }
public bool isPopupShown(PopupType type) { if (popups.Count != 0) { foreach (PopupBase popup in popups) { if (popup.getPopupType() == type) { return true; } } } return false; }
public void setContent(PopupType newContent) { if (currentContent != null) { currentContent.SetActive(false); lastContents.Push(currentContent); } currentContent = (GameObject)Instantiate(contentPrefabs[(int)newContent]); currentContent.transform.SetParent(gameObject.transform, false); }
public Popup(PopupType pt) { InitializeComponent(); if (pt == PopupType.AllGood) { this.text = "Everything looks aight, man"; Button OK = this.MakeButton("Aight, cool"); this.Controls.Add(OK); OK.Width = this.Width - 10; OK.Location = new Point(5, this.Height - (OK.Height + 5)); OK.Click += Dismiss; } }
// ------------------------------------------------------------------------------------ // public virtual void initialize(PopupType type, int popupNumber, PopupParamsBase popupParams) { _type = type; _name = "Popup" + type.ToString(); _popupNumber = popupNumber; popupCanvasGO = Instantiate (ResourcesBase.load(getCanvasPrefabPath()) as GameObject) as GameObject; popupCanvasGO.name = _name; popupCanvasGO.transform.localScale = Vector3.zero; Canvas popupCanvas = popupCanvasGO.GetComponent<Canvas>(); popupCanvas.planeDistance = POPUP_FIRST_POSITION - popupNumber * POPUP_NEXT_POSITION; popupCanvas.sortingOrder = (popupNumber + 10); popupCanvas.worldCamera = SceneBase.getCurrentSceneClass().getUIManager().getUICamera().getCamera(); }
public void HandleInput(string inputType) { currentPopupType = (PopupType)typeof(Popups).GetField ("currentPopupType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (popups); switch (inputType) { case "Accept": if (currentPopupType == PopupType.OK || currentPopupType == PopupType.SCROLL_TEXT) { //CancelPopup (); AcceptPopup (); } else if (currentPopupType == PopupType.OK_CANCEL) { if (selectedIndex == 0) { AcceptPopup (); } else if (selectedIndex == 1) { CancelPopup (); } } else if (currentPopupType == PopupType.MULTIBUTTON) { AcceptMultibuttonPopup (); } else if (currentPopupType == PopupType.DECK_SELECTOR) { AcceptDeckSelectorPopup (); } else if (currentPopupType == PopupType.TOWER_CHALLENGE_SELECTOR) { AcceptTowerChallengePopup (); } selectedIndex = -1; break; case "Cancel": CancelPopup (); selectedIndex = -1; break; case "Right": MoveSelectionIndicator (Movement.Right); break; case "Left": MoveSelectionIndicator (Movement.Left); break; case "Up": MoveSelectionIndicator (Movement.Up); break; case "Down": MoveSelectionIndicator (Movement.Down); break; } }
public FormWPFContainer(Model.ForkTale forkTale, PopupType popupType) { InitializeComponent(); this.MainPanel.Controls.Add(_host); _forkTale = forkTale; switch (popupType) { case PopupType.Globals: ShowGlobals(forkTale.Global); break; case PopupType.Enumerations: ShowEnumerations(forkTale.Global); break; } this.MainPanel.Controls.Add(_host); }
private void DrawPopupHoverIndicator() { // Hide the selection indicator when the mouse moved. if (oldMousePosition != Input.mousePosition) { oldMousePosition = Input.mousePosition; shouldDrawSeletionIndicator = false; } if (shouldDrawSeletionIndicator && selectedIndex > -1) { currentPopupType = (PopupType)ReflectionsManager.GetValue (popups, "currentPopupType"); string okText = (string)ReflectionsManager.GetValue (popups, "okText"); string cancelText = (string)ReflectionsManager.GetValue (popups, "cancelText"); if (this.currentPopupType != PopupType.NONE) { GUI.depth = 4; GUI.skin = buttonHighlightedUISkin; int fontSize = GUI.skin.button.fontSize; GUI.skin.box.fontSize = 10 + Screen.height / 72; float num = (float)Screen.height * 0.03f; Rect rect; if (currentPopupType == PopupType.DECK_SELECTOR) { rect = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.45f, (float)Screen.height * 0.255f, (float)Screen.height * 0.9f, (float)Screen.height * 0.49f); } else { if (currentPopupType == PopupType.TOWER_CHALLENGE_SELECTOR) { rect = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.5f, (float)Screen.height * 0.1f, (float)Screen.height * 1f, (float)Screen.height * 0.8f); } else { if (currentPopupType == PopupType.SCROLL_TEXT) { rect = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.5f, (float)Screen.height * 0.1f, (float)Screen.height * 1f, (float)Screen.height * 0.8f); } else { rect = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.35f, (float)Screen.height * 0.3f, (float)Screen.height * 0.7f, (float)Screen.height * 0.4f); } } } Rect rect2 = new Rect (rect.x + num, rect.y + num, rect.width - 2f * num, rect.height - 2f * num); //float num2 = (float)Screen.height * 0.03f; //Rect r = new Rect (rect2.xMax - num2, rect2.y, num2, num2); //float num4 = (float)Screen.height * 0.055f; //float height2 = rect2.height * ((this.currentPopupType != PopupType.SAVE_DECK && currentPopupType != PopupType.PURCHASE_PASSWORD_ENTRY) ? ((currentPopupType != PopupType.INFO_PROGCLOSE) ? 0.6f : 0.8f) : 0.35f); int fontSize3 = GUI.skin.label.fontSize; GUI.skin.label.fontSize = fontSize3; if (currentPopupType == PopupType.OK || currentPopupType == PopupType.SCROLL_TEXT) { Rect position2 = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.1f, rect2.yMax - (float)Screen.height * 0.05f, (float)Screen.height * 0.2f, (float)Screen.height * 0.05f); GUI.Box (position2, okText); } else { if (currentPopupType == PopupType.OK_CANCEL || currentPopupType == PopupType.SAVE_DECK) {// || currentPopupType == PopupType.PURCHASE_PASSWORD_ENTRY) { Rect r2 = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.21f, rect2.yMax - (float)Screen.height * 0.05f, (float)Screen.height * 0.2f, (float)Screen.height * 0.05f); Rect r3 = new Rect ((float)Screen.width * 0.5f + (float)Screen.height * 0.01f, rect2.yMax - (float)Screen.height * 0.05f, (float)Screen.height * 0.2f, (float)Screen.height * 0.05f); if (selectedIndex == 0) { GUI.Box (r2, okText); } else if (selectedIndex == 1) { GUI.Box (r3, cancelText); } } else { if (currentPopupType == PopupType.MULTIBUTTON) { string[] buttonList = (string[])ReflectionsManager.GetValue (popups, "buttonList"); float num5 = (float)Screen.height * 0.05f; float num6 = num5 + (float)Screen.height * 0.02f; Rect r4 = new Rect ((float)Screen.width * 0.5f - (float)Screen.height * 0.1f, rect2.y + rect2.height * 0.55f - ((float)buttonList.Length / 2f - (float)selectedIndex) * num6 + (num6 - num5), (float)Screen.height * 0.2f, num5); GUI.Box (r4, buttonList [selectedIndex]); } } } if (currentPopupType != PopupType.INFO_PROGCLOSE && currentPopupType != PopupType.OK && currentPopupType != PopupType.SCROLL_TEXT) { /* GUI.skin = this.closeButtonSkin; if (this.GUIButton (r, string.Empty)) { this.HidePopup (); this.cancelCallback.PopupCancel (this.popupType); } GUI.skin = this.regularUISkin; */ } if (currentPopupType == PopupType.DECK_SELECTOR) { DrawDeckSelectorHoverIndicator (rect2); } else if (currentPopupType == PopupType.TOWER_CHALLENGE_SELECTOR) { DrawTowerChallengeSelectorHoverIndicator(rect2); } /* if (currentPopupType == PopupType.JOIN_ROOM) { } else { if (currentPopupType == PopupType.SAVE_DECK || currentPopupType == PopupType.PURCHASE_PASSWORD_ENTRY) { } else { if (currentPopupType == PopupType.DECK_SELECTOR) { this.DrawDeckSelector (rect2); } else { if (currentPopupType == PopupType.SHARD_PURCHASE_ONE) { } else { if (currentPopupType == PopupType.SHARD_PURCHASE_TWO) { } else { if (currentPopupType == PopupType.TOWER_CHALLENGE_SELECTOR) { this.DrawTowerChallengeSelector (rect2); } } } } } }*/ GUI.skin.button.fontSize = fontSize; } } }
public void ShowPopupByMargin(View view, Rectangle margins, bool modal, bool rounded, string title) { _popupContent = view; PopupChanged = false; _isModal = modal; _popupType = PopupType.Margin; _marginRect = margins; _left = _parentPage.Width * margins.Left; _top = _parentPage.Height * margins.Top; _right = _parentPage.Width * margins.Right; _bottom = _parentPage.Height * margins.Bottom; DrawPopup(view, rounded, title); SetLayoutFlags(_popupFramer, AbsoluteLayoutFlags.None); SetLayoutBounds(_popupFramer, new Rectangle(_left, _top, _parentPage.Width - _right, 0)); if (_isModal) { _popupShield = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = new Color(0, 0, 0, 0.4) }; SetLayoutFlags(_popupShield, AbsoluteLayoutFlags.None); Children.Add(_popupShield, new Rectangle(0, 0, _parentPage.Width, _parentPage.Height)); } Children.Add(_popupFramer); _popupFramer.LayoutTo(new Rectangle(_left, _top, _parentPage.Width - _right, _parentPage.Height - _bottom), Device.OnPlatform<uint>(150, 50, 50), Easing.Linear); if (!PopupVisible) { OnOpened(); } PopupVisible = true; }
public void ShowPopupRelative(View view, View relativeTo, double width, double height, bool modal, string title) { _popupContent = view; _relativeTo = relativeTo; _oheight = height; _owidth = width; PopupChanged = false; _height = _oheight + 16; _width = _owidth; _isModal = modal; _popupType = PopupType.Relative; _title = title; var points = this.GetXY(_relativeTo); DrawPopup(_popupContent, false, _title); if (_isModal) { _popupShield = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = new Color(0, 0, 0, 0.4) }; SetLayoutFlags(_popupShield, AbsoluteLayoutFlags.None); Children.Add(_popupShield, new Rectangle(0, 0, _parentPage.Width, _parentPage.Height)); } SetLayoutFlags(_popupFramer, AbsoluteLayoutFlags.None); if (!PopupVisible) { SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, 0, 0)); } Children.Add(_popupFramer); _triangleStack.Children.Insert(0, new StackLayout{ BackgroundColor = Color.Transparent, WidthRequest = (GetX(relativeTo) - points.X) + (_relativeTo.Width / 2) - 10 }); if (!PopupVisible) { _popupFramer.LayoutTo(new Rectangle(points.X, points.Y, _width, _height), Device.OnPlatform<uint>(150, 50, 50), Easing.Linear); OnOpened(); } else { SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, _width, _height)); } PopupVisible = true; }
public void ShowPopupCenter(View view, double scale = .80, string title = "", bool modal = true, bool rounded = false) { _popupType = PopupType.Center; if (scale <= 1 && scale >= .25) { _scale = scale; } else { _scale = .80; } _isModal = modal; _popupContent = view; PopupChanged = false; _popupWidth = _parentPage.Width * _scale; _popupHeight = _parentPage.Height * _scale; DrawPopup(view, rounded, title); _popupLeft = ((_parentPage.Width - _parentPage.Padding.HorizontalThickness) - _popupWidth) / 2; _popupTop = ((_parentPage.Height - _parentPage.Padding.VerticalThickness) - _popupHeight) / 2; SetLayoutFlags(_popupFramer, AbsoluteLayoutFlags.None); SetLayoutBounds(_popupFramer, new Rectangle(_popupLeft + _popupWidth / 2, _popupTop + _popupHeight / 2, 0, 0)); if (_isModal) { _popupShield = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = new Color(0, 0, 0, 0.4) }; SetLayoutFlags(_popupShield, AbsoluteLayoutFlags.None); Children.Add(_popupShield, new Rectangle(0, 0, _parentPage.Width, _parentPage.Height)); } Children.Add(_popupFramer); _popupFramer.LayoutTo(new Rectangle(_popupLeft, _popupTop, _popupWidth, _popupHeight), 150, Easing.Linear); if (!PopupVisible) { OnOpened(); } PopupVisible = true; }
/// <summary> /// Closes popup control. /// </summary> /// <param name="popup">The popup that will be closed.</param> /// <param name="type">The type of the popup (e.g. Window, Popup, etc.).</param> /// <param name="detachFromVisualRoot">Value indicating whether should be detached from the visual root.</param> /// <returns>True if closed, otherwise False.</returns> internal static bool Close(System.Windows.Controls.Primitives.Popup popup, PopupType type, bool detachFromVisualRoot) { if (!CanPopupClose(popup)) { return false; } switch (type) { case PopupType.Window: if (openedWindows == 0) { return false; } CloseWindow(popup, detachFromVisualRoot); break; case PopupType.TopMostWindow: if (openedTopWindows == 0) { return false; } CloseTopMostWindow(popup, detachFromVisualRoot); break; case PopupType.Popup: if (openedPopups == 0) { return false; } ClosePopup(popup, detachFromVisualRoot); break; case PopupType.DockWindow: if (openedDockWindows == 0) { return false; } CloseDockWindow(popup, detachFromVisualRoot); break; default: return false; } return true; }
private void AcceptMultibuttonPopup() { if (selectedIndex < 0) { return; } string[] buttonList = (string[])ReflectionsManager.GetValue (popups, "buttonList"); if (selectedIndex >= buttonList.Length) { return; } App.AudioScript.PlaySFX ("Sounds/hyperduck/UI/ui_button_click"); currentPopupType = (PopupType)ReflectionsManager.GetValue (popups, "currentPopupType"); HidePopupMethodInfo.Invoke (popups, new object[] { }); IOkStringCallback callback = (IOkStringCallback)ReflectionsManager.GetValue (popups, "okStringCallback"); if (callback != null) { string popupType = (string)ReflectionsManager.GetValue(popups, "popupType"); callback.PopupOk(popupType, buttonList[selectedIndex]); } }
public void CreateQuestion(string title, string body, PopupResult popupResult, PopupType question, Action<PopupResult> handler) { var newObj = Instantiate(_objects[PopupBoxScript.AsText]); Text[] txtCmp = newObj.GetComponentsInChildren<Text>(); for (int i = 0; i < txtCmp.Length; i++) { var curCmp = txtCmp[i]; if (curCmp.name == "Title") { curCmp.text = title; } if (curCmp.name == "Body") { curCmp.text = body; } } // Set Buttons var btns = newObj.GetComponentsInChildren<Button>(); // Pass in bit field of btnFlags. int btnFlags = (int)popupResult; for (int i = 0; i < btns.Length; i++) { btns[i].gameObject.SetActive((btnFlags & (1 << i)) > 0); } var scrObj = newObj.GetComponent<PopupBoxScript>(); scrObj.action = handler; newObj.SetParent(_canvas.transform, false); }
public void CreateQuickPop(PopupType t, string message, float timeout, bool logToHistory = true) { foreach (QuickPopScript r in _quickPops) { r.BumpUp(); } var parentObj = Instantiate(_objects[QuickPopScript.AsText]); var newObj = parentObj.GetChild(0); var txtCmp = newObj.GetComponentInChildren<Text>(); parentObj.name = txtCmp.text = message; var qpScr = newObj.GetComponent<QuickPopScript>(); qpScr.Timeout = timeout; _quickPops.Enqueue(qpScr); newObj.transform.parent.SetParent(_canvas.transform, false); Image imgCmp = null; switch (t) { case PopupType.Message: break; case PopupType.Warning: imgCmp = newObj.GetChild(0).GetComponent<Image>(); imgCmp.sprite = _icons["Warning"]; break; case PopupType.Error: imgCmp = newObj.GetChild(0).GetComponent<Image>(); imgCmp.sprite = _icons["Problem"]; break; default: break; } }
internal static int MaxZIndex(PopupType type) { switch (type) { case PopupType.Window: return PopupManager.nextWindowZIndex - 1; case PopupType.DockWindow: return PopupManager.nextDockWindowZIndex - 1; case PopupType.Popup: return PopupManager.nextPopupZIndex - 1; case PopupType.TopMostWindow: return PopupManager.nextTopWindowZIndex - 1; default: return 0; } }
private void MoveSelectionIndicator(Movement movement) { currentPopupType = (PopupType)ReflectionsManager.GetValue (popups, "currentPopupType"); shouldDrawSeletionIndicator = true; if (currentPopupType == PopupType.OK_CANCEL) { if (movement == Movement.Left) { selectedIndex = 0; } else if (movement == Movement.Right) { selectedIndex = 1; } } else if (currentPopupType == PopupType.MULTIBUTTON) { int numButtons = ((string[])ReflectionsManager.GetValue(popups, "buttonList")).Length; if (movement == Movement.Up) { selectedIndex--; if (selectedIndex < 0) { selectedIndex = 0; } else if (selectedIndex >= numButtons) { selectedIndex = numButtons - 1; } } else if (movement == Movement.Down) { selectedIndex++; if (selectedIndex >= numButtons) { selectedIndex = numButtons - 1; } } } else if (currentPopupType == PopupType.DECK_SELECTOR) { List<DeckInfo> deckList = (List<DeckInfo>)ReflectionsManager.GetValue (popups, "deckList"); int listCount = deckList.Count; if (movement == Movement.Up) { if (selectedIndex - 2 >= 0) { selectedIndex -= 2; } } else if (movement == Movement.Down) { if (selectedIndex + 2 < listCount) { selectedIndex += 2; } } else if (movement == Movement.Left) { // We are on the right side if selected index currently is uneven. if (selectedIndex % 2 == 1 && selectedIndex > 0) { selectedIndex--; } } else if (movement == Movement.Right) { // We are on the left side if selected index currently is even. if (selectedIndex % 2 == 0 && selectedIndex < listCount - 1) { selectedIndex++; } } //Calculate the scroll view height. float scollViewHeight = Screen.height * 0.49f; float num = (float)Screen.height * 0.03f; scollViewHeight = scollViewHeight - 2f * num; scollViewHeight *= .85f; num = (float)Screen.height * 0.015f; scollViewHeight = scollViewHeight - 4f - 2f * num; // Calculate the total scroll size height. float num2 = (float)Screen.height * 0.07f; float num3 = num2 + num; int halfDeckLength = (deckList.Count % 2 != 0) ? (deckList.Count / 2 + 1) : (deckList.Count / 2); int deckListY = selectedIndex / 2; float scrollSizeHeight = (float)(halfDeckLength - 1) * num3 + num2; // Set the scroll position relative to the selected item. Vector2 deckScroll = (Vector2)typeof(Popups).GetField ("deckScroll", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (popups); deckScroll.y = (halfDeckLength - (halfDeckLength - deckListY)) * (scrollSizeHeight / halfDeckLength); deckScroll.y -= (scollViewHeight - num3); if (deckScroll.y < 0f) { deckScroll.y = 0f; } ReflectionsManager.SetValue (this.popups, "deckScroll", deckScroll); } else if (currentPopupType == PopupType.TOWER_CHALLENGE_SELECTOR) { TowerLevels[] levels = App.TowerChallengeInfo.levels; if (movement == Movement.Up) { if (selectedIndex > 0) { selectedIndex--; } } else if (movement == Movement.Down) { if (selectedIndex + 1 < levels.Length) { selectedIndex++; } } // Set the selectedIndex as the selectedChallengeID. ReflectionsManager.SetValue (popups, "selectedChallengeID", selectedIndex); // Calculate the scroll view height. float scollViewHeight = Screen.height * 0.8f; float num = (float)Screen.height * 0.03f; scollViewHeight = scollViewHeight - 2f * num; scollViewHeight *= .85f; num = (float)Screen.height * 0.015f; scollViewHeight = scollViewHeight - 4f - 2f * num; // Calculate the total scroll size height. float scrollSizeHeight = levels.Length * 55; // Set the scroll position relative to the selected item. Vector2 deckScroll = (Vector2)ReflectionsManager.GetValue (popups, "deckScroll"); deckScroll.y = (levels.Length - (levels.Length - selectedIndex)) * (scrollSizeHeight / levels.Length); deckScroll.y -= (scollViewHeight - 55f); if (deckScroll.y < 0f) { deckScroll.y = 0f; } ReflectionsManager.SetValue (popups, "deckScroll", deckScroll); } }
// ------------------------------------------------------------------------------------ // public void showPopup(PopupType type, PopupParamsBase popupParams) { int popupNumber = popups.Count; PopupBase popup = PopupFactory.createPopup(gameObject, type); if (popup == null) { SLog.logError("PopupManager showPopup: type == " + type.ToString() + ", PopupBase popup == null"); return; } popup.initialize(type, popupNumber, popupParams); popups.Add(popup); }
/// <summary> /// Opens popup control. /// </summary> /// <param name="popup">The popup that will be opened.</param> /// <param name="type">The type of the popup (e.g. Window, Popup, etc.).</param> /// <param name="attachToVisualRoot">Whether the popup should be attached to the visual root.</param> /// <returns>True if opened, otherwise False.</returns> internal static bool Open(System.Windows.Controls.Primitives.Popup popup, PopupType type, bool attachToVisualRoot) { if (!CanPopupOpen(popup)) { return false; } switch (type) { case PopupType.Window: OpenWindow(popup, attachToVisualRoot); break; case PopupType.TopMostWindow: OpenTopMostWindow(popup, attachToVisualRoot); break; case PopupType.Popup: OpenPopup(popup, attachToVisualRoot); break; case PopupType.DockWindow: OpenDockWindow(popup, attachToVisualRoot); break; default: return false; } return true; }
/// <summary> /// Attempt to brings the popup on top. Should be called on opened popups (IsOpen=true). /// </summary> /// <param name="popup">The popup that will be on top.</param> /// <param name="type">The type of the popup (e.g. Window, Popup, etc.).</param> /// <returns>True if on top, otherwise False.</returns> internal static bool BringToFront(System.Windows.Controls.Primitives.Popup popup, PopupType type) { if (!CanBringToFront(popup)) { return false; } switch (type) { case PopupType.Window: BringToFrontWindow(popup); break; case PopupType.TopMostWindow: BringToFrontTopMostWindow(popup); break; case PopupType.Popup: BringToFrontPopup(popup); break; case PopupType.DockWindow: BringToFrontDockWindow(popup); break; default: return false; } return true; }
private void CancelPopup() { App.AudioScript.PlaySFX ("Sounds/hyperduck/UI/ui_button_click"); currentPopupType = (PopupType)typeof(Popups).GetField ("currentPopupType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (popups); HidePopupMethodInfo.Invoke (popups, new object[] { }); ICancelCallback callback = ((ICancelCallback)typeof(Popups).GetField ("cancelCallback", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (popups)); if (callback != null) { string popupType = (string)typeof(Popups).GetField ("popupType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (popups); callback.PopupCancel(popupType); } }
private void HidePopup() { this.currentPopupType = PopupType.NONE; this.overlay.enabled = false; }
// ------------------------------------------------------------------------------------ // public override void initialize(PopupType type, int popupNumber, PopupParamsBase popupParams) { base.initialize(type, popupNumber, popupParams); addDelegateToButton("ButtonRetry", delegate() { SceneBase.getCurrentSceneClass().reloadScene(); }); }
private void ShowPopup(PopupType type) { Start(); this.currentPopupType = type; this.overlay.enabled = true; }
public void OnGUI() { DrawPopupHoverIndicator (); currentPopupType = (PopupType)typeof(Popups).GetField ("currentPopupType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (this.popups); if (currentPopupType != PopupType.NONE) { if (selectedIndex == -1) { selectedIndex = 0; if (!Input.GetMouseButtonUp(0)) { shouldDrawSeletionIndicator = true; } } } else { selectedIndex = -1; } }
private void Start() { if( this.overlay != null ) return; this.overlay = new GameObject("PopupBlackOverlay").AddComponent<GUIBlackOverlayButton>(); this.overlay.Init(this, 5, false); this.overlay.enabled = false; UnityEngine.Object.DontDestroyOnLoad(this.overlay.gameObject); this.currentPopupType = PopupType.NONE; this.regularUISkin = (GUISkin)Resources.Load("_GUISkins/RegularUI"); this.highlightedButtonStyle = new GUIStyle(this.regularUISkin.button); this.highlightedButtonStyle.normal.background = this.highlightedButtonStyle.hover.background; }
public void ShowPopup(PopupType type) { LinkedListNode<string> node = popupsList.Find(type.ToString()); if (node != null) { popupsList.Remove(node); popupsList.AddLast(node); this.SetupNextPopup(type.ToString(), false); } else { this.SetupNextPopup(type.ToString(), true); } Workspace.Instance.SendMessage("DisableInput"); }
/// <summary> /// Closes popup control. /// </summary> /// <param name="popup">The popup that will be closed.</param> /// <param name="type">The type of the popup (e.g. Window, Popup, etc.).</param> /// <returns>True if closed, otherwise False.</returns> internal static bool Close(System.Windows.Controls.Primitives.Popup popup, PopupType type) { return Close(popup, type, true); }