ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2021ǯ04·î11Æü(Æü) 19:16:09ÍúÎò
¤³¤Î¼ê½ç¤Ç¤Ï¡¢Ãµº÷¥¤¥Ù¥ó¥È¤Î³ÍÆÀ¾ðÊó¤ò°ì»þŪ¤ËÊÝ»ý¤¹¤ë½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¤³¤Î¼ê½ç¤òÍÑ°Õ¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¼¡¤Î¥»¡¼¥Ö¤È¥í¡¼¥É¤Î½èÍý¤ò¼ÂÁõ½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¼ê½ç£²£¶¡¡¡¼³ÍÆÀ¤·¤¿Ãµº÷¥¤¥Ù¥ó¥È¤Î°ì»þÊÝ»ý¡¼
£´£¶¡¥GameData ¥¹¥¯¥ê¥×¥È¤È DialogController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¡¢Ãµº÷¥¤¥Ù¥ó¥È¤Î¾ðÊó¤òÊÝ»ý¤Ç¤¤ë¤è¤¦¤Ë½èÍý¤òÄɲ乤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦List.Contains ¥á¥½¥Ã¥É
£´£¶¡¥GameData ¥¹¥¯¥ê¥×¥È¤È DialogController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¡¢Ãµº÷¥¤¥Ù¥ó¥È¤Î¾ðÊó¤òÊÝ»ý¤Ç¤¤ë¤è¤¦¤Ë½èÍý¤òÄɲ乤ë
¡¡Ãµº÷¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤¿¾ì¹ç¡¢¤½¤Î¾ðÊó¤Ï£±²ó¸Â¤ê¤Î¥²¡¼¥à¤Ç¤¢¤ì¤Ð¡¢¥¤¥Ù¥ó¥È¤ÎȯÀ¸¾ðÊó¤òµÏ¿¤¹¤ëɬÍפϤ¢¤Þ¤ê¿¤¯¤¢¤ê¤Þ¤»¤ó¡£
¤Ç¤¹¤¬¡¢¥²¡¼¥à»þ´Ö¤ÎŤ¤¥²¡¼¥à¤Î¾ì¹ç¡¢¥Ç¡¼¥¿¤ò¥»¡¼¥Ö¤·¤Æ¡¢¼¡²ó¤Ï¤½¤Î¾ðÊó¤òÍøÍѤ·¤Æ¥²¡¼¥à¤òºÆ³«¤¹¤ë¡¢¤È¤¤¤¦Êý¼°¤Ç¿Ê¤á¤Æ¤¤¤¯¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤³¤Î¥»¡¼¥Ö¤ä¥í¡¼¥É¤ÎÂоݤȤ·¤Æ¡¢Ãµº÷¥¤¥Ù¥ó¥È¤¬È¯À¸¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¡¡¡¼º£²ó¤Ç¤¢¤ì¤ÐÊõÈ¢¤ò³«¤±¤Æ¤¤¤ë¤«¤É¤¦¤«¡¼¡¡¤È¤¤¤¦¾ðÊó¤Ï¥»¡¼¥Ö¤¹¤ë¤è¤¦¤Ë¤·¤Ê¤¤¤È
¥²¡¼¥à¤òºÆ³«¤·¤¿ºÝ¤Ë¡¢ºÆÅÙƱ¤¸ÊõÈ¢¤ò³ÍÆÀ½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
¡¡¤³¤Î¼ê½ç¤Ç¤Ï¤½¤ÎÁ°½àÈ÷¤È¤·¤Æ¡¢Ãµº÷¥¤¥Ù¥ó¥È¤ÎȯÀ¸¾õ¶·¤ò°ì»þŪ¤ËÊÝ»ý¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
ÊÝ»ý¤¹¤ë¾ì½ê¤Ï GameData ¥¯¥é¥¹¤òÁÛÄꤷ¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï¡¢¤³¤Î¥¯¥é¥¹¤¬¥·¥ó¥°¥ë¥È¥ó¥¯¥é¥¹¤Ç¤¢¤ê¡¢
¤É¤Î¥¹¥¯¥ê¥×¥È¤«¤é¤Ç¤â¼«Í³¤Ë»²¾È¤¹¤ë¤³¤È¤¬ÍưפǤ¢¤ë¤³¤È¤«¤é¡¢°ì»þÊÝ»ý¤¹¤ëµ¡Ç½¤òͤ·¤Æ¤ª¤¯¤³¤È¤ËŬ¤·¤Æ¤¤¤ë¤¿¤á¤Ç¤¹¡£
¡¡
¡¡°ÊÁ°¤Ë¤âÀâÌÀ¤·¤Æ¤¤¤ë¤è¤¦¤Ë¡¢¥×¥í¥°¥é¥à¤Ë¤Ï¡¢½èÍý¤ÎÆâÍƤ¬µ½Ò¤µ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤È¡¢¤½¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹½èÍý¤Ë¤è¤Ã¤Æ¹½À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
ÅÅÏÃÄ¢¤Ë¡¢ÅÅÏäò¤·¤¿¤¤Áê¼êÀ褬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÅÅÏäò¤«¤±¤ë¤³¤È¤Ï½ÐÍè¤Ê¤¤¤Î¤ÈƱ¤¸¤Ç¡¢¥á¥½¥Ã¥É¤òŬÀڤʥ¿¥¤¥ß¥ó¥°¤Ç¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë¤Ï¡¢
»öÁ°¤Ë½èÍý¤òµ½Ò¤·¤¿¥á¥½¥Ã¥É¤òÍÑ°Õ¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
¡¡¤³¤ì¤Þ¤Ç¤Î½èÍý¤ÎºîÀ®¼ê½ç¤òºÆÅÙ¸«Ä¾¤·¤Æ¤ß¤Æ¤¤¤¿¤À¤±¤ì¤Ð¤ï¤«¤ê¤Þ¤¹¤¬¡¢¤¹¤Ù¤Æ¡¢¥á¥½¥Ã¥É¤òÍÑ°Õ¤·¤Æ¤«¤é¡¢¤½¤Î¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹½èÍý¤òµ½Ò¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡º£¸å¡¢¼«Ê¬¤Ç½èÍý¤ò¹Í¤¨¤Æ¹½ÃÛ¤·¤Æ¤¤¤¯¤ËºÝ¤·¤Æ¤âƱÍͤËÁȤßΩ¤Æ¤Æ¤¤¤¯¤Èºî¤ê¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢
¤É¤¦¤¤¤Ã¤¿½èÍý¤¬¡¢¤É¤Î¤è¤¦¤Ê¾ìÌ̤ÇɬÍפˤʤë¤Î¤«¤ò¥¤¥á¡¼¥¸¤·¡¢ºÇ½é¤Ë½èÍý¤ò¤Þ¤È¤á¤¿¥á¥½¥Ã¥É¤òÍÑ°Õ¤·¤Æ¤«¤é¡¢
¤½¤Î½èÍý¤ò¼Â¹Ô¤·¤¿¤¤¾ìÌÌ(½èÍý¤Î¥¿¥¤¥ß¥ó¥°)¤Ç¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤ò¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
¡¡º£²ó¤âƱÍͤμê½ç¤ÇºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£¡Ú¶µºà¤Ë½ñ¤¤¤Æ¤¢¤ë½çÈÖÄ̤ê¤Ë½ñ¤±¤Ð¤¤¤¤¡Û¤Ç¤Ï¤Ê¤¯¡¢¡Ú¤É¤¦¤·¤Æ¶µºà¤Ç¤Ï¤½¤Î¤è¤¦¤Ê½çÈ֤ǽèÍý¤òµ½Ò¤·¤Æ¤¤¤ë¤Î¤«¡Û¡¢
¤½¤¦¤¤¤Ã¤¿Éôʬ¤ËÃíÌܤò¤·¤Æ¿Ê¤á¤Æ¤¤¤¯¤è¤¦¤Ë¤¹¤ë¤ÈÍý²ò¤ò¿¼¤á¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡GameData ¥¯¥é¥¹¤Ë¡¢Ãµº÷¥¤¥Ù¥ó¥È¤ÎȯÀ¸¾õ¶·¤ò°ì»þŪ¤ËÊÝ»ý¤¹¤ë¤¿¤á¤ÎÊÑ¿ô¤ò List ·¿¤Ë¤ÆÍÑ°Õ¤·¤Æ¤ª¤¤Þ¤¹¡£
¤³¤ì¤Ï³°Éô¤Î¥¯¥é¥¹¤è¤êÌ¿Îá¤ò¼õ¤±¤ë¤³¤È¤Ç¡¢È¯À¸¤·¤Æ¤¤¤ë¥¤¥Ù¥ó¥È¤ÎÈÖ¹æ¤òÊÝ»ý¤¹¤ë¤è¤¦¤ËÍøÍѤ·¤Þ¤¹¡£
¤Ä¤Þ¤ê¡¢¥¢¥¤¥Æ¥à¤ÎÄɲᦺï½ü¤ÈƱ¤¸¤è¤¦¤ËÍøÍѤ¹¤ëÁ°Äó¤Ç¤¹¡£
¡¡¤³¤Î List ¤Ë¼ÂºÝ¤Ëõº÷¥¤¥Ù¥ó¥È¤ÎÈÖ¹æ¤òÄɲ乤뤿¤á¤Î¥á¥½¥Ã¥É¤òÍÑ°Õ¤·¤Þ¤¹¡£
³°Éô¤Î¥¯¥é¥¹¤Ï¤³¤Î¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢GameData ¥¯¥é¥¹¤ËÍÑ°Õ¤·¤Æ¤¢¤ë List ¤Ë¡¢Ãµº÷¤·¤¿¥¤¥Ù¥ó¥È¤ÎÈÖ¹æ¤òÄɲäǤ¤ë»ÅÁȤߤǤ¹¡£
¡¡GameData ¥¯¥é¥¹¤Ë¤³¤ì¤é¤Î¾ðÊó¤òÍÑ°Õ¤·¤Æ¤¤¤ë¤Î¤Ï¡¢¤É¤Î¥¹¥¯¥ê¥×¥È¤«¤é¤Ç¤âõº÷¥¤¥Ù¥ó¥È¤Î°ì»þÊÝ»ý¤ÎÌ¿Îá¤ò¼õ¤±¤é¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤¤¤Þ¤¹¡£
¥·¥ó¥°¥ë¥È¥ó¥¯¥é¥¹¤Ç¤¢¤ë¤¿¤á¡¢ÊÑ¿ô¤Ø¤ÎÂåÆþ¤¬ÉÔÍפǤ¹¤°¤Ë½èÍý¤ò¼Â¹Ô¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤¿¤á¤Ç¤¹¡£
GameData.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡°ú¿ô¤Ë»ØÄꤷ¤¿Í×ÁǤ¬¡¢»ØÄꤷ¤¿ List Æâ¤Ë¸ºß¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¤òȽÃǤ¹¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
Ìá¤êÃÍ¤Ï bool ·¿¤Ç¡¢Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï true¡¢Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï false ¤òÌᤷ¤Þ¤¹¡£
¡ãGameData.cs¡¡AddSearchEventNum ¥á¥½¥Ã¥ÉÆâ¡ä
// °ú¿ô¤Îõº÷¥¤¥Ù¥ó¥È¤ÎÈֹ椬 List ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç(¤³¤Î¥Á¥§¥Ã¥¯¤Ç½ÅÊ£ÅÐÏ¿¤òËɤ¤¤Ç¤¤¤ë) if (!getSearchEventNumsList.Contains(searchEventNum)) {
¡¡º£²ó¤Î¥±¡¼¥¹¤Ç¤Ï¡¢List ¤Ç¤¢¤ë getSearchEventNumsList ÊÑ¿ôÆâ¤ò¸¡º÷¤·¤Æ¡¢searchEventNum ÊÑ¿ô¤ÎÃͤ¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤«¤òȽÄꤷ¤Æ¤¤¤Þ¤¹¡£
List ¤Î·¿¤Ï int ·¿¡¢°ú¿ô¤Î·¿¤â int ·¿¤È¡¢¤É¤Á¤é¤â int ·¿¤Ç¤¢¤ë¤¿¤á¡¢¤³¤Î¥á¥½¥Ã¥É¤Ë¤è¤ë½èÍý¤¬À®Î©¤·¤Æ¤¤¤Þ¤¹¡£
¡¡È½Äê¤Î·ë²Ì¡¢false ¤Î¾ì¹ç¡¢¤Ä¤Þ¤ê¡¢List Æâ¤Ë searchEventNum ÊÑ¿ô¤ÎÃͤ¬´Þ¤Þ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢if ʸ¤Î¾ò·ï¤¬À®Î©¤·¡¢List ¤Ø¤ÎÄɲýèÍý¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡¤½¤Î¤¿¤á Contains ¥á¥½¥Ã¥É¤Ï¡¢½ÅÊ£¤¹¤ëÃͤÎÍ̵¤òȽÄꤹ¤ë¤¿¤á¤ËÍøÍѤ¹¤ë¤ÈÊØÍø¤Êµ¡Ç½¤Ë¤Ê¤ê¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
MicroSoft
List<T>.Contains(T) ¥á¥½¥Ã¥É
https://docs.microsoft.com/ja-jp/dotnet/api/system...
SamuraiEngineerBlog ÍÍ
¡ÚC#ÆþÌç¡ÛContains¤ÇÃͤ¬´Þ¤Þ¤ì¤ë¤«Ä´¤Ù¤ëÊýË¡(ʸ»úÎó/ÇÛÎó/List)
https://www.sejuku.net/blog/41745
±¢´³¤·Ãæ¤Î¥²¡¼¥à³«È¯¥á¥â ÍÍ
¡ÚC#,LINQ¡ÛContains¡ÁÇÛÎó¤ä¥ê¥¹¥È¤ÎÃæ¤Ç»ØÄꤷ¤¿Í×ÁǤ¬¤¢¤ë¤«¤òȽÄꤷ¤¿¤¤¤È¤¡Á
https://www.urablog.xyz/entry/2018/06/10/070000
¡¡
¡¡GameData ¥¯¥é¥¹¤Ëõº÷¥¤¥Ù¥ó¥È¤Î°ì»þÊÝ»ý¤ÎÊÑ¿ô¤È¡¢¤½¤ÎÊÑ¿ô¤Ëõº÷¥¤¥Ù¥ó¥È¤ÎÈÖ¹æ¤òÄɲ乤ë¥á¥½¥Ã¥É¤ò½àÈ÷¤·¤Þ¤·¤¿¡£
¤¢¤È¤Ï¤³¤Î»Å³Ý¤±¤òºîÆ°¤µ¤»¤ë¤¿¤á¤Ë¡¢Å¬Àڤʥ¿¥¤¥ß¥ó¥°¤Ç¡¢Ãµº÷¥¤¥Ù¥ó¥È¤ÎÈÖ¹æ¤òÄɲ乤ë¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
¡¡¤³¤Î¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤ËŬ¤·¤Æ¤ë¾ì½ê¤ò¹Í¤¨¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
¶µºà¤ò¸«¤ëÁ°¤Ë¡¢TODO µ¡Ç½¤ò»²¹Í¤Ë¤·¡¢¼ÂºÝ¤Ë¸Æ¤Ó½Ð¤·Ì¿Îá¤ò½ñ¤¤¤Æ¤ß¤ë¤È¤¤¤¤¤Ç¤·¤ç¤¦¡£
¡¡Ãµº÷¥¤¥Ù¥ó¥È¤ÎȯÀ¸¤Ë¹ç¤ï¤»¤Æ½èÍý¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢Ãµº÷¥¤¥Ù¥ó¥È¤¬È¯À¸ºÑ¤È¤·¤Æ List ¤ËÅÐÏ¿¤¹¤ë¤³¤È¤¬½ÐÍè¤ì¤Ð¡¢
¤½¤Î¾ðÊó¤ò³èÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢ºÆÅÙ¡¢Ãµº÷¥¤¥Ù¥ó¥È¤ÎȯÀ¸¤ò¹Ô¤ï¤Ê¤¤¤È¤¤¤¦½èÍý¤ò¼ÂÁõ¤¹¤ë¤³¤È¤â²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
DialogController.cs
¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡¤¹¤Ù¤Æ¤Î¼ê½ç¤¬½ªÎ»¤·¤Þ¤·¤¿¡£½èÍý¤ÎÀ©¸æÆâÍƤò³Îǧ¤·¤¿¾å¤Ç¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¥Ç¥Ð¥Ã¥°¤·¤Æ¤¤¤¤Þ¤¹¡£
³ÍÆÀ¤·¤¿ÊõÈ¢¤Î treasureEventNo ÊÑ¿ô¤ÎÃͤ¬¡¢GameData ¥¯¥é¥¹¤ËÍÑ°Õ¤·¤¿ List ·¿¤Î getSearchEventNumsList ÊÑ¿ô¤ËÄɲ䵤ì¤ì¤ÐÀ©¸æÀ®¸ù¤Ç¤¹¡£
¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡¤³¤Î¥Ç¡¼¥¿¤Ï°ì»þŪ¤ËÊÝ»ý¤Ï¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥»¡¼¥Ö¤Ï¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¤Î¤Ç¡¢¥²¡¼¥à¤ò½ªÎ»¤¹¤ë¤È¼º¤ï¤ì¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
¼¡¤Î¼ê½ç¤Ç¤Ï¤³¤Î¥Ç¡¼¥¿¤ò¥»¡¼¥Ö¤È¥í¡¼¥É¤ò¹Ô¤¤¡¢¥²¡¼¥à¤òºÆ³«¤·¤¿ºÝ¤Ë¡¢³ÍÆÀ¤·¤Æ¤¤¤ëÊõÈ¢¤Î¾ì¹ç¤Ë¤Ï¥²¡¼¥à¤Ëɽ¼¨¤µ¤ì¤Ê¤¤¡¢¤¢¤ë¤¤¤Ï²èÁü¤¬³«ÉõºÑ¤Î¾õÂ֤ˤʤëÀ©¸æ¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡¼¡¤Ï¡¡¼ê½ç£²£·¡¡¡¼³ÍÆÀ¤·¤¿Ãµº÷¥¤¥Ù¥ó¥È¤Î¥»¡¼¥Ö¤È¥í¡¼¥Éµ¡Ç½¤Î¼ÂÁõ¡¼¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