Exemple #1
0
    public void UpdateScroll()
    {
        Debug.Log("Updating...");
        // Mess.............
        string txt = "";

        if (PersistentData.Instance.TownsUnlocked < 5)
        {
            txt += "Travel to a new town\n" +
                   "<color=#D2009D>" + Mathf.Clamp(Inventory.Instance.goldCount, 0, Travel.NextPurchaseCost()) + "</color>" +
                   "/" + "<color=#D2009D>" + Travel.NextPurchaseCost() + "</color> gold\n\n";
        }

        if (PersistentData.Instance.TrueGolemsCrafted == 0)
        {
            txt += "Create <color=#" + ColorUtility.ToHtmlStringRGB(Quality.GradeToColor(Quality.QualityGrade.Mystic)) +
                   ">Mystic</color> Components\n" + "+\n" +
                   "Create more Golems";
        }
        else if (PersistentData.Instance.TrueGolemsCrafted < 4)
        {
            txt += "Create remaining " + (4 - PersistentData.Instance.TrueGolemsCrafted) + "True Golems";
        }

        TODOText.text = txt;
    }
Exemple #2
0
    private void GameOver()
    {
        Countdown.onComplete -= GameOver;
        start = false;
        grade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints());
        PointsManager.onFinishLeveling += () => {
            GemSpawnManager.UpgradeGem(grade);

            PointsManager.gameObject.SetActive(false);
            GradeText.text  = Quality.GradeToString(grade);
            GradeText.color = Quality.GradeToColor(grade);
            GradeText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(grade), 1f, 1f, 0f, false, 0f);
        };


        PointsManager.DoEndGameTransition();

        foreach (NewCutPoint cut in activeCuts)
        {
            Destroy(cut.gameObject);
        }

        ShowUIButtons();
    }
Exemple #3
0
    private void GameOver()
    {
        Countdown.onComplete -= GameOver;

        var tmpGrade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints());

        PointsManager.onFinishLeveling += () =>
        {
            brickSpawnmanager.Upgrade(tmpGrade);
            PointsManager.gameObject.SetActive(false);
            qualityText.text  = Quality.GradeToString(tmpGrade);
            qualityText.color = Quality.GradeToColor(tmpGrade);
            qualityText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(tmpGrade), 1f, 1f, 0f, false, 0f);
        };

        feedbackParticleSystem.GetComponent <ParticleSystem>().Stop();

        PointsManager.DoEndGameTransition();
        FollowSphere.SetActive(false);
        _currentRuneSprite.SetActive(false);
        ResetOptimalPoints();

        grade = Quality.CalculateCombinedQuality(GameManager.Instance.QualityTransfer, tmpGrade);
        ShowUIButtons();
        _dataBase.HideUI();
        _canTrace = false;
    }
Exemple #4
0
    private void GameOver()
    {
        StopCoroutine(CalculateSwipes(false));
        Countdown.onComplete -= GameOver;
        //if (gameOver) {
        //CalculateGrade();
        gameOver = true;

        var tmpGrade = Quality.CalculateGradeFromPoints(pointsManager.GetPoints());

        pointsManager.onFinishLeveling += () =>
        {
            GemSpawnManager.UpgradeGem(tmpGrade);
            pointsManager.gameObject.SetActive(false);
            qualityText.text  = Quality.GradeToString(tmpGrade);
            qualityText.color = Quality.GradeToColor(tmpGrade);
            qualityText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(tmpGrade), 1f, 1f, 0f, false, 0f);
        };

        pointsManager.DoEndGameTransition();

        // Combine grade at the end for when we return to shop.
        grade = Quality.CalculateCombinedQuality(GameManager.Instance.QualityTransfer, tmpGrade);

        ShowUIButtons();
    }
Exemple #5
0
 public void QualityText()
 {
     next.enabled        = true;
     retry.enabled       = true;
     qualityText.enabled = true;
     qualityText.text    = "Quality: " + Quality.GradeToString(tracer.GetComponent <Tracing>().grade);
     qualityText.color   = Quality.GradeToColor(tracer.GetComponent <Tracing>().grade);
 }
