Beispiel #1
0
    void Update()
    {
        // Clean up dead notifications.
        List <UINotification> deadList = new List <UINotification>();

        foreach (UINotification notification in visibleNotifications)
        {
            if (notification == null)
            {
                deadList.Add(notification);
            }
        }
        foreach (UINotification notification in deadList)
        {
            visibleNotifications.Remove(notification);
        }

        // Add queued notifications if there's room.
        while (notifications.Count > 0 && visibleNotifications.Count < maxVisibleNotifications)
        {
            UINotification notification = notifications.Dequeue();
            notification.transform.SetParent(transform, false);
            notification.Show();
            visibleNotifications.Add(notification);
        }
    }
 public void CreateDamageLabel(string text, Vector3 position, UINotification.TYPE t)
 {
     Text dmg = (Text)Instantiate(mUINotification, position, Quaternion.identity);
     dmg.transform.SetParent(transform,true);
     switch (t)
     {
         case UINotification.TYPE.CRIT:
             dmg.color = Color.yellow;
             dmg.fontSize = 14;
             break;
         case UINotification.TYPE.EXP:
             dmg.fontSize = 10;
             dmg.color = Color.white;
             break;
         case UINotification.TYPE.HPGAIN:
             dmg.color = Color.green;
             dmg.fontSize = 12;
             break;
         case UINotification.TYPE.HPLOSS:
             dmg.color = Color.red;
             break;
         case UINotification.TYPE.LVLUP:
             dmg.color = Color.yellow;
             dmg.fontSize = 15;
             dmg.GetComponent<UINotification>().Duration = 8;
             dmg.GetComponent<UINotification>().Decrease = 0.01f;
             break;
     }
     dmg.transform.localScale = mUINotification.transform.localScale;
     dmg.text = text;
 }
Beispiel #3
0
        public void init(GameManager gm, Player p, WorldMap w)
        {
            this.gm = gm;
            this.p  = p;
            this.w  = w;

            state = State.Default;

            note = new GameObject("UI Notification").AddComponent <UINotification> ();
            note.init();
            note.transform.parent = gm.pc.transform;

            hl = new GameObject("UI Highlight").AddComponent <UIHighlight> ();
            hl.init(this);
            hl.transform.parent = transform;

            mv = new GameObject("UI Movement").AddComponent <UIMovement> ();
            mv.init(this);

            tm = new GameObject("Tutorial Manager").AddComponent <TutorialManager>();
            tm.init();
            tm.transform.parent = transform;

            mmm = gameObject.AddComponent <MinimapManager>();
            mmm.transform.parent = transform;

            helper = gameObject.AddComponent <HelperUI>();
            helper.init(this);

            showHelp = false;
        }
Beispiel #4
0
    public void QueueNotification(string message)
    {
        UINotification newNotification = GameObject.Instantiate(notificationPrefab) as UINotification;

        newNotification.gameObject.SetActive(false);
        newNotification.Initialize(message, notificationLifetime);
        notifications.Enqueue(newNotification);
    }
Beispiel #5
0
        public void Draw()
        {
            UINotification notify = this.notify;

            if (notify is UINotification)
            {
                this.notify.Draw();

                // Draw Arrow
                if (this.arrowTexture.Length > 0)
                {
                    Systems.mapper.MetaList[MetaGroup.Decor].Atlas.DrawAdvanced(this.arrowTexture, this.arrowX, this.arrowY, Color.White * this.notify.alpha);
                }
            }
        }
