From: Nathaniel Wesley Filardo Date: Tue, 30 Oct 2018 22:37:48 +0000 (+0000) Subject: Add handbook activity X-Git-Tag: release-1.2~2 X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=2b1d7a391135e8d5999b531a8e812e822b88e93c;p=acmetensortoys-ctfws-android Add handbook activity --- diff --git a/mobile/build.gradle b/mobile/build.gradle index 08cdfcd..e858977 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -66,4 +66,6 @@ dependencies { } testImplementation 'junit:junit:4.12' + implementation 'com.android.support:recyclerview-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' } diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index b1fde30..069bcd9 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -40,6 +40,10 @@ android:name=".MainService" android:enabled="true" android:exported="false" /> + + + \ No newline at end of file diff --git a/mobile/src/main/assets/hand.html b/mobile/src/main/assets/hand.html new file mode 100644 index 0000000..2b150fc --- /dev/null +++ b/mobile/src/main/assets/hand.html @@ -0,0 +1,505 @@ + + + + +Capture the Flag with Stuff + + + + + + Capture the Flag with Stuff + + + +

I. Base Rules

+ +

I.@. Meta

+

I.@.1. When rules in this document conflict, the later rule takes + precedence.

+

I.@.1.a. E.g. I.C.4 states that a captor may not capture, while +V.D.2 states that a player wearing Doc Arnold's Belt +of Many Places at Once may capture multiple times.

+

I.@.2. The judges may choose to change the rules or add or remove stuff into +the game. Any such rules or stuff changes must be clearly explained before +the start of the game in which those changes are to be introduced.

+ +

I.A. Teams and Territories

+

I.A.1. The game consists of two teams, red and yellow. Team membership is +indicated by colored bands, worn on the upper arm or head, which must be +visible at all times.

+

I.A.2. Each team has a home territory. One team's is Wean, the other's is Doherty. +The teams should swap territories after each game. The territory is defined +as the space inside the building, with the doors closed, or as defined by +the judges in the case of ambiguity. Where there is a chamber between two +sets of doors, the chamber is included in the building.

+

I.A.3. Certain areas such as labs, clusters, and any normally +inaccessible or otherwise restricted areas are forbidden. No player may +enter these areas at any time during the game.

+

I.A.4. All areas which are neither a team's home territory nor +forbidden are neutral. There must always be at least ten feet of neutral +territory between opposing teams' home territories.

+

I.A.5. A player is considered to be in a team's territory if any +part of their body is in the team's territory. If a player is in no +team's territory, they are in neutral territory. Magic items have no +effect on players who are in neutral territory.

+ +

I.B. Players

+

I.B.1. A player is any person playing the game.

+

I.B.2. A teammate is a member of the same team.

+

I.B.3. An enemy is a player who is not a teammate.

+

I.B.4. A player may be normal, ethereal, captive, captor, prisoner, +interrogation victim, or stunned.

+

I.B.5. A normal player is in the default state described in these rules.

+

I.B.6. An ethereal player may not use, drop, or pick up magic items, +is not affected by magic items, may not capture, and may not be +captured. A player must use jazz hands to signal ethereality.

+

I.B.7. A captive is a player who has been captured (see ). +Captives may not move or touch enemy flags and may not use or drop + magic items (except for the Ninja Potion; see ).

+

I.B.8. A captor is a player who has captured another player (see +). Captors must lead their captives to the jail (see ), +but are otherwise normal players.

+

I.B.9. A prisoner is a player who was a captive, but has touched the Glyph of Jail +(see ).

+

I.B.10. An interrogation victim is a prisoner who has been given truth serum +by the jailer (see ). They may not use magic items, but otherwise act +identically to a prisoner except where specified.

+

I.B.11. A stunned player must immediately sit on the floor in the territory in which they were +stunned until the stun wears off. The time they are stunned is measured from +when they sit down, not when the stunning effect occurred. If they are captured +while stunned, they become unstunned. A player may not be stunned again while +stunned. Stunned players may not capture.

+

I.B.12. Only normal players and captors can be stunned.

+

I.B.12.a. If John Mackey changes a player's major during the game, the player is +stunned for one minute.

+ +

I.C. Capture and Imprisonment

+

