Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

Commit

Permalink
Ein echter Server + Ordnerstruktur-Verbesserungen
Browse files Browse the repository at this point in the history
  • Loading branch information
pklaschka committed May 28, 2017
1 parent ca16009 commit e0cc9d3
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 11 deletions.
19 changes: 16 additions & 3 deletions Platformer_001/Assets/Scenes (Level)/MenuSystem/Bestenliste.unity
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ MonoBehaviour:
bestenliste: {fileID: 75309908}
ownScore: {fileID: 104631839}
nameInput: {fileID: 704186048}
btnSubmit: {fileID: 0}
--- !u!114 &579019993
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -963,7 +964,18 @@ MonoBehaviour:
Culture=neutral, PublicKeyToken=null
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 971447814}
m_MethodName: CheckSubmitable
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
Expand Down Expand Up @@ -1148,7 +1160,7 @@ Prefab:
- target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -216.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d,
type: 2}
Expand Down Expand Up @@ -1409,6 +1421,7 @@ MonoBehaviour:
bestenliste: {fileID: 75309908}
ownScore: {fileID: 104631839}
nameInput: {fileID: 704186048}
btnSubmit: {fileID: 0}
--- !u!1 &1091293677
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1874,7 +1887,7 @@ Prefab:
- target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -141.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d,
type: 2}
Expand Down
38 changes: 36 additions & 2 deletions Platformer_001/Assets/Scripts/Bestenliste/Bestenliste.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class Bestenliste : MonoBehaviour
{
public static string serverAdress = "http://bestenliste:meineGemeineBestenliste@pi/inf21platformer";
public static string serverAdress = "http://bestenliste:meineGemeineBestenliste@inf21platformer.pabloklaschka.de";

private static string best5Adress = "getBestFive.php";
private static string rankAdress = "getRank.php?score=";
Expand All @@ -16,12 +16,15 @@ public class Bestenliste : MonoBehaviour
public Text bestenliste;
public Text ownScore;
public InputField nameInput;
public Button btnSubmit;

private int score;
private string scoreConfirmation;

private void Start()
{
btnSubmit = GetComponent<Button>();

score = PlayerPrefs.GetInt("maxEndlosweite", 0);
scoreConfirmation = PlayerPrefs.GetString("maxEndlosweiteConfirmation", "");

Expand Down Expand Up @@ -63,7 +66,38 @@ private IEnumerator SetupBestenliste()
else {
bestenliste.text = "<b>Die Besten:</b>\n" + myWr.downloadHandler.text;
}

}

public void CheckSubmitable()
{
var confirmationString = "confirming" + score + "-1-75_13+" + (score * score) % (score * 3 / 2);

if (confirmationString == scoreConfirmation)
{
if (nameInput.text.Length > 0 && nameInput.text.Length <= 100)
{
if (score > PlayerPrefs.GetInt("maxSubmitedEndlosweite", 0))
{
btnSubmit.GetComponentInChildren<Text>().text = "Veröffentlichen";
btnSubmit.interactable = true;
}
else
{
btnSubmit.interactable = false;
btnSubmit.GetComponentInChildren<Text>().text = "Bereits veröffentlicht!";
}
}
else
{
btnSubmit.interactable = false;
btnSubmit.GetComponentInChildren<Text>().text = "Ungültiger Name!";
}
}
else
{
btnSubmit.interactable = false;
btnSubmit.GetComponentInChildren<Text>().text = "Cheater!";
}
}

public void OpenBestenliste()
Expand Down
4 changes: 3 additions & 1 deletion Platformer_001/Assets/Scripts/Endlosmodus/Highscore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public void saveLength(int length) {

if (length > PlayerPrefs.GetInt("maxEndlosweite", 0)) {
PlayerPrefs.SetInt ("maxEndlosweite", length);
PlayerPrefs.SetString("maxEndlosweiteConfirmation", getHashed(length));

var confirmationString = "confirming" + length + "-1-75_13+" + (length * length) % (length * 3 / 2);
PlayerPrefs.SetString("maxEndlosweiteConfirmation", confirmationString);
}
PlayerPrefs.SetInt ("Endlosweite", length);
PlayerPrefs.Save();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public class GameOverErgebnis : MonoBehaviour {

private UnityEngine.UI.Text text;

void Start () {
public void Start () {
text = GetComponent<UnityEngine.UI.Text> ();

string aktuell = PlayerPrefs.GetInt ("Endlosweite", 0) + "";
string rekord = PlayerPrefs.GetInt ("maxEndlosweite", 0) + "";
var aktuell = PlayerPrefs.GetInt ("Endlosweite", 0) + "";
var rekord = PlayerPrefs.GetInt ("maxEndlosweite", 0) + "";

text.text = aktuellesErgebnisPrefix + " " + aktuell
+ "\n\r"
Expand Down

0 comments on commit e0cc9d3

Please sign in to comment.