Exemplo n.º 1
0
 void UF_UpdateRunTime(float dtime)
 {
     if (m_IsOver || m_IsPause)
     {
         return;
     }
     m_RunBuffer += GTime.DeltaTime;
     if (m_RunBuffer > 1)
     {
         m_RunBuffer     = m_RunBuffer - 1.0f;
         clockTimestamp += m_ISide;
         if (clockTimestamp < 0)
         {
             clockTimestamp = 0;
         }
         if (target != null)
         {
             m_DateTime = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
             UF_UpdateText();
         }
     }
     if (clockTimestamp == 0 && m_ISide < 0)
     {
         m_IsOver = true;
         GHelper.UF_SafeCallDelegate(m_EventClockOver);
     }
 }
Exemplo n.º 2
0
        //unity monobehavior event
        private void OnTriggerEnter(Collider hitObject)
        {
            Vector3 hitPoint = this.transform.position;

            if (!string.IsNullOrEmpty(triggerMask))
            {
                if (!GHelper.UF_CheckStringMask(triggerMask, hitObject.tag))
                {
                    return;
                }
            }

            //自身不检测碰撞
            if (ower == hitObject.gameObject || ower == null)
            {
                return;
            }
            //同类型Member不检测
            if (ower.tag == hitObject.tag)
            {
                return;
            }

            UF_OnColliderEnter(hitObject.gameObject, hitPoint);
        }
Exemplo n.º 3
0
        protected void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.layer == DefineLayer.HitRaycast)
            {
                return;
            }

            if (!string.IsNullOrEmpty(triggerMask))
            {
                if (!GHelper.UF_CheckStringMask(triggerMask, other.gameObject.tag))
                {
                    return;
                }
            }

            if (m_MapTriggerCache.ContainsKey(other.gameObject))
            {
                float fixedTime = time;
                //判定是否在连续触发事件内
                float dt = fixedTime - m_MapTriggerCache[other.gameObject];
                if (dt >= interval)
                {
                    m_MapTriggerCache[other.gameObject] = fixedTime;
                    TriggerGameObject(other.gameObject);
                }
            }
            else
            {
                m_MapTriggerCache.Add(other.gameObject, time);
                if (interval <= 0 || m_IsOnRun)
                {
                    TriggerGameObject(other.gameObject);
                }
            }
        }
Exemplo n.º 4
0
        static IEnumerator UF_IELoadSettingsFile(ConfigFile config, string settingFileName)
        {
            string filepath = GlobalPath.StreamingAssetsPath + "/" + settingFileName;

#if UNITY_EDITOR || UNITY_IPHONE || UNITY_STANDALONE
            WWW www = new WWW("file://" + filepath);
#elif UNITY_ANDROID
            WWW www = new WWW(filepath);
#endif
            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                //检查配置是否加密
                var    bytedata = GHelper.UF_BytesCopy(www.bytes);
                string chunk    = System.Text.Encoding.UTF8.GetString(bytedata, 0, Mathf.Min(bytedata.Length, 8)).Trim();
                if (chunk.StartsWith("[", System.StringComparison.Ordinal) || chunk.StartsWith("#", System.StringComparison.Ordinal))
                {
                    Debugger.UF_Log("No need to encryp setting file:" + settingFileName);
                }
                else
                {
                    Debugger.UF_Log(string.Format("Encryp setting file[{0}] with key[{1}]", settingFileName, ConfigEncBKey));
                    GHelper.UF_BytesKey(bytedata, ConfigEncBKey);
                }
                System.IO.MemoryStream ms = new System.IO.MemoryStream(bytedata);
                config.UF_OpenReader(new System.IO.StreamReader(ms));
            }
            else
            {
                Debugger.UF_Warn(string.Format("IELoadSettingsFile:[{0}]  error:[{1}] ", filepath, www.error));
            }
            www.Dispose();
        }
Exemplo n.º 5
0
 private void UF_UpdateText()
 {
     if (target != null)
     {
         if (string.IsNullOrEmpty(format))
         {
             target.text = clockTimestamp.ToString();
         }
         else
         {
             if (useRichText)
             {
                 target.text = GHelper.UF_ParseTextArithmetic(m_DateTime.ToString(format));
             }
             else
             {
                 target.text = m_DateTime.ToString(format);
             }
         }
     }
     if (m_UEventTick != null)
     {
         m_UEventTick.Invoke();
     }
 }