I.C.1. If a player touches an enemy when both are in the first +player's home territory, they may choose to capture the enemy. At this +point, the enemy becomes a captive.

+

I.C.1.a. As capture is optional, captors are encouraged to notify their +captives of this action ("Gotcha" is a good choice).

+

I.C.2. A player, when captured, must immediately drop any flags they are carrying at +the spot where they were captured.

+

I.C.3. A captive or prisoner must give up any non-concealable items upon +request of the captor or a teammate of the captor. Concealable items need not +be given up unless the enemy asking for them knows that the player has the +item.

+

I.C.4. A captor must lead their captive directly to their team's Glyph +of Jail (see ) at a reasonable speed. They cannot make any more +captures until their captive has entered jail by touching the Glyph of +Jail or another prisoner in the jail. Once this +occurs, the captor is again a normal player, and the captive becomes a +prisoner.

+

I.C.5. If a captor is stunned, their captive becomes a normal player.

+

I.C.6. Prisoners may use magic items.

+ +

I.D. Jail

+

I.D.1. Each team has a jail, designated by the Glyph of Jail.

+

I.D.1.a. Whenever possible, the Glyph of Jail in Doherty will be placed on floor A, +near the staircase closest to the main lobby, and the Glyph of Jail in Wean +will be placed on floor 6, near room 6220 at the end of the 6200 corridor.

+

I.D.2. One player on each team may take on the role of jailer by +wearing the team's Jailer Fedora. The jailer is a normal player except +as described in the remainder of this section. The jailer may at any +time transfer the fedora to a teammate, who becomes jailer, or +remove it, leaving no jailer.

+

I.D.2.a. In particular, if the jailer is captured or stunned, the jail +remains functional; prisoners are not released (although any interrogation +in progress is ended).

+

I.D.3. A player may not move the opposing team's fedora except to drop +it.

+

I.D.4. The prisoners must form one or more chains, with each player +touching the Glyph of Jail either directly or through a chain of other +prisoners.

+

I.D.5. If there is a jailer, they may relax the requirement to form chains.

+

I.D.5.a. Typically, the jail is at the end of a hall, and prisoners are allowed to +sit around in the vicinity of the jail.

+

I.D.6. Every fifteen minutes, starting from the beginning of play, +all prisoners are released from all jails. Released prisoners must +return to their home territories at reasonable speed, by the most +direct route. Prisoners released in this manner are ethereal until they +re-enter their home territories.

+

I.D.7. A player in a normal state not carrying a flag may touch a prisoner +in another team's jail. As long as freeing the prisoner does not break a +chain leading back to the jail, the prisoner is freed. Both players are +ethereal and must return to their home territory as after a jailbreak (see I.D.6); +they need not remain together.

+

I.D.8. The jailer has a supply of Truth Serum, which they may use by +poking a prisoner in the shoulder with a pinky finger. The prisoner +then becomes an interrogation victim.

+

I.D.9. The jailer may then ask the victim up to six yes/no +questions, and the victim may lie no more than once. The victim may +answer "I don't know" if they really don't know, but then the question +doesn't count against the six.

+

I.D.10. Upon completion of questioning, the victim is freed from jail +and must return to their home territory as after a jailbreak (see I.D.6). +Questioning is complete when the victim answers the sixth question, if +the jailer decides they are done with this victim, if the victim is +freed, at jailbreak, if there is no jailer, or if the jailer leaves line of +sight of the victim.

+

I.D.11. There may be at most one truth serum victim in each jail.

+ +

I.E. Initial Setup and Game Completion

+

I.E.1. At the beginning of the game, there is a setup period of +fifteen minutes. This time should be used for the placement of flags +and glyphs, and distribution of magic items. No player may enter enemy +territory during this period. Magic items have no effect during this +time.

+

I.E.2. The game begins at the end of the set up period and ends after one +hour, or when there remains only one team with uncaptured flags.

+ +

I.F. Additional Terms

+

I.F.1. Cooldown: This is a property of certain items. An item with +cooldown may not be activated again for one minute after its use. This +requirement may be suspended by the singing of a number of verses from +a song determined before the game begins; the item is then usable after +singing that song.

+

