mirror of
https://github.com/Aviortheking/Hangman.git
synced 2024-12-19 18:20:54 +00:00
doc
This commit is contained in:
parent
ba9b808769
commit
0bd40154f9
BIN
.idea/caches/build_file_checksums.ser
generated
Normal file
BIN
.idea/caches/build_file_checksums.ser
generated
Normal file
Binary file not shown.
224
.idea/codeStyles/Project.xml
generated
Normal file
224
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,224 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="RIGHT_MARGIN" value="100" />
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="USE_CUSTOM_SETTINGS" value="true" />
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value />
|
||||
</option>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<XML>
|
||||
<option name="XML_KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
|
||||
<option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||
</state>
|
||||
</component>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -24,7 +24,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -4,7 +4,9 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@ -55,8 +57,16 @@ public class GameActivity extends AppCompatActivity {
|
||||
|
||||
log("Logs");
|
||||
|
||||
gameUtil = new GameUtil();
|
||||
SharedPreferences sharedPref=getPreferences(Context.MODE_PRIVATE);
|
||||
String userName= sharedPref.getString("settting_difficulty", "0");
|
||||
|
||||
gameUtil = new GameUtil( Integer.parseInt(userName));
|
||||
word.setText(TextUtils.join("", gameUtil.getUndescores()));
|
||||
new Command().execute("LEADING|A");
|
||||
new Command().execute("LAGGING|A");
|
||||
new Command().execute("COULEUR|J");
|
||||
new Command().execute("AFFICHER|"+TextUtils.join("", gameUtil.getUndescores()));
|
||||
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
|
@ -47,7 +47,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if(getPref("setting_theme", this.getApplicationContext()) != "Color") {
|
||||
if(getPref("setting_theme", MainActivity.getInstance()) != "Color") {
|
||||
setPref("setting_theme", "Color", this.getApplicationContext());
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Command().execute("AFFICHER|test");
|
||||
Toast.makeText(instance, getPref("setting_theme", getApplicationContext()), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(instance, getPref("setting_theme", MainActivity.getInstance()), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
@ -107,12 +107,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static String getPref(String key, Context context) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return preferences.getString(key, null);
|
||||
public static String getPref(String key, Activity context) {
|
||||
SharedPreferences sharedPref=context.getPreferences(Context.MODE_PRIVATE);
|
||||
return sharedPref.getString(key, "pokemon");
|
||||
}
|
||||
|
||||
public static void setTheme(Activity activity) {
|
||||
activity.setTheme(activity.getResources().getIdentifier("DeltaWings."+getPref("setting_theme", activity.getApplicationContext()), "style", activity.getPackageName()));
|
||||
activity.setTheme(activity.getResources().getIdentifier("DeltaWings."+getPref("setting_theme", MainActivity.getInstance()), "style", activity.getPackageName()));
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
@ -20,9 +21,22 @@ public class GameUtil {
|
||||
private ArrayList<String> res = new ArrayList<>();
|
||||
private ArrayList<String> letters = new ArrayList<>();
|
||||
private HashMap<String, String> returning = new HashMap<>();
|
||||
private Integer difficulty;
|
||||
private String tag = "GameUtil";
|
||||
private String[][] replacements = {
|
||||
{"é", "e"},
|
||||
{"è", "e"},
|
||||
{"ê", "e"},
|
||||
{"î", "i"},
|
||||
{"ï", "i"},
|
||||
{"à", "a"},
|
||||
{"ç", "c"}
|
||||
};
|
||||
private String excluded = "aeyuio";
|
||||
private String accentexcluded = "âäàéèïî";
|
||||
|
||||
public GameUtil() {
|
||||
public GameUtil(Integer difficulty) {
|
||||
this.difficulty = difficulty;
|
||||
//Generate Word
|
||||
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
@ -61,21 +75,38 @@ public class GameUtil {
|
||||
|
||||
|
||||
|
||||
for (String lett: word.split("")) {
|
||||
Log.v(tag, lett);
|
||||
if(difficulty == 0 && (excluded.contains(lett) || accentexcluded.contains(lett))) {
|
||||
res.add(lett);
|
||||
Log.v(tag, "excluded || accentexcluded");
|
||||
|
||||
}
|
||||
else {
|
||||
Log.v(tag, "other");
|
||||
|
||||
for (int i = 0; i < word.length(); i++) {
|
||||
res.add("_");
|
||||
}
|
||||
}
|
||||
|
||||
Log.v(tag, res.toString());
|
||||
}
|
||||
|
||||
public boolean checkLetter(String letter) {
|
||||
/*if(difficulty == 1) {
|
||||
for(String[] replacement: replacements) {
|
||||
Log.v(tag, Arrays.toString(replacement));
|
||||
letter = letter.replace(replacement[0], replacement[1]);
|
||||
}
|
||||
}*/
|
||||
if(this.word.contains(letter)) {
|
||||
Log.v(tag, "Letter Found !");
|
||||
for (int i = 0; i < this.word.length(); i++) {
|
||||
if(String.valueOf(this.word.charAt(i)).equals(letter)) {
|
||||
res.set(i, letter);
|
||||
Log.v(tag, i +"");
|
||||
Log.v(tag, letter);
|
||||
Log.v(tag, String.valueOf(this.word.charAt(i)));
|
||||
res.set(i+1, letter);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -5,9 +5,9 @@
|
||||
Settings
|
||||
-->
|
||||
<string-array name="setting_difficulty">
|
||||
<item name="easy">easy</item>
|
||||
<item name="normal">normal</item>
|
||||
<item name="hard">hard</item>
|
||||
<item name="0">easy</item>
|
||||
<item name="1">normal</item>
|
||||
<item name="2">hard</item>
|
||||
</string-array>
|
||||
<string-array name="theme">
|
||||
<item name="color">Color</item>
|
||||
|
@ -23,11 +23,11 @@
|
||||
<string name="setting_general_ip">Select the server IP</string>
|
||||
<string name="setting_general_port">Select the server port</string>
|
||||
|
||||
<string name="setting_general_difficulty">Difficulty</string>
|
||||
|
||||
<string name="setting_single_title">Singleplayer</string>
|
||||
<string name="setting_single_desc">Singleplayer Configuration</string>
|
||||
|
||||
<string name="setting_single_difficulty">Difficulty</string>
|
||||
|
||||
<string name="setting_multi_title">Multiplayer</string>
|
||||
<string name="setting_multi_desc">Multiplayer Configuration</string>
|
||||
|
||||
|
@ -18,4 +18,10 @@
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/setting_general_port"/>
|
||||
<ListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/setting_difficulty"
|
||||
android:entryValues="@array/setting_difficulty"
|
||||
android:key="setting_difficulty"
|
||||
android:title="@string/setting_general_difficulty"/>
|
||||
</PreferenceScreen>
|
@ -5,5 +5,5 @@
|
||||
android:entries="@array/setting_difficulty"
|
||||
android:entryValues="@array/setting_difficulty"
|
||||
android:key="setting_difficulty"
|
||||
android:title="@string/setting_single_difficulty"/>
|
||||
android:title="@string/setting_general_difficulty"/>
|
||||
</PreferenceScreen>
|
BIN
doc/Hangman.docx
Normal file
BIN
doc/Hangman.docx
Normal file
Binary file not shown.
BIN
doc/hangman.png
Normal file
BIN
doc/hangman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
Loading…
x
Reference in New Issue
Block a user