Пример #1
0
        public override void DestroyBehaviour()
        {
            m_bNetAnswer = false;
            m_PathPos.Release();
            m_GotoBtn.onClick.RemoveAllListeners();

            if (m_AssetRes != null)
            {
                m_AssetRes.destroy();
                m_AssetRes = null;
            }

            DestroyPathPoint();
            DestroyPoint();
            MonsterTipsTrigger.onPointerDown -= LostMonsterTips;
            Game.GetInstance().SubscribeNetNotify(NetMsg.MSG_TEAM_MEMBER_POS, UpdateTeam);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.TASK_CHANGED, UpdateNpcState);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, UpdateRequsetTeam);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.NEW_MINIMAP_SELECT_MONSTER_MINIMAPINFO, MonsterSelectChange);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_MINI_MAP_COM_POS, ClickMiniMapPos);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_ACTOR_PATH_POINTS_CHANGED, OnWalkPathChange);
            ClientEventMgr.Instance.UnsubscribeClientEvent((int)xc.ClientEvent.CE_WORLD_BOSS_UPDATE_BOSS_INFO_ALL, UpdateWorldBossState);
            m_PathPoints.Clear();
            base.DestroyBehaviour();
        }
Пример #2
0
        public static IEnumerator CoLoadLocalizeFile(string path)
        {
            SGameEngine.AssetResource result = new SGameEngine.AssetResource();

            yield return(MainGame.HeartBehavior.StartCoroutine(SGameEngine.ResourceLoader.Instance.load_asset(path, typeof(TextAsset), result)));

            if (result.asset_ == null)
            {
                yield break;
            }

            TextAsset textAsset = result.asset_ as TextAsset;

            if (textAsset == null || textAsset.text == null)
            {
                Debug.LogError("加载本地化文件失败:" + path);
                yield break;
            }

            string content = textAsset.text;

            LocalizeManager.Instance.ParseLocalizationData(content);

            result.destroy();
        }
Пример #3
0
 private void DestroyAssetRes()
 {
     if (mAssetRes != null)
     {
         mAssetRes.destroy();
         mAssetRes = null;
     }
 }
        static int _g_get_asset_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                SGameEngine.AssetResource __cl_gen_to_be_invoked = (SGameEngine.AssetResource)translator.FastGetCSObj(L, 1);
                translator.Push(L, __cl_gen_to_be_invoked.asset_);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(1);
        }
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    SGameEngine.AssetResource __cl_gen_ret = new SGameEngine.AssetResource();
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to SGameEngine.AssetResource constructor!"));
        }
Пример #6
0
        public override void DestroyBehaviour()
        {
            m_bNetAnswer = false;

            ClearPoint();
            UIResourceManager.Instance.DestroyPool(m_teamPoint);

            if (m_assetRes != null)
            {
                m_assetRes.destroy();
                m_assetRes = null;
            }

            ClientEventMgr.Instance.UnsubscribeClientEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, OnTeamInfoChange);
            Game.GetInstance().UnsubscribeNetNotify(NetMsg.MSG_TEAM_MEMBER_POS, OnTeamMemberPos);

            base.DestroyBehaviour();
        }
Пример #7
0
        IEnumerator ShowAsync(string minimapName)
        {
            if (m_assetRes != null)
            {
                m_assetRes.destroy();
                m_assetRes = null;
            }

            if (0 == minimapName.Length)
            {
                m_minimapRawImage.enabled = false;
                yield break;
            }

            if (m_minimapRawImage.texture != null)
            {
                if (m_minimapRawImage.texture.name.CompareTo(minimapName.ToString()) == 0)
                {
                    yield break;
                }
            }

            m_assetRes = new SGameEngine.AssetResource();
            string assetPath = string.Format("Assets/Res/UI/Textures/MiniMap/{0}.png", minimapName);

            yield return(SGameEngine.ResourceLoader.Instance.StartCoroutine(
                             SGameEngine.ResourceLoader.Instance.load_asset(assetPath, typeof(Texture), m_assetRes)));

            if (m_assetRes == null || m_assetRes.asset_ == null)
            {
                if (null != m_minimapRawImage)
                {
                    m_minimapRawImage.enabled = false;
                }

                yield break;
            }

            if (null != m_minimapRawImage)
            {
                m_minimapRawImage.texture = m_assetRes.asset_ as Texture;
                m_minimapRawImage.enabled = true;
            }
        }
