Esempio n. 1
0
        private void DoShowUIEffect(string name, Transform root, int sortOrder, Vector3 worldPos, float lifeTime, Action callback)
        {
            GameObject effect = GameObjectPoolMgr.S.Allocate(name);

            effect.transform.SetParent(root);
            //effect.transform.localScale = Vector3.one;

            //set ui layer
            UnityExtensions.SetAllLayer(effect, LayerDefine.LAYER_UI);
            //set render order
            SetParticalRender(effect, sortOrder);

            effect.transform.position = worldPos;

            if (lifeTime < 0)
            {
                return;
            }
            UnityExtensions.CallWithDelay(GameplayMgr.S.Mono, () =>
            {
                //todo :������нű��ǵ�reset,�����ÿ�
                if (effect == null)
                {
                    return;
                }
                ResetPartical(effect);
                GameObjectPoolMgr.S.Recycle(effect);
                if (callback != null)
                {
                    callback.Invoke();
                }
            }, lifeTime);
        }
Esempio n. 2
0
        public void ShowEffect(string name, Vector3 worldPos, float lifeTime, Action callback)
        {
            GameObject effect = GameObjectPoolMgr.S.Allocate(name);

            effect.transform.SetParent(m_EffectRoot);
            effect.transform.position = worldPos;

            if (lifeTime < 0)
            {
                return;
            }
            UnityExtensions.CallWithDelay(GameplayMgr.S, () =>
            {
                //todo :������нű��ǵ�reset,�����ÿ�
                if (effect == null)//effect��destroy
                {
                    return;
                }
                ResetPartical(effect);
                GameObjectPoolMgr.S.Recycle(effect);
                if (callback != null)
                {
                    callback.Invoke();
                }
            }, lifeTime);
        }
Esempio n. 3
0
        protected void PlayParticleSystem(GameObject p, Transform parent, Vector3 position, Quaternion rotation, float recycleTime, bool isUseSelfTime)
        {
            ParticleSystem ps = p.GetComponent <ParticleSystem>();

            if (ps == null)
            {
                ps = p.GetComponentInChildren <ParticleSystem>();
            }
            ps.Clear();

            if (parent != null)
            {
                p.transform.SetParent(parent);
            }
            p.transform.position = position;
            p.transform.rotation = rotation;

            ps.Play();

            if (isUseSelfTime)
            {
                recycleTime = ps.main.duration;
            }
            UnityExtensions.CallWithDelay(this, () => { GameObjectPoolMgr.S.Recycle(p.gameObject); }, recycleTime);
        }
Esempio n. 4
0
        public void CheckTimeReward()
        {
            string lastTimeStr = GameData.LastPlayTimeString;

            if (!string.IsNullOrEmpty(lastTimeStr))
            {
                DateTime dtStart = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                var      timeStr = UnityExtensions.GetTimeStamp();
                if (!string.IsNullOrEmpty(timeStr))
                {
                    GameData.LastPlayTimeString = timeStr;
                    long longTimeLast /*= long.Parse(timeStr)*/;
                    long.TryParse(lastTimeStr, out longTimeLast);
                    var dtNow  = DateTime.UtcNow;
                    var dtLast = dtStart.AddMilliseconds(longTimeLast);
                    var adds   = (int)(dtNow - dtLast).TotalSeconds;

                    if (adds > GetShowTimeRewardMinTime)
                    {
                        //if(GuideMgr.S.IsGuideFinish(2))
                        //UIMgr.S.OpenPanel(UIID.PopEarnPanel, adds);
                    }
                }
            }

            StartTimeRecord();
        }
Esempio n. 5
0
        //每隔一段时间请求一下服务器时间存档作为最后游玩时间(ms时间戳)
        private void OnGameTimeRecord(int count)
        {
            Log.i("OnGameTimeRecord : " + count);

            GameDataMgr.S.Save();

            var timeStr = UnityExtensions.GetTimeStamp();

            if (/*m_GetTimeReward && */ !string.IsNullOrEmpty(timeStr))
            {
                GameData.LastPlayTimeString = timeStr;
            }
        }