ç§ã®ååã¯ãªã¯ãµãã§ããç§ã¯å°ãããªãããéåžžã«ã¯ãŒã«ãªTrinity DigitalããŒã ã®Androidéçºè ã§ãã ããã§ã¯ãFirebaseãšããããçš®é¡ã®éçã«åºã¥ããŠãã¹ã¯ãããã°ããºãäœæããçµéšã«ã€ããŠèª¬æããŸãã
ç§ãã¡ãšäžç·ã«é¢çœããã®ãã«ããããããšãã欲æ±ãããããã¶ãŽã©ãŒãã¯ã§Google Developer Groupã®åœ¢åŒã§FirebaseããŒãã£ã³ã°ãéå¬ããå¿ èŠæ§ãšäžèŽããã®ã¯ãããŸããŸèµ·ãããŸããã ç§ãã¡ã¯ããã®ãããªãã®ãèªåã§èŠããããšãã§ããããã«ãªããäŒè°ã§èŠããŠéçºã«åãçµãããšãã§ãããšèãå§ããŸããããæçµçã«ç§ãã¡ã¯çå£ã«å€¢äžã«ãªããç¥çããŒãã²ãŒã å šäœãæãä»ããŸããã
ã¢ã€ãã¢ïŒ
MTGãMunchkinãDNDãEvolutionãMafiaãScrabbleãªã©ãããŸããŸãªçšåºŠã®ããã¹ã¯ããããã®ã²ãŒã ããããããããšããŸãã ãã¹ã¯ãããã¯ããã®é°å²æ°ãšããããªã¢ãªãã£ããã€ãŸããçŸããã«ãŒã/ããããæã«æã¡ãããããèŠãŠãããŒãã«ã®äžã§ãã£ãããšå©ãæ©äŒã®ããã«å€§å¥œãã§ãã ãŸãããã¹ãŠã®ãã¹ã¯ãããã¯ããŸããŸãªç¹ã§ç°ãªããŸãããé ã§ã²ãŒã ã«æ²¡é ããããšã劚ããå€ãã®æ¬ ç¹ããããŸãã
- ã«ãŒã«ãèŠããå¿ èŠæ§ïŒã©ã®ã¢ã¯ã·ã§ã³ãæ£ããããã©ã®ã¢ã¯ã·ã§ã³ãæ£ãããªããã移åã®é åºãã©ã®ããã«æ±ºå®ãããããããã»ã¹äžã®äŸå€ã¯äœããããå€ãã®ãã€ã³ããã«ãŠã³ãããå¿ èŠããããã€ã³ããèŠããŠããå¿ èŠããããŸãã
- å€ã®èšç®ïŒçŸåšã©ã®ãããã®å¥åº·ãæ®ããŠããŸããïŒ ãããŠããã¹ãŠã®çµ±èšãèæ ®ããŠããã®ã«ãŒãã¯ã©ã®ãããªããŒãã¹ãäžããŠãããŸããïŒ ããããç§ã¯ãããã®ç°å¢æ¡ä»¶äžã§ã¹ãã«ãã¹ãã«åæ ŒããŸãããïŒ
- ã·ã¹ãã ã®ãã©ã€ã¢ã«ãèšé²ããµã€ã³ãã«æéã浪費ããŠããŸã...
- ååã«å®å šã§çŸå®çãªã¢ãã«ãäœæã§ããªãããšãããã¯ããã¬ã€ã€ãŒã®é ã®äžã«äœãã§ãããé ã®å®¹éãéãããŠããããã§ãã
- ãã¬ã€ã€ãŒã¯ã·ã¹ãã ãšã«ãŒã«ã«é¢ããã¡ã¿æ å ±ãæã£ãŠããŸããã·ã¹ãã ã®ç¥èã楜ããã ããã²ãŒã ã®äžçã§æ°ããããšãçºèŠãããããããšã¯ã§ããŸããã
ãããã¯ãã¹ãŠäžå®å®ã§ã泚æãããããããã€ããã¯ã¹ãäœäžãããŸãã ãããŠãç§ãã¡ã¯äœããã¹ãããèãåºããŸããïŒãããããµãŒããŒã«å ¥ããŠãã ããïŒ ããã¡ãã®åºæ¬çãªèãæ¹ã¯æ¬¡ã®ãšããã§ãããã¹ãŠã®ã«ãŒã«ãäžé£ã®åããå€ã®èšç®ãã©ã³ããã€ã¶ãŒããã®ä»ã®è«çéšåãå€éšã·ã¹ãã ã®è²¬ä»»ãšããŸãã ãã¬ã€ã€ãŒã¯ãåããã²ãŒã äžçã®ãã¿ãŒã³ãåŠã³ãæŠç¥ãæ§ç¯ããæ°ããæŠç¥ãè©Šããææ çã«é¢äžããããšã«å šåãå°œãããŸãã
決åæŠã§å°éãããããã¡ãã®ã³ã³ã»ããã«ã€ããŠã¯èª¬æããŸãããããã¯ãã¡ããèå³æ·±ãããšã§ããããªã殺ãããŠããªããããžã§ã¯ãã®ã¹ãã³ãå ±æããã®ã§ããããã ç§ãã¡ãèšç»ããããšãæ¬åœã«å®è¡ã§ãããã©ããã確èªããããã«ãç§ãã¡ãã€ã³ã¹ãã¬ãŒã·ã§ã³ãåŸããã¢ã«ã€ããŠèª¬æããŸãã
æŠå¿µå®èšŒãããã°ã
ãã£ã¬ã³ãžïŒ
ãéæ³ã®æŠããã®ãããªå°ãããŠã·ã³ãã«ãªã²ãŒã ãäœãå¿ èŠããããŸãã æ°äººã®å¯ŸæŠçžæããäºãã«åªæãæãã察æŠçžæã殺ããæ¹ãæåã«åã¡ãŸãã ãã¬ã€ã€ãŒã«ã¯ããã«ã¹ããããªã©ã®çµ±èšããããŸãã ååªæã¯ã«ãŒãã§ãããåªæã¯ãããããããæ¶è²»ããäœããã®çš®é¡ã®å¹æïŒæ²»çãé害ããŸãã¯ä»ã®äœãïŒãçã¿åºããŸãã
å®è£ ã«ã¯ã次ã®ãã®ãå¿ èŠã§ãã
- ãããããã«ãŒããäœãããã®NFCã¿ã°ã®æïŒã¢ã¹ã¯ã¯ã®å°äžéã®å笊ïŒïŒã
- 2ããŒã¹ïŒåãã¬ãŒã€ãŒçšïŒESP8266 + RFID-RC522ã¯ã移åæã«ããããèªã¿åãããããã¯ãŒã¯ã«éä¿¡ããŸãã
- Firebase-ããŒã¿ãä¿åããã«ãŒã«ã«åŸã£ãŠã¢ãã«å ã®å€ã移åããã³å€æŽããŸãã
- Android-ãã¬ã€ã€ãŒã«çºçãããã¹ãŠïŒèªåã®çµ±èšãä»ã®äººã®çµ±èšïŒã衚瀺ããŸãã
Firebaseã«ã€ããŠã®ãhello worldããªã©ãããããçš®é¡ã®ããšã¯åãäžããŸãããHabréãªã©ããã®ããŒãã«é¢ããè³æã¯ååã«ããããã§ãã 詳现ãããŒãããªãããã«ãã¢ãã«ã®ãã¹ãŠã®åŸ®åŠãªç¹ã«ã€ããŠã¯èšåããŸããã ããŒã¿ã®èªã¿åããæžã蟌ã¿ãåŠçã®æ¹æ³ã¯ããã«èå³æ·±ãã§ãã
ã¢ãã«ã«ã€ããŠå°ã
ãã®ãããããŒã¿ããŒã¹ã§ã¯ã²ãŒã ããŒããæ¢ããŸãã
ã35ïŒ74ïŒd6ïŒ65ãã¯ããŒãã£ãŒIDã§ã
ç¶æ ã¯ãã¬ã€ã€ãŒã§ã
ã¿ãŒã³ã¯äžé£ã®åãã§ã
ããŒãã£èªäœã«é¢ããæ å ±ã«å ããŠãã«ãŒãã®ãªã¹ããšããã€ãã®äºåèšå®ïŒããšãã°ãå¥åº·ãšããã®æ倧å€ïŒãä¿åããå¿ èŠããããŸãã
åNFCã¿ã°ã«ã¯ãããã€ãã®æ å ±ãä¿åã§ããŸãã ã¢ã¹ã¯ã¯ã®å°äžéã®ãã±ãããã«ãŒããšããŠäœ¿çšãããããåãã±ããã«ã¯ãã§ã«äžæã®ããŒãããããããå¿ èŠã§ãã ãããã®ããŒã¯ãããšãã°ãNFCã§å®è¡ã§ããAndroidã¢ããªã±ãŒã·ã§ã³ã§èªã¿åãããšãã§ããŸãã
ããã¯ãã«ãŒãã®äžæã®ããŒããã£ã¹ãã«å¿ èŠãªããã®éãããã³å¹æã®ã»ããã«å¿ããŠååãèšå®ããããŒã¿ããŒã¹ã®äžéšã§ãã
移åã¯æ¬¡ã®ãšããã§ãã
- ãã¬ã€ã€ãŒã¯ã«ãŒããéžæããããããªãŒããŒã®1ã€ã«æã£ãŠããŸãïŒå¹æã誰ã«é©çšãããã«ãã£ãŠç°ãªããŸã-èªåãŸãã¯çžæïŒã
- 圌ã¯Firebase Databaseã«æžã蟌ã¿ãŸã-ãã«ãŒãNã¯ãã¬ãŒã€ãŒMã§ãã¬ã€ãããŸããã
- Firebaseæ©èœã¯ãæ°ããã¬ã³ãŒããã ãŒãã®ã·ãŒã±ã³ã¹ã«åºçŸããããšã確èªãããããåŠçããŸãïŒãã¬ã€ãããã«ãŒãã®ãã¬ã€ã€ãŒãããã¬ã€ã€ãŒãåŒãé¢ããçŸåšã®ã«ãŒãããã¿ãŒã²ãããã¬ã€ã€ãŒã«ãšãã§ã¯ããå²ãåœãŠãæ¢ã«ãã¬ã€ã€ãŒã«ããã£ãŠãããã¹ãŠã®ãšãã§ã¯ããé©çšãããããã®æç¶æéã1æžãããŸã;
- Androidã¯ã©ã€ã¢ã³ãã¯ãFirebaseããŒã¿ããŒã¹ã®å€æŽã远跡ããçŸåšã®ãã¬ãŒã€ãŒã®çµ±èšã人éãèªãã圢åŒã§è¡šç€ºããã ãã§ãã
è ºãšã³ãŒããžã®ã¹ã ãŒãºãªç§»å
ãããŠãç§ãã¡ãæã£ãŠããè ºã¯ããã€ã¯ãã³ã³ãããŒã©ãŒESP 8266ãšRFID / NFCãªãŒããŒRFID-RC522ã§ãã ç§ãã¡ã®ã±ãŒã¹ã®ESP 8266ã¯ãå°ãããŠãé£ã¹ããããWi-Fiã¢ãžã¥ãŒã«ãçµã¿èŸŒãŸããŠããã ãã§ãªããArduinoäºææ§ããããŸãïŒããã«ãããããªãã¿ã®Arduino IDEã§ãã¡ãŒã ãŠã§ã¢ãäœæã§ããŸãïŒã
ãããã¿ã€ãã«ã¯ãESP 8266ã«åºã¥ããNode MCU v3ããŒãã䜿çšããŸãããããã«ãããUSBãä»ããŠãã¡ãŒã ãŠã§ã¢ãšé»æºãçŽæ¥ã¢ããããŒãã§ããŸããããã¯ãäžè¬çã«ãããã¿ã€ãã®ãã¬ãŒã ã¯ãŒã¯ã®çŸããã§ãã Cããã³Luaã§äœæã§ããŸãã ã¹ã¯ãªããèšèªå šè¬ãç¹ã«Luaã«å¯Ÿããæã¯å¥ãšããŠãCãéžæããŸããã ç§ãã¡ã®ã¢ã€ãã¢ãå®è£ ããããã«å¿ èŠãªã©ã€ãã©ãªã¹ã¿ãã¯ãã»ãšãã©ããã«èŠã€ãããŸããã
ããŠãRFID-RC522ã¯ããããæãã·ã³ãã«ã§æãäžè¬çãªã«ãŒããªãŒããŒã§ãã ã¢ãžã¥ãŒã«ã¯SPIãä»ããŠæ©èœããESP 8266ãžã®æ¥ç¶çšã«æ¬¡ã®ãã³é åãåããŠããŸãã
ããŒã¯ã¯å®ãã§ããã³ãŒããèŠããŠãã ããïŒ
ç§ãã¡ã®ä»äºã¯ããã§ãïŒ
- ã«ãŒããèªã;
- ãããããŒãã£ãŒãäœæããããã®ããŒã«ãŒãã§ããå ŽåãFirebaseã§æ°ããããŒãã£ãŒãäœæããŸãã
- ãããã²ãŒã ã«ãŒãã®å Žåãã«ãŒããååŸããŠFirebaseã«éä¿¡ããŸãïŒæ°ããã ãŒããäœæããŸãïŒã
- é»çãç¹æ» ãããŸãã
ã¹ãã£ããŒ
ã©ã€ãã©ãªãŒMFRC522ã䜿çšãããŸãã ã¹ãã£ããŒãšã®çžäºäœçšã¯SPIãçµç±ããŸãã
<code>void Scanner::init() { SPI.begin(); // SPI rc522->PCD_Init(); // rc522->PCD_SetAntennaGain(rc522->RxGain_max); // } String Scanner::readCard() { // if(rc522->PICC_IsNewCardPresent() && rc522->PICC_ReadCardSerial()) { // XX:XX String uid = ""; int uidSize = rc522->uid.size; for (byte i = 0; i < uidSize; i++) { if(i > 0) uid = uid + ":"; if(rc522->uid.uidByte[i] < 0x10) uid = uid + "0"; uid = uid + String(rc522->uid.uidByte[i], HEX); } return uid; } return ""; }
Firebase
Firebaseçšã®ãã°ãããFirebaseArduinoã©ã€ãã©ãªããããããã«ããŒã¿ãéä¿¡ããŠã€ãã³ãã远跡ã§ããŸãã Jsonãªã¯ãšã¹ãã®äœæãšéä¿¡ããµããŒãããŸãã
Firebaseãšã®ããåãã¯éåžžã«ç°¡åã§ããããšããããã2è¡ã§ç°¡åã«èª¬æã§ããŸãã
Firebase.setInt("battles/" + battleId + "/states/" + player + "/hp", 50); if(firebaseFailed()) return;
firebaseFailedïŒïŒã¯æ¬¡ã®ãšããã§ãã
int Cloud::firebaseFailed() { if (Firebase.failed()) { digitalWrite(ERROR_PIN, HIGH); // Serial.print("setting or getting failed:"); Serial.println(Firebase.error()); // delay(1000); digitalWrite(ERROR_PIN, LOW); // return 1; } return 0; }
JSONãªã¯ãšã¹ãã¯æ¬¡ã®ããã«éä¿¡ã§ããŸãã
StaticJsonBuffer<200> jsonBuffer; JsonObject& turn = jsonBuffer.createObject(); turn["card"] = cardUid; turn["target"] = player; Firebase.set("battles/" + battleId + "/turns/" + turnNumber, turn); if(firebaseFailed()) return 1;
åºæ¬çã«ãéã®éšåãããå¿ èŠãªãã®ã¯ããã ãã§ãã åœåã¯ãå¯èœãªéãæœè±¡åããããšèããŠããŸããããå šäœãšããŠãããè¡ããŸããã æåã®ãã¡ãŒã ãŠã§ã¢ã®äœæ以æ¥ãããã¯1åããå€æŽãããŠããããããã¯éèŠã§ã¯ãããŸããã
ç¹å¥ã«èšç·ŽãããFirebaseæ©èœã«ã€ããŠ
ããã¯ãçŸåšã®ã²ãŒã ã®åããä¿åãããããŒã¹ã®äžéšã§ãã ååãã§ã¯ãã©ã®çš®é¡ã®ã«ãŒãããã¬ã€ãããã©ã®ãã¬ã€ã€ãŒã«åããããŠãããã瀺ãããŸãã æ°ãã移åäžã«äœããå®è¡ãããå Žåã¯ããã¿ãŒã³ãããŒãã®å€æŽã远跡ããFirebaseé¢æ°ãäœæããŸãã
exports.newTurn = functions.database.ref('/battles/{battleId}/turns/{turnId}').onWrite(event => { // , if (event.data.previous.val()) return; // admin.database().ref('/battles/' + event.params.battleId + '/turns').once('value') .then(function(snapshot) { // , var whoCasts = (snapshot.numChildren() + 1) % 2; // admin.database().ref('/battles/' + event.params.battleId + '/states').once('value') .then(function(snapshot) { var states = snapshot.val(); var castingPlayer = states[whoCasts]; var notCastingPlayer = states[(whoCasts + 1) % 2]; var targetPlayer; if (whoCasts == event.data.current.val().target) targetPlayer = castingPlayer; else targetPlayer = notCastingPlayer; // admin.database().ref('/cards/' + event.data.current.val().card).once('value') .then(function(snapshot) { var card = snapshot.val(); // castingPlayer.mana -= card.mana; // var cardEffects = card.effects; if (!targetPlayer.effects) targetPlayer.effects = []; for (var i = 0; i < cardEffects.length; i++) targetPlayer.effects.push(cardEffects[i]); // , playEffects(castingPlayer); playEffects(notCastingPlayer); // return event.data.adminRef.root.child('battles').child(event.params.battleId) .child('states').update(states); }) }) }) });
playEffectsé¢æ°ã¯æ¬¡ã®ããã«ãªããŸãïŒã¯ããevalããããŸããããã¢ãããžã§ã¯ãã§ã¯ããã¯ããªãåãå ¥ãããããšæããŸãïŒã
function playEffects(player) { if (!player.effects) return; for (var i = 0; i < player.effects.length; i++) { var effect = player.effects[i]; if (effect.duration > 0) { eval(effect.id + '(player)'); effect.duration--; } } }
åå¹æã¯æ¬¡ã®ããã«ãªããŸãã
function fire_damage(targetPlayer) { targetPlayer.hp -= getRandomInt(0, 11); }
ããã§ã¯ãããããããŒã¿ããŒã¹å ã®ãã¬ãŒã€ãŒã次ã®ããã«è¡šãããŠããããšã説æãã䟡å€ããããŸãã
ã€ãŸããããããã«ååãå¥åº·ãããããããŸãã ãããŠãäœãããããã«é£ã³èŸŒãã å Žåãå¹æã衚瀺ãããŸãïŒ
ã¡ãªã¿ã«ãå¹æã«é¢é£ããå¥ã®åé¡ããããŸãããã§ã«å¹æãæç¶ããŠãããã®ã¯åé€ããå¿ èŠããããŸãã ãã1ã€ã®é¢æ°ãæžããŸãããã
exports.effectFinished = functions.database.ref('/battles/{battleId}/states/{playerId}/effects/{effectIndex}') .onWrite(event => { effect = event.data.current.val(); if (effect.duration === 0) return event.data.adminRef.root.child('battles').child(event.params.battleId).child('states') .child(event.params.playerId).child('effects').child(event.params.effectIndex).remove(); });
ãããŠããã®çŸããããã¹ãŠæºåž¯é»è©±ã®ç»é¢ã«è¡šç€ºããããšã¯æ®ã£ãŠããŸãã
ããšãã°ã次ã®ããã«ïŒ
ã¯ããããã§ãïŒ
远跡ããããŒãã£ãŒãšå¯ŸæŠçžæãéžæããæ°åã§çµ±èšã確èªããäžè¬åããã圢åŒã§å¯ŸæŠçžæã®çµ±èšã確èªããŸãïŒããŸããŸãªæ¥œããã®çµµæåã«ããŸãããïŒã
ã³ãŒããèªã¿ãããããããã®æ¡ä»¶ä»ãã¢ããªã±ãŒã·ã§ã³ã¹ããŒãã次ã«ç€ºããŸãã
Androidã®FirebaseããããŒã¿ãèªã¿åãã®ã¯éåžžã«ç°¡åã§ããããŒã¿ããŒã¹å ã®ç¹å®ã®ããŒãã«ãªã¹ããŒãããã¯ããDataSnapshotããã£ããããŠUIã«éä¿¡ããŸãã ããã¯ãæåã®ç»é¢ã«ããŒãã£ã®ãªã¹ãã衚瀺ããæ¹æ³ã§ãïŒã³ãŒããå€§å¹ ã«æžãããŠãããŒã¿ã®åä¿¡ãšè¡šç€ºã«é¢ããç¬éã®ã¿ã匷調衚瀺ããŸãïŒã
public class MainActivity extends AppCompatActivity { // ... @Override protected void onCreate(Bundle savedInstanceState) { // ... FirebaseDatabase database = FirebaseDatabase.getInstance(); // "battles" ( , // - ) database.getReference().child("battles").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot battles) { final List<String> battleIds = new ArrayList<String>(); for (DataSnapshot battle : battles.getChildren()) battleIds.add(battle.getKey()); ArrayAdapter<String> adapter = new ArrayAdapter<>(MainActivity.this, android.R.layout.simple_list_item_1, battleIds.toArray(new String[battleIds.size()])); battlesList.setAdapter(adapter); battlesList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { PlayerActivity.start(MainActivity.this, battleIds.get(i)); } }); } @Override public void onCancelled(DatabaseError databaseError) { // ... } }); } }
ãããããããŒã¯ã¢ããã䜿çšããŠãã¡ã€ã«ãäžèŠ§è¡šç€ºããããšã¯ãããŸããããã¹ãŠãéåžžã«ç°¡åã§ãã
ãã®ãããããŒãã£ãŒãã¯ãªãã¯ãããšãã«PlayerActivityãèµ·åããŸãã
public class PlayerActivity extends AppCompatActivity implements ChoosePlayerFragment.OnPlayerChooseListener { // ... @Override protected void onCreate(Bundle savedInstanceState) { // ... battleId = getIntent().getExtras().getString(EXTRA_BATTLE_ID); // , if (savedInstanceState == null) getSupportFragmentManager() .beginTransaction() .replace(R.id.container, ChoosePlayerFragment.newInstance(battleId)) .commit(); } @Override public void onPlayerChoose(String playerId, String opponentId) { // - getSupportFragmentManager() .beginTransaction() .replace(R.id.container, StatsFragment.newInstance(battleId, playerId, opponentId)).addToBackStack(null) .commit(); } }
ChoosePlayerFragmentã¯ãéžæããã²ãŒã ã®ç¶æ ããŒããèªã¿åãããããã2人ã®å¯ŸæŠçžæãåŒãåºããŠããã¿ã³ã«ååãå ¥ããŸãïŒè©³çŽ°ã«ã€ããŠã¯ãèšäºã®æåŸã«ãããªã³ã¯ãåç §ããŠãã ããïŒã
ãã®æç¹ã§ãStatsFragmentã«ã€ããŠè©±ã䟡å€ããããŸããStatsFragmentã¯ã察æŠçžæã®ã¹ããŒã¿ã¹ã®å€åã远跡ãããããã衚瀺ããŸãã
public class StatsFragment extends Fragment { // ... @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { // ... // , // addSingleValueEventListener , // database.getReference().child("settings") .addSingleValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot settings) { maxHp = Integer.parseInt(settings.child("max_hp").getValue().toString()); maxMana = Integer.parseInt(settings.child("max_mana").getValue().toString()); } // ... }); // database.getReference().child("battles").child(battleId).child("states").child(playerId) .addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot player) { hp = player.child("hp").getValue().toString(); mana = player.child("mana").getValue().toString(); hpView.setText("HP: " + hp + "/" + maxHp); manaView.setText("MANA: " + mana + "/" + maxMana); } // ... }); // database.getReference().child("battles").child(battleId).child("states").child(opponentId) .addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot opponent) { opponentName.setText(opponent.child("name").getValue().toString()); if (opponent.hasChild("hp") && opponent.hasChild("mana")) { int hp = Integer.parseInt(opponent.child("hp").getValue().toString()); float thidPart = maxHp / 3.0f; if (hp <= 0) { opponentView.setImageResource(R.drawable.grumpy); return; } else if (hp < thidPart) { opponentView.setImageResource(R.drawable.sad); return; } else if (hp < thidPart * 2) { opponentView.setImageResource(R.drawable.neutral); return; } opponentView.setImageResource(R.drawable.smile); } } // ... }); } }
ãã¢ã°ããºãçµã¿ç«ãŠãã®ã¯ããã ãã§ãã å®å šãªãœãŒã¹ã³ãŒãã¯githubã«ååšãããããªãã¢ã€ãã¢ã¯ç§ãã¡ã®æ³åã®äžã«ååšããŸãã ããã§ããã¡ã€ã«ã䜿çšããŠã¢ãã«ãå®æãããèšèšã«ã€ãŸãããŠã³ã³ãã³ããäœæããŠããŸãã ãããŠãã¢ã€ãã¢ãçãæ®ã£ãããããã¯ç¢ºãã«ããã«ããã€ãã®åœ«åãçã¿åºããŸãã