Example #1
0
    public override void DragComponent_OnMouseUp(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Ship ship, Vector3 dragLastPosition, Vector3 dragBeginPosition, Quaternion dragBeginQuaternion)
    {
        base.DragComponent_OnMouseUp(boardAreaType, slots, moduleMech, ship, dragLastPosition, dragBeginPosition, dragBeginQuaternion);
        if (DragManager.Instance.IsCanceling)
        {
            DragManager.Instance.IsCanceling = false;
            CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
            return;
        }

        ClientPlayer.BattlePlayer.BattleGroundManager.StopShowSlotBloom();
        if (boardAreaType != ClientPlayer.BattlePlayer.HandArea) //离开手牌区域
        {
            foreach (Slot sa in slots)
            {
                if (CheckMechCanEquipMe(sa, out string info))
                {
                    summonEquipRequest(sa.Mech, dragLastPosition);
                    return;
                }
                else
                {
                    AudioManager.Instance.SoundPlay("sfx/OnSelectMechFalse");
                    NoticeManager.Instance.ShowInfoPanelCenter(info, 0, 1f);
                    CancelPlayOut(dragBeginPosition, dragBeginQuaternion); //收回
                }
            }
        }
        else
        {
            CancelPlayOut(dragBeginPosition, dragBeginQuaternion); //收回
        }
    }
Example #2
0
    public void Initialize(ClientPlayer clientPlayer)
    {
        ResetAll();
        RefreshBattlePlayerSize();
        ClientPlayer       = clientPlayer;
        transform.rotation = ClientPlayer.WhichPlayer == Players.Self ? Quaternion.Euler(0, 0, 0) : Quaternion.Euler(0, 180, 0);
        HandManager.Initialize(ClientPlayer);
        BattleGroundManager.Initialize(ClientPlayer);
        MetalLifeEnergyManager.Initialize(ClientPlayer);
        PlayerBuffManager.Initialize(ClientPlayer);
        PlayerCoolDownCardManager.Initialize(ClientPlayer);
        CardDeckManager.Initialize(ClientPlayer);
        Ship.Initialize(ClientPlayer);

        HandArea         = clientPlayer.WhichPlayer == Players.Self ? BoardAreaTypes.SelfHandArea : BoardAreaTypes.EnemyHandArea;
        BattleGroundArea = clientPlayer.WhichPlayer == Players.Self ? BoardAreaTypes.SelfBattleGroundArea : BoardAreaTypes.EnemyBattleGroundArea;
    }
Example #3
0
    public override void DragComponent_OnMouseUp(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Ship ship, Vector3 dragLastPosition, Vector3 dragBeginPosition, Quaternion dragBeginQuaternion)
    {
        base.DragComponent_OnMouseUp(boardAreaType, slots, moduleMech, ship, dragLastPosition, dragBeginPosition, dragBeginQuaternion);
        RoundManager.Instance.HideTargetPreviewArrow();

        if (DragManager.Instance.IsCanceling)
        {
            DragManager.Instance.IsCanceling = false;
            return;
        }

        if (moduleMech)
        {
            if (moduleMech.ClientPlayer != ClientPlayer)
            {
                if (moduleMech.CheckModuleMechCanAttackMe(this))
                {
                    MechAttackMechRequest request = new MechAttackMechRequest(ClientPlayer.ClientId, M_MechID, RoundManager.Instance.EnemyClientPlayer.ClientId, moduleMech.M_MechID);
                    Client.Instance.Proxy.SendMessage(request);
                }
                else
                {
                    NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("ModuleMech_ShouldAttackDefenderFirst"), 0, 0.5f);
                }
            }
        }
        else if (ship)
        {
            if (ship.ClientPlayer != ClientPlayer)
            {
                if (ship.CheckModuleMechCanAttackMe(this) != 0)
                {
                    MechAttackShipRequest request = new MechAttackShipRequest(Client.Instance.Proxy.ClientID, M_MechID);
                    Client.Instance.Proxy.SendMessage(request);
                }
                else
                {
                    NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("ModuleMech_ShouldAttackMechsFirst"), 0, 0.5f);
                }
            }
        }

        DragManager.Instance.DragOutDamage = 0;
    }
Example #4
0
 public virtual void DragComponent_OnMouseUp(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Ship ship, Vector3 dragLastPosition, Vector3 dragBeginPosition, Quaternion dragBeginQuaternion)
 {
     ClientPlayer.BattlePlayer.HandManager.IsBeginDrag = false;
 }
Example #5
0
 public virtual void DragComponent_OnMousePressed(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Vector3 dragLastPosition)
 {
 }
Example #6
0
 public virtual void DragComponent_OnMouseUp(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Ship ship, Vector3 dragLastPosition, Vector3 dragBeginPosition, Quaternion dragBeginQuaternion)
 {
 }
