Пример #1
0
    private void TraceHide(PopUpData data)
    {
        string content = data.localizedTitle.GetLocalizedString().Result + ": " + data.localizedContent.GetLocalizedString().Result;

        TrackerAsset.Instance.setVar("content", content.Replace("\"", "'"));
        TrackerAsset.Instance.Completable.Completed("tip_" + data.name.ToLower(), CompletableTracker.Completable.DialogFragment);
    }
Пример #2
0
        private void LoadData()
        {
            try
            {
                popupData = popupdata.ReadObject <PopUpData>();
                if (popupData.rules.Count == 0)
                {
                    LoadDefaultRuleList();
                    Puts("Loading Default Rules List");
                }
                if (popupData.commands.Count == 0)
                {
                    LoadDefaultCommandList();
                    Puts("Loading Default Command List");
                }
                if (popupData.notices.Count == 0)
                {
                    LoadDefaultNoticeList();
                    Puts("Loading Default Notice List");
                }

                Puts("Loaded {0} Rules", popupData.rules.Count);
                Puts("Loaded {0} Commands", popupData.commands.Count);
                Puts("Loaded {0} Notices", popupData.notices.Count);
            }
            catch
            {
                Puts("Failed to load PopUpData");
                popupData = new PopUpData();
            }
        }
Пример #3
0
    void OnGroupEvaluated(Operation op, int answer, bool isCorrect)
    {
        var dat = new PopUpData {
            op1 = op.operand1, op2 = op.operand2, op = op.op, answer = answer
        };

        if (isCorrect)
        {
            mCorrectPopUpQueue.Enqueue(dat);

            if (mCorrectPopUpRout == null)
            {
                mCorrectPopUpRout = StartCoroutine(DoCorrectPopUp());
            }
        }
        else
        {
            if (incorrectEqPopText)
            {
                incorrectEqPopText.text = dat.GetString(false);
            }

            if (mIncorrectPopUpRout != null)
            {
                StopCoroutine(mIncorrectPopUpRout);
            }

            mIncorrectPopUpRout = StartCoroutine(DoIncorrectPopUp());
        }
    }
Пример #4
0
        /// <summary>
        /// Finally Create PopUp
        /// </summary>
        /// <returns></returns>
        public IAminDialogPopUpContent create()
        {
            // set UI text Title
            title.text       = _popUpData.title;
            bodyMessage.text = _popUpData.bodyMessage;

            // cleaning button and recources from Containers
            foreach (Transform btn in buttonContainer.transform)
            {
                Destroy(btn.gameObject);
            }

            foreach (Transform res in resourceContainer.transform)
            {
                Destroy(res.gameObject);
            }

            // setting Icon PopUp
            iconPopUp.sprite = _popUpData.icon;
            bodyMessage.text = _popUpData.bodyMessage;

            //creating button
            _popUpData.buttons.ForEach(createButton);

            //creating resources
            _popUpData.resources.ForEach(createValue);

            // New PopUpData
            _popUpData = new PopUpData();

            // active PopUp
            popUpPrefab.SetActive(true);

            return(this);
        }
Пример #5
0
 public PopUpData(PopUpData data)
 {
     title            = data.title;
     content          = data.content;
     image            = data.image;
     localizedTitle   = data.localizedTitle;
     localizedContent = data.localizedContent;
     localizedImage   = data.localizedImage;
 }
Пример #6
0
    private void ShowTutorialInfo(TutorialTrigger t)
    {
        if (t == null)
        {
            return;
        }

        if (lastTutorialTrigger != null)
        {
            if (lastTutorialTrigger.destroyOnShowed)
            {
                Destroy(lastTutorialTrigger);
            }
            lastTutorialTrigger = null;
        }

        PopUpData info = t.info;

        if (t.highlightObject)
        {
            popUpManager.Show(info, t.GetRect());
        }
        else
        {
            popUpManager.Show(info);
        }
        if (TemaryManager.Instance != null)
        {
            TemaryManager.Instance.AddTemary(t.info);
        }

        if (t.OnShowed != null)
        {
            t.OnShowed.Invoke();
        }

        if (!triggered.Contains(t.GetHash()))
        {
            triggered.Add(t.GetHash());
        }

        if (!saved.Contains(t.GetHash()))
        {
            savePending.Add(t);
        }

        if (t.isSaveCheckpoint)
        {
            SavePendingTriggers();
        }

        lastTutorialTrigger = t;

        /*if (t.destroyOnShowed)
         *  Destroy(t);*/
    }
Пример #7
0
    public void Show(PopUpData data)
    {
        imageMaterial.SetVector("_PositionSize", Vector4.zero);
        mainContent.SetActive(true);
        popupPanel.Show(data);
        popupPanel.CenterPosition();

        TraceShow(data);
        popupPanel.AddListener(() => { TraceHide(data); Hide(); });
    }
Пример #8
0
    public void AddTemary(PopUpData data)
    {
        string hash = Hash.ToHash(data.title + data.content, "TutorialTrigger");

        if (shownTutorials.Contains(hash))
        {
            return;
        }

        shownTutorials.Add(hash);
        Configure();
    }
Пример #9
0
    private bool IsWaitNoPopUp(object data)
    {
        bool isWaitNoPopUp = false;

        if (data != null && data.GetType() == typeof(PopUpData))
        {
            PopUpData popUpData = (PopUpData)data;

            if (popUpData != null)
            {
                isWaitNoPopUp = popUpData.IsWaitNoPopUp;
            }
        }

        return(isWaitNoPopUp);
    }