I.F.2. Concealment: Potions may be concealed, meaning they need not +be visible. All other game items must be visible at all times. A +captive is not required to give up a concealed item unless their captor +asks for it specifically and knows that they have the item.

+

I.F.2.a. Potions cannot be used while concealed.

+

I.F.3. Dispelling: A dispelled item has no magical effects.

+

I.F.4. Field of View: The field of view is the extent of the observable world that +is visible to the player at any given moment.

+

I.F.5. Line of Sight: A player is within line of sight of an item or event +if they can rotate themself to bring it into their field of view.

+

I.F.6. See: A player sees an item or event if it passes within their field of +view and they can recognize it.

+

I.F.7. Sacrificial: Red items are sacrificial. These items may +only be activated in enemy territory, must be dropped upon use, and may not +be picked up or moved when in enemy territory.

+

I.F.8. Whap: A player is whapped by a wand if it hits them at approximately the same +time the wand bearer shouts the key word.

+

I.F.8.a. As wands are fairly soft, whapping a player on the head counts but is discouraged.

+

I.F.9. Key Words/Phrases: Some items have a key word or phrase used to +activate them. This phrase must be said entirely in the territory where the +activation occurs, and the action occurs upon completion of the phrase.

+

I.F.10. Knowledge: knowledge of an opponent's concealable items, as referenced in +rules I.C.3 and I.F.2, means that they have not had a chance to dispose of +that item since the last time you saw it in their possession.

+ +

I.G. Flags

+

I.G.1. Flags are large pieces of cloth or felt. Each team has three or more flags.

+

I.G.2. Flags must be placed during the initial setup time, and their +placement must be supervised by a judge. They must be placed no higher +than six feet above the floor; the flag must be clearly visible from most +angles; flags must be placed no more than one flag per +hallway or corridor. If the flag is placed inside a container, there +must be an obvious way to remove the flag in one smooth motion.

+

I.G.3. No flag may ever exist in an area with fewer than two exits, +unless it is being carried. If a flag is dropped in an area with only +one exit, a judge must move it the shortest possible distance to a +valid location.

+

I.G.4. Any magic items a player is carrying are dispelled if they are +carrying a flag, and remain dispelled for one minute after the player +gives up the item or drops the flag.

+

I.G.5. Each flag will be assigned a point value at the beginning of the game by the +head judge.

+

I.G.5.a. Judges may or may not inform the players of these values on a per-game basis.

+

I.G.6. The winner of the game is the team with the most points. The point values of +each flag must be set such that the team with the most flags has the most points.

+

I.G.6.a. If the point system is set differently than specified in I.G.6, the players +must be informed of this fact before the set up of the game in which this takes place.

+

I.G.7. A player who brings a flag to the judges room earns for their +team the number of points associated with the flag. The flag is then +out of play for the remainder of the game.

+ +

I.H. Judges

+

I.H.1. Judges are indicated by blue or silver headbands, and are responsible for +keeping the game running smoothly.

+

I.H.2. The head judge is the final arbiter and scorekeeper, and should remain in the +judges' room, which is Wean Hall 8427 unless otherwise specified.

+

I.H.3. An assistant head judge should reside at each team's jail.

+

I.H.4. Each team should also have at least 1 roaming judge. The total number of +roaming judges is up to the head judge, and based on the number of players.

+

I.H.4.a. Roaming judges’ responsibility is to resolve conflicts or perform other +duties required of them.

+

I.H.5. Judges should attempt to resolve disputes fairly and find outcomes agreeable +to both sides. In all cases, the judge's decision is final.

+ +

II. Glyphs

+ +

II.A. General

+

II.A.1. Glyphs are large sheets of paper or poster-board marked with a spell.

+

II.A.2. Each glyph is owned by a particular team, indicated by the coloring of the glyph.

+

II.A.3. A glyph must be taped to a wall in the owning team's territory or side + of a door that would be in the owning team's territory if it were closed.

+

II.A.3.a. Once placed, all glyphs are considered part of the owning team’s territory.

+

II.A.4. A glyph affects all normal players on opposing teams in its owning team's + territory.

+

II.A.5. A glyph may not be placed within ten feet of a flag. If a flag is dropped + within ten feet of a dispellable glyph, the glyph is dispelled for as long as + the flag remains, and for one minute after.

+

