Beispiel #1
0
        protected override void Run(Session session, M2C_UseSkill message)
        {
            UnitComponent uc     = session.DomainScene().CurrentScene().GetComponent <UnitComponent>();
            Unit          sender = uc.Get(message.Sender);

            if (sender == null)
            {
                return;
            }

            var combatU = sender.GetComponent <CombatUnitComponent>();

            if (combatU != null && combatU.TryGetSkillAbility(message.SkillConfigId, out SkillAbility skill))
            {
                if (skill.SkillConfig.PreviewType == SkillPreviewType.SelectCircularInCircularArea)
                {
                    combatU.GetComponent <SpellComponent>().SpellWithPoint(skill, new Vector3(message.X, message.Y, message.Z));
                }
                else if (skill.SkillConfig.PreviewType == SkillPreviewType.SelectTarget)
                {
                    var aim = uc.Get(message.Reciver);
                    if (aim != null)
                    {
                        combatU.GetComponent <SpellComponent>().SpellWithTarget(skill, aim.GetComponent <CombatUnitComponent>());
                    }
                    else
                    {
                        combatU.GetComponent <SpellComponent>().SpellWithTarget(skill, null);
                        return;
                    }
                }
                else if (skill.SkillConfig.PreviewType == SkillPreviewType.SelectRectangleArea)
                {
                    combatU.GetComponent <SpellComponent>().SpellWithDirect(skill, new Vector3(message.X, message.Y, message.Z));
                }
                else
                {
                    Log.Error("未处理的类型" + skill.SkillConfig.PreviewType);
                }
            }
            else
            {
                Log.Error("技能不存在");
                return;
            }
        }
        protected override async ETTask Run(Session session, M2C_CreateUnits message)
        {
            UnitComponent unitComponent = Game.Scene.GetComponent <UnitComponent>();

            foreach (UnitInfo unitInfo in message.Units)
            {
                if (unitComponent.Get(unitInfo.UnitId) != null)
                {
                    continue;
                }
                Unit unit = UnitFactory.Create(Game.Scene, unitInfo);
            }

            await ETTask.CompletedTask;
        }
Beispiel #3
0
        protected override async ETVoid Run(Session session, M2C_CreateUnits message)
        {
            UnitComponent unitComponent = session.Domain.GetComponent <UnitComponent>();

            foreach (UnitInfo unitInfo in message.Units)
            {
                if (unitComponent.Get(unitInfo.UnitId) != null)
                {
                    continue;
                }
                Unit unit = UnitFactory.Create(session.Domain, unitInfo.UnitId);
                unit.Position = new Vector3(unitInfo.X, unitInfo.Y, unitInfo.Z);
            }

            await ETTask.CompletedTask;
        }
Beispiel #4
0
        protected override async ETVoid Run(Session session, M2C_CreateUnits message)
        {
            Log.Debug("我收到了 创建Unit的服务器消息");

            UnitComponent unitComponent = session.Domain.GetComponent <UnitComponent>();

            foreach (UnitInfo unitInfo in message.Units)
            {
                if (unitComponent.Get(unitInfo.UnitId) != null)
                {
                    continue;
                }
                Unit unit = UnitFactory.Create(session.Domain, unitInfo);
            }

            await ETTask.CompletedTask;
        }
Beispiel #5
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;

                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);
            }
        }