Exemplo n.º 6
0
        void UF_UpdateOnRealTime()
        {
            if (m_IsOver || m_IsPause)
            {
                return;
            }

            int tick         = System.Environment.TickCount + m_TickOverflow;
            int durationTick = Mathf.Abs(tick - m_TickBuffer);
            int stamp        = durationTick / 1000;

            if (stamp >= 1)
            {
                m_TickOverflow  = durationTick - stamp * 1000;
                m_TickBuffer    = tick;
                clockTimestamp += stamp * m_ISide;
                if (clockTimestamp < 0)
                {
                    clockTimestamp = 0;
                }
                if (target != null)
                {
                    //m_DateTime.AddSeconds (stamp);
                    m_DateTime = GTime.UF_TimestampToDateTime(clockTimestamp, m_IsNormal);
                    UF_UpdateText();
                }
            }
            if (clockTimestamp == 0 && m_ISide < 0)
            {
                m_IsOver = true;
                GHelper.UF_SafeCallDelegate(m_EventClockOver);
            }
        }
Exemplo n.º 7
0
 private void UF_UpdatePlayClipEvent()
 {
     if (m_CurrentPlayClip != null)
     {
         m_PlayingTime += GTime.RunDeltaTime;
         float progress = m_PlayingLength <= 0 ? 1:Mathf.Clamp01(m_PlayingTime / m_PlayingLength);
         progress = GHelper.ShortFloat(progress);
         if (m_CurrentPlayClip.playingAcitveEvent)
         {
             var count = m_CurrentPlayClip.clipEvents.Count;
             for (int k = m_EventTriggerIndex; k < count; k++)
             {
                 if (progress >= m_CurrentPlayClip.clipEvents [k].trigger)
                 {
                     m_EventTriggerIndex++;
                     UF_ExcuteAnimatorClipEvent(m_CurrentPlayClip.name, m_CurrentPlayClip.playingParam, m_CurrentPlayClip.clipEvents [k].name, m_CurrentPlayClip.clipEvents [k].param);
                 }
             }
         }
         if (progress >= 1)
         {
             m_PlayingTime      = m_PlayingLength;
             m_isPlayingElemelt = false;
             GHelper.UF_SafeCallDelegate(m_CurrentPlayClip.playingCallback, null);
         }
     }
 }
Exemplo n.º 8
0
        protected IEnumerator UF_MotionEuler(
            Transform target,
            Vector3 vfrom,
            Vector3 vto,
            float duration,
            bool ingoreTimeScale,
            bool spaceWorld,
            DelegateVoid eventFinish)
        {
            float progress = 0;
            float tickBuff = 0;

            while (progress < 1)
            {
                float delta = ingoreTimeScale ? GTime.RunDeltaTime : GTime.UnscaleDeltaTime;
                tickBuff += delta;
                progress  = Mathf.Clamp01(tickBuff / duration);
                Vector3 current = progress * vto + (1 - progress) * vfrom;
                if (spaceWorld)
                {
                    target.eulerAngles = current;
                }
                else
                {
                    target.localEulerAngles = current;
                }
                yield return(null);
            }

            GHelper.UF_SafeCallDelegate(eventFinish);
        }
Exemplo n.º 9
0
        //通过加载本地持久化路径下资源目录结构获取所有资源信息
        internal static void UF_LoadAssetInfoFromPersistent()
        {
            Debugger.UF_Log("Load All AssetInfo From Persistent");

            //重置所有路径,避免已删除文件误加载
            //foreach (var v in s_DicAssetsMap.Values) {
            //    v.path = string.Empty;
            //}
            s_DicAssetsMap.Clear();
            s_ListAssetsMap.Clear();
            Debugger.UF_Log("GlobalPath.BundlePath:" + GlobalPath.BundlePath);
            //读取Bundle资源信息
            GHelper.UF_ForeachFloder(GlobalPath.BundlePath, (e) => {
                if (UF_CheckIsAssetFile(e))
                {
                    string fName   = Path.GetFileName(e);
                    string absPath = e.Substring(e.IndexOf("BundleAssets", System.StringComparison.Ordinal));
                    var afi        = new AssetFileInfo(AssetFileType.Bundle, fName, fName, absPath, e);
                    s_ListAssetsMap.Add(afi);

                    if (!s_DicAssetsMap.ContainsKey(fName))
                    {
                        s_DicAssetsMap.Add(fName, afi);
                    }
                    else
                    {
                        //替换为持久化路径
                        //s_DicAssetsMap[fName].path = e;
                        Debugger.UF_Error(string.Format("AssetDataBase Error -> Same Assets File Name: {0}", fName));
                    }
                }
            });

            //读取Lua代码资源信息
            GHelper.UF_ForeachFloder(GlobalPath.ScriptPath, (e) => {
                if (UF_CheckIsAssetFile(e))
                {
                    string fName = Path.GetFileName(e);
                    if (Path.GetExtension(fName) == ".lua")
                    {
                        string absPath = e.Substring(e.IndexOf("Runtimes", System.StringComparison.Ordinal));
                        var afi        = new AssetFileInfo(AssetFileType.Runtimes, fName, fName, absPath, e);
                        s_ListAssetsMap.Add(afi);

                        if (!s_DicAssetsMap.ContainsKey(fName))
                        {
                            s_DicAssetsMap.Add(fName, new AssetFileInfo(AssetFileType.Runtimes, fName, fName, absPath, e));
                        }
                        else
                        {
                            //s_DicAssetsMap[fName].path = e;
                            Debugger.UF_Error(string.Format("AssetDataBase Error -> Same Lua File Name: {0}", fName));
                        }
                    }
                }
            });
        }
Exemplo n.º 10
0
        private void UF_InvokePathPointFinish()
        {
            //完成移动
            DelegateVoid tmp = m_EventPathFinish;

            m_EventPathFinish = null;

            GHelper.UF_SafeCallDelegate(tmp);
        }
Exemplo n.º 11
0
        public static Color32 UF_ReadColor(string chunk, int startIdx)
        {
            string strVal = UF_ReadString(chunk, startIdx);

            if (string.IsNullOrEmpty(strVal))
            {
                return(new Color32(255, 255, 255, 255));
            }
            return(GHelper.UF_UF_ParseStringToColor32(strVal));
        }
Exemplo n.º 12
0
        public static Vector2 UF_ReadVector2(string chunk, int startIdx)
        {
            string strVal = UF_ReadString(chunk, startIdx);
            float  x, y;

            string[] array = GHelper.UF_SplitStringWithCount(strVal, 2, ',');
            float.TryParse(array [0], out x);
            float.TryParse(array [1], out y);
            return(new Vector2(x, y));
        }
Exemplo n.º 13
0
 //自动适配安全区域
 public void UF_AutoFitNotchScreen()
 {
     if (GlobalSettings.NativeInfo != null)
     {
         float offset = GHelper.UF_ParseFloat(GlobalSettings.NativeInfo.UF_GetValue("SAFE_OFFSET", "0"));
         if (offset > 0)
         {
             UF_SetSafeOffset(offset);
         }
     }
 }
Exemplo n.º 14
0
 public int UF_GetIntValue(string key, int defaultValue = 0)
 {
     if (m_HashData.ContainsKey(key))
     {
         return(GHelper.UF_ParseInt(m_HashData[key]));
     }
     else
     {
         return(defaultValue);
     }
 }
Exemplo n.º 15
0
 public bool UF_GetBoolValue(string key, bool defaultValue = false)
 {
     if (m_HashData.ContainsKey(key))
     {
         return(GHelper.UF_ParseBool(m_HashData[key]));
     }
     else
     {
         return(defaultValue);
     }
 }
Exemplo n.º 16
0
 public void UF_BatchPlay(string batchName)
 {
     string[] names = GHelper.UF_SplitString(batchName);
     if (names != null)
     {
         for (int k = 0; k < names.Length; k++)
         {
             UF_Play(names [k]);
         }
     }
 }
Exemplo n.º 17
0
 //设置层
 public void UF_SetLayer(int value, bool withChild = false)
 {
     if (withChild)
     {
         GHelper.UF_BatchSetLayer(this.gameObject, value);
     }
     else
     {
         this.gameObject.layer = value;
     }
 }
Exemplo n.º 18
0
        public static Vector4 UF_ReadVector4(string chunk, int startIdx)
        {
            string strVal = UF_ReadString(chunk, startIdx);
            float  x, y, z, w;

            string[] array = GHelper.UF_SplitStringWithCount(strVal, 4, ',');
            float.TryParse(array [0], out x);
            float.TryParse(array [1], out y);
            float.TryParse(array [2], out z);
            float.TryParse(array [3], out w);
            return(new Vector4(x, y, z, w));
        }
