Inheritance: MonoBehaviour
    // Use this for initialization
    void Start()
    {
        tk2dTextMesh text = GetComponent <tk2dTextMesh>();

        text.text = Game.game.currentQuest.title;
        text.Commit();
    }
    void Awake()
    {
        textMesh = GetComponent<tk2dTextMesh>();

        // now tokenize the code
        string[] cWords = Regex.Split(codeToType, @"(?<=[\s+])");
        string whitespaceBuffer = "";
        for (int i = 0; i < cWords.Length; i++)
        {
            if (cWords[i] == " " || cWords[i] == "\t")
                whitespaceBuffer += cWords[i];
            else
            {
                if (whitespaceBuffer.Length > 0)
                {
                    codeWords.Add(whitespaceBuffer + cWords[i]);
                    whitespaceBuffer = "";
                }
                else
                {
                    codeWords.Add(cWords[i]);
                }
            }
        }
        if (whitespaceBuffer.Length > 0)
            codeWords.Add(whitespaceBuffer);
        //codeWords = new List<string>(cWords);
    }
    public void start(string str, Color color, Transform pointer, float posX = 0.0f, float posY = 100.0f)
    {
        if (text == null)
        {
            text = gameObject.transform.Find("effect").GetComponent <tk2dTextMesh>();
        }

        text.maxChars = str.Length;
        text.text     = str;
        text.color    = color;
        _color        = color;

        text.Commit();

        _v = text.GetMeshDimensionsForString(str);

        _pos = pointer.transform.position;

        _pos.x -= _v.x * 0.5f;
        _pos.x += posX;

        tf.position = GameManager.me.inGameGUICamera.ScreenToWorldPoint(GameManager.me.gameCamera.WorldToScreenPoint(_pos));;

        init(pointer, posX - _v.x * 0.5f, posY, true);

        _isStart = true;
        animation.Play();

        if (PerformanceManager.isLowPc)
        {
            return;
        }

        StartCoroutine(onCompleteEffectCT());
    }
示例#4
0
 // Use this for initialization
 void Start()
 {
     stageText  = GameObject.Find("Stage").GetComponent <tk2dTextMesh>();
     numberText = GameObject.Find("Number").GetComponent <tk2dTextMesh>();
     clearText  = GameObject.Find("Clear").GetComponent <tk2dTextMesh>();
     scoreText  = GameObject.Find("ScoreText").GetComponent <tk2dTextMesh>();
 }
示例#5
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();

        jumpButtonSprite = this.transform.FindChild("Jump Button").GetComponent<tk2dSlicedSprite>();
        jumpText = this.transform.FindChild("Jump Text").GetComponent<tk2dTextMesh>();
    }
示例#6
0
    IEnumerator LoadScoreBoard()
    {
        yield return(StartCoroutine(objGameInfo.highScoreController.GetScores()));

        List <HighScore> scores = objGameInfo.highScoreController.scores;

        Debug.Log("GameOverController:LoadScoreBoard() - scores.Count = " + scores.Count);

        Vector3 pos = new Vector3(417.5394f, 381.1733f, -2.0f);

        foreach (HighScore score in scores)
        {
            GameObject objScore = (GameObject)Instantiate(objScoreBoardText,
                                                          pos,
                                                          Quaternion.identity);

            tk2dTextMesh txt = objScore.GetComponent <tk2dTextMesh>();

            if (txt != null)
            {
                txt.text = string.Format("{0} - {1} - {2}\n\r", score.Score, score.Name, score.TimeAlive);
                Debug.Log(txt.text);
                txt.Commit();
            }

            pos = new Vector3(pos.x, pos.y - 20.0f, pos.z);
        }
    }
        /// <summary>Tweens a 2D Toolkit TextMesh's color to the given value.
        /// Also stores the TextMesh as the tween's inTarget so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Color, Color, ColorOptions> DOColor(this tk2dTextMesh inTarget, Color endValue, float duration)
        {
            TweenerCore <Color, Color, ColorOptions> t = DOTween.To(() => inTarget.color, x => inTarget.color = x, endValue, duration);

            t.SetTarget(inTarget);
            return(t);
        }
    void UpdateLobbyUI(List <Lobby> list)
    {
        m_serverLobbyData = list;
        for (int i = 0; i < list.Count; i++)
        {
            Lobby lobby = list[i];
            //Debug.Log("I IS: "+i +  "    lobby is: "+lobby.SessionID);

            if (m_lobbyList[i] != null)
            {
                m_lobbyList[i].SetActive(true);

                tk2dTextMesh lobbyInfo = m_lobbyList[i].GetComponentInChildren <tk2dTextMesh>();
                string       info      = lobby.SessionID +
                                         "                                        " +
                                         lobby.NumofPlayers + "/4" +
                                         "                                      " +
                                         ((lobby.HasStarted) ? "Playing" : "Waiting");

                lobbyInfo.text = info;
            }
            else
            {
                Debug.LogError("Lobby list of index: " + i + " is NULL");
            }
        }
    }
