Exemplo n.º 1
0
        public void Init(float startTime, string text, FixedFlyType type)
        {
            AniStart      = startTime;
            ShowText.text = text;
            mType         = type;

            if (null != EffectGo)
            {
                EffectGo.SetActive(false);
            }
            if (type == FixedFlyType.Huanling || type == FixedFlyType.Mochong)
            {
                EffectGo.SetActive(true);
            }
        }
Exemplo n.º 2
0
        public override void InitializeSrv()
        {
            //CoreEntry.gEventMgr.AddListener(GameEvent.GE_PLAYER_EXP, OnPlayerExp);
            CoreEntry.gEventMgr.AddListener(GameEvent.GE_PALYER_JINGJIE_EXP, OnPlayerJingJieExp);
            CoreEntry.gEventMgr.AddListener(GameEvent.GE_FLY_SKILL, OnSkillFlyText);
            CoreEntry.gEventMgr.AddListener(GameEvent.GE_AddExpInfo, OnAddExpInfo);


            m_FixedTextDict.Clear();
            m_CachedDict.Clear();
            for (int i = 0; i < (int)FixedFlyType.Max; i++)
            {
                FixedFlyType type = (FixedFlyType)i;
                m_FixedTextDict[type] = new List <FixedFlyItem>();
                m_CachedDict[type]    = new List <FixedFlyItem>();
            }
        }
Exemplo n.º 3
0
        //-------------------------------------------

        void Update()
        {
            DoProcessText();

            float realTime = Time.realtimeSinceStartup;

            for (int i = 0; i < (int)FixedFlyType.Max; i++)
            {
                FixedFlyType type = (FixedFlyType)i;
                if (m_FixedTextDict.ContainsKey(type))
                {
                    List <FixedFlyItem> showList = m_FixedTextDict[type];
                    for (int j = 0; j < showList.Count; j++)
                    {
                        UpdateFixedText(showList[j], realTime);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void ShowFixedFly(FixedFlyType type, string text)
        {
            Transform parent = null;

            switch (type)
            {
            case FixedFlyType.Exp:
                parent = ExpRoot;
                break;

            case FixedFlyType.Huanling:
            case FixedFlyType.Mochong:
                parent = SkillRoot;
                break;

            default:
                break;
            }
            if (null == parent)
            {
                return;
            }

            List <FixedFlyItem> activeList = m_FixedTextDict[type];
            List <FixedFlyItem> cacheList  = m_CachedDict[type];
            string path = m_FlyTextPath[type];

            FixedFlyItem item = null;
            int          cnt  = cacheList.Count;

            if (cnt > 0)
            {
                item = cacheList[cnt - 1];
                cacheList.RemoveAt(cnt - 1);

                item.transform.localPosition = Vector3.zero;
                //item.gameObject.SetActive(true);
                item.gameObject.transform.SetRenderActive(true);
            }
            else
            {
                GameObject prefab = (GameObject)CoreEntry.gResLoader.Load(path, typeof(GameObject));
                if (null == prefab)
                {
                    return;
                }
                GameObject obj = Instantiate(prefab) as GameObject;
                if (null == obj)
                {
                    return;
                }

                obj.transform.SetParent(parent);
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                obj.SetActive(true);
                item = obj.GetComponent <FixedFlyItem>();
            }

            if (null != item)
            {
                activeList.Add(item);
                item.Init(Time.realtimeSinceStartup, text, type);
            }
        }