public virtual void RemoveCard(CCard card) { if (card == null) { return; } var currentCard = card; while (currentCard != null) { if (this.m_Cards.Contains(currentCard)) { this.m_Cards.Remove(currentCard); } currentCard = currentCard.connectWithCard; } if (this.m_AvailableCards.Contains(card)) { this.m_AvailableCards.Clear(); this.m_AvailableCards.TrimExcess(); } if (this.m_ReturnCards.Contains(card)) { this.m_ReturnCards.Clear(); this.m_ReturnCards.TrimExcess(); } }
public IHttpActionResult PayFlight([FromBody] string paym_det, [FromUri] string user) { CCard card = JsonConvert.DeserializeObject <CCard>(paym_det); string result = CustomerSQLHandler.PayFlight(card.card_number, card.security_code, user); return(Ok(result)); }
public void on_ready_req() { if (!all_received(PROTOCOL.READY_TO_START)) { return; } reset(); for (int i = 0; i < this.players.Count; ++i) { CPacket msg = CPacket.create((short)PROTOCOL.PLAYER_ORDER_RESULT); msg.push((byte)this.order_manager.random_cards.Count); for (byte slot_index = 0; slot_index < this.order_manager.random_cards.Count; ++slot_index) { CCard card = this.order_manager.random_cards[slot_index]; msg.push(slot_index); msg.push(card.number); msg.push((byte)card.pae_type); msg.push(card.position); } this.players[i].send(msg); } this.engine.start(this.players); for (int i = 0; i < this.players.Count; ++i) { send_cardinfo_to_player(this.players[i]); } }
void ON_START_TURN(CPacket msg) { byte remain_bomb_card_count = msg.pop_byte(); update_floor_cards(msg); if (remain_bomb_card_count > 0) { CPacket card_msg = CPacket.create((short)PROTOCOL.FLIP_BOMB_CARD_REQ); this.local_server.on_receive_from_ai(card_msg); } else { byte slot_index = this.brain.choice_card_to_put(this.hand_cards, null, this.floor_card_manager); CPacket card_msg = CPacket.create((short)PROTOCOL.SELECT_CARD_REQ); CCard card = this.hand_cards[slot_index]; card_msg.push(card.number); card_msg.push((byte)card.pae_type); card_msg.push(card.position); card_msg.push(slot_index); byte is_shaking = 1; card_msg.push(is_shaking); //UnityEngine.Debug.Log(string.Format("sent {0}, {1}, {2}", card.number, card.pae_type, card.position)); this.local_server.on_receive_from_ai(card_msg); } }
void next_turn() { send_player_statistics(this.engine.current_player_index); this.engine.clear_turn_data(); this.engine.move_to_next_player(); CPacket turn_msg = CPacket.create((short)PROTOCOL.START_TURN); turn_msg.push(this.players[this.engine.current_player_index].agent.remain_bomb_count); // 바닥 카드 갱신을 위한 데이터. List <CFloorSlot> slots = this.engine.floor_manager.slots; turn_msg.push((byte)slots.Count); for (int i = 0; i < slots.Count; ++i) { turn_msg.push((byte)slots[i].cards.Count); for (int card_index = 0; card_index < slots[i].cards.Count; ++card_index) { CCard card = slots[i].cards[card_index]; turn_msg.push(card.number); turn_msg.push((byte)card.pae_type); turn_msg.push(card.position); } } this.players[this.engine.current_player_index].send(turn_msg); }
/// <summary> /// Скопировать все карты обследования для указанных id госпитализации и консультации /// </summary> /// <param name="hospitalizationId">id госпитализации</param> /// <param name="visitId">id консультации</param> /// <param name="newHospitalizationId">id новой госпитализации</param> /// <param name="newVisitId">id новой консультации</param> public void CopyByHospitalizationAndVisitId( int hospitalizationId, int visitId, int newHospitalizationId, int newVisitId) { int cardListCnt = _cardList.Count; for (int i = 0; i < cardListCnt; i++) { if (_cardList[i].HospitalizationId == hospitalizationId && _cardList[i].VisitId == visitId) { var newCard = new CCard(_cardList[i]); string oldFilePath = GetPicturePath(newCard.GetPictureFileName()); newCard.HospitalizationId = newHospitalizationId; newCard.VisitId = newVisitId; _cardList.Add(newCard); string newFilePath = GetPicturePath(newCard.GetPictureFileName()); if (File.Exists(oldFilePath)) { File.Copy(oldFilePath, newFilePath); } else { PutDefaultPictureFile(newCard.CurrentCardType, newFilePath); } } } Save(null); }
/// <summary> /// Добавить карту обследования с двумя частями /// </summary> /// <param name="fromCardWorker">Класс для работы с картами из двух частей в базе, откуда копируется госпитализация</param> /// <param name="toCardWorker">Класс для работы с картами из двух частей в базе, куда копируется госпитализация</param> /// <param name="cardType">Тип карты</param> /// <param name="fromHospitalizationId">id госпитализации в базе, откуда копируются карты</param> /// <param name="toHospitalizationId">id новой госпитализации в базе, куда копируются карты</param> /// <param name="fromVisitId">id консультации в базе, откуда копируются карты</param> /// <param name="toVisitId">id новой консультации в базе, куда копируются карты</param> public static void AddLeftRightCard( CCardWorker fromCardWorker, CCardWorker toCardWorker, CardType cardType, int fromHospitalizationId, int toHospitalizationId, int fromVisitId, int toVisitId) { if (fromCardWorker.IsExists(fromHospitalizationId, fromVisitId, cardType)) { toCardWorker.GetByGeneralData(toHospitalizationId, toVisitId, CardSide.Left, cardType); var newCard = new CCard( fromCardWorker.GetByGeneralData(fromHospitalizationId, fromVisitId, CardSide.Left, cardType)) { HospitalizationId = toHospitalizationId, VisitId = toVisitId }; toCardWorker.Update(newCard); toCardWorker.GetByGeneralData(toHospitalizationId, toVisitId, CardSide.Right, cardType); newCard = new CCard( fromCardWorker.GetByGeneralData(fromHospitalizationId, fromVisitId, CardSide.Right, cardType)) { HospitalizationId = toHospitalizationId, VisitId = toVisitId }; toCardWorker.Update(newCard); } }
/// <summary> /// Обновить информацию о карте обследования /// </summary> /// <param name="cardInfo">Информация о карте обследования</param> public void Update(CCard cardInfo) { int n = GetIndexFromList(cardInfo.HospitalizationId, cardInfo.VisitId, cardInfo.CurrentSideOfCard, cardInfo.CurrentCardType); cardInfo.NotInDatabase = false; _cardList[n] = new CCard(cardInfo); Save(cardInfo); }
public virtual void AddCardToList(CCard card) { card.isDropped = true; card.column = this; card.Clear(); // ADD TO LIST this.m_Cards.Add(card); }
void apply_card_status( byte number, PAE_TYPE pae_type, byte position, CARD_STATUS status) { CCard card = find_card(number, pae_type, position); card.set_card_status(status); }
public void add_card_to_floor(CCard card) { if (!this.floor_pae.ContainsKey(card.pae_type)) { this.floor_pae.Add(card.pae_type, new List<CCard>()); } this.floor_pae[card.pae_type].Add(card); }
public void add_card_to_floor(CCard card) { if (!this.floor_pae.ContainsKey(card.pae_type)) { this.floor_pae.Add(card.pae_type, new List <CCard>()); } this.floor_pae[card.pae_type].Add(card); }
public virtual void Set(CCard card) { this.cache.Enqueue(card); // SET PARENT card.transform.SetParent(this.m_Transform); card.transform.localPosition = Vector3.zero; card.transform.localRotation = Quaternion.identity; card.transform.localScale = Vector3.one; }
public virtual void OnFollowCard(CCard parent, int index) { this.m_RectTransform.SetParent(parent.transform); var position = Vector3.zero; position.y -= (index + 1) * this.GetHeightOffset(); dragObject.localPosition = position; this.m_BGImage.raycastTarget = false; }
public void Add_Card( CCard card ) { if ( card.Color != ECardColor.Invalid && card.Value != ECardValue.Invalid ) { m_Cards.Add( card ); } m_Count++; }
public virtual void AddCardToColumn(CCard card) { card.isDropped = true; card.column = this; card.transform.SetParent(this.m_RectTransform); card.MoveToPosition(this.GetLastCardPosition()); card.Clear(); // ADD TO LIST this.m_Cards.Add(card); }
public Client() { Random random = new Random(); _code = random.Next(100, 999); account = new Account(5000); card = new CCard(account); Clients.Add(this); }
//------------------------------------------------------------------------------ // static 매소드. public static void send_select_card(CCard card, byte slot, byte is_shaking) { CPacket msg = CPacket.create((short)PROTOCOL.SELECT_CARD_REQ); msg.push(card.number); msg.push((byte)card.pae_type); msg.push(card.position); msg.push(slot); msg.push(is_shaking); CNetworkManager.Instance.send(msg); }
/// <summary> /// Получить карту обследования по переданному id госпитализации, /// id консультации, типа карты и стороны /// </summary> /// <param name="hospitalizationId">id госпитализации</param> /// <param name="visitId">id консультации</param> /// <param name="cardSide">Сторона карты</param> /// <param name="cardType">Тип карты</param> /// <returns></returns> public CCard GetByGeneralData( int hospitalizationId, int visitId, CardSide cardSide, CardType cardType) { int n = GetIndexFromList(hospitalizationId, visitId, cardSide, cardType); if (n == _cardList.Count) { var newCardInfo = new CCard { HospitalizationId = hospitalizationId, VisitId = visitId, CurrentSideOfCard = cardSide, CurrentCardType = cardType, NotInDatabase = true }; Bitmap packedPicture; switch (cardType) { case CardType.HandCutaneousNerves: packedPicture = Properties.Resources.CardHandCutaneousNerves; break; case CardType.HandDermatome: packedPicture = Properties.Resources.CardHandDermatome; break; case CardType.LegCutaneousNerves: packedPicture = Properties.Resources.CardLegCutaneousNerves; break; case CardType.LegDermatome: packedPicture = Properties.Resources.CardLegDermatome; break; case CardType.PamplegiaCard: packedPicture = Properties.Resources.CardPamplegiaCard; break; case CardType.SacriplexCard: packedPicture = Properties.Resources.CardSacriplexCard; break; default: throw new ArgumentException(cardType + " неизвестный тип карты обследования"); } newCardInfo.Picture = new Bitmap(packedPicture); _cardList.Add(newCardInfo); return(new CCard(newCardInfo)); } return(new CCard(_cardList[n])); }
public virtual bool IsCanConnect(CCard card) { if (this.m_StateCard != ECardState.FACE_UP) { return(false); } if (card.stateCard != ECardState.FACE_UP) { return(false); } return((this.cardValue - 1) == card.cardValue); }
CCard pop_specific_card_from_floor(PAE_TYPE pae_type, CARD_STATUS status) { if (!this.floor_pae.ContainsKey(pae_type)) { return(null); } CCard card = this.floor_pae[pae_type].Find(obj => obj.status == status); this.floor_pae[pae_type].Remove(card); return(card); }
public void remove_card(CCard card) { CFloorSlot slot = find_slot(card.number); if (slot != null) { slot.remove_card(card); //UnityEngine.Debug.Log(string.Format("removed card. {0}, {1}, {2}, remain {3}", // card.number, card.pae_type, card.position, // slot.cards.Count)); } }
// 해당번호와 동일한 위치에 카드를 놓는다. public void puton_card(CCard card) { CFloorSlot slot = find_slot(card.number); if (slot == null) { slot = find_empty_slot(); slot.add_card(card); return; } this.slots[slot.slot_position].add_card(card); }
public PaintDoublePictureForm(string formName, CWorkersKeeper workersKeeper, CCard cardLeftInfo, CCard cardRightInfo) { InitializeComponent(); _configurationEngine = workersKeeper.ConfigurationEngine; Text = formName; _cardWorker = workersKeeper.CardWorker; _cardLeftInfo = cardLeftInfo; _cardRightInfo = cardRightInfo; _shadePaintLeft = new ShadePaint(cardLeftInfo.Picture, "Левая сторона"); _shadePaintRight = new ShadePaint(cardRightInfo.Picture, "Правая сторона"); }
public CDeckOfCards() { int CardIndex = 0; for (int SuitType = (int)CCard.CARD_SUIT.SUIT_HEART; SuitType <= (int)CCard.CARD_SUIT.SUIT_SPADE; SuitType++) { for (int Value = (int)CCard.CARD_VALUE.VALUE_ACE; Value <= (int)CCard.CARD_VALUE.VALUE_KING; Value++) { m_Cards[CardIndex] = new CCard(); m_Cards[CardIndex].SetSuit(SuitType); m_Cards[CardIndex].SetValue(Value); CardIndex++; } } }
// 카드 분배. void distribute_cards() { byte player_index = this.first_player_index; byte floor_index = 0; // 2번 반복하여 바닥에는 8장, 플레이어에게는 10장씩 돌아가도록 한다. for (int count = 0; count < 2; ++count) { // 바닥에 4장. for (byte i = 0; i < 4; ++i) { CCard card = pop_front_card(); this.distributed_floor_cards.Add(card); this.floor_manager.put_to_begin_card(card); ++floor_index; } // 1p에게 5장. for (int i = 0; i < 5; ++i) { CCard card = pop_front_card(); this.distributed_players_cards[player_index].Add(card); this.player_agents[player_index].add_card_to_hand(card); } player_index = find_next_player_index_of(player_index); // 2p에게 5장. for (int i = 0; i < 5; ++i) { CCard card = pop_front_card(); this.distributed_players_cards[player_index].Add(card); this.player_agents[player_index].add_card_to_hand(card); } player_index = find_next_player_index_of(player_index); } check_bonus_cards(); this.floor_manager.refresh_floor_cards(); if (!this.floor_manager.validate_floor_card_counts()) { //todo:fatal!! UnityEngine.Debug.LogError("Invalid floor card count!!"); return; } }
void add_player_get_cards_info_to(CPacket msg) { // 플레이어가 가져갈 카드 정보. byte count_to_player = (byte)this.engine.cards_to_give_player.Count; msg.push(count_to_player); for (byte card_index = 0; card_index < count_to_player; ++card_index) { CCard card = this.engine.cards_to_give_player[card_index]; msg.push(card.number); msg.push((byte)card.pae_type); msg.push(card.position); } }
void ON_BEGIN_CARD_INFO(CPacket msg) { Queue <CCard> floor_cards = new Queue <CCard>(); this.player_index = msg.pop_byte(); // floor cards. byte floor_count = msg.pop_byte(); for (byte i = 0; i < floor_count; ++i) { byte number = msg.pop_byte(); PAE_TYPE pae_type = (PAE_TYPE)msg.pop_byte(); byte position = msg.pop_byte(); CCard card = new CCard(number, pae_type, position); floor_cards.Enqueue(card); this.floor_card_manager.puton_card(card); } byte player_count = msg.pop_byte(); for (byte player = 0; player < player_count; ++player) { Queue <CCard> cards = new Queue <CCard>(); byte player_index = msg.pop_byte(); byte card_count = msg.pop_byte(); for (byte i = 0; i < card_count; ++i) { byte number = msg.pop_byte(); PAE_TYPE pae_type = PAE_TYPE.KWANG; byte position = byte.MaxValue; if (number != byte.MaxValue) { pae_type = (PAE_TYPE)msg.pop_byte(); position = msg.pop_byte(); // AI플레이어 본인 것만 담는다. CCard card = new CCard(number, pae_type, position); this.hand_cards.Add(card); } } } CPacket finished_msg = CPacket.create((short)PROTOCOL.DISTRIBUTED_ALL_CARDS); this.local_server.on_receive_from_ai(finished_msg); }
void add_choice_card_info_to(CPacket msg) { List <CCard> target_cards = this.engine.target_cards_to_choice; byte count = (byte)target_cards.Count; msg.push(count); for (int i = 0; i < count; ++i) { CCard card = target_cards[i]; msg.push(card.number); msg.push((byte)card.pae_type); msg.push(card.position); } }
public virtual void Init() { // UI this.m_RectTransform = this.transform as RectTransform; // GROUP this.m_Group = GameObject.FindObjectOfType <CGroupCard>(); this.m_GroupColumns = this.transform.Find("GroupColumns").GetComponent <RectTransform>(); // COLUMN this.m_Columns = this.transform.GetComponentsInChildren <CColumn>(); for (int i = 0; i < this.m_Columns.Length; i++) { this.m_Columns[i].Init(); } // CARD this.m_CardPrefab = Resources.Load <CCard>("Cards/Card"); // POINTS this.m_ReturnBox = this.transform.Find("ReturnCardPoint").GetComponent <CReturnBox>(); this.m_SpawnCardPoint = this.transform.Find("SpawnCardPoint").GetComponent <RectTransform>(); this.m_DrawCardsToColumnsButton = this.transform.Find("DrawCardsToColumnsButton").GetComponent <Button>(); this.m_DrawCardsToColumnsButton.onClick.AddListener(this.OnNextDraw); this.m_ResetButton = this.transform.Find("ResetButton").GetComponent <Button>(); this.m_ResetButton.onClick.AddListener(this.OnResetMatch); this.m_HintButton = this.transform.Find("HintButton").GetComponent <Button>(); this.m_HintButton.onClick.AddListener(this.OnActiveHint); // DRAW CARDS this.m_OnBoardCards = new List <CCard>(); for (int i = 0; i < this.m_DataCards.Length; i++) { var value = this.m_DataCards[i]; var card = Instantiate(this.m_CardPrefab); card.Init(); card.Setup(value); card.SetParentInCenter(this.m_SpawnCardPoint); this.m_OnBoardCards.Add(card); } this.m_ReturnBox.Init(); this.m_OnHintCards = new List <object>(); // BLOCK CBoard.BOARD_LOCK = true; // ORIENTATION // this.CalculateBaseOrientation(Input.deviceOrientation); // var orientationManager = GameObject.FindObjectOfType<CUIOrientation>(); // orientationManager.OnOrientationChange.AddListener (this.CalculateBaseOrientation); // SHUFFLE this.ShuffleCards(); // On START DRAW Invoke("OnStartDraw", 1f); }
IEnumerator move_flip_card(byte number, PAE_TYPE pae_type, byte position) { // 뒤집은 카드 움직이기. CCardPicture deck_card_picture = this.deck_cards.Pop(); CCard flipped_card = this.card_manager.find_card(number, pae_type, position); deck_card_picture.update_card(flipped_card, get_hwatoo_sprite(flipped_card)); yield return(StartCoroutine(flip_deck_card(deck_card_picture))); yield return(new WaitForSeconds(0.3f)); deck_card_picture.transform.localScale = SCALE_TO_FLOOR; move_card_to_floor(deck_card_picture, CARD_EVENT_TYPE.NONE); yield return(new WaitForSeconds(0.5f)); }
public void move_kookjin_to_pee() { CCard card = pop_specific_card_from_floor(PAE_TYPE.YEOL, CARD_STATUS.KOOKJIN); if (card == null) { // 국진이 없다!?? UnityEngine.Debug.LogError("Cannot find kookjin!! player : " + this.player_index); return; } card.change_pae_type(PAE_TYPE.PEE); card.set_card_status(CARD_STATUS.TWO_PEE); add_card_to_floor(card); calculate_score(); }
public CCardPicture find_card(CCard card) { return this.card_pictures.Find(obj => obj.card.is_same(card.number, card.pae_type, card.position)); }
public void update_card(CCard card, Sprite image) { this.card = card; this.sprite_renderer.sprite = image; }
// Construction public CPassCardsGameAction( CCard card1, CCard card2 ) { Card1 = card1.Clone(); Card2 = card2.Clone(); }
public void add_card_to_hand(CCard card) { //UnityEngine.Debug.Log(string.Format("add to hand. player {0}, {1}, {2}, {3}", // this.player_index, card.number, card.pae_type, card.position)); this.hand_pae.Add(card); }
// Construction public CDiscardCardGameAction( CCard card ) { Card = card.Clone(); }
// Construction public CPlayCardGameAction( CCard card ) { Card = card.Clone(); }
// Private Interface private void Add_Card( CCard card ) { m_Cards.Add( card ); }
public void put_to_begin_card(CCard card) { this.begin_cards.Add(card); }
public void add_card(CCard card) { this.cards.Add(card); }
public void remove_card(CCard card) { this.cards.Remove(card); }
void ON_BEGIN_CARD_INFO(CPacket msg) { Queue<CCard> floor_cards = new Queue<CCard>(); this.player_index = msg.pop_byte(); // floor cards. byte floor_count = msg.pop_byte(); for (byte i = 0; i < floor_count; ++i) { byte number = msg.pop_byte(); PAE_TYPE pae_type = (PAE_TYPE)msg.pop_byte(); byte position = msg.pop_byte(); CCard card = new CCard(number, pae_type, position); floor_cards.Enqueue(card); this.floor_card_manager.puton_card(card); } byte player_count = msg.pop_byte(); for (byte player = 0; player < player_count; ++player) { Queue<CCard> cards = new Queue<CCard>(); byte player_index = msg.pop_byte(); byte card_count = msg.pop_byte(); for (byte i = 0; i < card_count; ++i) { byte number = msg.pop_byte(); PAE_TYPE pae_type = PAE_TYPE.KWANG; byte position = byte.MaxValue; if (number != byte.MaxValue) { pae_type = (PAE_TYPE)msg.pop_byte(); position = msg.pop_byte(); // AI플레이어 본인 것만 담는다. CCard card = new CCard(number, pae_type, position); this.hand_cards.Add(card); } } } CPacket finished_msg = CPacket.create((short)PROTOCOL.DISTRIBUTED_ALL_CARDS); this.local_server.on_receive_from_ai(finished_msg); }