示例#9
0
    void Update()
    {
        if (m_point.dead)
        {
            m_popText.SetActive(false);
        }
        else
        {
            // Check if the mouse is hovering
            Vector3 hoverPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            if (GetComponent <Collider2D>().OverlapPoint(hoverPos))
            {
                SetOpen(true);
            }
            else
            {
                SetOpen(false);
            }

            tk2dTextMesh mesh = m_popText.GetComponent <tk2dTextMesh>();
            mesh.GetComponent <Renderer>().enabled = true;
            if (IsOpen())
            {
                mesh.text = "Population: " + m_point.population;
            }
            else
            {
                mesh.text = "" + m_point.population;
            }
            mesh.Commit();
        }
    }
    // Use this for initialization
    void Start()
    {
        timer    = timeCountdown;
        textMesh = (tk2dTextMesh)GetComponent <tk2dTextMesh> ();

        ballController = (BallController)FindObjectOfType(typeof(BallController));
    }
示例#11
0
 void Awake()
 {
     if (mText == null)
     {
         mText = GetComponentInChildren <tk2dTextMesh>();
     }
 }
 private void Start()
 {
     if (this.textMesh == null)
     {
         this.textMesh = base.GetComponent<tk2dTextMesh>();
     }
 }
示例#13
0
        /// <summary>Tweens a 2D Toolkit TextMesh's alpha color to the given value.
        /// Also stores the TextMesh as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Color, Color, ColorOptions> DOFade(this tk2dTextMesh target, float endValue, float duration)
        {
            TweenerCore <Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);

            t.SetTarget(target);
            return(t);
        }
示例#14
0
    // For drawing temporary text on the screen
    public void addTempText(string text, Vector2 textGridPos, float duration)
    {
        GameObject textObj = GameObject.Instantiate(popupTextPrefab) as GameObject;

        textObj.transform.parent = transform;
        tk2dTextMesh  textToAdd = textObj.GetComponent <tk2dTextMesh>();
        TemporaryText tempText  = textObj.AddComponent <TemporaryText>();

        tempText.timeVisible = duration;
        float textX = textGridPos.x;

        if (textX < 2)
        {
            textX = 2;
        }
        if (textX > 13)
        {
            textX = 13;
        }
        float textY = textGridPos.y + 1;

        _popupText.anchor = TextAnchor.LowerCenter;
        if (textY > Globals.ROOM_HEIGHT - 2)
        {
            textY             = textGridPos.y;
            _popupText.anchor = TextAnchor.UpperCenter;
        }
        Vector2 actualPos = toActualCoordinates(new Vector2(textX, textY));

        textToAdd.transform.localPosition = new Vector3(actualPos.x, actualPos.y - Globals.CELL_SIZE / 2, textToAdd.transform.localPosition.z);
        textToAdd.text = text;
        textToAdd.Commit();
        textToAdd.gameObject.SetActive(true);
    }
示例#15
0
    void Awake()
    {
        textMesh = GetComponent <tk2dTextMesh>();

        // now tokenize the code
        string[] cWords           = Regex.Split(codeToType, @"(?<=[\s+])");
        string   whitespaceBuffer = "";

        for (int i = 0; i < cWords.Length; i++)
        {
            if (cWords[i] == " " || cWords[i] == "\t")
            {
                whitespaceBuffer += cWords[i];
            }
            else
            {
                if (whitespaceBuffer.Length > 0)
                {
                    codeWords.Add(whitespaceBuffer + cWords[i]);
                    whitespaceBuffer = "";
                }
                else
                {
                    codeWords.Add(cWords[i]);
                }
            }
        }
        if (whitespaceBuffer.Length > 0)
        {
            codeWords.Add(whitespaceBuffer);
        }
        //codeWords = new List<string>(cWords);
    }
    // Use this for initialization
    void Start()
    {
        timer = timeCountdown;
        textMesh = (tk2dTextMesh)GetComponent<tk2dTextMesh> ();

        ballController = (BallController)FindObjectOfType (typeof(BallController));
    }