Exemplo n.º 19
0
 protected override void UF_OnColliderEnter(GameObject hitObject, Vector3 hitPoint)
 {
     //只对Member 生效
     if (GHelper.UF_CheckStringMask(DefineTagMask.Member, hitObject.tag))
     {
         base.UF_OnColliderEnter(hitObject, hitPoint);
     }
     else
     {
         UF_PlayTriggerEffect(hitPoint);
     }
 }
Exemplo n.º 20
0
 protected override void UF_OnColliderEnter(GameObject hitObject, Vector3 hitPoint)
 {
     if (GHelper.UF_CheckStringMask(DefineTagMask.Member, hitObject.tag) && hitObject.activeSelf)
     {
         base.UF_OnColliderEnter(hitObject, hitPoint);
     }
     else
     {
         UF_PlayTriggerDip();
         UF_PlayTriggerEffect(this.position);
     }
     this.UF_Stop();
 }
Exemplo n.º 21
0
        private UpgradeFileInfo UF_CreateUpgradeFileInfo(string chunk)
        {
            UpgradeFileInfo ret = new UpgradeFileInfo();

            string[] value = GHelper.UF_SplitStringWithCount(chunk, 3);
            ret.version = value [0].Substring(value [0].IndexOf('-') + 1);
            ret.size    = int.Parse(value [1].Trim());
            ret.zip     = value [0].Trim() + ".zip";
            //取用CDN资源
            ret.url   = string.Format("{0}/{1}", GlobalSettings.UrlAssetsUpgrade.Trim(), ret.zip);
            ret.ucode = value [2];
            return(ret);
        }
Exemplo n.º 22
0
        private void UF_DrawDebugWriter()
        {
            string pwfile = PlayerPrefs.GetString("dw_p_file", "");
            string pwidpe = PlayerPrefs.GetString("dw_p_idpe", "127.0.0.1:6789");

            GUI.color = Color.white;

            try{
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Set File Writer", GUILayout.Width(120)))
                {
                    if (!string.IsNullOrEmpty(pwfile.Trim()))
                    {
                        if (!File.Exists(pwfile))
                        {
                            string abspath = Path.GetDirectoryName(pwfile);
                            if (!Directory.Exists(abspath))
                            {
                                Directory.CreateDirectory(abspath);
                            }
                        }
                        FileWriter fw = new FileWriter(pwfile);
                        Debugger.UF_GetInstance().logger.UF_AddWriter(fw);
                    }
                }
                pwfile = GUILayout.TextArea(pwfile);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Set UDP Writer", GUILayout.Width(120)))
                {
                    if (!string.IsNullOrEmpty(pwidpe.Trim()))
                    {
                        string[]     args = GHelper.UF_SplitStringWithCount(pwidpe, 2, ':');
                        UdpNetWriter uw   = new UdpNetWriter(args[0], int.Parse(args[1]));
                        uw.UF_Write(string.Format("\n\n\n------------------Start UPD Console:[{0}]------------------\n", GTime.DateHMS));
                        Debugger.UF_GetInstance().logger.UF_AddWriter(uw);
                    }
                }
                pwidpe = GUILayout.TextField(pwidpe);
                GUILayout.EndHorizontal();
            }catch (System.Exception ex) {
                Debugger.UF_Exception(ex);
            }

            if (GUI.changed)
            {
                PlayerPrefs.SetString("dw_p_file", pwfile);
                PlayerPrefs.SetString("dw_p_idpe", pwidpe);
            }
        }
Exemplo n.º 23
0
 protected override void UF_OnColliderEnter(GameObject hitObject, Vector3 hitPoint)
 {
     //只对Member 生效
     if (GHelper.UF_CheckStringMask(DefineTagMask.Member, hitObject.tag))
     {
         if (!m_MapTriggerCache.ContainsKey(hitObject))
         {
             m_MapTriggerCache.Add(hitObject, m_ExistTime);
         }
         var tarHitPoint = hitObject.transform.position;
         tarHitPoint.y = hitPoint.y;
         base.UF_OnColliderEnter(hitObject, tarHitPoint);
     }
 }
