public async Task <IActionResult> Edit(int id, [Bind("Id,CategoryName")] CardCategory cardCategory) { if (id != cardCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cardCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardCategoryExists(cardCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cardCategory)); }
public void Setup(CardCategory requiredCardCategory, bool isMine) { this.slotType = requiredCardCategory; // setup slot sprite if (slotType == CardCategory.Operative) { GetComponentInChildren <SpriteRenderer>().sprite = operativeSlotSprite; } else { GetComponentInChildren <SpriteRenderer>().sprite = policySlotSprite; } this.isMine = isMine; // is this a local or enemy operative slot? if (animateIn) { Vector2 scale = transform.localScale; transform.localScale = Vector2.zero; transform.DOScale(scale, 0.2f); } mouseTargetable = GetComponent <MouseTargetable>(); mouseTargetable.SetTargetingGroup(GetEmptyTargetingGroup()); }
protected WorldCard(CardCategory category, int cost, int pointValue, bool isMilitary, bool isWindfall, GoodType goodType) : base(category, cost, pointValue) { IsMilitary = isMilitary; IsWindfall = isWindfall; GoodType = goodType; }
public YuCeVerfier(CardCategory c = CardCategory.Unknown) { MaxCards = 1; MinCards = 1; MaxPlayers = 0; this.c = c; }
public static CardDefinitionType GetCardDefinitionType(CardCategory category, PickupEffect effect1) { switch (category) { case CardCategory.Creature: switch (effect1) { case PickupEffect.None: return(CardDefinitionType.SmallPlayerCreature); case PickupEffect.Damage: return(CardDefinitionType.PlayerCreatureDamage); } break; case CardCategory.InstantSpell: switch (effect1) { case PickupEffect.Damage: return(CardDefinitionType.Fireball); } break; } Debug.LogError("Error: couldn't find CardDefinitionType for combination " + category + " - " + effect1); return(CardDefinitionType.None); }
public IActionResult Edit(int id, [Bind("Id,CategoryName,CreateTime,UpdateTime")] CardCategory cardCategory) { if (id != cardCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _ICardCategoryService.Update(cardCategory); } catch (DbUpdateConcurrencyException) { if (!CardCategoryExists(cardCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(cardCategory)); }
public void SetCategory(CardCategory category) { SetCategories(new HashSet <CardCategory>() { category }); }
public Card(CardCategory category, string name) { ServerCard = new ServerCard { cardName = name, category = category }; string spritename = string.Join("-", name.ToLower().Split(' ')); try { var stream = System.IO.File.OpenRead("dataimg/" + spritename + ".png"); cardImageTexture = Texture2D.FromStream(Game.GraphicsDevice, stream); //cardImageTexture = Online.Game.Content.Load<Texture2D>(spritename); } catch (Exception e) { Console.WriteLine($"Card :: {spritename} could not be loaded."); } // default card to hidden Hidden = true; Size = new Vector2(0.12f); SetWantedSize(Size); LayerDepth = 1; if (cardHiddenTexture == null) cardHiddenTexture = Game.Content.Load<Texture2D>("card-back"); if (cardTemplateTexture == null) cardTemplateTexture = Game.Content.Load<Texture2D>("card"); }
void analyse_deck() { if (fDeck == null) return; // Rows fRows = new List<CardCategory>(); Array cats = Enum.GetValues(typeof(CardCategory)); foreach (CardCategory cat in cats) fRows.Add(cat); // Columns fColumns = new List<Difficulty>(); Array diffs = Enum.GetValues(typeof(Difficulty)); foreach (Difficulty diff in diffs) { if ((diff == Difficulty.Trivial) && (fDeck.Level < 3)) continue; if (diff == Difficulty.Random) continue; fColumns.Add(diff); } fCells = new Dictionary<Point, int>(); fRowTotals = new Dictionary<int, int>(); fColumnTotals = new Dictionary<int, int>(); for (int row = 0; row != fRows.Count; ++row) { CardCategory cat = fRows[row]; for (int col = 0; col != fColumns.Count; ++col) { Difficulty diff = fColumns[col]; // Get list of cards for this cell int count = 0; foreach (EncounterCard card in fDeck.Cards) { if ((card.Category == cat) && (card.GetDifficulty(fDeck.Level) == diff)) count += 1; } fCells[new Point(row, col)] = count; // Add to row total if (!fRowTotals.ContainsKey(row)) fRowTotals[row] = 0; fRowTotals[row] += count; // Add to column total if (!fColumnTotals.ContainsKey(col)) fColumnTotals[col] = 0; fColumnTotals[col] += count; } } }
public CardText(int id, CardCategory category, int subCategory, string[] good, string[] bad) { this.id = id; this.category = category; this.subCategory = subCategory; this.good = good; this.bad = bad; }
protected Card(CardCategory category, int cost, int pointValue) { _currentZone = new NullZone(); _zoneChanger = zone => _currentZone = zone; Category = category; Cost = cost; PointValue = pointValue; }
Card CreateCard(int i, CardCategory cardCategory, System.Type enumType) { var subcategories = System.Enum.GetValues(enumType); int subCategory = (int)subcategories.GetValue(RandomHelper.Next(subcategories.Length)); var boozeLevelForCard = RandomHelper.Next(maxBoozeLevel + 1); return(new Card(i, cardCategory, subCategory, RandomHelper.Next(boozeLevelForCard + 1) == boozeLevelForCard, -1, boozeLevelForCard)); }
private void analyse_deck() { if (this.fDeck == null) { return; } this.fRows = new List <CardCategory>(); foreach (CardCategory value in Enum.GetValues(typeof(CardCategory))) { this.fRows.Add(value); } this.fColumns = new List <Difficulty>(); foreach (Difficulty difficulty in Enum.GetValues(typeof(Difficulty))) { if (difficulty == Difficulty.Trivial && this.fDeck.Level < 3 || difficulty == Difficulty.Random) { continue; } this.fColumns.Add(difficulty); } this.fCells = new Dictionary <Point, int>(); this.fRowTotals = new Dictionary <int, int>(); this.fColumnTotals = new Dictionary <int, int>(); for (int i = 0; i != this.fRows.Count; i++) { CardCategory item = this.fRows[i]; for (int j = 0; j != this.fColumns.Count; j++) { Difficulty item1 = this.fColumns[j]; int num = 0; foreach (EncounterCard card in this.fDeck.Cards) { if (card.Category != item || card.GetDifficulty(this.fDeck.Level) != item1) { continue; } num++; } this.fCells[new Point(i, j)] = num; if (!this.fRowTotals.ContainsKey(i)) { this.fRowTotals[i] = 0; } Dictionary <int, int> nums = this.fRowTotals; Dictionary <int, int> nums1 = nums; int num1 = i; nums[num1] = nums1[num1] + num; if (!this.fColumnTotals.ContainsKey(j)) { this.fColumnTotals[j] = 0; } Dictionary <int, int> item2 = this.fColumnTotals; Dictionary <int, int> nums2 = item2; int num2 = j; item2[num2] = nums2[num2] + num; } } }
public Card (int id, CardCategory category, int subCategory, bool positive = true, int phase = -1, int boozeLevel = -1) { this.id = id; this.category = category; this.subCategory = subCategory; this.positive = positive; this.phase = phase; this.boozeLevel = boozeLevel; }
void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs) { ISkill skill; List <Card> cards; List <Player> players; if (owner.AskForCardUsage(new CardUsagePrompt("YuanHu", this), new YuanHuVerifier(), out skill, out cards, out players)) { CardCategory type = cards[0].Type.Category; YuanHuEffect = effectMap[type]; NotifySkillUse(players); Game.CurrentGame.HandleCardTransfer(owner, players[0], DeckType.Equipment, cards); switch (type) { case CardCategory.Weapon: { var result = from player in Game.CurrentGame.AlivePlayers where player != players[0] && Game.CurrentGame.DistanceTo(players[0], player) == 1 select player; if (result.Count() == 0) { break; } List <Card> nCards; List <Player> nPlayers; if (!owner.AskForCardUsage(new CardUsagePrompt("YuanHuQiZhi"), new YuanHuChoiceOnePlayer(players[0]), out skill, out nCards, out nPlayers)) { nPlayers = new List <Player>(); nPlayers.Add(result.First()); } if (nPlayers[0].HandCards().Count + nPlayers[0].DelayedTools().Count + nPlayers[0].Equipments().Count > 0) { var Card = Game.CurrentGame.SelectACardFrom(nPlayers[0], owner, new CardChoicePrompt("YuanHu", nPlayers[0], owner), "YuanHu", false, false); Game.CurrentGame.HandleCardDiscard(nPlayers[0], new List <Card>() { Card }); } break; } case CardCategory.Armor: { Game.CurrentGame.DrawCards(players[0], 1); break; } case CardCategory.DefensiveHorse: case CardCategory.OffensiveHorse: { Game.CurrentGame.RecoverHealth(owner, players[0], 1); break; } default: break; } } }
public Card(int id, CardCategory category, int subCategory, bool positive = true, int phase = -1, int boozeLevel = -1) { this.id = id; this.category = category; this.subCategory = subCategory; this.positive = positive; this.phase = phase; this.boozeLevel = boozeLevel; }
public void Init() { List <CitizenType> types = Enum.GetValues(typeof(CitizenType)).Cast <CitizenType>().ToList(); type.Value = types[UnityEngine.Random.Range(0, types.Count)]; List <CardCategory> cardCategories = Enum.GetValues(typeof(CardCategory)).Cast <CardCategory>().ToList(); favorite = cardCategories[UnityEngine.Random.Range(0, cardCategories.Count)]; }
public void SpawnCategory(CardSize cardSize, int defaultColumnCount = 0) { CardCategory cardCategoryToSpawn = Instantiate <CardCategory>(cardCategoryPrefab, Vector3.zero, Quaternion.identity, contentTransform); cardCategoryToSpawn.SetupCardCategory(cardSize, unityCards.FindAll(uC => uC.cardSize == cardSize), defaultColumnCount); if (!cardCategories.Contains(cardCategoryToSpawn)) { cardCategories.Add(cardCategoryToSpawn); } }
public IActionResult Create([Bind("Id,CategoryName,CreateTime,UpdateTime")] CardCategory cardCategory) { if (ModelState.IsValid) { _ICardCategoryService.Add(cardCategory); return(RedirectToAction("Index")); } return(View(cardCategory)); }
public async Task <IActionResult> Create([Bind("Id,CategoryName")] CardCategory cardCategory) { if (ModelState.IsValid) { _context.Add(cardCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cardCategory)); }
public static string GetSubCategoryName(CardCategory category, int subCategory) { switch (category) { case CardCategory.Talk: return ((TalkCategory)subCategory).ToString(); case CardCategory.Emotion: return ((EmotionCategory)subCategory).ToString(); case CardCategory.Action: return ((ActionCategory)subCategory).ToString(); } return null; }
public CardCategoryInfo GetCategoryInfo(CardCategory category) { for (int i = 0; i < categoriesInfo.Count; i++) { if (categoriesInfo[i].category == category) { return(categoriesInfo[i]); } } Debug.LogError("Error: couldn't find category info for " + category + " in card definitions library."); return(null); }
public bool InSelectedCell(EncounterCard card) { if (fSelectedCell == Point.Empty) return false; int diff_index = fSelectedCell.X - 1; Difficulty diff = fColumns[diff_index]; int cat_index = fSelectedCell.Y - 1; CardCategory cat = fRows[cat_index]; return ((card.Category == cat) && (card.GetDifficulty(fDeck.Level) == diff)); }
//Create card page from AlbumsPage public CreateCardPage(CardCategory cardCategory, Dir parentAlbum) { this.parentAlbum = parentAlbum; InitializeComponent(); if (cardCategory == CardCategory.Event) { cardTypeSwitch.IsToggled = true; } initialize(); }
public bool Delete(CardCategory model) { try { _context.Remove(model); _context.SaveChangesAsync(); return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// Calculates the number of cards of a given category in the deck. /// </summary> /// <param name="cat">The card category.</param> /// <returns>Returns the number of cards.</returns> public int Count(CardCategory cat) { int count = 0; foreach (EncounterCard card in fCards) { if (card.Category == cat) { count += 1; } } return(count); }
public bool Update(CardCategory model) { try { model.UpdateTime = DateTime.Now; _context.Update(model); _context.SaveChangesAsync(); return(true); } catch (Exception ex) { return(false); } }
public Bitmap GetBaseFrontImage(CardCategory cat) { switch (cat) { case CardCategory.Treasure: return(ImgResources.OriginalTreasureFront); case CardCategory.Dungeon: return(ImgResources.OriginalDungeonFront); default: throw new NotImplementedException(); } }
public int Count(CardCategory cat) { int num = 0; foreach (EncounterCard fCard in this.fCards) { if (fCard.Category != cat) { continue; } num++; } return(num); }
public Card(JSONClass json) { if (json == null) { throw new ArgumentNullException("json"); } JsonString = json.ToString(); if (json["id"] == null || json["type"] == null || json["viewed"] == null || json["created"] == null || json["updated"] == null) { throw new ArgumentException("Missing required field(s)."); } ID = json["id"]; Type = json["type"]; Viewed = json["viewed"].AsBool; Created = json["created"].AsInt; Updated = json["updated"].AsInt; if (json["extras"] != null) { Extras = JsonUtils.JSONClassToDictionary(json["extras"].AsObject); } Categories = new HashSet <CardCategory>(); if (json["categories"] == null) { Categories.Add(CardCategory.NO_CATEGORY); } else { JSONArray jsonArray = (JSONArray)JSON.Parse(json["categories"].ToString()); if (jsonArray == null || jsonArray.Count == 0) { Categories.Add(CardCategory.NO_CATEGORY); } else { for (int i = 0; i < jsonArray.Count; i++) { CardCategory category = (CardCategory)EnumUtils.TryParse(typeof(CardCategory), jsonArray[i], true, CardCategory.NO_CATEGORY); if (category != CardCategory.NO_CATEGORY) { Categories.Add(category); } } if (Categories.Count == 0) { Categories.Add(CardCategory.NO_CATEGORY); } } } }
int IComparable <Phase10CardInformation> .CompareTo(Phase10CardInformation other) { if (Number != other.Number) { return(Number.CompareTo(other.Number)); } else if (Color.Equals(other.Color) == false) { return(Color.CompareTo(other.Color)); } else { return(CardCategory.CompareTo(other.CardCategory)); } }
public static string GetSubCategoryName(CardCategory category, int subCategory) { switch (category) { case CardCategory.Talk: return(((TalkCategory)subCategory).ToString()); case CardCategory.Emotion: return(((EmotionCategory)subCategory).ToString()); case CardCategory.Action: return(((ActionCategory)subCategory).ToString()); } return(null); }
private async Task <Dir> createCard() { /* * bool validCardName = await validateCardNameEntry(); * * if (!validCardName) cardNameEntry.Text = generateDefaultCardName(); */ CardCategory cardCategory = (cardTypeSwitch.IsToggled ? CardCategory.Event : CardCategory.People); Dir card = await FSManager.addNewCardAsync(cardNameEntry.Text, cardCategory, this.parentAlbum); cardCreated?.Invoke(card); return(card); }
public CardTemplate(string cardName, string description, int playCost, bool isChargeable, int chargeCost, CardCategory category, CardID ID) { this.cardName = cardName; this.description = description; this.playCost = playCost; this.isChargeable = isChargeable; this.chargeCost = chargeCost; this.cat = category; this.ID = ID; }
protected DevelopmentCard(CardCategory category, int cost, int pointValue) : base(category, cost, pointValue) { }
public static bool IsCardCategory(CardCategory a, CardCategory belongsTo) { return (a & belongsTo) == belongsTo; }
public void SetCategory(CardCategory category) { _feedViewModel.SetCategory(category); }
public CardText (int id, CardCategory category, int subCategory, string[] good, string[] bad) { this.id = id; this.category = category; this.subCategory = subCategory; this.good = good; this.bad = bad; }
public void SetCategory(CardCategory category) { SetCategories(new HashSet<CardCategory> { category }); }