Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (!isVisible)                                  //if the player is out of bounds
     {
         posType currentPosition = getPositionType(); //gets current player position (refer back to the enum)
         setPointerPosition(currentPosition);         //sets pointer's position
         setPointerRotation(currentPosition);         //sets pointer's rotation
     }
 }
 public void setPosPieces(posType type, posSide side, int x, int y)
 {
     if (x < 0 || x > 9 || y < 0 || y > 10)
     {
         MessageBox.Show("error setPosPieces out of range");
     }
     else
     {
         board[x][y][0] = type.ToString();
         board[x][y][1] = side.ToString();
     }
 }
Exemplo n.º 3
0
    private posType getPositionType()       //gets current player position (refer back to the enum)
    {
        posType pos = posType.other;

        if (playerTransform.position.y > screenMax.y)     //out of the screen (top)
        {
            if (playerTransform.position.x > screenMax.x) //also out on the right
            {
                pos = posType.topRight;
            }
            else if (playerTransform.position.x < screenMin.x)      //also out on the left
            {
                pos = posType.topLeft;
            }
            else                                                    //not out on the horizontal axis
            {
                pos = posType.top;
            }
        }
        else if (playerTransform.position.y < screenMin.y)   //out of the screen (bottom)
        {
            if (playerTransform.position.x > screenMax.x)    //out of the screen (right)
            {
                pos = posType.bottomRight;
            }
            else if (playerTransform.position.x < screenMin.x)   //out of the screen (left)
            {
                pos = posType.bottomLeft;
            }
            else
            {
                pos = posType.bottom;
            }
        }
        else                                              //not out on the top
        {
            if (playerTransform.position.x > screenMax.x) //out of the screen (right)
            {
                pos = posType.right;
            }
            else if (playerTransform.position.x < screenMin.x)   //out of the screen (left)
            {
                pos = posType.left;
            }
        }
        return(pos);
    }
Exemplo n.º 4
0
    private void setPointerPosition(posType pos) //sets position, based on the position variable
    {
        Vector2 newPosition;                     //new pointer position

        switch (pos)
        {
        case (posType.topRight):
            newPosition = new Vector2(screenMax.x - 1, screenMax.y - 1);
            break;

        case (posType.topLeft):
            newPosition = new Vector2(screenMin.x + 1, screenMax.y - 1);
            break;

        case (posType.top):
            newPosition = new Vector2(playerTransform.position.x, screenMax.y - 1);
            break;

        case (posType.right):
            newPosition = new Vector2(screenMax.x - 1, playerTransform.position.y);
            break;

        case (posType.left):
            newPosition = new Vector2(screenMin.x + 1, playerTransform.position.y);
            break;

        case (posType.bottomRight):
            newPosition = new Vector2(screenMax.x - 1, screenMin.y + 1);
            break;

        case (posType.bottomLeft):
            newPosition = new Vector2(screenMin.x + 1, screenMin.y + 1);
            break;

        case (posType.bottom):
            newPosition = new Vector2(playerTransform.position.x, screenMin.y + 1);
            break;

        default:
            newPosition = new Vector2(playerTransform.position.x, playerTransform.position.y);
            break;
        }
        pointerTransform.position = newPosition;    //set new position
    }
Exemplo n.º 5
0
 void ChangeType()
 {
     if(Input.GetKey(KeyCode.A) && currentPos == posType.CENTER)
     {
         currentPos = posType.LEFT;
     }
     if (Input.GetKey(KeyCode.D) && currentPos == posType.CENTER)
     {
         currentPos = posType.RIGHT;
     }
     if (Input.GetKey(KeyCode.A) && currentPos == posType.RIGHT)
     {
         currentPos = posType.CENTER;
     }
     if (Input.GetKey(KeyCode.D) && currentPos == posType.LEFT)
     {
         currentPos = posType.CENTER;
     }
 }
Exemplo n.º 6
0
    private void setPointerRotation(posType pos)
    {
        switch (pos)
        {
        case posType.topRight:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 45);
            break;

        case posType.topLeft:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 135);
            break;

        case posType.top:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 90);
            break;

        case posType.right:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 0);
            break;

        case posType.left:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 180);
            break;

        case (posType.bottomRight):
            pointerTransform.rotation = Quaternion.Euler(0, 0, -45);
            break;

        case (posType.bottomLeft):
            pointerTransform.rotation = Quaternion.Euler(0, 0, -135);
            break;

        case (posType.bottom):
            pointerTransform.rotation = Quaternion.Euler(0, 0, -90);
            break;

        default:
            pointerTransform.rotation = Quaternion.Euler(0, 0, 0);
            break;
        }
    }