Exemplo n.º 24
0
        protected virtual void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.layer == DefineLayer.HitRaycast)
            {
                return;
            }
            if (string.IsNullOrEmpty(eTrigger))
            {
                return;
            }
            if (!string.IsNullOrEmpty(triggerMask))
            {
                if (!GHelper.UF_CheckStringMask(triggerMask, other.tag))
                {
                    return;
                }
            }
            if (m_AttachTarget != null && m_AttachTarget == other.gameObject)
            {
                return;
            }

            //send message
            MessageSystem msg = MessageSystem.UF_GetInstance();

            msg.UF_BeginSend();
            msg.UF_PushParam(eTrigger);
            msg.UF_PushParam(this.gameObject);
            msg.UF_PushParam(other.gameObject);
            for (int k = 0; k < eParams.Length; k++)
            {
                msg.UF_PushParam(eParams[k]);
            }
            msg.UF_EndSend(DefineEvent.E_TRIGGER_CONTROLLER);

            if (m_UETrigger != null)
            {
                m_UETrigger.Invoke();
            }

            //paly sound
            AudioManager.UF_GetInstance().UF_Play(eSound);
            //release?
            if (autoRelese)
            {
                this.Release();
            }
        }
Exemplo n.º 25
0
        //碰撞
        internal void UF_OnCollisionHit(ControllerColliderHit hit)
        {
            if (!activeTriggerCollision)
            {
                return;
            }

            GameObject hitTarget = hit.gameObject;

            if (hitTarget.tag == DefineTag.Ground)
            {
                return;
            }

            if (!UF_CheckCollisionIntervalTime())
            {
                return;
            }

            //忽略指定层碰撞
            if (hitTarget.tag == DefineTag.Block || hitTarget.tag == DefineTag.Unwalk)
            {
                //碰撞不可走区域
                MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_AVATAR_BLOCK, m_Avatar, hitTarget, hit.point);
                return;
            }

            //只处理角色间碰撞
            if (m_Avatar.tag != hitTarget.tag)
            {
                //if (!CheckCollisionIntervalTime()) return;
                if (GHelper.UF_CheckStringMask(collisionMask, hitTarget.tag))
                {
                    //推开角色
                    if (hit.collider is CharacterController)
                    {
                        var     targetController = hit.collider as CharacterController;
                        Vector3 pushForward      = MathX.UF_Foward(m_Avatar.position, hit.transform.position);
                        pushForward.y = 0;
                        //Vector3 pushForward = hit.moveDirection;
                        targetController.Move(pushFactor * pushForward.normalized * GTime.RunDeltaTime);
                    }

                    MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_AVATAR_COLLISION, m_Avatar, hitTarget);
                }
            }
        }
Exemplo n.º 26
0
        public void UF_ExecuteTweenAlpha(string valchunk)
        {
            if (string.IsNullOrEmpty(valchunk))
            {
                return;
            }
            List <string> list = ListCache <string> .Acquire();

            GHelper.UF_SplitStringWithCount(valchunk, 4, list, ';');
            float vform      = GHelper.UF_ParseFloat(list[0]);
            float vto        = GHelper.UF_ParseFloat(list[1]);
            float vduration  = GHelper.UF_ParseFloat(list[2]);
            bool  vtimescale = GHelper.UF_ParseBool(list[3]);

            UF_CrossRenderAlpha(vform, vto, vduration, vtimescale);
            ListCache <string> .Release(list);
        }
Exemplo n.º 27
0
        protected IEnumerator UF_MotionTransPosition(
            Transform target,
            Vector3 vfrom,
            Transform toObj,
            float duration,
            bool ingoreTimeScale,
            float heightOffset,
            bool spaceWorld,
            Vector3 offset,
            bool focusAngle,
            DelegateVoid eventFinish)
        {
            float progress = 0;
            float tickBuff = 0;

            while (progress < 1)
            {
                float delta = ingoreTimeScale ? GTime.RunDeltaTime : GTime.UnscaleDeltaTime;
                tickBuff += delta;
                progress  = Mathf.Clamp01(tickBuff / duration);
                Vector3 current       = progress * (toObj.position + offset) + (1 - progress) * vfrom;
                Vector3 currentOffset = new Vector3(0, heightOffset * Mathf.Sin(Mathf.PI * progress), 0);
                Vector3 lastPositon   = default(Vector3);
                if (spaceWorld)
                {
                    lastPositon     = target.position;
                    target.position = current + currentOffset;
                    if (focusAngle)
                    {
                        target.eulerAngles = MathX.UF_EulerAngle(lastPositon, target.position);
                    }
                }
                else
                {
                    lastPositon          = target.localPosition;
                    target.localPosition = current + currentOffset;
                    if (focusAngle)
                    {
                        target.localEulerAngles = MathX.UF_EulerAngle(lastPositon, target.position);
                    }
                }
                yield return(null);
            }

            GHelper.UF_SafeCallDelegate(eventFinish);
        }
