Example #1
0
    void OnResourcesChanged(EventData e)
    {
        if (e.Data.ContainsKey("newbest"))
        {
            BestText.text = Localer.GetText("BestScore") + GameManager.Instance.Player.BestScore.ToString();
            return;
        }
        long amount  = GameManager.Instance.Game.GetTotalPoints();
        bool isforce = (bool)e.Data["isforce"];

        if (isforce)
        {
            SetAmountForce(amount);
        }
        else
        {
            SetAmount(amount);
        }
        //
        //if (GameManager.Instance.Player.BestScore < amount)
        //{
        //	GameManager.Instance.Player.BestScore = amount;
        //	BestText.text = Localer.GetText("BestScore") + amount.ToString();
        //}
    }
Example #2
0
 public void InitPopup(ETrophyType trophyType)
 {
     _trophyType           = trophyType;
     RewardAmountText.text = "$" + GameManager.Instance.GameData.XMLtrophiesData[trophyType].Reward.ToString();
     DescriptionText.text  = Localer.GetText(_trophyType.ToString());
     ShowPopup();
 }
Example #3
0
 public void InitTip(TutorialData data)
 {
     _data = data;
     transform.localScale = new Vector3(1, 1, 1);
     TipBody   = transform.Find("TipBody").gameObject;
     Cross     = TipBody.transform.Find("Cross").gameObject;
     Arrow     = transform.Find("Arrow").gameObject;
     Text      = TipBody.transform.Find("Text").GetComponent <Text>();
     Text.text = Localer.GetText("Tutorial_") + data.Id;
     if (!data.IsArrow)
     {
         Arrow.SetActive(false);
     }
     if (data.Type == "ui")
     {
         SetUITutorialPos(new Vector3(data.X, data.Y, 0));
     }
     else
     {
         //SetTutorialPos(SceneToUiPosition(new Vector3(data.X, data.Y, 0)));
         UpdateScrollPosition();
     }
     //transform.GetComponent<CanvasGroup>().blocksRaycasts = false;
     //transform.GetComponent<CanvasGroup>().interactable = false;
     HideTipForce();
 }
Example #4
0
 public void SetResultData()
 {
     _titleText.text            = Localer.GetText("Statistic");
     _singleLevelCountText.text = Localer.GetText("SingleCount") + ": " + GameManager.Instance.data.SingleLevelGameCount.ToString();
     _duoLevelCountText.text    = Localer.GetText("DuoCount") + ": " + GameManager.Instance.data.CooperativeLevelGameCount.ToString();
     _bestTimeText.text         = Localer.GetText("BestTime") + ": " + GameManager.Instance.data.SurvivalLevelTimeInString;
     _bestScoreText.text        = Localer.GetText("BestScore") + ": " + GameManager.Instance.data.ScoreLevelResult.ToString();
 }
Example #5
0
 public void ChangeText()
 {
     _settingTitleText.text  = Localer.GetText("Setting");
     _languageTitleText.text = Localer.GetText("Language");
     _volumeTitleText.text   = Localer.GetText("Volume");
     _soundTitleText.text    = Localer.GetText("Sound");
     _musicTitleText.text    = Localer.GetText("Music");
 }
Example #6
0
 public void RoundCountChange(int roundCounter)
 {
     _text.transform.localScale = new Vector3(0.2f, 0.2f, 1f);
     _text.text = Localer.GetText("Round") + " " + (++roundCounter).ToString();
     LeanTween.value(gameObject, 0.2f, 1f, 0.7f).setOnUpdate((float val) => {
         _tempScale = new Vector3(val, val, 1f);
         _text.transform.localScale = _tempScale;
     });
 }
    public void UpdateInfoPanel(List <CommandsManager.CommandType> commands, int variation)
    {
        string str = "";

        foreach (var item in commands)
        {
            str += Localer.GetText("CMD." + item.ToString() + "_" + variation) + "\n";
        }
        ShowText(str);
    }
Example #8
0
    //private ZActionWorker _worker;


    void Awake()
    {
        AmountCurrent   = 0;
        Amount          = 0;
        AmountText.text = "0";
        BestText.text   = Localer.GetText("BestScore") + GameManager.Instance.Player.BestScore.ToString();
        //EventManager.OnResourcesChangedEvent += OnResourcesChanged;
        //EventManager.OnShowAddResourceEffect += OnShowAddResourceEffect;
        ////_worker = new ZActionWorker();
    }
Example #9
0
    void Start()
    {
        string atext = Localer.GetText(TextId);

                #if UNITY_STANDALONE
        atext = atext.Replace("{ct}", Localer.GetText("click"));
                #else
        atext = atext.Replace("{ct}", Localer.GetText("tap"));
                #endif
        transform.GetComponent <Text>().text = atext;
    }
