Пример #1
0
    public static CardEntity GetCardByCardId(int cardId, int userId)
    {
        DbCommand comm = GenericDataAccess.CreateCommand();
        comm.CommandText = "GetCardByCardId_v4";
        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@CardID";
        param.Value = cardId;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@UserID";
        param.Value = userId;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        CardEntity card = new CardEntity();
        DataTable dt = GenericDataAccess.ExecuteCommand(comm);
        if (dt.Rows.Count > 0)
        {
            card.CardID = Int32.Parse(dt.Rows[0]["CardID"].ToString());
            card.CardName = dt.Rows[0]["CardName"].ToString();
            card.CardMoney = Double.Parse(dt.Rows[0]["CardMoney"].ToString());
            card.CardLive = Int32.Parse(dt.Rows[0]["CardLive"].ToString());
            card.Synchronize = Int32.Parse(dt.Rows[0]["Synchronize"].ToString());
        }

        return card;
    }
Пример #2
0
 public void AddCard(CardEntity card)
 {
     cards.Add(card);
     RefreshPositions();
     // Do this after refreshing positions or the lerpattractor will get confused about scale:
     card.transform.parent = cardFan.transform;
 }
Пример #3
0
    void Start () {
        card = GameManager.Instance.GetEntity(data.cardId) as CardEntity;
        if(data.x >= 0)
        {
            UnitSlot slot = GameManager.Instance.gameBoard.GetSlot(data.x, data.y);
        }
        flyTimer = flyDelay;
	}
Пример #4
0
    void Start () {
        card = (CardEntity) GameManager.Instance.GetEntity(data.cardId);
        card.Alpha = 0;
        if(card.EntityView.owner == GameManager.Instance.MyPlayer.playerName)
        {
            GameManager.Instance.playerHand.RemoveCard(card);
        }
        else
        {
            GameManager.Instance.opponentHand.RemoveCard(card);
        }
	}
Пример #5
0
    //同步钱包//
    public static bool SyncCardInsert(CardEntity card)
    {
        DbCommand comm = GenericDataAccess.CreateCommand();
        comm.CommandText = "SyncCardInsert_v4";
        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@CardID";
        param.Value = card.CardID;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@CardName";
        param.Value = card.CardName;
        param.DbType = DbType.String;
        param.Size = 20;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@CardMoney";
        param.Value = card.CardMoney;
        param.DbType = DbType.Double;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@UserID";
        param.Value = card.UserID;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@CardLive";
        param.Value = card.CardLive;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        param = comm.CreateParameter();
        param.ParameterName = "@Synchronize";
        param.Value = card.Synchronize;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        int result = -1;
        try
        {
            result = GenericDataAccess.ExecuteNonQuery(comm);
        }
        catch
        {
        }

        return (result != -1);
    }