II.A.6. A glyph may not be placed such that any part of it is more than 6 feet off + the ground.

+ +

II.B. Glyph of Jail

+

II.B.1. The Glyph of Jail is indicated by the word "Jail".

+

II.B.2. The Glyph of Jail defines the Jail, as described by section .

+

II.B.3. The Glyph of Jail cannot be dispelled.

+ +

II.C. Glyph of Entrancement

+

II.C.1. The Glyph of Entrancement is indicated by the word "Gotcha".

+

II.C.2. A player who sees the Glyph of Entrancement is stunned for one minute.

+ +

II.D. Glyph of the Disgusting Doorknob

+

II.D.1. The Glyph of the Disgusting Doorknob is indicated by the word "Yukko".

+

II.D.2. If a Glyph of the Disgusting Doorknob is on a door, a player may not +open the door or prevent it from closing by interacting with the side of +the door the Glyph is on. If the Glyph is mounted on one of a set of doors, +all doors are affected.

+

II.D.2.a. The Glyph of Disgusting Doorknob affects players in neutral territory.

+

II.D.3. The counting of exits for purposes of flag placement is unaffected by +this glyph.

+

II.D.4. If a Glyph of the Disgusting Doorknob is mounted next to the +buttons controlling an elevator, no affected player may push any of the +buttons or prevent the elevator doors from closing.

+

II.D.5. Any player must be able to exit to neutral territory without opening any +door from a side affected by a Glyph of the Disgusting Doorknob or activating +any stuff. No player can be completely trapped by this glyph.

+ +

II.E. Glyph of Alarm

+

II.E.1. The Glyph of Alarm is indicated by the word "Alarm".

+

II.E.2. A player who sees the Glyph of Alarm must shout or sing +"Alarm" or another phrase as loudly as possible for one minute or +until they are captured or returns to neutral space.

+ +

II.F. Glyph of Recharge

+

II.F.1. The Glyph of Recharge is indicated by the word "Recharge".

+

II.F.2. A player may recharge a white colored magical item (see ) by holding it + to a Glyph of Recharge for a period of 10 seconds.

+

II.F.2.a. A player may use any Glyph of Recharge in either territory.

+ +

III. Potions

+ +

III.A. General

+

III.A.1. Potions are small pieces of foam wrapped in colored tape.

+

III.A.2. Potions are concealable.

+ +

III.B. Ninja Potion of Magic Smoke

+

III.B.1. The Ninja Potion of Magic Smoke is red, and thus sacrificial.

+

III.B.2. To activate this item a captive throws this potion onto the ground and yells +as loudly as possible "Poof, I am a Ninja!". All enemy players who hear this +and are within line of sight of the user are stunned for ten seconds.

+

III.B.2.a. This includes enemy players within line of sight in all +territories. Players in neutral territory are unaffected, as they are +immune to all stuff.

+ +

III.C. Potion of Wait... There's a Key at the Bottom of This

+

III.C.1. The Potion of Wait... There's a Key at the Bottom of This is green and has cooldown.

+

III.C.2. To activate this potion, a player must bonk themself on the head +with this potion and use one of the key words "Lolt", "Jube", or "Key".

+

III.C.3. A stunned player, once they are sitting, may use this potion to unstun +themself and return to a normal state.

+

III.C.4. A prisoner may use this potion to free themself from jail and return to a normal state.

+ +

III.D. Potion of Mind Control

+

III.D.1. The Potion of Mind Control is blue.

+

III.D.2. To use this potion, a player must capture an enemy player while + using the key word "obey". The enemy becomes the player's captive, + and must be handed this potion immediately.

+

III.D.3. A player may capture two people simultaneously with one invocation + of the potion's ability. They must be simultaneously tagged when the + player says "obey". Both enemies become the player's captive.

+

III.D.4. Captive(s) who are handed this potion must proceed directly to jail as if + escorted by the captor, clearly displaying the potion to any members of the + captor's team they encounter.

+

III.D.4.a. Player(s) controlled by the Potion of Mind Control are still + captive(s). They may not be stunned, and they ignore opponents' glyphs.

+

III.D.4.b. No player may take the Potion of Mind Control from captive(s) being + controlled by it, even if they know they have it.

+

