public int SetNthStage(int total, int stageindex, QuestController Qc, bool EquipmentAllowed) { int nthTotal = 0; int ID = this.playerID; List <int> Indexes = new List <int>(); int index = StrongestFoe(Qc); FoeCard FC = (FoeCard)Qc.hands[playerID].cards[index]; nthTotal += FC.BattlePoints; PlayCard(index, Qc, true, stageindex); Indexes.Add(index); if (EquipmentAllowed == true) { for (int i = 0; i < Qc.hands[ID].cards.Count; i++) { if (Qc.hands[ID].cards[i].Type == "Equipment") { EquipmentCard EC = (EquipmentCard)Qc.hands[ID].cards[i]; if (EC.BattlePoints + nthTotal < total) { index = i; nthTotal += EC.BattlePoints; PlayCard(i, Qc, true, stageindex); Indexes.Add(index); break; } } } } RemoveCards(Indexes, Qc); return(nthTotal); }
private EquipmentCard applayEquipmentIcon(int playerID, EquipmentCard equipment) { if (hasMultiEffects(equipment)) { equipment = selectEffect(equipment); } setEquipmentIcon(playerID, equipment); return(equipment); }
public override void joinQuest(int numberOfStages, QuestController qc) { int TempBP = 0; float count = 0f; int AmourFound = 0; foreach (Card c in qc.hands[playerID].cards) { TempBP = 0; switch (c.Type) { case "Ally": TempBP += ((AllyCard)c).BattlePoints; if (TempBP >= 10) { count++; } else if (((AllyCard)c).name == "Sir Percival") { count += .5f; } break; case "Equipment": EquipmentCard TempEC = (EquipmentCard)c; if (TempEC.BattlePoints >= 10) { count++; } else if (TempEC.name == "Corsair Dagger") { count += .5f; } break; case "Amour": if (AmourFound < 1) { count++; AmourFound++; } break; default: break; } } Debug.Log(count); if (count >= numberOfStages) { qc.join(true); } else { qc.join(false); } }
public void ApplyEquipmentCardToUnit(EquipmentCard card, Unit unit) { var item = card.Data; var previousEquipment = unit.EquipItem(item); if (previousEquipment != null) { GameState.PlayerCards.Add(new EquipmentCard(previousEquipment)); } RefreshUnitStats(unit); }
private EquipmentCard selectEffect(EquipmentCard equipment) { QueryForm query = new QueryForm(equipment.tool, (selectedTool) => { equipment.tool = selectedTool; }); query.ShowDialog(); query.BringToFront(); query.Focus(); return(equipment); }
// Release on Player private void ProcessEquipment(int playerID, EquipmentCard equipment) { //Grapical equipment = applayEquipmentIcon(playerID, equipment); this.selectedCard.face = CardFace.FRONT; this.usedCard.Push(this.selectedCard); //Logical setPlayerState(playerID, equipment); }
private void GridTable_SelectionChanged(object sender, SelectionChangedEventArgs e) { EquipmentCard EuipCard = GridTable.SelectedItem as EquipmentCard; if (EuipCard != null) { check = db.EquipmentCard.Where(w => w.NameOfEquipment == EuipCard.NameOfEquipment && w.InventoryNumber == EuipCard.InventoryNumber && w.CommissioningDate == EuipCard.CommissioningDate).Select(s => s.IdEquipment).FirstOrDefault(); } else { check = 0; } }
public EditEquipmentPage(EquipmentCard SelectedEQC) { InitializeComponent(); if (SelectedEQC != null) { _currentEquipmentCard = SelectedEQC; } DataContext = _currentEquipmentCard; ComboNomenclature.ItemsSource = AccountingEquipmentEntities.GetContext().Nomenclature.ToList(); ComboManufacturer.ItemsSource = AccountingEquipmentEntities.GetContext().Manufacturer.ToList(); ComboModel.ItemsSource = AccountingEquipmentEntities.GetContext().Equipment.ToList(); }
private void setEquipmentIcon(int index, EquipmentCard equipment) { this.Invoke((MethodInvoker)(() => { if (equipment.getType() == CType.EQ_REPAIR) { this.toolIcons[equipment.tool][index].Visible = false; } else { this.toolIcons[equipment.tool][index].Visible = true; } })); }
public override void joinQuest(int numberOfStages, QuestController qc) { List <string> typesOfEquipment = new List <string> { "Dagger", "Sword", "Mount", "Lance", "LSword", "Axe" }; List <int> weaponTotals = new List <int>(); for (int i = 0; i < 6; i++) { weaponTotals.Add(0); } int cardCount = 0, foeCounter = 0; List <Card> playerCards = qc.hands[playerID].cards; foreach (Card C in playerCards) { if (C.Type == "Foe") { if (((FoeCard)C).BattlePoints < 20) { foeCounter++; } } if (C.Type == "Ally") { cardCount++; } if (C.Type == "Equipment") { EquipmentCard EQ = (EquipmentCard)C; for (int i = 0; i < 6; i++) { if (EQ.TypeOfEquipment == typesOfEquipment[i] && weaponTotals[i] <= numberOfStages) { weaponTotals[i]++; cardCount++; } } } } if (cardCount >= numberOfStages * 2) { qc.join(true); } else { qc.join(false); } }
public void RemoveCard(int index) { _inventory.RemoveAt(index); if (_inventory.Count == 0) { GiveNewCard(starterWeapon); } _current = _inventory[0].card; _currInvIndex = 0; transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = _current.EquipmentSprite; _handChanged = true; }
/// <summary> /// 删除记录 /// </summary> private void BtnDelete_Click(object sender) { if (View.DGSelect.SelectedItem == null) { MessageBox.Show("请选择要删除的功能模块!"); } foreach (var item in View.DGSelect.Items) { if (View.DGSelect.SelectedItem == item) { EquipmentCard model = item as EquipmentCard; new EquipmentCardBIZ().delete(model); MessageBox.Show("删除成功!"); BtnSearch_Click(null); } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { Random rand = new Random(); EquipmentCard Card = new EquipmentCard() { NameOfEquipment = Name.Text, Lifetime = Mou.Text, InventoryNumber = rand.Next(1000, 10000).ToString(), CommissioningDate = DateTime.Now, DecommissioningDate = DateTime.Now.AddMonths(Convert.ToInt32(Mou.Text)), idTypeOfEquipment = db.TypeOfEquipment.Where(w => w.TypeOfEquipment1 == Cmb.Text).Select(s => s.idTypeOfEquipment).FirstOrDefault(), idStatusOfEquipment = 2 }; db.EquipmentCard.Add(Card); db.SaveChanges(); MessageBox.Show("Оборудование добавлено"); }
/// <summary> /// 修改记录 /// </summary> private void BtnUpdate_Click(object sender) { if (View.DGSelect.SelectedItem == null) { MessageBox.Show("请选择要修改的记录!"); } foreach (var item in View.DGSelect.Items) { if (View.DGSelect.SelectedItem == item) { EquipmentCard model = item as EquipmentCard; //FuncModule gnmk = (FuncModule)sender; EquipmentCardEditView view = new EquipmentCardEditView(model); view.ShowDialog(); BtnSearch_Click(null); } } }
public void GiveNewCard(EquipmentCard newCard) { if (newCard.type == EquipmentType.item) { ItemCard iCard = (ItemCard)newCard; iCard.UseItem(this); } else if (newCard.type == EquipmentType.weapon) { EquipmentItem newItem = new EquipmentItem(); newItem.card = newCard; WeaponCard temp = (WeaponCard)newCard; newItem.ammoCount = temp.AmmoCap; _inventory.Add(newItem); } _handChanged = true; }
override public void OnDrop(PointerEventData eventData) { GameObject card = eventData.pointerDrag; EquipmentCard eqCardScript = card.GetComponent <EquipmentCard>(); // If dropped card is in fact an item ( has EquipmentCard script ) if (eqCardScript != null) { // If item slot matches eq slot then use card, if not return card. if ((eqCardScript.cardValues as EquipmentValue).eqPart == eqPart) { eqCardScript.UseCard(); } else { card.GetComponent <Draggable>().ReturnToParent(); } Draggable.FreePlaceholder(); } }
override public void OnPointerExit(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } Draggable draggable = eventData.pointerDrag.GetComponent <Draggable>(); if (!draggable) { return; } EquipmentCard equipmentCard = draggable.GetComponent <EquipmentCard>(); if (draggable != null && equipmentCard != null) { equipmentCard.gameObject.SetActive(true); eqImage.sprite = placeholderImage; } }
private void setPlayerState(int index, EquipmentCard equipment) { switch (equipment.tool) { case Tool.CART: if (equipment.getType() == CType.EQ_REPAIR) { this.playerStates[index].isDestroyedCart = false; } else { this.playerStates[index].isDestroyedCart = true; } break; case Tool.LATTERN: if (equipment.getType() == CType.EQ_REPAIR) { this.playerStates[index].isDestroyedLantern = false; } else { this.playerStates[index].isDestroyedLantern = true; } break; case Tool.PICKAXE: if (equipment.getType() == CType.EQ_REPAIR) { this.playerStates[index].isDestroyedPickaxe = false; } else { this.playerStates[index].isDestroyedPickaxe = true; } break; } }
override public void OnPointerEnter(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } Draggable draggable = eventData.pointerDrag.GetComponent <Draggable>(); if (!draggable) { return; } EquipmentCard equipmentCard = draggable.GetComponent <EquipmentCard>(); // Setting item icon in eq slot, if it matches with item slot if (draggable != null && equipmentCard != null && (equipmentCard.cardValues as EquipmentValue).eqPart == eqPart) { eqImage.sprite = equipmentCard.transform.Find("CardImage").GetComponent <Image>().sprite; } }
void Start() { healthBar.current = healthBar.max = _currHealth = _maxHealth; _current = _inventory[_currInvIndex].card; if (_current != null) { transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = _current.EquipmentSprite; } if (_cardHandUI == null) { _cardHandUI = GameObject.FindGameObjectWithTag("Card Hand").GetComponent <CardHandUI>(); } for (int i = 0; i < _inventory.Count; i++) { if (_inventory[i].card != null) { WeaponCard temp = (WeaponCard)_inventory[i].card; _inventory[i].ammoCount = temp.AmmoCap; } } }
public int Delete(EquipmentCard model) { return(CommonAccess.ComSQLiteDelete(model, "ID")); }
public EquipmentCardEditView(EquipmentCard md) { InitializeComponent(); this.Loaded += new RoutedEventHandler(EquipmentCardEditVM.PageLoad); MD = md; }
/// <summary> /// 装备盔甲 /// </summary> public void RequestEquipArmor(EquipmentCard armor) { //请求网络 GameClient.Instance.GetGameSceneManager().gameManager.RequestEquipment(armor, 2); }
private bool hasMultiEffects(EquipmentCard equipment) { return(hasMultiEffects(equipment.tool)); }
/// <summary> /// 装备盔甲 /// </summary> public void EquipArmor(EquipmentCard armor) { //本地 if (this.equipments.armor == null) { //角色没有装备 this.equipments.armor = armor; } else { //角色已经有装备了 this.equipments.armor.OnUnequiped(this); this.equipments.armor = armor; } //请求网络 GameClient.Instance.GetGameSceneManager().gameManager.RequestEquipment(armor, 2); }
//------请求使用装备 public void RequestEquipment(EquipmentCard equip, int equipPosition)//Weapon = 1, Armor = 2, Jewelry1 = 3,Jewelry2 = 4 { LogsSystem.Instance.Print(string.Format("向网络请求装备 {0} ,位置 {1}", equip.GetCardName(), equipPosition)); LogsSystem.Instance.Print("尚未实现", LogLevel.DEBUG); throw new NotImplementedException(); }
public int UpdateBy(EquipmentCard _model, string _identity) { return(dal.Update(_model, _identity)); }
public int Update(EquipmentCard _model) { return(dal.Update(_model, "ID")); }
public int Insert(EquipmentCard _model) { return(dal.Insert(_model)); }
public void SetEquipment(EquipmentCard equipmentCard, int position) { //Weapon = 1, Armor = 2, Jewelry1 = 3,Jewelry2 = 4 switch (position) { case 1: { this.equipments.weapon = equipmentCard; break; } case 2: { this.equipments.armor = equipmentCard; break; } case 3: { this.equipments.jewelry1 = equipmentCard; break; } case 4: { this.equipments.jewelry2 = equipmentCard; break; } default: { LogsSystem.Instance.Print("未知的装备位置:" + position, LogLevel.WARN); break; } } }
public int InsertOrUpdateBy(EquipmentCard _model, string _identity) { return(_model.ID == 0 ? dal.Insert(_model) : dal.Update(_model, _identity)); }
private void picCard_MouseUp(object sender, MouseEventArgs e) { if (this.isMyTurn && this.isMouseDown && this.selectedPic != null) { this.isMouseDown = false; EraseGraphics(); Point mouseLocation = new Point(e.X + selectedPic.Left, e.Y + selectedPic.Top); Field releasePoint = GetReleaseField(mouseLocation.X, mouseLocation.Y); // ##################### ADD DOWN BY USING METHOD ######################## // Release on Grid // Release on Map if (releasePoint == Field.MAP) // is in map { Point?gridPoint = GetGridPoint(mouseLocation.X, mouseLocation.Y); // Mouse Pointer Position if (gridPoint.HasValue) // grid point is valid { if ((this.selectedCard is EquipmentCard) || (this.selectedCard is CaveCard && !field.IsValidPosition(ConvertLocationToCoords(mouseLocation), (CaveCard)selectedCard))) { MoveToStartPosition(selectedPic); return; } else { if (this.playerStates[this.clientID].hasDestroyed() && this.selectedCard is CaveCard) { MessageBox.Show("장비가 파괴되어 길을 놓을 수 없습니다.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); MoveToStartPosition(this.selectedPic); return; } if (ProcessGrid((Point)gridPoint)) { Send(); } } } else { MoveToStartPosition(selectedPic); return; } } // Release on Player: Use Equipment(Repair, Destruction) Card else if (releasePoint == Field.PLAYER) { EquipmentCard selectedEquipment = selectedCard as EquipmentCard; if (selectedEquipment == null) { MoveToStartPosition(selectedPic); return; } int index = GetPlayerIndex(mouseLocation); if (index >= playerNum) { MoveToStartPosition(selectedPic); } else { //this.selectedCard.face = CardFace.FRONT; //this.usedCard.Push(this.selectedCard); ProcessEquipment(index, selectedEquipment); DeleteImage(selectedPic); RemoveFromHands(); Send(); } } // Release on Deck: Discard the Card => Show Card Back else if (releasePoint == Field.DECK) { this.selectedCard.face = CardFace.BACK; this.usedCard.Push(this.selectedCard); //this.picUsedCard.Image = GetCardImage(this.usedCard.Peek()); DeleteImage(selectedPic); RemoveFromHands(); Send(); } // ##################### ADD UP ######################## else { MoveToStartPosition(selectedPic); } } }
public int delete(EquipmentCard _model) { return(dal.Delete(_model)); }
/// <summary> /// 请求装上装备 /// </summary> public void RequestEquipment(EquipmentCard equip, int equipPosition)//Weapon = 1, Armor = 2, Jewelry = 3 { LogsSystem.Instance.Print(string.Format("向网络请求装备 {0} ,位置 {1}", equip.GetCardName(), equipPosition)); OperateEquipData detail = new OperateEquipData(); detail.operatePlayerUUID = this.playerInfo.UUID; detail.operatePlayerUid = this.playerInfo.uid; detail.operatePlayerPosition = this.playerRoomData.allocPosition; detail.operateCardUUID = equip.GetCardUUID(); detail.equipCardId = equip.GetCardID(); detail.equipPosition = equipPosition; detail.operateCode = 0; GameData data = new GameData(); data.roomID = this.playerRoomData.roomID; data.operateCode = OperateCode.OperateEquip; data.operateData = JsonCoding<OperateEquipData>.encode(detail); GameClient.Instance.SendToServer(data); }
public override void TournamentBehavior(int Case, TournementControler Tc) { int ID = this.playerID; switch (Case) { case 1: bool play = false; for (int i = 0; i < Tc.hands[ID].cards.Count; i++) { switch (Tc.hands[ID].cards[i].Type) { case "Foe": break; case "Amour": if (Tc.dzones[playerID].SpecificUseCards.Count == 0) { PlayCard(i, Tc); } break; case "Ally": PlayCard(i, Tc); break; case "Equipment": play = true; EquipmentCard EC1 = ((EquipmentCard)Tc.hands[ID].cards[i]); foreach (EquipmentCard EC in Tc.dzones[playerID].Equipment) { if (EC1.TypeOfEquipment == EC.TypeOfEquipment) { play = false; break; } } if (play == true) { PlayCard(i, Tc); } break; default: break; } } break; case 2: bool play2 = false; List <int> Equip = new List <int>(); for (int i = 0; i < Tc.hands[ID].cards.Count; i++) { if (Tc.hands[ID].cards[i].Type == "Equipment") { for (int j = i + 1; j < Tc.hands[ID].cards.Count; j++) { if (Tc.hands[ID].cards[j].Type == "Equipment") { if (((EquipmentCard)Tc.hands[ID].cards[i]).TypeOfEquipment == ((EquipmentCard)Tc.hands[ID].cards[j]).TypeOfEquipment) { Equip.Add(i); play2 = true; } } } } } if (play2 == true) { ExecutetPhase(Equip, Tc); } break; default: break; } }