Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
curly_bracket_next_line = false
spaces_around_operators = true

[*.cs]
indent_size = 4

[*.{markdown,md}]
trim_trailing_whitespace = false
91 changes: 8 additions & 83 deletions Assets/Scripts/GameMasterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using UnityEngine;
using UnityEngine.UI;

public class GameMasterManager : MonoBehaviour
{
public class GameMasterManager : MonoBehaviour {

public StateMachine<GameMasterManager> controller;
public GameObject mainMenu, gameMenu, optionsMenu;
public WordGridManager gridManger;
Expand All @@ -19,7 +19,6 @@ public class GameMasterManager : MonoBehaviour
public Button dailyButton;
public GameObject Tutorial;


public void Quit() {
Application.Quit();
}
Expand Down Expand Up @@ -59,8 +58,6 @@ private void Start() {
if (!gridManger.HasInt(WordGridManager.MONTH)) gridManger.SetInt(WordGridManager.MONTH, 0);
if (!gridManger.HasInt(WordGridManager.YEAR)) gridManger.SetInt(WordGridManager.YEAR, 0);



controller = new StateMachine<GameMasterManager>(new MainMenuState(), this);
GoToMainMenu();
GetWord();
Expand Down Expand Up @@ -93,11 +90,8 @@ public void DailyCheck() {
dailySeed = v.GetHashCode();
}
dailyTimerText.gameObject.SetActive(DailyDisabled);


}


public void OpenTutorial() {
Tutorial.SetActive(true);
}
Expand All @@ -112,67 +106,31 @@ public void CloseTutorial() {
public static Dictionary<int, List<string>> answerWords = new Dictionary<int, List<string>>();
public static bool initYet = false;


public TMP_Dropdown dropDown, numberOfGuessesDropDown;

public List<WordBank> wordbanks = new List<WordBank>();

public string GetWord() {

if (!initYet) {
InitializeWordBanks();
}

return commonWords[selectedLength].PickRandom();
}


public void SetLength(int i) {
if (i == 0) {
selectedLength = 1;
} else if (i == 1) {
selectedLength = 2;
} else if (i == 2) {
selectedLength = 3;
} else if ( i == 3) {
selectedLength = 4;
} else if (i == 4) {
selectedLength = 5;
} else if (i == 5) {
selectedLength = 6;
} else if (i == 6) {
selectedLength = 7;
} else if (i == 7) {
selectedLength = 8;
if (i >= 0 && i <= 7) {
selectedLength = i + 1;
}


gridManger.SetInt(WordGridManager.SELECTEDLENGTH, i);

}


public void SetNumberOfGuesses(int i) {
if (i == 0) {
numberOfGuesses = 1;
} else if (i == 1) {
numberOfGuesses = 2;
} else if (i == 2) {
numberOfGuesses = 3;
} else if (i == 3) {
numberOfGuesses = 4;
} else if (i == 4) {
numberOfGuesses = 5;
} else if (i == 5) {
numberOfGuesses = 6;
} else if (i == 6) {
numberOfGuesses = 7;
} else if (i == 7) {
numberOfGuesses = 8;
} else if (i == 8) {
numberOfGuesses = 9;
} else if (i == 9) {
numberOfGuesses = 10;
if (i >= 0 && i <= 9) {
numberOfGuesses = i + 1;
}

gridManger.SetInt(WordGridManager.NUMBEROFGUESSES, i);
Expand All @@ -182,8 +140,8 @@ public void SetNumberOfGuesses(int i) {
public void InitializeWordBanks() {
commonWords = new Dictionary<int, List<string>>();
answerWords = new Dictionary<int, List<string>>();
foreach (WordBank b in wordbanks) {

foreach (WordBank b in wordbanks) {
int len = b.wordLength;
if (!commonWords.ContainsKey(len)) {
commonWords.Add(len, new List<string>());
Expand All @@ -195,7 +153,6 @@ public void InitializeWordBanks() {
string contents = b.commonWordText.text;
string[] w = contents.Split("\n");
foreach (string s in w) {
//print(s);
string sss = s.ToUpper();
sss = sss.Substring(0, b.wordLength);
commonWords[len].Add(sss);
Expand All @@ -206,7 +163,6 @@ public void InitializeWordBanks() {
contents = b.answerWordText.text;
w = contents.Split("\n");
foreach (string s in w) {
// print(s);
string sss = s.ToUpper();
sss = sss.Substring(0, b.wordLength);
answerWords[len].Add(sss);
Expand All @@ -217,22 +173,16 @@ public void InitializeWordBanks() {
initYet = true;
}



public static string jsonSaveFileName = "LASTPUZZLE.json";


public string GetLastPuzzleSavePath() {
return Application.persistentDataPath +"/"+ jsonSaveFileName;
}

public LastPuzzle GetDefaultLastPuzzle() {


LastPuzzle last = new LastPuzzle();
last.grid = new WORDBUTTONSTATE[5, 6];
return last;

}

public GridLayoutGroup gridgroup;
Expand All @@ -241,7 +191,6 @@ public LastPuzzle GetDefaultLastPuzzle() {
public List<Image> spawnedImages = new List<Image>();

public void GetLastPuzzleForDisplay() {

LastPuzzle puzzle = null;

if (File.Exists(GetLastPuzzleSavePath())) {
Expand Down Expand Up @@ -289,12 +238,8 @@ public void GetLastPuzzleForDisplay() {
}
}
}


}



public void SetHardMode(bool b) {
gridManger.SetBool(WordGridManager.HARDMODE, b);
}
Expand All @@ -313,18 +258,12 @@ public void InitializeStringVars(List<string> s) {

public void SetStringVars(List<string> s, int val) {
foreach (string ss in s) {
gridManger.SetInt(ss, val);
gridManger.SetInt(ss, val);
}
}


private void Update() {
controller.Update();





}

public void HideAll() {
Expand Down Expand Up @@ -365,11 +304,7 @@ public void GoToGameplayMenu(bool isDaily) {
}

public void DeleteProgress() {

SetStringVars(new List<string>() { WordGridManager.CURRENTSTREAK, WordGridManager.LARGESTSTREAK, WordGridManager.NUMBEROFPUZZLESPLAYED, WordGridManager.NUMBERWINS, WordGridManager.WIN1, WordGridManager.WIN2, WordGridManager.WIN3, WordGridManager.WIN4, WordGridManager.WIN5, WordGridManager.WIN6, WordGridManager.DAY, WordGridManager.MONTH, WordGridManager.YEAR }, 0);



}

public void SaveLastPuzzle(LastPuzzle l) {
Expand Down Expand Up @@ -410,17 +345,7 @@ public class OptionsState : State<GameMasterManager> {

}



[System.Serializable]
public class LastPuzzle {


public WORDBUTTONSTATE[,] grid;


}




5 changes: 2 additions & 3 deletions Assets/Scripts/TitleSetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
using UnityEngine;
using TMPro;

public class TitleSetter : MonoBehaviour
{
public class TitleSetter : MonoBehaviour {

public List<TextMeshProUGUI> textMeshProUGUIs = new List<TextMeshProUGUI>();
public string title = "Word Game";


private void Awake() {
foreach (TextMeshProUGUI t in textMeshProUGUIs) {
t.SetText(title);
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/WordRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class WordRow : MonoBehaviour {
public float shakeAmount = 50f;
public float shakeSpeed = 200f;
public float currentTarget = 0;

public void Shake() {
shaking = true;
stopshaketime = Time.time + shakeTime;
Expand All @@ -36,7 +37,7 @@ private void Update() {
MoveTowardsTarget();
}
}
}
}
}

public void MoveTowardsZeroX() {
Expand Down