III.D.4.c. If the Potion of Mind Control is dispelled, the captive(s) under its control + are freed.

+

III.D.5. A captor who uses the Potion of Mind Control becomes a normal + player after handing off the potion. They do not have to escort the + captive(s) to jail.

+

III.D.6. The captive(s) may not proceed to jail by a route that is less + than direct, in an effort to explore for flags or for any other + reason.

+

III.D.6.a. If two players were captured, they are controlled by the same + potion and must stay together.

+

III.D.7. This potion may be activated while concealed.

+ +

IV. Wands

+ +

IV.A. General

+

IV.A.1. Wands are eighteen-inch lengths of foam rubber.

+

IV.A.2. The effect of a wand is activated by whapping a person or glyph and shouting +the key word.

+

IV.A.3. Each use of the key word invokes at most one wand on one subject.

+ +

IV.B. Wand of Vengeance

+

IV.B.1. The Wand of Vengeance has key word "Toast", and is red, and +thus sacrificial.

+

IV.B.2. A normal player may whap an enemy in the enemy's home territory. +The user captures the enemy, and both players become ethereal. The user +must lead the enemy back to their jail as directly as possible at reasonable +speed.

+

IV.B.3. Upon entry into the user's home territory, the user becomes a captor and the +enemy becomes a captive.

+ +

IV.C. Wand of Stun

+

IV.C.1. The Wand of Stun has key word "Stun", and is green and has cooldown.

+

IV.C.2. Any player whapped with this wand is stunned for one minute.

+ +

IV.D. Wand of Dispel

+

IV.D.1. The Wand of Dispel has key word "Dispel", and is blue and has cooldown.

+

IV.D.2. If a player is whapped with the wand of dispel, all magic items they are +carrying are dispelled for one minute.

+

IV.D.3. If two players simultaneously use this wand on each other, +all items carried by both players are dispelled for one minute.

+

IV.D.4. A dispellable glyph which is whapped by the Wand of Dispel is dispelled for +one minute.

+ +

V. Belts

+ +

V.A. General

+

V.A.1. A belt is a long sash of cloth or felt.

+

V.A.2. To be used, a belt must be tied around a player's waist.

+

V.A.3. A belt can be worn by at most one player.

+

V.A.4. A player can wear at most one belt.

+ +

V.B. Andy Warhol's Belt of Pop Occultism

+

V.B.1. Andy Warhol's Belt of Pop Occultism is red, and thus sacrificial.

+

V.B.2. To activate this belt, the wearer must yell as loudly as +possible some phrase to be determined by the judges before the start of +the game. Upon activation, all enemy players within line of sight of +the user are stunned for one minute.

+

V.B.2.a. Since the belt is sacrificial, the user must also drop the belt.

+ +

V.C. Goombah's Belt of Humiliating Protection

+

V.C.1. Goombah's Belt of Humiliating Protection is green.

+

V.C.2. This belt is activated by starting to skip and loudly sing "Yankee Doodle". +While singing and skipping continues, the belt is in use, and the wearer is +immune to capture and stun.

+

V.C.3. Any number of teammates may share the protection of this belt +by holding hands with the wearer, either directly or through a chain of +teammates, as long as all teammates in the chain are skipping and +singing along.

+

V.C.4. If any player in the chain is dispelled, all items carried by all members of the chain are dispelled.

+

V.C.4.a. In particular, the Goombah's belt is dispelled.

+

V.C.5. This belt does not function in elevators.

+ +

V.D. Doc Arnold's Belt of Many Places at Once

+

V.D.1. Doc Arnold's Belt is blue.

+

V.D.2. A player wearing Doc Arnold's Belt may have up + to three captives at once. They may attempt to capture further + captives beyond their first.

+

V.D.3. Once any captures have been made, the player must lead the captives + directly to jail as normal. On their way, the player may deviate from + their route only in the manner described below in + V.D.4.

+

V.D.4. While wearing Doc Arnold's belt, a captor with at + most two captives may use the key phrase "I'LL BE BACH." If they do, each + captive of that captor must remain stationary for as long as the + captor remains within their line of sight, and for a period of 10 + seconds thereafter. If the captor wearing the belt is outside of a + captive's line of sight for a period of 10 seconds while using + this effect, that captive is freed and becomes a normal player. + This effect ends after one minute, or when the wearer resumes + taking captives directly to jail, whichever occurs first.