Example #10
0
    // Use this for initialization
    void Start()
    {
        Text text = GetComponent <Text>();

        if (text != null)
        {
            text.text = Localer.GetText(TextID);
        }
        else
        {
            Debug.LogError("Can't set localized text: Text component not found in " + gameObject.name);
        }
    }
Example #11
0
 void RefreshText()
 {
     if (textComponent != null)
     {
         textComponent.text = Localer.GetText(TextID);
     }
     else if (textMeshComponent != null)
     {
         textMeshComponent.text = Localer.GetText(TextID);
     }
     else
     {
         Debug.LogError("Can't set localized text: Text or TextMeshPro component not found in " + gameObject.name);
     }
 }
Example #12
0
    public void UpdateTrophy(ETrophyType id)
    {
        Id          = id;
        Group.alpha = 1;
        TrophyData         trophyData   = GameManager.Instance.GameData.XMLtrophiesData[id];
        TrophyCompleteData completeData = GameManager.Instance.Player.TrophiesItems[id];

        // progress
        if (trophyData.Param <= 1 || trophyData.IsSingle)
        {
            ProgressText.gameObject.SetActive(false);
        }
        else
        {
            ProgressText.gameObject.SetActive(true);
            //if (Id == ETrophyType.PlayMoreThan5hoursCumulative)
            //{
            //	int hours = completeData.Param / (60 * 60);
            //	ProgressText.text = hours.ToString() + "/5";
            //} else
            {
                ProgressText.text = completeData.Param.ToString() + "/" + trophyData.Param.ToString();
            }
        }
        // money
        MoneyText.text = trophyData.Reward.ToString();
        // description text
        DescriptionText.text = Localer.GetText(id.ToString());
        // trophy icon
        if (completeData.Completed)
        {
            CompleteObj.SetActive(true);
            Filler.gameObject.SetActive(false);
        }
        else
        {
            CompleteObj.SetActive(false);
            if (completeData.Param <= 0)
            {
                Filler.gameObject.SetActive(false);
            }
            else
            {
                Filler.gameObject.SetActive(true);
                Filler.fillAmount = (float)completeData.Param / (float)trophyData.Param;
            }
        }
    }
Example #13
0
 public void Show(bool isSingle = false, bool IsScore = false)
 {
     if (!isSingle)
     {
         if (_border.MyRectTransform.anchoredPosition.x < 0)
         {
             _firstPlayerText.text  = Localer.GetText("Looser");
             _secondPlayerText.text = Localer.GetText("Winer");
             _firstPlayerPanel.SetActive(false);
             _secondPlayerPanel.SetActive(true);
         }
         else
         {
             _firstPlayerText.text  = Localer.GetText("Winer");
             _secondPlayerText.text = Localer.GetText("Looser");
             _firstPlayerPanel.SetActive(true);
             _secondPlayerPanel.SetActive(false);
         }
     }
     else if (isSingle)
     {
         if (!IsScore)
         {
             _firstPlayerText.text = Localer.GetText("SurvivalTime") + ": " + Timer.CurrentTime;
             _firstPlayerPanel.SetActive(true);
         }
         else
         {
             _firstPlayerText.text = Localer.GetText("Score") + ": " + ScoreDisplayer.Score;
             _firstPlayerPanel.SetActive(true);
         }
     }
     LeanTween.value(gameObject, _canvasGroup.alpha, 1f, 0.3f).setOnUpdate((float val) =>
     {
         _canvasGroup.alpha = val;
     }).setOnComplete(() =>
     {
         EnableCanvasInteraction(true);
     });
 }
Example #14
0
    private IEnumerator OnSequenceCompleted(List <SequencePipe> orderedPipes, ESequenceType sResult)
    {
        // count points, remove pipes from sequence
        long points     = 0;
        int  multiplyer = (int)sResult;

        for (int i = 1; i <= SIZE; ++i)
        {
            points      += _sequence[i].Param * multiplyer;
            _sequence[i] = null;
        }
        // fly pipes to center and explode
        for (int i = 0; i < orderedPipes.Count; ++i)
        {
            orderedPipes[i].OnSequenceAnimation(SIZE - 1 - i);
        }
        yield return(new WaitForSeconds(Consts.PIPES_ON_SEQUENCE_ANIMATION_TIME));

        // shake screen
        GameManager.Instance.Game.ShakeCamera(Consts.SHAKE_POWER_ON_SEQUENCE, Consts.SHAKE_POWER_ON_SEQUENCE, Consts.SHAKE_TIME_ON_SEQUENCE);
        // show popup with points
        GameObject popupObj = (GameObject)GameObject.Instantiate(SequenceCompletePopupPrefab, Vector3.zero, Quaternion.identity);

        popupObj.transform.SetParent(transform, false);
        popupObj.transform.localPosition = new Vector3(0, 52, 0);
        popupObj.GetComponent <Canvas>().overrideSorting = true;
        Transform textsContainer = popupObj.transform.Find("Container");
        Text      typeText       = textsContainer.Find("Text0").GetComponent <Text>();

        typeText.text = Localer.GetText(sResult.ToString());
        Text pointsText = textsContainer.Find("Text1").GetComponent <Text>();

        pointsText.text = Localer.GetText(points.ToString());
        GameObject.Destroy(popupObj, 5.0f);
        // add points
        GameManager.Instance.Game.AddPointsForSequence(points);
        //
        yield return(null);
    }