Exemple #6
0
    // Return a string to be used in the UI.
    // TODO: need a way to get item color.
    public string ItemInfo()
    {
        Color  col       = Quality.GradeToColor(Quality.QualityGrade.Passable);
        string colString = "<color=#" + ColorUtility.ToHtmlStringRGBA(col) + ">";
        string terminate = "</color>";

        return(string.Format("Quality: {0}{1}{2}" + System.Environment.NewLine +
                             "Type: {3}{4}{5}", colString, Quality.QualityGrade.Passable, terminate, colString, type, terminate));
    }
    public string GetItemInfo()
    {
        string grade    = Quality.GradeToString(quality);
        string gradeCol = "#" + ColorUtility.ToHtmlStringRGB(Quality.GradeToColor(quality));
        string str      = string.Format("Quality: <color={0}>{1}</color>\n" +
                                        "Quantity: <color=white>{2}</color>\n" +
                                        (isNew ? "<color=#ffc605fc>NEW</color>\n" : ""), gradeCol, grade, quantity);

        return(str);
    }
Exemple #8
0
 private void Reset()
 {
     currentGrade           = StartingGrade;
     TextCurrentLevel.text  = Quality.GradeToString(currentGrade);
     TextCurrentLevel.color = Quality.GradeToColor(currentGrade);
     foregroundImage.color  = Quality.GradeToColor(currentGrade);
     fillAmount             = 0;
     foregroundTransform.DOComplete();
     UpdateFillAmount();
 }
Exemple #9
0
    private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj)
    {
        golemText.enabled       = true;
        golemBottomText.enabled = true;
        golemText.text          = string.Format("New {0} {1} Golem!", grade, gemType);
        golemText.color         = Quality.GradeToColor(grade);
        golemBottomText.color   = Quality.GradeToColor(grade);
        yield return(new WaitForSeconds(3f));

        golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj));
        //Need to show golem schematic
        TutorialProgressChecker.Instance.UpdateItemStatus("Golem", TutorialProgressChecker.ImageStatus.JustAchieved);
        TutorialProgressChecker.Instance.ShowCanvas(true);
    }
    private void Start()
    {
        //BackgroundImage = Background.GetComponent<Image>();
        BackgroundTransform = Background.GetComponent <RectTransform>();
        foregroundImage     = Foreground.GetComponent <Image>();
        foregroundTransform = Foreground.GetComponent <RectTransform>();

        // Get quality grades for shop level 3.
        grades = new LinkedList <Quality.QualityGrade>(Quality.GetPossibleGrades(3));
        // Pop the current grade.
        //currentGrade = grades.First.Value;
        currentGrade = StartingGrade;
        //grades.RemoveFirst();

        // Initialize with details.
        TextCurrentLevel.text  = Quality.GradeToString(currentGrade);
        TextCurrentLevel.color = Quality.GradeToColor(currentGrade);
        foregroundImage.color  = Quality.GradeToColor(currentGrade);

        fillAmount = StartFill;

        // POSITIONING FOREGROUND BAR.
        // Foreground bar min/max derived from the background.
        // These are inverted from what you would expect because of Unity anchors.
        // barMaxWidth = 0.0 -> barMinWidth = 1.0;
        barHeight   = BackgroundTransform.rect.height - Padding * 2f;
        barMaxWidth = Padding * 2f;
        barMinWidth = BackgroundTransform.rect.width + Padding * 2f;

        // Position the middle of the bar correctly in almost all circumstances.
        Vector3 pos = foregroundTransform.anchoredPosition;

        //pos.x = -Padding;
        pos.x = Padding;
        foregroundTransform.anchoredPosition = pos;

        // Fill initial correctly.
        //foregroundTransform.sizeDelta = new Vector2(-barMaxWidth, barHeight);
        float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount);

        foregroundTransform.sizeDelta = new Vector2(fill, barHeight);

        // Subscribe to countdown tick.
        Countdown.onTick += SubtractFixed;
    }
Exemple #11
0
    private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj)
    {
        golemText.enabled       = true;
        golemBottomText.enabled = true;
        golemText.text          = string.Format("New {0} {1} Golem!", grade, gemType);
        golemText.color         = Quality.GradeToColor(grade);
        golemBottomText.color   = Quality.GradeToColor(grade);
        yield return(new WaitForSeconds(3f));

        if (golemObj != null)
        {
            golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj));
        }
        else
        {
            RestartGolem(null);
        }
    }