+

V.D.4.a. A captor wearing Doc Arnold's belt may not use the key phrase + again if they have not brought a new captive back to their waiting + captive(s) since the last time they used the key phrase.

+

V.D.5. If the belt is dispelled, all of its wearer's captives except the + first are freed. If two captives were captured at the same time, + the captor may choose which one to keep.

+ +

VI. White Magic Items

+ +

VI.A. White Magic Items

+

VI.A.1. A white magic item is white.

+

VI.A.2. A white magic item must be charged to be used.

+

VI.A.2.a. All white magic items are charged at the start of the game

+

VI.A.3. White magic items come in potion, wand, and belt types.

+

VI.A.4. Each white magic item can be used as though it were a magic item of + the same type of any other color, and is activated by invoking the + keyword and action of that item.

+

VI.A.4.a. A white potion may be activated as any potion defined in , a + white wand as any wand defined in , and a white belt as any belt + defined in .

+

VI.A.5. A white magic item is always white. During its activation, it gains + the color of the magic item which was invoked, and follows all rules + of that magic item.

+

VI.A.5.a. In order to activate a white magic item, you must be in a valid + player state and location for activating that color and type of magic + item

+

VI.A.5.b. For example, if a white wand is used to invoke a Wand of + Vengeance , you must be in enemy territory, and the white wand is + sacrificial.

+

VI.A.6. After the activation of a white magic item, it becomes discharged + and loses the color of the invoked item.

+

VI.A.6.a. If a white magic item touches the ground, it becomes discharged.

+

VI.A.7. In order to recharge a white magic item, a player must hold it to + either a Glyph of Recharge (see ) or their own + Glyph of Jail (see ) for a period of ten seconds.

+ +

VII. Sportsmanship

+ +

VII.A. Physicality

+

VII.A.1. Players may not physically impede or block other players, either with their +bodies or with objects.

+

VII.A.1.a. This includes actions like preventing elevators from +moving. Breakage of this rule is grounds to eject you from the game.

+

VII.A.2. You may not change official timekeeping watches.

+

VII.A.3. You may not fabricate or replicate game items.

+ +

VII.B. Lies

+

VII.B.1. Although lies and deceit are part of the game, there are several things you +may not conceal, obfuscate, or lie about.

+

VII.B.2. You may not lie about whether you're in the game.

+

VII.B.3. You may not lie about which team you're on.

+

VII.B.4. You may not lie about the status of the game.

+

VII.B.4.a. For example, whether the game has started or ended.

+

VII.B.5. You may not lie about what non-concealable items you have.

+

VII.B.6. You may not lie about cooldown, dispel, or charge status of items.

+

VII.B.7. You may not lie about any player's status.

+

VII.B.8. You may not make jazz hands unless you are ethereal.

+

VII.B.9. You may not display a Potion of Mind Control in enemy territory unless you +are a captive under its control.

+

VII.B.10. You may not imitate the activation or use of an item without the intent of +using it.

+ +

0. Respect: Above all, don't be a jackass.

+ +
+
+
+

+ Copyright © The Carnegie Mellon KGB.
+