Example #15
0
    public override bool OpenForm(EventData e)
    {
        //_currentScene = (string)e.Data["scene"];
        TryRescale();
        _canScroll = true;
        // update visible trophies
        for (int i = 1; i <= HEIGHT; ++i)
        {
            Items[i].UpdateTrophy(Items[i].Id);
        }
        // update caption
        int completed = 0;

        foreach (var td in GameManager.Instance.Player.TrophiesItems)
        {
            if (td.Value.Completed)
            {
                ++completed;
            }
        }
        CaptionText.text = Localer.GetText("Trophies") + " " + completed.ToString() + "/" + GameManager.Instance.Player.TrophiesItems.Count.ToString();
        //
        return(true);
    }
Example #16
0
 public void SetTextId(string atext)
 {
     TextId = atext;
     CheckPopup();
     _popupScript.SetText(Localer.GetText(TextId));
 }
Example #17
0
 public void SetText()
 {
     AText.text = Localer.GetText("Level") + " " + (GameManager.Instance.Player.CurrentLevel + 1).ToString();
 }
Example #18
0
 private void OnRoundWinned(int score)
 {
     Score      = score;
     _text.text = Localer.GetText("Score") + ": " + score.ToString();
 }
Example #19
0
    public override bool OpenForm(EventData e)
    {
        //TryRescale();
        HideButtons();
        float canvasTime = 0.5f;

        ACanvasGroup.alpha = 0;
        LeanTween.value(ACanvasGroup.gameObject, 0.0f, 1.0f, canvasTime)
        .setOnUpdate((float val) => {
            ACanvasGroup.alpha = val;
        });

        float atime = 0.3f;

        LevelText.text = Localer.GetText("Level") + " " + (GameManager.Instance.Player.CurrentLevel + 1).ToString();
        int starsAmount = (int)GameManager.Instance.BoardData.StarsGained;
        int moves       = GameManager.Instance.BoardData._allTurns;

        for (int i = 0; i < Stars.Count; ++i)
        {
            if (i < starsAmount)
            {
                Stars[i].SetActive(true);
                Image img = Stars[i].GetComponent <Image>();
                img.color = new Color(1, 1, 1, 0);
                int starNumber = i;
                LeanTween.delayedCall(canvasTime + i * atime, () => { PlayStarSound(starNumber); });
                LeanTween.value(img.gameObject, img.color, Color.white, atime)
                .setOnUpdate((Color val) => {
                    img.color = val;
                })
                .setDelay(canvasTime + i * atime);
            }
            else
            {
                Stars[i].SetActive(false);
            }
        }

        LeanTween.delayedCall(canvasTime + starsAmount * atime, ShowButtons);

        //Invoke("ShowButtons", canvasTime + starsAmount * atime);

        int        currentLevel      = GameManager.Instance.Player.CurrentLevel;
        LevelState levelState        = GameManager.Instance.Player.LevelsStates[currentLevel];
        int        prevBest          = levelState.BestMoves;
        bool       firstTimeComplete = prevBest < 0;

        if (firstTimeComplete)
        {
            levelState.BestMoves = moves;
        }
        else
        {
            levelState.BestMoves = Mathf.Min(moves, levelState.BestMoves);
        }
        levelState.Stars = starsAmount;
        //
        GameManager.Instance.Player.LevelsStates[currentLevel] = levelState;

        if (currentLevel == Consts.LEVELS_COUNT - 1)
        {
            // it was last level
            if (firstTimeComplete)
            {
                //TODO Message that you completed all levels!!!!
            }
        }
        else
        {
            // unlock next level
            int        nextLevel      = currentLevel + 1;
            LevelState nextLevelState = GameManager.Instance.Player.LevelsStates[nextLevel];
            nextLevelState.Unlocked = true;
            GameManager.Instance.Player.LevelsStates[nextLevel] = nextLevelState;
            GameManager.Instance.Settings.Save();
        }
        ZAnalitycs.FinishLevelEvent(currentLevel);
        return(true);
    }
 private void Start()
 {
     _titleText.text = Localer.GetText("SelectType");
 }
Example #21
0
 void ReInit()
 {
     ButtonGroup.transform.Find("Text").GetComponent <Text>().text = Localer.GetText("MoreInfo");
 }
Example #22
0
 private void Awake()
 {
     _text      = GetComponent <TMP_Text>();
     _text.text = Localer.GetText("Score") + ": " + "0";
 }