Пример #10
0
    private bool IsAddingData(object data)
    {
        bool isAddingData = false;

        if (data != null && data.GetType() == typeof(PopUpData))
        {
            PopUpData popUpData = (PopUpData)data;

            if (popUpData != null)
            {
                isAddingData = popUpData.IsAddData;
            }
        }

        return(isAddingData);
    }
Пример #11
0
    private void ProcessNext()
    {
        if (!QuickPopUpAllowed && alreadyActive)
        {
            PositionLerper.StartReverseLerp();
            AlphaLerper.StartLerping();
            alreadyActive    = false;
            alphaLerpRunning = false;
            return;
        }

        if (!QuickPopUpAllowed)
        {
            return;
        }

        if (alphaLerpRunning)
        {
            PopUpData data = PopUpsToShow.Dequeue();
            Image.sprite = data.Icon;
            Text.text    = data.Text;
        }

        if (PopUpsToShow.Count == 0)
        {
            PositionLerper.StartReverseLerp();
            AlphaLerper.StartLerping();
            alreadyActive    = false;
            alphaLerpRunning = false;
            return;
        }

        alphaLerpRunning = true;
        AlphaLerper.StartLerping(() => {
            alphaLerpRunning = false;
            PopUpData data   = PopUpsToShow.Dequeue();
            Image.sprite     = data.Icon;
            Text.text        = data.Text;

            AlphaLerper.StartReverseLerp();
        });
    }
Пример #12
0
    public void Show(PopUpData data, Rect rect)
    {
        TraceShow(data);
        float   xPadding = highlightPadding * Screen.width / bodyRect.rect.width;
        float   yPadding = highlightPadding * Screen.height / bodyRect.rect.height;
        Vector2 position = new Vector2(rect.x + rect.width / 2.0f, rect.y + rect.height / 2.0f);
        Vector2 offset   = new Vector2(rect.width / 2.0f + xPadding, rect.height / 2.0f + yPadding);

        imageMaterial.SetVector("_PositionSize", new Vector4(rect.x, rect.y, rect.width, rect.height));

        mainContent.SetActive(true);
        popupPanel.Show(data);
        popupPanel.SetTargetPositionAndOffset(position, offset);

        if (data.next != null)
        {
            popupPanel.AddListener(() => { TraceHide(data); Show(data.next, rect); });
        }
        else
        {
            popupPanel.AddListener(() => { TraceHide(data); Hide(); });
        }
    }
Пример #13
0
    // Warning: this method empties button listeners
    public void Show(PopUpData data)
    {
        data.localizedTitle.RefreshString();
        data.localizedContent.RefreshString();

        // Set texts
        titleContent.SetActive(!string.IsNullOrEmpty(data.localizedTitle.GetLocalizedString().ToString()));
        titleText.gameObject.SetActive(!string.IsNullOrEmpty(data.localizedTitle.GetLocalizedString().ToString()));

        titleText.StringReference = data.localizedTitle;
        titleText.RefreshString();

        contentContent.SetActive(!string.IsNullOrEmpty(data.localizedContent.GetLocalizedString().ToString()));
        contentText.gameObject.SetActive(!string.IsNullOrEmpty(data.localizedContent.GetLocalizedString().ToString()));
        contentText.StringReference = data.localizedContent;
        contentText.RefreshString();

        // Set action
        nextButton.onClick.RemoveAllListeners();
        if (data.next == null)
        {
            buttonText.text = "Cerrar";
            //nextButton.onClick.AddListener(Hide); // Controlled from manager
        }
        else
        {
            buttonText.text = "Siguiente";
            //nextButton.onClick.AddListener(() => Show(data.next)); // Controlled from manager
        }

        // Update size dynamically
        UpdateCapLimit();

        // Activate panel
        gameObject.SetActive(true);
    }
Пример #14
0
    private void ShowCategory(TutorialType type)
    {
        if (!shownTemary.ContainsKey(type))
        {
            return;
        }

        // Deactivate tutorial category list
        if (backButton != null)
        {
            categoryList.gameObject.SetActive(false);
        }

        // Delete previous content
        foreach (Transform child in contentRect)
        {
            Destroy(child.gameObject);
        }

        // Show all tutorials
        List <PopUpData> tutorials = shownTemary[type];
        PopUpData        lastData  = null;

        foreach (PopUpData data in tutorials)
        {
            if (lastData == null || data.localizedTitle.ToString() != lastData.localizedTitle.ToString())
            {
                AddTitle(data.localizedTitle);
            }
            if (!data.localizedImage.IsEmpty)
            {
                AddImage(data.localizedImage);
            }
            AddParagraph(data.localizedContent);
            lastData = data;
        }

        contentRect.gameObject.SetActive(true);

        if (backButton != null)
        {
            backButton.gameObject.SetActive(true);
        }

        if (bodyContent != null)
        {
            bodyContent.SetActive(true);
        }

        //categoryTitle.text = TypeToString(type);
        localizedCategoryTitle.StringReference = TypeToString(type);
        localizedCategoryTitle.RefreshString();
        currentType = type;

        if (!initialized)
        {
            return;
        }

        TraceScreenAccesed();
    }
 public void ShowPopUp(PopUpData popData)
 {
     openUIInRoot <Page_popUp>(eUIType.TopUI);
     refreshUI <Page_popUp>(popData);
 }
        public void ShowPopUp(string text, PopUpData.ePopUpType Type = PopUpData.ePopUpType.TypeOK, OnVoidCallBack OKButtonClick = null, OnVoidCallBack CancelButtonClick = null)
        {
            PopUpData data = new PopUpData(text, Type, OKButtonClick, CancelButtonClick);

            ShowPopUp(data);
        }