Пример #8
0
        static int _m_try_load_asset_immediately(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            SGameEngine.ResourceLoader __cl_gen_to_be_invoked = (SGameEngine.ResourceLoader)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 5 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Type>(L, 3) && translator.Assignable <SGameEngine.AssetResource>(L, 4) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 5))
                {
                    string      _asset_path           = LuaAPI.lua_tostring(L, 2);
                    System.Type _type                 = (System.Type)translator.GetObject(L, 3, typeof(System.Type));
                    SGameEngine.AssetResource _result = (SGameEngine.AssetResource)translator.GetObject(L, 4, typeof(SGameEngine.AssetResource));
                    bool _lock_asset = LuaAPI.lua_toboolean(L, 5);

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.try_load_asset_immediately(_asset_path, _type, _result, _lock_asset);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 4 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Type>(L, 3) && translator.Assignable <SGameEngine.AssetResource>(L, 4))
                {
                    string      _asset_path           = LuaAPI.lua_tostring(L, 2);
                    System.Type _type                 = (System.Type)translator.GetObject(L, 3, typeof(System.Type));
                    SGameEngine.AssetResource _result = (SGameEngine.AssetResource)translator.GetObject(L, 4, typeof(SGameEngine.AssetResource));

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.try_load_asset_immediately(_asset_path, _type, _result);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to SGameEngine.ResourceLoader.try_load_asset_immediately!"));
        }
        static int _m_destroy(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            SGameEngine.AssetResource __cl_gen_to_be_invoked = (SGameEngine.AssetResource)translator.FastGetCSObj(L, 1);


            try {
                {
                    __cl_gen_to_be_invoked.destroy(  );



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Пример #10
0
        public IEnumerator ShowAsync(string minimapName)
        {
            if (m_AssetRes != null)
            {
                m_AssetRes.destroy();
                m_AssetRes = null;
            }

            m_AssetRes = new SGameEngine.AssetResource();
            if (mMiniMapRawImage == null)
            {
                yield break;
            }

            if (mMiniMapRawImage.texture != null)
            {
                if (mMiniMapRawImage.texture.name.CompareTo(minimapName.ToString()) == 0)
                {
                    yield break;
                }
            }

            yield return(SGameEngine.ResourceLoader.Instance.StartCoroutine(SGameEngine.ResourceLoader.Instance.load_asset("Assets/Res/UI/Textures/MiniMap/" + minimapName + ".png", typeof(Texture), m_AssetRes)));

            if (m_AssetRes == null || m_AssetRes.asset_ == null)
            {
                if (null != mMiniMapRawImage)
                {
                    mMiniMapRawImage.enabled = false;
                }

                yield break;
            }

            if (null != mMiniMapRawImage)
            {
                mMiniMapRawImage.texture = m_AssetRes.asset_ as Texture;
                mMiniMapRawImage.enabled = true;
                //mMiniMapRawImage.rectTransform.sizeDelta = new Vector2(1920, 1920);
            }
        }
Пример #11
0
        static int _m_instantiate_prefab_from_asset_object(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            SGameEngine.ResourceLoader __cl_gen_to_be_invoked = (SGameEngine.ResourceLoader)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 3 && translator.Assignable <SGameEngine.AssetResource>(L, 2) && translator.Assignable <UnityEngine.Transform>(L, 3))
                {
                    SGameEngine.AssetResource _asset = (SGameEngine.AssetResource)translator.GetObject(L, 2, typeof(SGameEngine.AssetResource));
                    UnityEngine.Transform     parent = (UnityEngine.Transform)translator.GetObject(L, 3, typeof(UnityEngine.Transform));

                    UnityEngine.GameObject __cl_gen_ret = __cl_gen_to_be_invoked.instantiate_prefab_from_asset_object(_asset, parent);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && translator.Assignable <SGameEngine.AssetResource>(L, 2))
                {
                    SGameEngine.AssetResource _asset = (SGameEngine.AssetResource)translator.GetObject(L, 2, typeof(SGameEngine.AssetResource));

                    UnityEngine.GameObject __cl_gen_ret = __cl_gen_to_be_invoked.instantiate_prefab_from_asset_object(_asset);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to SGameEngine.ResourceLoader.instantiate_prefab_from_asset_object!"));
        }
        static int _m_set_obj(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            SGameEngine.AssetResource __cl_gen_to_be_invoked = (SGameEngine.AssetResource)translator.FastGetCSObj(L, 1);


            try {
                {
                    SGameEngine.AssetObject _asset_obj = (SGameEngine.AssetObject)translator.GetObject(L, 2, typeof(SGameEngine.AssetObject));

                    __cl_gen_to_be_invoked.set_obj(_asset_obj);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static int _m_SetAuido(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.MarryFireworkManager.EmitInfo __cl_gen_to_be_invoked = (xc.MarryFireworkManager.EmitInfo)translator.FastGetCSObj(L, 1);


            try {
                {
                    SGameEngine.AssetResource ar = (SGameEngine.AssetResource)translator.GetObject(L, 2, typeof(SGameEngine.AssetResource));

                    __cl_gen_to_be_invoked.SetAuido(ar);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Пример #14
0
            private IEnumerator LoadHandbookAssetAsync(string path)
            {
                var assetRes = new SGameEngine.AssetResource();

                yield return(SGameEngine.ResourceLoader.Instance.StartCoroutine(SGameEngine.ResourceLoader.Instance.load_asset(path, typeof(Texture), assetRes)));

                DestroyAssetRes(); // 需要先销毁旧的图片资源
                mAssetRes = assetRes;
                if (handbookPicture == null)
                {
                    yield break;
                }
                if (mAssetRes == null || mAssetRes.asset_ == null)
                {
                    yield break;
                }
                mTextureObj = mAssetRes.asset_ as Texture;
                if (handbookPicture != null)
                {
                    handbookPicture.texture = mTextureObj;
                    CommonTool.SetActive(handbookPicture.gameObject, true);
                }
            }