Пример #6
0
    void Start()
    {
        elapsed = 0;
        card = GameManager.Instance.GetEntity(data.cardView.id) as CardEntity;
        GameManager.Instance.opponentHand.RemoveCard(card);
        if(card == null)
        {
            Debug.LogError("Card not found");
            enabled = false;
        }
        card.EntityView = data.cardView;
        card.lerpTransform.SetTransform(GameManager.Instance.gameBoard.cardReveal, 0.5f);

        if (data.cardView.column >= 0)
        {
            slot = GameManager.Instance.gameBoard.GetSlot(data.cardView.column, data.cardView.row);
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int cardId = Int32.Parse(Request.Form["cardid"].ToString());
        string cardName = Request.Form["cardname"].ToString();
        double cardMoney = Double.Parse(Request.Form["cardmoney"].ToString());
        int cardLive = Int32.Parse(Request.Form["cardlive"].ToString());
        int userId = Int32.Parse(Request.Form["userid"].ToString());

        CardEntity card = new CardEntity();
        card.CardID = cardId;
        card.CardName = cardName;
        card.CardMoney = cardMoney;
        card.UserID = userId;
        card.CardLive = cardLive;
        card.Synchronize = 0;

        bool success = SyncHelper.SyncCheckCardIsExists(cardId, userId);
        if (success)
        {
            success = SyncHelper.SyncCardUpdate(card);
        }
        else
        {
            success = SyncHelper.SyncCardInsert(card);
        }

        string result = "{";
        if (success)
        {
            result += "\"result\":\"ok\"";
        }
        else
        {
            result += "\"result\":\"error\"";
        }
        result += "}";

        Response.Write(result);
        Response.End();
    }
Пример #8
0
 // Use this for initialization
 void Start () {
     card = GameManager.Instance.GetEntity(data.causeId) as CardEntity;
     if (data.playerName == GameManager.Instance.MyPlayer.playerName)
     {
         isPlayer = true;
     }
     else
     {
         isPlayer = false;
         if(data.resource == "ENERGY_RESOURCE")
         {
             UIManager.Instance.enemyEnergy.text = data.amount + " / " + GameManager.Instance.OpponentPlayer.GetMaxResource("ENERGY_RESOURCE");
         }
         else
         {
             UIManager.Instance.enemyMinerals.text = data.amount + " / " + GameManager.Instance.OpponentPlayer.GetMaxResource("MINERAL_RESOURCE");
         }
         
         Remove();
     }
     flyTimer = flyDelay;
 }
Пример #9
0
    //添加类别操作
    protected void Button1_Click(object sender, EventArgs e)
    {
        string cardName = this.CardNameEmpIns.Text.Trim();
        if (cardName == "")
        {
            Utility.Alert(this, "名称未填写!");
            return;
        }
        string cardMoney = this.CardMoneyEmpIns.Text.Trim();
        if (cardMoney != "")
        {
            if (!ValidHelper.CheckDouble(cardMoney))
            {
                Utility.Alert(this, "余额填写错误!");
                return;
            }
        }
        else
        {
            cardMoney = "0";
        }

        CardEntity card = new CardEntity();
        card.CardName = cardName;
        card.CardMoney = Double.Parse(cardMoney);
        card.UserID = userId;
        card.CardLive = 1;
        card.Synchronize = 1;

        bool success = CardAccess.InsertCard(card);
        if (success)
        {
            Utility.Alert(this, "添加成功。", "UserCardAdmin.aspx");
        }
        else
        {
            Utility.Alert(this, "添加失败!");
        }
    }
		public Point GetCenterPos(CardEntity entity, bool top)
		{
			var xOffset = entity.ActualWidth / 2;
			var yOffset = entity.ActualHeight / 2;
			if(top)
				yOffset -= 12;
			else
			{
				yOffset += 12;
				yOffset *= -1;
			}
			var x = GetPosition(entity).X + xOffset;
			var y = GetPosition(entity).Y + yOffset;
			return new Point(x, y);
		}
Пример #11
0
 void Start()
 {
     card = GameManager.Instance.GetEntity(command.CardEntityId).GetComponent<CardEntity>();
     transform.position = card.transform.position;
     card.lerpTransform.SetTransform(cardEnlarged, enlargeTime);
 }
Пример #12
0
 public void RemoveCard(CardEntity card)
 {
     cards.Remove(card);
     RefreshPositions();
 }
Пример #13
0
    //类别更新操作
    protected void CardList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int cardId = Int32.Parse(CardList.DataKeys[e.RowIndex].Value.ToString());
        TextBox cardNameBox = (TextBox)CardList.Rows[e.RowIndex].FindControl("CardNameBox");
        string cardName = cardNameBox.Text.Trim();
        if (cardName == "")
        {
            Utility.Alert(this, "名称未填写!");
            return;
        }
        TextBox cardMoneyBox = (TextBox)CardList.Rows[e.RowIndex].FindControl("CardMoneyBox");
        string cardMoney = cardMoneyBox.Text.Trim();
        if (!ValidHelper.CheckDouble(cardMoney))
        {
            Utility.Alert(this, "余额填写错误!");
            return;
        }

        bool success = false;
        if (cardId == 0)
        {
            success = UserAccess.UpdateUserMoneyNew(userId, Double.Parse(cardMoney));
        }
        else
        {
            CardEntity card = new CardEntity();
            card.CardID = cardId;
            card.CardName = cardName;
            card.CardMoney = Double.Parse(cardMoney);
            card.UserID = userId;
            card.CardLive = 1;
            card.Synchronize = 1;

            success = CardAccess.UpdateCard(card);
        }

        if (success)
        {
            Utility.Alert(this, "更新成功。");

            CardList.EditIndex = -1;
            BindGrid();
        }
        else
        {
            Utility.Alert(this, "更新失败!");
        }
    }