Exemplo n.º 28
0
        private bool UF_LoadTexture(string fName)
        {
            string path = fName;

            Texture2D tex = null;

            if (folderType == FolderType.Persistent)
            {
                path = GlobalPath.PersistentPath + "/" + path;
                tex  = TextureManager.UF_GetInstance().UF_LoadTextureLocal(path);
            }
            else if (folderType == FolderType.StreamingAssets)
            {
#if UNITY_ANDROID && !UNITY_EDITOR
                var bytes = GHelper.UF_LoadAndroidAssetFile(path);
                if (bytes != null && bytes.Length > 0)
                {
                    tex = TextureManager.UF_GetInstance().UF_LoadTextureBytes(bytes, System.IO.Path.GetFileNameWithoutExtension(path));
                }
#else
                path = GlobalPath.StreamingAssetsPath + "/" + path;
                tex  = TextureManager.UF_GetInstance().UF_LoadTextureLocal(path);
#endif
            }
            else if (folderType == FolderType.AssetsBundle)
            {
                tex = TextureManager.UF_GetInstance().UF_LoadTexture(fName);
            }

            if (tex != null)
            {
                target.texture = tex;
                if (enableOnAccessable)
                {
                    target.enabled = true;
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 播放Action,并清空之前的播放列表,可用';'间隔多个Action的播放,所有Action播放完毕会触发完成事件
        /// </summary>
        public void UF_Play(string strName, bool triggerEvent, float fSpeed, string playParam = "", DelegateMethod eventFinish = null)
        {
            if (string.IsNullOrEmpty(strName))
            {
                return;
            }
            if (lockPlay)
            {
                Debugger.UF_Warn(string.Format("Animator Has been lock,play {0} failed", strName));
                return;
            }
            //避免重复播放
            if (m_isPlayingElemelt && m_CurrentPlayClip != null && m_CurrentPlayClip.name == strName)
            {
                return;
            }
            UF_ClearPlayQueue();
            m_CurrentPlayClip = null;
            m_IsOver          = false;
            m_IsPause         = false;
            this.ctrlSpeed    = 1;
            if (strName.IndexOf(';') > -1)
            {
                List <string> inlist = ListCache <string> .Acquire();

                GHelper.UF_SplitString(strName, inlist);
                for (int k = 0; k < inlist.Count; k++)
                {
                    if (!string.IsNullOrEmpty(inlist[k]))
                    {
                        UF_AddToPlayQueue(inlist[k], triggerEvent, fSpeed, string.Empty, eventFinish);
                    }
                }
                ListCache <string> .Release(inlist);
            }
            else
            {
                UF_AddToPlayQueue(strName, triggerEvent, fSpeed, playParam, eventFinish);
            }

            //立即执行更新一次,避免播放速度过快导致显示异常
            this.UF_OnUpdate();
        }
Exemplo n.º 30
0
        private void UF_PlayAnimatorClip(AnimatorClip aClip)
        {
            //获取影片播放长度
            m_PlayingLength = UF_GetAnimationClipRealLength(m_CurrentPlayClip.name) / m_CurrentPlayClip.playingSpeed;
            m_PlayingLength = GHelper.ShortFloat(m_PlayingLength);
            //设置当前影片播放速度
            this.speed = m_CurrentPlayClip.speed * m_CurrentPlayClip.playingSpeed;
            //重置索引
            m_EventTriggerIndex = 0;
            //重置当前影片播放时间
            m_PlayingTime      = 0;
            m_IsOver           = false;
            m_isPlayingElemelt = true;

            //播放影片动画
            if (m_Animator == null)
            {
                Debugger.UF_Warn("Animator Component is null,Animation will not play!");
                return;
            }
            switch (aClip.crossMode)
            {
            case AnimatorClip.CrossMode.CrossFabe:
                m_Animator.CrossFadeInFixedTime(aClip.clipName, aClip.fadeFactor);
                break;

            case AnimatorClip.CrossMode.Direct:
                if (aClip.wrapMode == WrapMode.Loop)
                {
                    m_Animator.Play(aClip.clipName);
                }
                else
                {
                    m_Animator.Play(aClip.clipName, 0, 0);
                }
                break;

            default:
                m_Animator.Play(aClip.clipName);
                break;
            }
        }