Beispiel #6
0
        public void SetTutorialNote(short posX, short posY, string title, string text, DirRotate dir = DirRotate.Center)
        {
            // Don't overwrite a notify that's already been drawn.
            if (this.notify is UINotification && this.notify.alpha > 0)
            {
                return;
            }

            // UI Notification
            this.notify = new UINotification(UIHandler.globalUI, UIAlertType.Success, title, text, 0, UIHandler.theme.notifs.ItemWidth);
            this.notify.SetRelativePosition(posX, posY);

            // Set Arrow (if applicable)
            this.SetArrow(dir);
        }
    public override void OnInspectorGUI()
    {
        if (uiNotification == null)
        {
            uiNotification = (UINotification)target;
        }

        //base.OnInspectorGUI();

        serializedObject.Update();

        LinkChildUIElementsToNotification();

        DoozyUIHelper.VerticalSpace(8);
        DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
        #region Header
        DoozyUIHelper.DrawTexture(DoozyUIResources.BarUiNotification);
        #endregion
        if (uiNotification.notificationContainer != null) //we check if this notification has at least a notification container attached (if not, we disable it)
        {
            DoozyUIHelper.DrawTexture(DoozyUIResources.BarEnabled);
        }
        else
        {
            DoozyUIHelper.DrawTexture(DoozyUIResources.BarDisabled);
        }
        DoozyUIHelper.VerticalSpace(8);
        #region Show Help
        DoozyUIHelper.ResetColors();
        uiNotification.showHelp = EditorGUILayout.ToggleLeft("Show Help", uiNotification.showHelp, GUILayout.Width(160));
        DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
        #endregion
        DoozyUIHelper.VerticalSpace(8);
        #region Notification Container
        if (uiNotification.notificationContainer != null)
        {
            DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightGreen);
        }
        else
        {
            DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightRed);
        }
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(sp_notificationContainer, true, GUILayout.Width(410));
        EditorGUILayout.EndHorizontal();
        DoozyUIHelper.ResetColors();

        if (uiNotification.showHelp)
        {
            DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightRed);
            EditorGUILayout.HelpBox("required", MessageType.None);
            DoozyUIHelper.ResetColors();
            EditorGUILayout.HelpBox("This is a chld gameObject of the notification, with an UIElement component attached, that will serve as the main container of all the other notification elements. It should contain everything besides the overlay.", MessageType.None);
            EditorGUILayout.HelpBox("To play sounds when it appears and when it dissapears you can add them in the attached UIElement IN and OUT animations.", MessageType.None);
            DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
        }
        #endregion
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Overlay
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_overlay, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("This is the fullscreen overlay / color tint.", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Title
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_title, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("This gameobject should have either a Text or a TextMeshProUGUI component attached.", MessageType.None);
                EditorGUILayout.HelpBox("If you used a TextMeshProUGUI componenet make sure TextMeshPro it is enabled in the UIManager or the Control Panel.", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Message
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_message, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("This gameobject should have either a Text or a TextMeshProUGUI component attached.", MessageType.None);
                EditorGUILayout.HelpBox("If you used a TextMeshProUGUI componenet make sure TextMeshPro it is enabled in the UIManager or the Control Panel.", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Icon
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_icon, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("Every notification can have a customized icon or you can leave it null. Link the Image component here and pass in the icon Sprite when you call the ShowNotification method.", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region CloseButton
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_closeButton, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("This is a special button as it coveres the entire notification area. This allows the user to dismiss at once the notification, just by touching/clicking on it.", MessageType.None);
                EditorGUILayout.HelpBox("TIP: you can attach a Button component to the Overlay. link it here and have a full screen close button", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Buttons
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_buttons, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("These are the buttons you would like to be available for this notification. They can be turned on or off when you call the ShowNotification method.", MessageType.None);
                EditorGUILayout.HelpBox("See documentation for more details.", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Special Elements
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_specialElements, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("If you added stars or anything else with an UIElement attached, you need to link it here", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.VerticalSpace(8);
        if (uiNotification.notificationContainer != null)
        {
            #region Effects
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(sp_effects, true, GUILayout.Width(410));
            EditorGUILayout.EndHorizontal();

            if (uiNotification.showHelp)
            {
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.LightOranage);
                EditorGUILayout.HelpBox("optional", MessageType.None);
                DoozyUIHelper.ResetColors();
                EditorGUILayout.HelpBox("If you added any effects with UIEffect attached, you need to link them here so that they can work as intended", MessageType.None);
                DoozyUIHelper.SetZoneColor(DoozyUIHelper.DoozyColor.Doozy);
            }
            #endregion
        }
        DoozyUIHelper.ResetColors();
        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(target);
    }
 void OnEnable()
 {
     uiNotification = (UINotification)target;
     UpdateSerializedProperties();
 }
Beispiel #9
0
    public void OnClick()
    {
        UINotification notification = UIManager.ShowNotification("BattleSceneDetails", -1, false);

        notification.GetComponent <HUDBattleSceneDetails>().SetData(_playerPreferencesManager, Data);
    }