示例#17
0
        public override void ShowBuffValue(GameObject pos_go = null)
        {
            if (m_BuffValue == 0)
            {
                return;
            }
            tk2dTextMesh hitText = null;
            Vector3      pos     = new Vector3(0.0f, 0.0f, -25.0f);

            if (pos_go != null)
            {
                pos.x = pos_go.transform.localPosition.x;
                pos.y = pos_go.transform.localPosition.y + 10f;
            }
            else
            {
                pos.x = m_BuffOwner.BattleCardObj.transform.localPosition.x;
                pos.y = m_BuffOwner.BattleCardObj.transform.localPosition.y + 10f;
            }
            if (m_BuffValue < 0)
            {
                hitText      = m_BuffOwner.CreateHitText(BattleUI.Instacne.redText, pos, Vector3.one);
                hitText.text = "" + m_BuffValue;
            }
            else if (m_BuffValue > 0)
            {
                hitText      = m_BuffOwner.CreateHitText(BattleUI.Instacne.greenText, pos, Vector3.one);
                hitText.text = "+" + m_BuffValue;
            }
            hitText.Commit();
            hitText.animation.Play();
        }
示例#18
0
    static void BakeRecursive(Transform node, Vector3 accumulatedScale)
    {
        accumulatedScale = new Vector3(accumulatedScale.x * node.localScale.x,
                                       accumulatedScale.y * node.localScale.y,
                                       accumulatedScale.z * node.localScale.z);

        tk2dBaseSprite sprite   = node.GetComponent <tk2dBaseSprite>();
        tk2dTextMesh   textMesh = node.GetComponent <tk2dTextMesh>();

        if (sprite)
        {
            Vector3 spriteAccumScale = new Vector3(accumulatedScale.x * sprite.scale.x,
                                                   accumulatedScale.y * sprite.scale.y,
                                                   accumulatedScale.z * sprite.scale.z);
            node.localScale = Vector3.one;
            sprite.scale    = spriteAccumScale;
        }
        if (textMesh)
        {
            Vector3 spriteAccumScale = new Vector3(accumulatedScale.x * textMesh.scale.x,
                                                   accumulatedScale.y * textMesh.scale.y,
                                                   accumulatedScale.z * textMesh.scale.z);
            node.localScale = Vector3.one;
            textMesh.scale  = spriteAccumScale;
            textMesh.Commit();
        }

        for (int i = 0; i < node.childCount; ++i)
        {
            BakeRecursive(node.GetChild(i), accumulatedScale);
        }
    }
示例#19
0
        private IEnumerator ShowLabel(tk2dTextMesh label, float forSeconds)
        {
            label.gameObject.SetActive(true);
            yield return(new WaitForSeconds(forSeconds));

            label.gameObject.SetActive(false);
        }
 public void setText(string text, tk2dTextMesh copyStyle)
 {
     tk2dTextMesh componentInChildren = base.GetComponentInChildren<tk2dTextMesh>();
     componentInChildren.inlineStyling = true;
     componentInChildren.text = text;
     componentInChildren.Commit();
 }
示例#21
0
    // Use this for initialization

    void OnEnable()
    {
        manager = FindObjectOfType(typeof(GameManager)) as GameManager;
        life    = maxLife;
        player  = GetComponent <tk2dAnimatedSprite>();
        player.animationEventDelegate = PlayerAnim;
        if (isPlayer)
        {
            lifeBar        = GameObject.Find("PlayerLifeFill").GetComponent <tk2dSlicedSprite>();
            actorName      = GameObject.Find("PlayerName").GetComponent <tk2dTextMesh>();
            actorName.text = characterName;
            actorName.Commit();
        }
        else if (isBoss)
        {
            playerPos       = GameObject.FindWithTag("Player").transform;
            carefulVelocity = velocity * 0.3f;
            GameObject.Find("BossLifeBar").renderer.enabled  = true;
            GameObject.Find("BossLifeFill").renderer.enabled = true;
            GameObject.Find("BossPortrait").renderer.enabled = true;
            GameObject.Find("BossName").renderer.enabled     = true;
        }
        else
        {
            playerPos       = GameObject.FindWithTag("Player").transform;
            carefulVelocity = velocity * 0.3f;
        }
        player.color = new Color(player.color.r, player.color.g, player.color.b, 1f);
        states       = PlayerStates.idle;
        player.Play("Idle");
        StartCoroutine("CharacterBehaviour");
    }
示例#22
0
        /// <summary>Tweens a 2D Toolkit TextMesh's dimensions to the given value.
        /// Also stores the TextMesh as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Vector3, Vector3, VectorOptions> DOScale(this tk2dTextMesh target, Vector3 endValue, float duration)
        {
            TweenerCore <Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.scale, x => target.scale = x, endValue, duration);

            t.SetTarget(target);
            return(t);
        }
示例#23
0
 public void UpdateText()
 {
     if (mText == null)
         mText = GetComponentInChildren<tk2dTextMesh>();
     mText.text = string.Format(ViewTextFormat,mCurrentNum.ToString());
     mText.Commit();
 }