+
+ + + + + + + + + diff --git a/mobile/src/main/assets/handico/belts.png b/mobile/src/main/assets/handico/belts.png new file mode 100644 index 0000000..f6fbed1 Binary files /dev/null and b/mobile/src/main/assets/handico/belts.png differ diff --git a/mobile/src/main/assets/handico/capture.png b/mobile/src/main/assets/handico/capture.png new file mode 100644 index 0000000..73fcf10 Binary files /dev/null and b/mobile/src/main/assets/handico/capture.png differ diff --git a/mobile/src/main/assets/handico/flags.png b/mobile/src/main/assets/handico/flags.png new file mode 100644 index 0000000..ee4b703 Binary files /dev/null and b/mobile/src/main/assets/handico/flags.png differ diff --git a/mobile/src/main/assets/handico/glyphs.png b/mobile/src/main/assets/handico/glyphs.png new file mode 100644 index 0000000..d793c95 Binary files /dev/null and b/mobile/src/main/assets/handico/glyphs.png differ diff --git a/mobile/src/main/assets/handico/jail.png b/mobile/src/main/assets/handico/jail.png new file mode 100644 index 0000000..96f4bb6 Binary files /dev/null and b/mobile/src/main/assets/handico/jail.png differ diff --git a/mobile/src/main/assets/handico/judges.png b/mobile/src/main/assets/handico/judges.png new file mode 100644 index 0000000..39c7f67 Binary files /dev/null and b/mobile/src/main/assets/handico/judges.png differ diff --git a/mobile/src/main/assets/handico/meta.png b/mobile/src/main/assets/handico/meta.png new file mode 100644 index 0000000..e37faec Binary files /dev/null and b/mobile/src/main/assets/handico/meta.png differ diff --git a/mobile/src/main/assets/handico/players.png b/mobile/src/main/assets/handico/players.png new file mode 100644 index 0000000..3fe924e Binary files /dev/null and b/mobile/src/main/assets/handico/players.png differ diff --git a/mobile/src/main/assets/handico/potions.png b/mobile/src/main/assets/handico/potions.png new file mode 100644 index 0000000..310ad59 Binary files /dev/null and b/mobile/src/main/assets/handico/potions.png differ diff --git a/mobile/src/main/assets/handico/setup.png b/mobile/src/main/assets/handico/setup.png new file mode 100644 index 0000000..f9c946b Binary files /dev/null and b/mobile/src/main/assets/handico/setup.png differ diff --git a/mobile/src/main/assets/handico/sportsmanship.png b/mobile/src/main/assets/handico/sportsmanship.png new file mode 100644 index 0000000..5f292c3 Binary files /dev/null and b/mobile/src/main/assets/handico/sportsmanship.png differ diff --git a/mobile/src/main/assets/handico/teams_territories.png b/mobile/src/main/assets/handico/teams_territories.png new file mode 100644 index 0000000..7fef007 Binary files /dev/null and b/mobile/src/main/assets/handico/teams_territories.png differ diff --git a/mobile/src/main/assets/handico/terms.png b/mobile/src/main/assets/handico/terms.png new file mode 100644 index 0000000..1ff2729 Binary files /dev/null and b/mobile/src/main/assets/handico/terms.png differ diff --git a/mobile/src/main/assets/handico/wands.png b/mobile/src/main/assets/handico/wands.png new file mode 100644 index 0000000..f774240 Binary files /dev/null and b/mobile/src/main/assets/handico/wands.png differ diff --git a/mobile/src/main/assets/handico/white.png b/mobile/src/main/assets/handico/white.png new file mode 100644 index 0000000..7e53a80 Binary files /dev/null and b/mobile/src/main/assets/handico/white.png differ diff --git a/mobile/src/main/assets/handord.txt b/mobile/src/main/assets/handord.txt new file mode 100644 index 0000000..d433cff --- /dev/null +++ b/mobile/src/main/assets/handord.txt @@ -0,0 +1,14 @@ +meta +teams_territories +players +capture +jail +setup +terms +flags +judges +glyphs +potions +wands +belts +sportsmanship diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/HandbookActivity.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/HandbookActivity.java new file mode 100644 index 0000000..7a5f0a4 --- /dev/null +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/HandbookActivity.java @@ -0,0 +1,132 @@ +package com.acmetensortoys.ctfwstimer; + +import android.content.res.AssetManager; +import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.VectorDrawable; +import android.net.Uri; +import android.support.annotation.NonNull; +import android.support.v4.content.ContextCompat; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.DividerItemDecoration; +import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.RecyclerView; +import android.util.Log; +import android.util.TypedValue; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.widget.Button; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +public class HandbookActivity extends AppCompatActivity { + + private class HandbookAdapter extends RecyclerView.Adapter { + + class MyVH extends RecyclerView.ViewHolder { + Button b; + MyVH(Button b) { + super(b); + this.b = b; + } + } + + final String[] fns; + final View.OnClickListener ocl; + + HandbookAdapter(String[] fns, View.OnClickListener ocl) { + this.fns = fns; + this.ocl = ocl; + } + + + + @Override + public MyVH onCreateViewHolder(ViewGroup parent, int tipe) { + Button b = new Button(HandbookActivity.this, null, R.style.Widget_AppCompat_Button_Borderless); + b.setOnClickListener(ocl); + return new MyVH(b); + } + + @Override + public void onBindViewHolder(MyVH vh, int pos) { + try { + InputStream is = getAssets().open("handico/" + fns[pos] + ".png"); + Drawable d = BitmapDrawable.createFromStream(is, fns[pos]); + vh.b.setBackground(d); + } catch (IOException ignored) { + String ch = fns[pos]; + int ix = ch.indexOf('-'); + if (ix >= 0) { ch = ch.substring(ix); } + vh.b.setText(ch); + } + } + + @Override + public int getItemCount() { + return fns.length; + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.d("CtFwSHandbook", "onCreate"); + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_handbook); + + final WebView wv = findViewById(R.id.hand_wv); + + final String[] sections; + try { + InputStream is = getAssets().open("handord.txt", AssetManager.ACCESS_STREAMING); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + List lines = new ArrayList<>(); + String line; + while ((line = br.readLine()) != null) { + lines.add(line); + } + sections = lines.toArray(new String[0]); + + final RecyclerView rv = findViewById(R.id.hand_tabs); + rv.setHasFixedSize(true); + + LinearLayoutManager lm = new LinearLayoutManager(this); + rv.setLayoutManager(lm); + + Drawable divdr = ContextCompat.getDrawable(this, R.drawable.hand_tab_div); + if (divdr != null) { + DividerItemDecoration divde = new DividerItemDecoration(rv.getContext(), + lm.getOrientation()); + divde.setDrawable(divdr); + rv.addItemDecoration(divde); + } + + final View.OnClickListener ocl = new View.OnClickListener() { + @Override + public void onClick(View v) { + int ix = rv.getChildAdapterPosition(v); + Log.d("CtFwSHandbook", "onClick avix=" + ix); + if (ix != RecyclerView.NO_POSITION) { + Log.d("CtFwSHandbook" , "onClick avs=" + sections[ix]); + wv.loadUrl("file:///android_asset/hand.html#" + sections[ix]); + } + } + }; + + RecyclerView.Adapter a = new HandbookAdapter(sections, ocl); + rv.setAdapter(a); + } catch (IOException ioe) { + Log.d("CtFwSHandbook", "IOException?", ioe); + } + + wv.loadUrl("file:///android_asset/hand.html"); + } +} diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java index 2720b3e..ae0e198 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java @@ -209,6 +209,9 @@ public class MainActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(MenuItem mi) { switch(mi.getItemId()) { + case R.id.menu_hand: + startActivity(new Intent(this, HandbookActivity.class)); + return true; case R.id.menu_reconn: if (mSrvBinder != null) { mSrvBinder.connect(true); diff --git a/mobile/src/main/res/drawable/hand_tab_div.xml b/mobile/src/main/res/drawable/hand_tab_div.xml new file mode 100644 index 0000000..fb8e136 --- /dev/null +++ b/mobile/src/main/res/drawable/hand_tab_div.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mobile/src/main/res/layout/activity_handbook.xml b/mobile/src/main/res/layout/activity_handbook.xml new file mode 100644 index 0000000..cd08b3b --- /dev/null +++ b/mobile/src/main/res/layout/activity_handbook.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/mobile/src/main/res/menu/mainmenu.xml b/mobile/src/main/res/menu/mainmenu.xml index f64919f..a88af04 100644 --- a/mobile/src/main/res/menu/mainmenu.xml +++ b/mobile/src/main/res/menu/mainmenu.xml @@ -1,7 +1,14 @@ - + 16dp 16dp + + 4dp diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml index 1c3640e..59eaa5b 100644 --- a/mobile/src/main/res/values/strings.xml +++ b/mobile/src/main/res/values/strings.xml @@ -2,6 +2,7 @@ tcp://ctfws-mqtt.acmetensortoys.com:1883 CMUKGB CtFwS Timer + CMUKGB CtFwS Handbook Game\nEnd Game\nStart @@ -38,6 +39,7 @@ Jailbreak %1$d of %2$d About + Handbook Settings Quit @@ -74,4 +76,11 @@ ]]> Reconnect + + Terribly sorry, something has gone wrong. Please try loading the + official rules. + + ]]> +