Example #7
0
    public override void DragComponent_OnMouseUp(BoardAreaTypes boardAreaType, List <Slot> slots, ModuleMech moduleMech, Ship ship, Vector3 dragLastPosition, Vector3 dragBeginPosition, Quaternion dragBeginQuaternion)
    {
        base.DragComponent_OnMouseUp(boardAreaType, slots, moduleMech, ship, dragLastPosition, dragBeginPosition, dragBeginQuaternion);
        RoundManager.Instance.HideTargetPreviewArrow();

        if (DragManager.Instance.IsCanceling)
        {
            DragManager.Instance.IsCanceling = false;
            CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
            return;
        }

        if (boardAreaType != ClientPlayer.BattlePlayer.HandArea) //离开手牌区域
        {
            if (!CardInfo.TargetInfo.HasTargetMech && !CardInfo.TargetInfo.HasTargetEquip && !CardInfo.TargetInfo.HasTargetShip)
            {
                summonSpellRequest();
                return;
            }
            else
            {
                if (CardInfo.TargetInfo.HasTargetMech)
                {
                    //To Mech
                    if (moduleMech == null || moduleMech.IsDead)
                    {
                        CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
                    }
                    else
                    {
                        bool validTarget = false;
                        switch (CardInfo.TargetInfo.targetMechRange)
                        {
                        case TargetRange.None:
                            validTarget = false;
                            break;

                        case TargetRange.Mechs:
                            validTarget = true;
                            break;

                        case TargetRange.SelfMechs:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyMechs:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.Heroes:
                            if (!moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.SelfHeroes:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.SelfClientPlayer && !moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyHeroes:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.EnemyClientPlayer && !moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.Soldiers:
                            if (moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.SelfSoldiers:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.SelfClientPlayer && moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemySoldiers:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.EnemyClientPlayer && moduleMech.CardInfo.MechInfo.IsSoldier)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.AllLife:
                            validTarget = true;
                            break;

                        case TargetRange.SelfLife:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyLife:
                            if (moduleMech.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;
                        }

                        if (validTarget)
                        {
                            summonSpellRequestToMech(moduleMech);
                            return;
                        }
                        else
                        {
                            AudioManager.Instance.SoundPlay("sfx/OnSelectMechFalse");
                            NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("CardSpell_SelectCorrectMech"), 0, 1f);
                        }
                    }
                }

                if (CardInfo.TargetInfo.HasTargetEquip)
                {
                    //To Equip
                    if (slots.Count == 0)
                    {
                        CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
                    }
                    else
                    {
                        ModuleEquip equip = slots[0].Mech.MechEquipSystemComponent.GetEquipBySlotType(slots[0].MSlotTypes);
                        if (equip == null || equip.M_ModuleMech.IsDead)
                        {
                            CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
                        }
                        else
                        {
                            bool validTarget = false;
                            switch (CardInfo.TargetInfo.targetEquipRange)
                            {
                            case TargetRange.None:
                                validTarget = false;
                                break;

                            case TargetRange.Mechs:
                                validTarget = true;
                                break;

                            case TargetRange.SelfMechs:
                                if (equip.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.EnemyMechs:
                                if (equip.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.Heroes:
                                if (!equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.SelfHeroes:
                                if (equip.ClientPlayer == RoundManager.Instance.SelfClientPlayer && !equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.EnemyHeroes:
                                if (equip.ClientPlayer == RoundManager.Instance.EnemyClientPlayer && !equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.Soldiers:
                                if (equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.SelfSoldiers:
                                if (equip.ClientPlayer == RoundManager.Instance.SelfClientPlayer && equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.EnemySoldiers:
                                if (equip.ClientPlayer == RoundManager.Instance.EnemyClientPlayer && equip.CardInfo.MechInfo.IsSoldier)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.AllLife:
                                validTarget = true;
                                break;

                            case TargetRange.SelfLife:
                                if (equip.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                                {
                                    validTarget = true;
                                }
                                break;

                            case TargetRange.EnemyLife:
                                if (equip.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                                {
                                    validTarget = true;
                                }
                                break;
                            }

                            if (validTarget)
                            {
                                summonSpellRequestToEquip(equip);
                                return;
                            }
                            else
                            {
                                AudioManager.Instance.SoundPlay("sfx/OnSelectMechFalse");
                                NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("CardSpell_SelectCorrectEquip"), 0, 1f);
                            }
                        }
                    }
                }

                if (CardInfo.TargetInfo.HasTargetShip)
                {
                    // ToShip
                    if (!ship) //带目标法术卡未指定目标,则收回
                    {
                        CancelPlayOut(dragBeginPosition, dragBeginQuaternion);
                    }
                    else
                    {
                        bool validTarget = false;
                        switch (CardInfo.TargetInfo.targetShipRange)
                        {
                        case TargetRange.Ships:
                            validTarget = true;
                            break;

                        case TargetRange.SelfShip:
                            if (ship.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyShip:
                            if (ship.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.Decks:
                            validTarget = true;
                            break;

                        case TargetRange.SelfDeck:
                            if (ship.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyDeck:
                            if (ship.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.AllLife:
                            validTarget = true;
                            break;

                        case TargetRange.SelfLife:
                            if (ship.ClientPlayer == RoundManager.Instance.SelfClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;

                        case TargetRange.EnemyLife:
                            if (ship.ClientPlayer == RoundManager.Instance.EnemyClientPlayer)
                            {
                                validTarget = true;
                            }
                            break;
                        }

                        if (validTarget)
                        {
                            summonSpellRequestToShip(ship);
                            return;
                        }
                        else
                        {
                            AudioManager.Instance.SoundPlay("sfx/OnSelectMechFalse");
                            NoticeManager.Instance.ShowInfoPanelCenter(LanguageManager.Instance.GetText("CardSpell_SelectCorrectShip"), 0, 1f);
                        }
                    }
                }
            }

            DragManager.Instance.DragOutDamage = 0;
        }

        transform.SetPositionAndRotation(dragBeginPosition, dragBeginQuaternion); //如果脱手地方还在手中,则收回
        ClientPlayer.BattlePlayer.HandManager.RefreshCardsPlace();
    }