示例#24
0
    public void start(int num)
    {
        tk2dTextMesh font = gameObject.GetComponent <tk2dTextMesh>();

        if (num > 0)
        {
            font.text  = "+" + num;
            font.color = Color.blue;
        }
        else
        {
            font.text  = "" + num;
            font.color = Color.red;
        }

        this.name = "plus" + font.text;

        font.Commit();

        Hashtable ht = new Hashtable();

        ht.Add("y", 60.0f);
        ht.Add("time", 1);
        ht.Add("looptype", iTween.LoopType.none);
        ht.Add("oncomplete", "onCompleteMotion");
        ht.Add("easetype", iTween.EaseType.easeOutQuad);

        iTween.MoveBy(gameObject, ht);
    }
    void Start()
    {
        tk2dTextMesh scoreTitle = (tk2dTextMesh)GameObject.Find(NameUtils.NAME_SCORE_TITLE).GetComponent <tk2dTextMesh>();

        scoreTitle.text = PlayerPrefs.GetInt(ScoreUtils.TOTAL_SCORE).ToString();
        scoreTitle.Commit();
        buttonsGO           = GameObject.FindGameObjectsWithTag(TagUtils.TAG_BUTTONS);
        buttonsPlayerNameGO = GameObject.FindGameObjectsWithTag(TagUtils.TAG_SCORE_LEADERBOARD);

        string startedLevel            = PlayerPrefs.GetString(ScoreUtils.LEVEL_USER_INIT);
        bool   canBeAddedToLeaderboard = ScoreUtils.canBeAddedToLeaderboard(startedLevel);

        leaderboard = ScoreUtils.getLeaderboard();
        score       = PlayerPrefs.GetInt(ScoreUtils.TOTAL_SCORE);
        position    = ScoreUtils.checkUserEnterLeaderboard(leaderboard, score);

        if (canBeAddedToLeaderboard && isOnLeaderboard(position))
        {
            foreach (GameObject buttonGO in buttonsGO)
            {
                buttonGO.SetActive(false);
            }
        }
        else
        {
            foreach (GameObject buttonGO in buttonsPlayerNameGO)
            {
                buttonGO.SetActive(false);
            }
        }
        SoundManager.GetInstance().changeAudio(sounds[IDX_SOUND_GAME_OVER]);
    }
示例#26
0
    // Update is called once per frame
    void Update()
    {
        tk2dTextMesh text = GetComponent <tk2dTextMesh>();

        text.color = textColor;
        text.Commit();
    }
示例#27
0
    public void InitGeneralCharacter(GameObject animalCharacter, long playerID, string playerName, int cellX, int cellY)
    {
        characterInstance = Instantiate(animalCharacter, transform.position, transform.rotation) as GameObject;
        var animationScript = characterInstance.GetComponent <CharacterAnimController>();

        animationScript.EnemyPlayer = !isSelf;

        float spawnX = ZooMap.GetHorizontalPos(cellX);
        float spawnY = ZooMap.GetVerticalPos(cellY);

        animationScript.SpawnCharacter(spawnX, spawnY);

        if (isSelf)
        {
            characterInstance.gameObject.tag = "Player";
        }

        characterInstance.gameObject.name = "" + playerID;

        // Instantiate name
        tk2dTextMesh nameScript = characterInstance.transform.Find("HUD_Name").GetComponent <tk2dTextMesh>();

        if (nameScript != null)
        {
            nameScript.text = playerName;
        }
    }
示例#28
0
 static void OnUndoRedo()
 {
     foreach (GameObject go in Selection.gameObjects)
     {
         tk2dSpriteFromTexture sft     = go.GetComponent <tk2dSpriteFromTexture>();
         tk2dBaseSprite        spr     = go.GetComponent <tk2dBaseSprite>();
         tk2dTextMesh          tm      = go.GetComponent <tk2dTextMesh>();
         tk2dTileMap           tilemap = go.GetComponent <tk2dTileMap>();
         if (sft != null)
         {
             sft.ForceBuild();
         }
         else if (spr != null)
         {
             spr.ForceBuild();
         }
         else if (tm != null)
         {
             tm.ForceBuild();
         }
         else if (tilemap != null)
         {
             tilemap.ForceBuild();
         }
     }
 }
