Ejemplo n.º 1
0
        public static async ETVoid EnterMapAsync(Scene zoneScene, string sceneName)
        {
            try
            {
                /*
                 * // 加载Unit资源
                 * ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
                 * await resourcesComponent.LoadBundleAsync($"unit.unity3d");
                 *
                 * // 加载场景资源
                 * await Game.Scene.GetComponent<ResourcesComponent>().LoadBundleAsync("map.unity3d");
                 * // 切换到map场景
                 * using (SceneChangeComponent sceneChangeComponent = Game.Scene.AddComponent<SceneChangeComponent>())
                 * {
                 *  await sceneChangeComponent.ChangeSceneAsync(sceneName);
                 * }
                 */
                G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;

                //Game.Scene.AddComponent<OperaComponent>();

                Game.EventSystem.Publish(new EventType.EnterMapFinish()
                {
                    ZoneScene = zoneScene
                });
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 2
0
        public static async ETVoid EnterMapAsync(string sceneName)
        {
            try
            {
                // 加载Unit资源
                ResourcesComponent resourcesComponent = ET.Game.Scene.GetComponent <ResourcesComponent>();
                await resourcesComponent.LoadBundleAsync($"unit.unity3d");

                // 加载场景资源
                await ET.Game.Scene.GetComponent <ResourcesComponent>().LoadBundleAsync("map.unity3d");

                // 切换到map场景
                using (SceneChangeComponent sceneChangeComponent = ET.Game.Scene.AddComponent <SceneChangeComponent>())
                {
                    await sceneChangeComponent.ChangeSceneAsync(sceneName);
                }

                G2C_EnterMap g2CEnterMap = await ET.SessionComponent.Instance.Session.Call(new C2G_EnterMap()) as G2C_EnterMap;

                PlayerComponent.Instance.MyPlayer.UnitId = g2CEnterMap.UnitId;

                Game.Scene.AddComponent <OperaComponent>();

                Game.EventSystem.Publish(new EventType.EnterMapFinish());
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 3
0
        public static async ETVoid EnterMapAsync(Scene zoneScene, string sceneName)
        {
            try
            {
                G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;

                Game.EventSystem.Publish(new EventType.EnterMapFinish()
                {
                    ZoneScene = zoneScene
                }).Coroutine();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 4
0
        public static async ETTask EnterMapAsync(Scene zoneScene)
        {
            try
            {
                G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;

                zoneScene.GetComponent <PlayerComponent>().MyId = g2CEnterMap.MyId;
                Game.EventSystem.Publish(new EventType.EnterMapFinish()
                {
                    ZoneScene = zoneScene
                });
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Ejemplo n.º 5
0
        public static async ETTask EnterMapAsync(Scene zoneScene)
        {
            try
            {
                G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent <SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;

                UnitComponent unitComponent = zoneScene.GetComponent <UnitComponent>();
                unitComponent.MyUnit = unitComponent.Get(g2CEnterMap.UnitId);

                Game.EventSystem.Publish(new EventType.EnterMapFinish()
                {
                    ZoneScene = zoneScene
                }).Coroutine();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }