Пример #1
0
        public void OnEndDrag(PointerEventData eventData)
        {
            isDrag = false;

            //Post close deploy building area and extra deploy building are
            SpecialCardType cardType = specialCard.cardType;

            //Locked building mode drag deployment code.Dwayne.

            /*
             * if ( cardType == SpecialCardType.Tower || cardType == SpecialCardType.Institute )
             * {
             * if ( EventSystem.current.IsPointerOverGameObject() )
             * {
             * cardType = SpecialCardType.None;
             * }
             *
             * MessageDispatcher.PostMessage( MessageType.DeployBuildingAreaClose, mark );
             * MessageDispatcher.PostMessage( MessageType.CloseCheckBattleFieldObj, GetBuildingType( cardType ) );
             * }
             * else */

            if (cardType == SpecialCardType.Tramcar)
            {
                MessageDispatcher.PostMessage(Constants.MessageType.DeploySquad, GameConstants.UNIT_TRAMCAR_METAID, eventData.position);
            }
            else if (cardType == SpecialCardType.Demolisher)
            {
                MessageDispatcher.PostMessage(Constants.MessageType.DeploySquad, GameConstants.UNIT_DEMOLISHER_METAID, eventData.position);
            }

            MessageDispatcher.PostMessage(MessageType.CloseDeployAreas, mark);
            cardType = SpecialCardType.None;
        }
Пример #2
0
        //Locked building mode drag deployment code.Dwayne.

        /*
         * private BuildingType GetBuildingType( SpecialCardType type )
         * {
         *      if( type == SpecialCardType.Tower )
         *      {
         *              return BuildingType.Tower;
         *      }
         *      else if( type == SpecialCardType.Institute )
         *      {
         *              return BuildingType.Institute;
         *      }
         *
         * return BuildingType.NoneBuilding;
         * }*/

        public void OnDrag(PointerEventData eventData)
        {
            if (!specialCard.canDeploy || specialCard.maskImage.gameObject.activeInHierarchy)
            {
                return;
            }

            SpecialCardType cardType = specialCard.cardType;

            //Locked building mode drag deployment code.Dwayne.

            /*
             * if ( cardType == SpecialCardType.Institute || cardType == SpecialCardType.Tower )
             * {
             *      MessageDispatcher.PostMessage( MessageType.CheckBattleFieldObjPositionChange, eventData.position );
             * }*/
        }
Пример #3
0
        public Card(
            string cardDescription,
            int cardMoveModifier,
            int cardMovePosition,
            int cardMoneyAdded,
            int cardMoneySubtracted,
            bool cardPerPlayer,
            string cardSpecial)
        {
            // Set the variables
            description  = cardDescription;
            moveModifier = cardMoveModifier;
            movePosition = cardMovePosition;
            perPlayer    = cardPerPlayer;

            // Check if the card is subtracting money
            if (cardMoneyAdded == 0)
            {
                moneyModifier -= (int)cardMoneySubtracted;      // Make the moneyModifier negative by subtracting the amountSubtracted from 0
            }
            else
            {
                moneyModifier += (int)cardMoneyAdded;           // Make the moneyModifier positive by adding the amountAdded to 0
            }
            // Check if the card has a special attribute
            if (cardSpecial != "")
            {
                // Set the special attribute
                switch (cardSpecial)
                {
                case "freeJail":
                    specialCardType = SpecialCardType.GetOutOfJailFreeCard;
                    break;

                case "goToJail":
                    specialCardType = SpecialCardType.GoToJailCard;
                    break;

                case "canPassGo":
                    specialCardType = SpecialCardType.CanPassGo;
                    break;
                }
            }
        }
Пример #4
0
        public Card(
            string cardDescription,
            int cardMoveModifier,
            int cardMovePosition,
            int cardMoneyAdded,
            int cardMoneySubtracted,
            bool cardPerPlayer,
            string cardSpecial)
        {
            // Set the variables
            description = cardDescription;
            moveModifier = cardMoveModifier;
            movePosition = cardMovePosition;
            perPlayer = cardPerPlayer;

            // Check if the card is subtracting money
            if (cardMoneyAdded == 0)
                moneyModifier -= (int)cardMoneySubtracted;      // Make the moneyModifier negative by subtracting the amountSubtracted from 0
            else
                moneyModifier += (int)cardMoneyAdded;           // Make the moneyModifier positive by adding the amountAdded to 0

            // Check if the card has a special attribute
            if (cardSpecial != "")
            {

                // Set the special attribute
                switch (cardSpecial)
                {
                    case "freeJail":
                        specialCardType = SpecialCardType.GetOutOfJailFreeCard;
                        break;
                    case "goToJail":
                        specialCardType = SpecialCardType.GoToJailCard;
                        break;
                    case "canPassGo":
                        specialCardType = SpecialCardType.CanPassGo;
                        break;
                }
            }
        }
Пример #5
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            isDrag = true;

            if (!specialCard.canDeploy || specialCard.maskImage.gameObject.activeInHierarchy)
            {
                return;
            }

            ClosePopUp();

            SpecialCardType cardType = specialCard.cardType;

            //Locked building mode drag deployment code.Dwayne.

            /*
             * if ( cardType == SpecialCardType.Institute || cardType == SpecialCardType.Tower )
             * {
             * MessageDispatcher.PostMessage( MessageType.OpenCheckBattleFieldObj, GetBuildingType( cardType ), eventData.pressPosition );
             * MessageDispatcher.PostMessage( MessageType.DeployBuildingAreaOpen, mark );
             * }*/

            MessageDispatcher.PostMessage(MessageType.ShowDeployAreas, mark);
        }
Пример #6
0
        public int GetSpecialCost(SpecialCardType specialIndex, out int limitNum)
        {
            //Locked building mode drag deployment code. Dwayne.

            /*if ( instituteCost == 0 )
             * {
             *  instituteCost = instituteProtoData.Find( p => p.ID == Constants.GameConstants.INSTITUTE_ID ).DeploymentCost;
             *
             *  if ( towerProtoData.Count > 0 )
             *  {
             *      towerCost = towerProtoData[0].DeploymentCost;
             *  }
             *  else
             *  {
             *      DebugUtils.LogError( DebugUtils.Type.UI, "There can't find towerPorotoData,check table and logic." );
             *  }
             * }*/

            if (tramCarCost == 0)
            {
                UnitsProto.Unit unit = dataManager.unitsProtoData.Find(p => p.ID == Constants.GameConstants.UNIT_TRAMCAR_METAID);
                tramCarCost     = unit.DeploymentCost;
                tramCarLimitNum = unit.MaxMembers;
            }

            if (demolisherCost == 0)
            {
                UnitsProto.Unit unit = dataManager.unitsProtoData.Find(p => p.ID == Constants.GameConstants.UNIT_DEMOLISHER_METAID);
                demolisherCost     = unit.DeploymentCost;
                demolisherLimitNum = unit.MaxMembers;
            }

            int cost = 0;

            switch (specialIndex)
            {
            //Locked building mode drag deployment code. Dwayne.

            /*
             *  case SpecialCardType.Institute:
             *  {
             * cost = instituteCost;
             *      limitNum = GameConstants.INSTITUTE_DEPLOYMENT_LIMIT;
             * break;
             *  }
             *  case SpecialCardType.Tower:
             *  {
             * cost = towerCost;
             *      limitNum = GameConstants.TOWER_DEPLOYMENT_LIMIT;
             * break;
             *  }*/
            case SpecialCardType.Tramcar:
            {
                cost     = tramCarCost;
                limitNum = tramCarLimitNum;
                break;
            }

            case SpecialCardType.Demolisher:
            {
                cost     = tramCarCost;
                limitNum = demolisherLimitNum;
                break;
            }

            default:
            {
                DebugUtils.LogError(DebugUtils.Type.UI, string.Format("Can't handle this SpecialCardType {0} now", specialIndex));
                limitNum = -1;
                break;
            }
            }
            return(cost);
        }
Пример #7
0
 public SpecialCard(SpecialCardType specialMoveType)
 {
     CardType = specialMoveType;
 }