示例#29
0
    void OnParticleCollision(GameObject collision)
    {
        //int checkStatus;
        int checkStatus;

        Transform laserGun = collision.transform.parent;

        LaserGun gunScript = laserGun.GetComponent <LaserGun>();

        checkStatus = gunScript.status;



        if ((collision.tag == "enemyLaser" || collision.name == "LaserFire1" || collision.name == "LaserFire") && checkStatus == 2)
        {
            tk2dTextMesh dT = damageNumber.GetComponent <tk2dTextMesh>();

            int damage = 1;
            dT.text = damage.ToString();

            takeDamage();

            GameObject.Instantiate(damageNumber, transform.position, Quaternion.identity);

            GameObject  cam = GameObject.Find("tk2dCamera");
            CameraShake cS  = (CameraShake)cam.GetComponent(typeof(CameraShake));
            cS.shakeCam();

            AudioSource.PlayClipAtPoint(playerStruck, transform.position);
        }
    }
示例#30
0
    //���ͷ�Ͻ�����
    IEnumerator _Coro_EffectProcessing(int num, Player killer)
    {
        if (PrefabGO_EfBackground == null)
        {
            yield break;
        }
        //����
        GameMain.Singleton.SoundMgr.PlayOneShot(Snd_GetPrize);

        //����������
        GameObject   goEffect = Instantiate(PrefabGO_EfBackground) as GameObject;
        tk2dSprite   aniSpr   = goEffect.GetComponentInChildren <tk2dSprite>();
        Transform    tsEffect = goEffect.transform;
        tk2dTextMesh text     = goEffect.GetComponentInChildren <tk2dTextMesh>();

        text.text = num.ToString();
        text.Commit();

        //��ʼ��λ����
        Vector3 originLocalPos = new Vector3(0.385F, -0.5F, -0.19F);
        Vector3 targetLocalPos = new Vector3(0.385F, 0.5F, -0.19F);

        tsEffect.parent        = killer.transform;
        tsEffect.localPosition = originLocalPos;
        tsEffect.localRotation = Quaternion.identity;


        //ҡ������
        iTween.RotateAdd(text.gameObject, iTween.Hash("z", 8F, "time", 0.27F, "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.easeInOutSine));


        //�����ƶ�
        float elapse  = 0F;
        float useTime = 0.2F;

        while (elapse < useTime)
        {
            tsEffect.localPosition = originLocalPos + (targetLocalPos - originLocalPos) * (elapse / useTime);
            elapse += Time.deltaTime;
            yield return(0);
        }
        tsEffect.localPosition = targetLocalPos;
        yield return(new WaitForSeconds(Duration_FinishPad));

        //����
        elapse  = 0F;
        useTime = 0.2F;
        while (elapse < useTime)
        {
            aniSpr.color = new Color(1F, 1F, 1F, 1F - elapse / useTime);
            text.color   = new Color(1F, 1F, 1F, 1F - elapse / useTime);
            text.Commit();
            elapse += Time.deltaTime;
            yield return(0);
        }


        Destroy(goEffect.gameObject);
    }
示例#31
0
    // Since we don't have full control over when Unity calls "Start",
    // useful to have a manually called "init" function
    public virtual void init()
    {
        _sprite = GetComponent <tk2dSprite>();
        _text   = GetComponentInChildren <tk2dTextMesh>();

        _gridPos   = PlayState.instance.toGridCoordinates(x, y);
        _nextPoint = _gridPos;
    }
示例#32
0
 public void Stop()
 {
     enabled       = false;
     _curCountDown = 0;
     Destroy(_textCountDown.gameObject);
     _textCountDown = null;
     Recover();
 }
示例#33
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        actionText = this.transform.FindChild("Action Text").GetComponent<tk2dTextMesh>();
        actionButton = this.transform.FindChild("Action Button").GetComponent<tk2dSprite>();

        timeLeftUntilFade = maxTimeUntilFade;
    }
示例#34
0
 void Awake()
 {
     spiteLv   = this.gameObject.GetComponent <tk2dSprite>();
     txtSp     = this.gameObject.transform.GetChild(1).gameObject;
     txtMesh   = txtSp.GetComponent <tk2dTextMesh>();
     spiteRate = this.gameObject.transform.GetChild(0).GetComponent <tk2dSprite>();
     itemLevel = this.gameObject.GetComponent <tk2dUIItem>();
 }
示例#35
0
    // Use this for initialization
    void Start()
    {
        tk2dTextMesh textMesh = GetComponent <tk2dTextMesh>();

        textMesh.text     = credits;
        textMesh.maxChars = credits.Length;
        textMesh.Commit();
    }
示例#36
0
        /// <summary>Tweens a tk2dTextMesh's text to the given value.
        /// Also stores the tk2dTextMesh as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end string to tween to</param><param name="duration">The duration of the tween</param>
        /// <param name="richTextEnabled">If TRUE (default), rich text will be interpreted correctly while animated,
        /// otherwise all tags will be considered as normal text</param>
        /// <param name="scrambleMode">The type of scramble mode to use, if any</param>
        /// <param name="scrambleChars">A string containing the characters to use for scrambling.
        /// Use as many characters as possible (minimum 10) because DOTween uses a fast scramble mode which gives better results with more characters.
        /// Leave it to NULL (default) to use default ones</param>
        public static TweenerCore <string, string, StringOptions> DOText(this tk2dTextMesh target, string endValue, float duration, bool richTextEnabled = true, ScrambleMode scrambleMode = ScrambleMode.None, string scrambleChars = null)
        {
            TweenerCore <string, string, StringOptions> t = DOTween.To(() => target.text, x => target.text = x, endValue, duration);

            t.SetOptions(richTextEnabled, scrambleMode, scrambleChars)
            .SetTarget(target);
            return(t);
        }
示例#37
0
        /// <summary>Tweens a 2D Toolkit TextMesh's dimensions to the given value.
        /// Also stores the TextMesh as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Vector3, Vector3, VectorOptions> DOScaleZ(this tk2dTextMesh target, float endValue, float duration)
        {
            TweenerCore <Vector3, Vector3, VectorOptions> t = DOTween.To(() => target.scale, x => target.scale = x, new Vector3(0, 0, endValue), duration);

            t.SetOptions(AxisConstraint.Z)
            .SetTarget(target);
            return(t);
        }
示例#38
0
 private void _getTextMesh()
 {
     GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
     if (go == null)
     {
         return;
     }
     _textMesh =  go.GetComponent<tk2dTextMesh>();
 }
示例#39
0
 void Start()
 {
     int levelNumber = StringUtils.getLevelBySceneName (PlayerPrefs.GetString (ScoreUtils.LEVEL_USER_INIT));
     timer = TimerUtils.getTimerByLevel(levelNumber - 1);
     fullTimer = timer;
     textMesh = GetComponent<tk2dTextMesh>();
     string answer = TimerUtils.getTimeFromFloat (Timer);
     textMesh.text = TimerUtils.TIME_STR + answer;
 }
 private void Start()
 {
     if (this.tm == null)
     {
         this.tm = base.GetComponent<tk2dTextMesh>();
     }
     this.tm.text = GameData.instance.GetItemAmount(this.itemId) + string.Empty;
     this.tm.Commit();
 }
示例#41
0
    // Update is called once per frame
    void Update()
    {
        textMesh = (tk2dTextMesh)gameObject.GetComponent(typeof(tk2dTextMesh));

        //Buscar el valor asociado con textId

        textMesh.text = (Time.realtimeSinceStartup - initialTime).ToString("000");

        textMesh.Commit();
    }
    void Awake()
    {
        speech = transform.FindChild("SpeechBubble").gameObject;

        speechBubble = speech.GetComponentInChildren<tk2dSlicedSprite>();
        textMesh = speech.GetComponentInChildren<tk2dTextMesh>();

        speech.SetActive(false);
        UpdateTexts(text);
    }
	// Add textmeshes to the list here
	// Take care to not add twice
	// Never queue in edit mode
	public static void QueueCommit( tk2dTextMesh textMesh ) {
#if UNITY_EDITOR
		if (!Application.isPlaying) {
			textMesh.DoNotUse__CommitInternal();
		}
		else 
#endif
		{
			Instance.QueueCommitInternal( textMesh );
		}
	}
 private void Start()
 {
     if (this.textMesh == null)
     {
         this.textMesh = base.GetComponent<tk2dTextMesh>();
     }
     if (!string.IsNullOrEmpty(this.key))
     {
         this.SetKey(this.key);
     }
 }
示例#45
0
	public static IEnumerator LerpColorAToB(tk2dTextMesh text, float time, Color targetColor, CallBackPtr callbackPtr = null){
		Color orinColor = text.color;
		for(float t = 0; t < time; t += tk2dUITime.deltaTime){
			float nt = Mathf.Clamp01( t / time );
			nt = Mathf.Sin(nt * Mathf.PI * 0.5f);
			text.color = Color.Lerp(orinColor, targetColor, nt);
			yield return 0;
		}
		text.color = targetColor;
		if(callbackPtr != null)
			callbackPtr();
	}
示例#46
0
	public void Initialize(float screenWidth, float screenHeight, float ratio){
		if(!isInit){
			isInit = true;
		}
		isEndBeginAni = false;
		enabled = true;
		sprite = transform.GetChild(0).GetComponent<tk2dSprite>();//GetComponent<tk2dSprite>();
		textMesh = transform.GetChild(1).GetComponent<tk2dTextMesh>();
		xLenth = (1 / ratio) * screenWidth / 2 + sprite.GetBounds().size.x;
		//if(callbackPtr != null)
		//	endAniCallBack = callbackPtr;
	}
    // Use this for initialization
    void Start()
    {
        LanguageDictionary dictionary = LanguageDictionary.Instance;

        textMesh = (tk2dTextMesh)gameObject.GetComponent(typeof(tk2dTextMesh));

        //Buscar el valor asociado con textId

        textMesh.text = dictionary.getText (gameObject.name);

        textMesh.Commit();
    }
示例#48
0
    // Use this for initialization
    void Start()
    {
        if (bubble){
            Destroy(gameObject);
        }
        else {
            bubble = this;
        }

        renderer.enabled = false;
        textMesh = GetComponentInChildren<tk2dTextMesh>();
        textMesh.renderer.enabled = false;
    }
 private void SetTextValue(tk2dTextMesh tm, int amount, [Optional, DefaultParameterValue(false)] bool useAnimation, [Optional, DefaultParameterValue("")] string updateMethod)
 {
     if (useAnimation)
     {
         int num = int.Parse(tm.text);
         object[] args = new object[] { "name", "showingOil", "from", num, "to", amount, "time", 0.5f, "onupdate", updateMethod };
         iTween.ValueTo(base.gameObject, iTween.Hash(args));
     }
     else
     {
         tm.text = amount + string.Empty;
         tm.Commit();
     }
 }
    // Use this for initialization
    void OnEnable()
    {
        GameMain.EvtLanguageChange += Handle_LanguageChanged;
        mTextMesh = GetComponent<tk2dTextMesh>();
        if (LItem == null || mTextMesh == null)
        {
            Debug.LogError("���������Աδ��ֵ����.");
            Destroy(this);
            return;
        }

        mTextMesh.text = LItem.CurrentText;
        mTextMesh.Commit();
    }
示例#51
0
    void onTextChanged()
    {
        if (textMesh == null || cursorGO == null) {
            cursorGO = GameObject.FindGameObjectWithTag (TagUtils.TAG_CURSOR_INPUT);
            textMesh = GameObject.FindGameObjectWithTag (TagUtils.TAG_INPUT_LEADERBOARD).GetComponent<tk2dTextMesh> ();
        }

        int textLength = textMesh.text.Length;
        if (textLength >= ScoreUtils.TOTAL_CHARACTERS_NAME) {
            cursorGO.renderer.enabled = false;
        } else {
            cursorGO.renderer.enabled = true;
        }
    }
 private void ShowHelp()
 {
     if (this.helpTM == null)
     {
         this.helpTM = base.GetComponentInChildren<tk2dTextMesh>();
     }
     if (this.helpTM != null)
     {
         int num = UnityEngine.Random.Range(1, MaxHelpAmount + 1);
         string str = Localization.Localize(string.Concat(new object[] { "UIHelpInfo_", (int) this.UIId, "_", num }));
         this.helpTM.maxChars = 100;
         this.helpTM.text = str;
         this.helpTM.Commit();
     }
 }
示例#53
0
    // Use this for initialization
    void Start()
    {
        btnText = GetComponentInChildren<tk2dTextMesh>();

        if(GameOverStatus == "Won")
        {
            btnText.text = string.Format("Next");
        }
        else
        {
            btnText.text = string.Format("Retry");
        }

        btnText.Commit();
    }
 public void SetFleetOpended(bool opened)
 {
     if (!opened)
     {
         this.button = base.GetComponent<tk2dButton>();
         this.button.enabled = false;
         this.bgSprite = base.GetComponent<tk2dSprite>();
         this.bgSprite.color = notOpenedColor;
         base.GetComponent<BoxCollider>().enabled = false;
         this.nameTM = base.GetComponentInChildren<tk2dTextMesh>();
         if (this.nameTM != null)
         {
             this.nameTM.color = notOpenedColor;
         }
     }
 }
示例#55
0
	// Use this for initialization
	void Start ()
	{
		string ItemId = AndysApplesAssets.LONGEVITY_GOOD.ItemId;
		int level = StoreInventory.GetGoodUpgradeLevel (ItemId);
		
		textMesh = GetComponent<tk2dTextMesh> ();
		
		switch (colliderscript.GAME_MODE) {
		case AppleCollider.GAME_MODES.FAST_APPLES:
                    if (level < 6)
                    {
                        countDownSeconds += (5 * level);
                        textMesh.text = countDownSeconds.ToString();
                    }
                    else
                    {
                        countDownSeconds += 25;
                        textMesh.text = countDownSeconds.ToString();
                    }
            //countDownSeconds = 10;
                //AndyUtils.LogDebug(TAG, "CountdownSeconds are " + countDownSeconds);
                textMesh.text = countDownSeconds.ToString();
			
			break;
		case AppleCollider.GAME_MODES.PERFECTIONIST:
			textMesh.text = colliderscript.lifeCounter.ToString ();
			break;
		}
        //AndyUtils.LogDebug(TAG, "Committing Text");
		textMesh.Commit ();
		
		if (game_end != null && audio == null) {
			AudioSource source = gameObject.AddComponent<AudioSource> ();
			source.playOnAwake = false;
		}
		
		if (timerActive) {
			switch (colliderscript.GAME_MODE) {
			case AppleCollider.GAME_MODES.FAST_APPLES:
				InvokeRepeating ("InitiateCountdown", 1.0f, 1.0f);
				break;
			case AppleCollider.GAME_MODES.PERFECTIONIST:
				InvokeRepeating ("TimeGame", 1.0f, 1.0f);
				break;
			}
		}
	}
 private void SetLevel2(tk2dTextMesh textMesh, int basic, int addAmount, int maxCanAdd, GameObject maxObj)
 {
     if (this.isSmall)
     {
         if (maxCanAdd == 0)
         {
             textMesh.text = string.Empty;
             textMesh.wordWrapWidth = 0x15;
             if (maxObj != null)
             {
                 maxObj.SetActive(true);
             }
         }
         else if (addAmount == maxCanAdd)
         {
             textMesh.text = string.Empty;
             textMesh.wordWrapWidth = 0x15;
             if (maxObj != null)
             {
                 maxObj.SetActive(true);
             }
         }
         else
         {
             textMesh.text = "+\n" + addAmount;
         }
     }
     else
     {
         string format = "{0}^C00ff00ff(+{1})";
         string str2 = "{0}^Cff0000ff(+{1})";
         if (maxCanAdd == 0)
         {
             textMesh.text = string.Format(str2, basic, "0");
         }
         else if (addAmount == maxCanAdd)
         {
             textMesh.text = string.Format(str2, basic, addAmount + string.Empty);
         }
         else
         {
             textMesh.text = string.Format(format, basic, addAmount);
         }
     }
     textMesh.Commit();
 }
 public void SetResources(Dictionary<string, int> res)
 {
     tk2dTextMesh[] meshArray = new tk2dTextMesh[] { this.oilText, this.ammoText, this.steelText, this.aluminumText };
     ResourceTypes[] typesArray = new ResourceTypes[] { ResourceTypes.Oil, ResourceTypes.Ammo, ResourceTypes.Steel, ResourceTypes.Aluminium };
     for (int i = 0; i < meshArray.Length; i++)
     {
         string key = ((int) typesArray[i]) + string.Empty;
         if (res.ContainsKey(key))
         {
             meshArray[i].text = res[key] + string.Empty;
         }
         else
         {
             meshArray[i].text = "0";
         }
         meshArray[i].Commit();
     }
 }
    void Start()
    {
        leaderboardMesh = GetComponent<tk2dTextMesh>();

        string[] leaderboard = ScoreUtils.getLeaderboard();

        StringBuilder sb = new StringBuilder();

        for (int i = 1; i <= leaderboard.Length; i++) {
            string position = i.ToString();
            position = position.PadRight(18 - position.Length , ' ');
            string[] userData = leaderboard[i - 1].Split('_');
            string playerName = userData[0];
            playerName = playerName.PadRight(19, ' ');
            string playerScore = userData[1];

            sb.Append(position + playerName + playerScore + "\n");
        }

        leaderboardMesh.text = sb.ToString();
        leaderboardMesh.Commit ();
    }
    // Use this for initialization
    void Start()
    {
        //tktextMesh = gameObject.GetComponent<tk2dTextMesh> as tk2dTextMesh ;
        tktextMeshHP = transform.gameObject.GetComponent("tk2dTextMesh") as tk2dTextMesh;
        GameObject  _gold = GameObject.FindWithTag ( "goldcoin" ) ;
        if ( _gold )
        {
            tktextMeshGoleCoin = _gold.GetComponent("tk2dTextMesh") as tk2dTextMesh ;
        }

        //IGState.st.Score = new IGScores();

        //IGState.st.Score.HP  = 200;
        //IGState.st.Score.OriginalHP  = 200 ;
        //IGState.st.Score.GoldCoin  = 0 ;

        _score = new IGScores ();
        _score.HP = IGState.st.Score.HP ;
        _score.OriginalHP = IGState.st.Score.OriginalHP  ;
        _score.GoldCoin = IGState.st.Score.GoldCoin   ;

        StartCoroutine( CalculateScore() );
    }
示例#60
0
 void Awake()
 {
     if (mText == null)
         mText = GetComponentInChildren<tk2dTextMesh>();
 }