Exemple #12
0
    private void GameOver()
    {
        Countdown.onComplete -= GameOver;
        start = false;
        grade = Quality.CalculateGradeFromPoints(pointsManager.GetPoints());
        feedbackParticleSystem.Stop();
        pointsManager.onFinishLeveling += () => {
            OreSpawnManager.Upgrade(grade);
            pointsManager.gameObject.SetActive(false);
            qualityText.text  = Quality.GradeToString(grade);
            qualityText.color = Quality.GradeToColor(grade);
            qualityText.gameObject.SetActive(true);
            SFX.Play(Quality.ReturnSFXName(grade), 1f, 1f, 0f, false, 0f);
        };

        pointsManager.DoEndGameTransition();

        ShowUIButtons();
    }
    // Moves to the next quality level in the queue.  If none is available, returns false.
    private bool MoveDownQualityLevel(float spare = 0f)
    {
        if (currentGrade == grades.Last.Value)
        {
            return(false);
        }

        // Update the current grade.
        var current = grades.Find(currentGrade);

        if (current == null || current.Next == null)
        {
            return(false);
        }

        currentGrade = current.Next.Value;

        TextCurrentLevel.text  = Quality.GradeToString(currentGrade);
        TextCurrentLevel.color = Quality.GradeToColor(currentGrade);
        foregroundImage.color  = Quality.GradeToColor(currentGrade);

        foregroundTransform.DOComplete();

        fillAmount = 1f;        // - spare;
        UpdateQualityBar(Ease, LevelChangeEaseTime);
        Subtract(spare);

        //float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount);
        //foregroundTransform.sizeDelta = new Vector2(fill, barHeight);


        //Original SFX
        //SFX.Play("quality_bar_deplete");

        //New SFX entered on 27/8/18 by Pierre
        SFX.Play("Mini_Game_Quality_loss", 1f, 1f, 0f, false, 0f);

        return(true);
    }
Exemple #14
0
    // Moves to the next quality level in the queue.  If none is available, returns false.
    private bool MoveUpQualityLevel(float spare = 0f)
    {
        if (grades.Count == 5)
        {
            return(false);
        }

        // Update the current grade.
        var current = grades.Find(currentGrade);

        //Debug.Log(subsequent.Value + " next grade");
        if (current == null || current.Previous == null)
        {
            return(false);
        }

        currentGrade = current.Previous.Value;
        //Debug.Log("current grade is " + currentGrade);

        TextCurrentLevel.text  = Quality.GradeToString(currentGrade);
        TextCurrentLevel.color = Quality.GradeToColor(currentGrade);
        foregroundImage.color  = Quality.GradeToColor(currentGrade);

        foregroundTransform.DOComplete();

        fillAmount = 0f;
        UpdateFillAmount();
        //UpdateQualityBar(Ease, LevelChangeEaseTime);
        //Add(spare);

        //float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount);
        //foregroundTransform.sizeDelta = new Vector2(fill, barHeight);

        // SFX.Play("??");
        //New SFX placed by Pierre 27/8/18
        SFX.Play("Mini_Game_Quality_gain", 1f, 1f, 0f, false, 0f);

        return(true);
    }
    // Use this for initialization
    void Start()
    {
        this.prevXPos      = this.background.transform.position.x;
        this.backgroundMat = background.GetComponent <MeshRenderer>().material;
        this.offset        = new Vector2(0, 0);

        /*
         * if (GameManager.Instance.SpriteTransfer) {
         * this.wizardSprite.sprite = GameManager.Instance.SpriteTransfer;
         * } else {
         * Debug.Log("Couldn't find a sprite, will use default.");
         * }
         */

        this.basePrice = (shonkyInstance.item as Shonky).basePrice;
        string grade    = Quality.GradeToString(shonkyInstance.Quality);
        string gradeCol = "#" + ColorUtility.ToHtmlStringRGB(Quality.GradeToColor(shonkyInstance.Quality));
        string str      = string.Format("Base Price: <color=white>{0}</color>\n" +
                                        "Quality: <color={1}>{2}</color>\n", basePrice, gradeCol, grade);

        infoText.text = str;

        //Instantiate(shonkyPrefab, Vector3.zero, Quaternion.identity).transform.SetParent(backingPlate.transform);
    }