private LocationCard GetChangedCard(Dictionary <string, LocationCard> dict, Position position) { LocationCard lc = null; if (dict != null && dict.ContainsKey(position.Code)) { lc = dict[position.Code]; } if (lc == null) { return(null); } if (lc.Flag != position.Flag || lc.Power != position.Power)//标志和电压发生变化 { lc.Flag = position.Flag; lc.Power = position.Power; if (lc.Power >= AppSetting.LowPowerFlag) { lc.PowerState = 0; } else { lc.PowerState = 1;//低电告警状态 } //editCardList.Add(lc); //LocationCards.Edit(lc); return(lc); } else { return(null); } }
/// <summary> /// Tries to resolve address by passing the test to the Bing Geo-Spatial API /// and looking for returned locations. /// </summary> /// <param name="context">The context.</param> /// <param name="message">The message.</param> /// <returns>The asynchronous task.</returns> private async Task TryResolveAddressAsync(IDialogContext context, IMessageActivity message) { var locationSet = await this.geoSpatialService.GetLocationsByQueryAsync(this.apiKey, message.Text); var foundLocations = locationSet?.Locations; if (foundLocations == null || foundLocations.Count == 0) { await context.PostAsync(this.ResourceManager.LocationNotFound); context.Wait(this.MessageReceivedAsync); } else { this.locations.AddRange(foundLocations.Take(MaxLocationCount)); var locationsCardReply = context.MakeMessage(); locationsCardReply.Attachments = LocationCard.CreateLocationHeroCard(this.apiKey, this.locations); locationsCardReply.AttachmentLayout = AttachmentLayoutTypes.Carousel; await context.PostAsync(locationsCardReply); if (this.locations.Count == 1) { this.PromptForSingleAddressSelection(context); } else { await this.PromptForMultipleAddressSelection(context); } } }
private string GetUdpAlarmInfo(int id, List <LocationCard> lcList) { string strData = ""; LocationCard lc = lcList.Find(p => p.Id == id); if (lc == null) { //lc = bll.LocationCards.Find(p => p.Id == id); //if (lc != null) //{ // lcList.Add(lc); //} } if (lc == null) { return(strData); } if (lc != null) { strData = "{\"cmdType\":\"02\",\"data\":{\"tagId\":\"" + lc.Code + "\",\"opType\":\"03\"}}"; } return(strData); }
private void DrawLocationCard() { turnLocation = GameController.turnPlayerController.DrawLocationCard(); turnLocation.SetParent(turnLocationRect); LogWindow.Log("The selected location for this turn is: " + turnLocation.name); }
public LocationCard AddTagByPos(Position pos) { LocationCard tag = new LocationCard(); tag.Name = pos.Code; tag.Code = pos.Code; CardRole role = roles.Find(p => p.Name == "管理人员"); if (role == null) { role = roles[0]; } tag.CardRoleId = roles[0].Id; bool r1 = bll.LocationCards.Add(tag); pos.CardId = tag.Id; pos.RoleId = tag.CardRoleId;//角色 if (r1) { var person = AddPersonByTag(pos, tag); if (person != null) { pos.PersonnelID = person.Id; } } return(tag); }
public Crime (CharacterCard characterC, LocationCard locationC, ObjectCard objectC) { this.characterCard = characterC; this.locationCard = locationC; this.objectCard = objectC; }
public void initialize_game() { this.game_event_handler = new LOTRGameEventHandler(this); response_is_yes_no = false; waiting_for_player_response = false; EnemyCardResponses.set_game(this); PlayerCardResponses.set_game(this); CardEnablers.set_game(this); cur_player = null; cur_location = null; players = new List <LOTRPlayer>(); staged_cards = new List <EnemyCard>(); encounter_discard_pile = new List <EnemyCard>(); enemy_deck = EnemyCard.PASSAGE_THROUGH_MIRWOOD_ENEMIES(); //Utils.Shuffle(enemy_deck); for (var i = 0; i < num_players; i++) { players.Add(new LOTRPlayer()); } players[0].add_hero(LOTRHero.ARAGORN()); players[0].add_hero(LOTRHero.GLOIN()); players[0].add_hero(LOTRHero.THEODRED()); player_done_engaging = new Dictionary <LOTRPlayer, bool>(); allowing_actions = false; forced_response_after_action = false; times_to_respond = 1; card_to_respond_to = null; times_responded = 0; num_options_to_display = -1; begin_game(); }
public static LocationCard NECROMANCERS_PASS() { LocationCard the_card = new LocationCard("Necromancer's Pass", 3, 2, "Travel: The first player must discard 2 cards from his hand at random to travel here." , "ORC", new List <LOTRGame.TRAITS>() { LOTRGame.TRAITS.STRONGHOLD, LOTRGame.TRAITS.DOL_GULDUR }, "??"); Func <GameArgs, bool> criteria = (GameArgs args) => { LOTRPlayer first_player = args.relevant_player; return(first_player.get_cards_in_hand().Count >= 2); }; the_card.set_travel_criteria(criteria); List <Func <EventArgs, Card, bool> > card_played_criteria = new List <Func <EventArgs, Card, bool> >() { CardEnablers.card_is_me }; the_card.respond_to_event(GameEvent.LOCATION_TRAVELED, PlayerCardResponses.action_maker(card_played_criteria, EnemyCardResponses.necromancers_pass, the_card)); return(the_card); }
private void BeforeEnemyMove(EnemyCard enemy, LocationCard dest) { if (dest.m_cardName == m_attached.m_cardName && !enemy.IsKeywordContain(Card.Keyword.Elite)) { enemy.m_canMove = false; GameLogic.Get().OutputGameLog(string.Format("{0}被<障碍物>阻挡,无法进入{1}\n", enemy.m_cardName, dest.m_cardName)); } }
public PurchaseOrder( CorporationCard corporationCard, SaleCard saleCard, LocationCard shipToLocation) { Corporation = corporationCard; Sale = saleCard; ShipToLocation = shipToLocation; }
public void LoadCardData(LocationCardData card) { cardData = card; LoadRegularCardData(card); LocationCard locationCard = GetComponent <LocationCard>(); locationCard.initiative = card.initiative; }
private void _BuildPathRecur(LocationCard node, List <LocationCard> pathToBuild) { var parent = node.m_BFS_parent; if (parent) { _BuildPathRecur(parent, pathToBuild); pathToBuild.Add(parent); } }
// Just reveal, not enter it public void RevealLocation(LocationCard card) { m_mainGameUI.m_tempHighlightCard = card.gameObject; ShowHighlightCardExclusive(card, true); m_mainGameUI.m_confirmChoiceBtn.gameObject.SetActive(true); m_mainGameUI.m_choiceMode = MainGame.ConfirmButtonMode.RevealCard; card.m_isVisit = true; }
private void Update() { if (m_attached != null && m_attached.m_cardName != Player.Get().m_currentLocation.m_cardName) { GameLogic.Get().OutputGameLog(string.Format("{0}离开了{1},丢弃<障碍物>\n", Player.Get().m_investigatorCard.m_cardName, m_attached.m_cardName)); GameLogic.Get().m_beforeEnemyMoveEvent.RemoveListener(m_beforeEnemyMove); m_attached = null; GetComponent <PlayerCard>().Discard(); } }
public static LocationCard ENCHANTED_STREAM() { LocationCard the_card = new LocationCard("Enchanted Stream", 2, 2, "While Enchanted Stream is the active location, players cannot draw cards." , "ORC", new List <LOTRGame.TRAITS>() { LOTRGame.TRAITS.FOREST }, "??"); return(the_card); }
public static LocationCard GREAT_FOREST_WEB() { LocationCard the_card = new LocationCard("Great Forest Web", 2, 2, "Travel: Each player must exhaust 1 hero he controls to travel here." , "SPIDER", new List <LOTRGame.TRAITS>() { LOTRGame.TRAITS.FOREST }, ""); Func <GameArgs, bool> criteria = (GameArgs args) => { LOTRGame game = args.g; foreach (var player in game.get_players()) { bool has_ready_character = false; foreach (var card in player.get_heroes()) { if (!card.is_exhausted()) { has_ready_character = true; break; } } if (!has_ready_character) { foreach (var card in player.get_allies()) { if (!card.is_exhausted()) { has_ready_character = true; break; } } } if (!has_ready_character) { return(false); } } return(true); }; the_card.set_travel_criteria(criteria); List <Func <EventArgs, Card, bool> > card_played_criteria = new List <Func <EventArgs, Card, bool> >() { CardEnablers.card_is_me }; the_card.respond_to_event(GameEvent.LOCATION_TRAVELED, PlayerCardResponses.action_maker(card_played_criteria, EnemyCardResponses.great_forest_web, the_card, valid_targets: CardEnablers.valid_targets_player_characters_ready)); return(the_card); }
public LocationCard DrawLocationCard() { if (locationDeck.Count() <= 0) { ReshuffleLocationDeck(); } LocationCard card = (LocationCard)locationDeck.DrawCard(); card.player = this; return(card); }
public override void OnSpawnAtLocation(LocationCard loc) { GameLogic.Get().OutputGameLog(string.Format("<{0}>出现在了<{1}>\n", m_cardName, loc.m_cardName)); if (loc.m_cardName == Player.Get().m_currentLocation.m_cardName) { Player.Get().AddEngagedEnemy(this); } else { GameLogic.m_lstUnengagedEnemyCards.Add(this); } }
public void BindCardToPerson(Personnel person, LocationCard tag) { if (tag != null && person != null) { LocationCardToPersonnel cardToPerson = new LocationCardToPersonnel(); cardToPerson.PersonnelId = person.Id; cardToPerson.LocationCardId = tag.Id; LocationCardToPersonnels.Add(cardToPerson); tag.IsActive = true;//绑定了人员就激活 LocationCards.Edit(tag); } }
public void SpawnAtLocation(Card card, LocationCard destination, bool bHighlight) { if (bHighlight) { m_mainGameUI.m_tempHighlightCard = card.gameObject; ShowHighlightCardExclusive(card, false); m_mainGameUI.m_confirmChoiceBtn.gameObject.SetActive(true); m_mainGameUI.m_choiceMode = MainGame.ConfirmButtonMode.RevealCard; } DockCard(card.gameObject, destination.gameObject, 300, true, true); card.OnSpawnAtLocation(destination); }
public void location_chosen(LocationCard location_to_travel_to) { if (location_to_travel_to.is_location_card()) { if (can_travel_to_location()) { travel_to_location(location_to_travel_to); } else { Debug.Log("WHAT THE SHIT HOW ARE YOU TRAVELING"); } } }
/// <summary> /// BFS /// </summary> /// <param name="start"></param> /// <param name="end"></param> private List <LocationCard> PathFinding(LocationCard start, LocationCard end) { UnityEngine.Assertions.Assert.IsTrue(start.m_cardName != end.m_cardName, "Start and end can't be same in EnemyCard.PathFinding()!!!"); // First reset all nodes var all = FindObjectsOfType <LocationCard>(); foreach (var node in all) { node.m_BFS_checked = false; node.m_BFS_parent = null; } List <LocationCard> path = new List <LocationCard>(); Queue <LocationCard> queue = new Queue <LocationCard>(); queue.Enqueue(m_currentLocation); m_currentLocation.m_BFS_checked = true; bool bFind = false; while (queue.Count > 0 && !bFind) { var parent = queue.Dequeue(); for (int i = 0; i < parent.m_lstDestinations.Count; ++i) { var child = parent.m_lstDestinations[i]; if (child.m_cardName == end.m_cardName) { // Found it! child.m_BFS_parent = parent; _BuildPathRecur(child, path); path.Add(child); bFind = true; break; } else if (!child.m_BFS_checked) { child.m_BFS_parent = parent; queue.Enqueue(child); child.m_BFS_checked = true; } } } UnityEngine.Assertions.Assert.IsTrue(path.Count > 1, "Pathfinding failed in EnemyCard.PathFinding()!!!"); return(path); }
public override void OnReveal(Card card) { var pc = GetComponent <PlayerCard>(); GameLogic.Get().OutputGameLog(string.Format("{0}打出<障碍物>,花费{1}资源\n", Player.Get().m_investigatorCard.m_cardName, pc.m_cost)); m_attached = Player.Get().m_currentLocation; GameLogic.Get().SpawnAtLocation(pc, m_attached, false); m_beforeEnemyMove = new UnityAction <EnemyCard, LocationCard>(BeforeEnemyMove); GameLogic.Get().m_beforeEnemyMoveEvent.AddListener(m_beforeEnemyMove); Player.Get().m_currentAction.Pop(); }
private Personnel AddPersonByTag(Position pos, LocationCard tag) { Personnel person = new Personnel(); person.Name = "Tag_" + pos.Code; person.ParentId = 6;//访客 bool r2 = bll.Personnels.Add(person); if (r2) { bll.BindCardToPerson(person, tag); return(person); } return(null); }
public static List <EnemyCard> TREE_CARDS() { List <EnemyCard> result = new List <EnemyCard>(); result.Add(FOREST_SPIDER()); result.Add(FOREST_SPIDER()); result.Add(FOREST_SPIDER()); result.Add(FOREST_SPIDER()); result.Add(EAST_BIGHT_PATROL()); result.Add(BLACK_FOREST_BATS()); result.Add(LocationCard.OLD_FOREST_ROAD()); result.Add(LocationCard.OLD_FOREST_ROAD()); result.Add(LocationCard.FOREST_GATE()); result.Add(LocationCard.FOREST_GATE()); return(result); }
public static LocationCard FOREST_GATE() { LocationCard the_card = new LocationCard("Forest Gate", 2, 4, "Response: After you travel to Forest Gate, the first player may draw 2 cards." , "TREE", new List <LOTRGame.TRAITS>() { LOTRGame.TRAITS.FOREST }, "??"); the_card.respond_to_event(GameEvent.LOCATION_TRAVELED, PlayerCardResponses.action_maker(new List <Func <EventArgs, Card, bool> >() { CardEnablers.card_is_me }, EnemyCardResponses.forest_gate, the_card)); return(the_card); }
public ActionResult Edit(LocationCard tag) { if (ModelState.IsValid) { var result = db.LocationCards.Edit(tag); if (result) { return(Json(new { success = result })); } else { return(Json(new { success = result, errors = db.LocationCards.ErrorMessage })); } } return(base.View(tag)); }
/// <summary> /// Prompts the user for multiple address selection. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> private async Task PromptForMultipleAddressSelection(IDialogContext context) { if (this.supportsKeyboard) { var keyboardCardReply = context.MakeMessage(); keyboardCardReply.Attachments = LocationCard.CreateLocationKeyboardCard(this.locations, this.ResourceManager.MultipleResultsFound); keyboardCardReply.AttachmentLayout = AttachmentLayoutTypes.List; await context.PostAsync(keyboardCardReply); } else { await context.PostAsync(this.ResourceManager.MultipleResultsFound); } context.Wait(this.MessageReceivedAsync); }
public static void StartCombat(LocationCard locationCard, UnitCard p1, UnitCard p2) { instance.gameObject.SetActive(true); instance.location = locationCard; instance.player1Card = p1; instance.player2Card = p2; instance.location.SetParent(instance.locationRect); instance.player1Card.SetParent(instance.player1Rect); instance.player2Card.SetParent(instance.player2Rect); instance.turn = locationCard.CalculateInitiative(instance.player1Card, instance.player2Card); instance.OnCombatStart(); instance.OnAttackTurnStart(); }
public void travel_to_location(LocationCard location) { for (var i = 0; i < staged_cards.Count; i++) { if (staged_cards[i] == location) { cur_location = location; //TOOD: remove from staging staged_cards.RemoveAt(i); game_event_handler.fire_game_event(GameEvent.LOCATION_TRAVELED, new GameArgs(game: this, p: get_cur_player(), c: location, a: () => { finish_travel_phase(); })); break; } } //TODO: travel effects }