Exemplo n.º 7
0
        private List<cardOptionItem> getCardOptionListByPosId(int posId, posType postype, int langId, decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency)
        {
            var posItem = getBankPosByType(postype, langId).Where(a => a.bankPosId == posId).FirstOrDefault();

            // posItem is Valid
            if (posItem != null)
            {
                db.Entry(posItem).Collection(p => p.tbl_bankPosOption).Load();
                var posOptionList = posItem.tbl_bankPosOption;

                List<cardOptionItem> helperList = new List<cardOptionItem>();

                // Add Defult Option => Tek Çekim
                helperList.Add(getDefaultOption(cargoAndProductPrice, priceStrFormat, currency));

                foreach (var item in posOptionList)
                {
                    if (item.minBasketAmount <= cargoAndProductPrice)
                    {
                        cardOptionItem helper = new cardOptionItem();
                        helper.monthStr = item.paymentCount.ToString();

                        var calc = getInstallmentAmount(cargoAndProductPrice, item.paymentCount, item.additionalAmount);

                        helper.totalPrice = calc.Item2;
                        helper.monthPrice = calc.Item1;
                        helper.bankPosOptionId = item.bankPosOptionId;
                        helper.totalPriceStr = helper.totalPrice.ToString("F2", priceStrFormat) + " " + currency;
                        helper.monthPriceStr = helper.monthPrice.ToString("F2", priceStrFormat) + " " + currency;

                        helperList.Add(helper);
                    }
                }

                return helperList;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 8
0
        internal List<cardOptionItem> getCardOptionList(int langId, decimal cargoAndProductPrice, string cardNo, posType postype, CultureInfo priceStrFormat, string currency)
        {
            var posList = getBankPosByType(postype, langId);

            int posId = 0;
            foreach (var item in posList)
            {
                // Get Pos Class
                var posItem = getPosClass(item.posCode);
                if (posItem != null)
                {
                    // Is Card Relative Pos
                    if (posItem.isBinExist(cardNo))
                    {
                        posId = item.bankPosId;
                        break;
                    }
                }
            }

            // Taksitli
            if (posId != 0)
            {
                return getCardOptionListByPosId(posId, postype, langId, cargoAndProductPrice, priceStrFormat, currency);
            }
            else // Tek çekim Main Pos
            {
                return getMainPosOption(postype, langId, cargoAndProductPrice, priceStrFormat, currency);
            }
        }
Exemplo n.º 9
0
 public Horse(posType pType, posSide pSide) : base()
 {
 }
Exemplo n.º 10
0
 public General(posType pType, posSide pSide) : base(pType, pSide)
 {
 }
Exemplo n.º 11
0
 public Guard(posType pType, posSide pSide) : base(pType, pSide)
 {
 }
Exemplo n.º 12
0
 public Cannon(posType pType, posSide pSide) : base(pType, pSide)
 {
 }
Exemplo n.º 13
0
 public Elephant(posType pType, posSide pSide) : base(pType, pSide)
 {
 }
Exemplo n.º 14
0
 public Pieces(posType pType, posSide pSide)
 {
     this.side = pSide.ToString();
     this.type = pType.ToString();
 }
Exemplo n.º 15
0
        private List<cardOptionItem> getMainPosOption(posType postype, int langId, decimal cargoAndProductPrice, CultureInfo priceStrFormat, string currency)
        {
            var posItem = getBankPosByType(postype, langId).Where(a => a.isMainPos).FirstOrDefault();

            if (posItem != null)
            {
                List<cardOptionItem> helperList = new List<cardOptionItem>();

                // Only Add Defult Option => Tek Çekim
                helperList.Add(getDefaultOption(cargoAndProductPrice, priceStrFormat, currency));
                return helperList;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 16
0
 public Chariot(posType pType, posSide pSide) : base(pType, pSide)
 {
 }
Exemplo n.º 17
0
 public List<tbl_bankPos> getBankPosByType(posType postype, int iangId)
 {
     return db.tbl_bankPos.Include("tbl_bank").Where(a => a.tbl_bank != null && a.tbl_bank.statu && a.statu && a.posTypeId == (int)postype).ToList();
 }
Exemplo n.º 18
0
 public Soldier(posType pType, posSide pSide) : base(pType, pSide)
 {
 }