Esempio n. 1
0
        private void BuildNumber(ShootTextInfo shootTextInfo, Transform parent)
        {
            string tempNumber     = shootTextInfo.content;
            char   numberOperator = tempNumber[0];
            string animationType  = "";
            string plusOrMinus    = "";

            //出现字体时对应的动画类型
            animationType = shootTextInfo.animationType == TextAnimationType.None ? TextAnimationType.Normal.ToString() : shootTextInfo.animationType.ToString();

            #region 运算符

            GameObject operatorObj = null;
            plusOrMinus = numberOperator == '+' ? operatorPlusKeyPostfix : operatorMinusKeyPostfix;

            operatorObj = Instantiate(numberDic[animationType + plusOrMinus]);
            operatorObj.transform.SetParent(parent, false);

            #endregion

            #region 数字

            GameObject numberObj = null;
            for (int i = 1; i < tempNumber.Length; i++)
            {
                numberObj = Instantiate(numberDic[animationType + numberPrefix + tempNumber[i]]);
                numberObj.transform.SetParent(parent, false);
            }

            #endregion
        }
 public void SetInfo(ShootTextInfo shootTextInfo) //执行顺序优于Start
 {
     content = shootTextInfo.content;
     animationType = shootTextInfo.animationType;
     moveType = shootTextInfo.moveType;
     delayMoveTime = Time.time + shootTextInfo.delayMoveTime;
     cacheTranform = shootTextInfo.cacheTranform;
     initializedHorizontalPositionOffset = shootTextInfo.initializedHorizontalPositionOffset;
     initializedVerticalPositionOffset = shootTextInfo.initializedVerticalPositionOffset;
 }
Esempio n. 3
0
        private GameObject InstanceShootText(ShootTextInfo shootTextInfo)
        {
            GameObject shootText = Instantiate(shootTextPrefab);

            //先拼装字体,顺序颠倒会造成组件无法找到对应物体
            BuildNumber(shootTextInfo, shootText.transform);

            ShootTextComponent tempShootTextComponent = shootText.GetComponent <ShootTextComponent>();

            tempShootTextComponent.SetInfo(shootTextInfo);
            handleShootTextGroup.Add(tempShootTextComponent);
            return(shootText);
        }
Esempio n. 4
0
        public void CreatShootText(string content, TextAnimationType textAnimationType, TextMoveType textMoveType, float delayMoveTime, float initializedVerticalPositionOffset, float initializedHorizontalPositionOffset, Transform tempTransform)
        {
            ShootTextInfo shootTextInfo = new ShootTextInfo();

            shootTextInfo.content       = content;
            shootTextInfo.animationType = textAnimationType;
            shootTextInfo.moveType      = textMoveType;
            shootTextInfo.delayMoveTime = delayMoveTime;
            shootTextInfo.initializedVerticalPositionOffset   = initializedVerticalPositionOffset;
            shootTextInfo.initializedHorizontalPositionOffset = initializedHorizontalPositionOffset;
            shootTextInfo.cacheTranform = tempTransform;

            CreatShootText(shootTextInfo);
        }
Esempio n. 5
0
 public void CreatShootText(ShootTextInfo shootTextInfo)
 {
     if (CheckNumber(shootTextInfo.content))
     {
         if (IsAllowAddShootText())
         {
             waitShootTextGroup.Enqueue(shootTextInfo);
         }
         else
         {
             Debug.LogWarning("数量过多不能添加!!!");
         }
     }
     else
     {
         Debug.LogError("飘字数据不合法");
     }
 }