Skip to content

Commit f938f0f

Browse files
committed
adding SessionData and GameManager Skripts
1 parent 73303e8 commit f938f0f

File tree

16 files changed

+587
-247
lines changed

16 files changed

+587
-247
lines changed

LearningForDummies/Assets/DevScene.unity

Lines changed: 476 additions & 0 deletions
Large diffs are not rendered by default.

LearningForDummies/Assets/DevScene.unity.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LearningForDummies/Assets/Revised SE Skripts.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class GameManager : MonoBehaviour
6+
{
7+
public SessionData sessionData;
8+
9+
10+
public void Start()
11+
{
12+
13+
}
14+
15+
}
16+
17+
public enum GameMode
18+
{
19+
singleplayer = 1,
20+
multiplayer = 2
21+
}

LearningForDummies/Assets/Scripts/SaveSystemJson.cs.meta renamed to LearningForDummies/Assets/Revised SE Skripts/GameManager.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LearningForDummies/Assets/Scripts/SaveData.cs.meta renamed to LearningForDummies/Assets/Revised SE Skripts/SaveData.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LearningForDummies/Assets/Revised SE Skripts/SaveManager.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public void savePlayerProfileToFile()
2929
Debug.Log("Saved Active PlayerProfile to FileSystem in " + Application.persistentDataPath);
3030
}
3131

32+
33+
3234
public void addQuestionToOwnQuestionCatalogue()
3335
{
3436
string questionName;
@@ -71,6 +73,9 @@ public void addQuestionToOwnQuestionCatalogue()
7173
}
7274
Question question = new Question(questionName, answers, rightAnswerPosition);
7375
createdQuestionCatalogue.questions.Add(question);
76+
77+
// Code um InputField leer zu machen
78+
7479
Debug.Log("A new Question has been added to the currently active QuestionCatalogue.");
7580
}
7681

@@ -92,12 +97,6 @@ public void saveQuestionCatalogueToFileSystem()
9297
{
9398
createdQuestionCatalogue.fileName = fileName;
9499
}
95-
96-
if (createdQuestionCatalogue.questions.Count < 5)
97-
{
98-
Debug.Log("A Catalogue has to have a minimum of 5 added Questions.\nCatalogue Saving Process has been stopped.\nPlease add More Questions.");
99-
return; //Exits the Function
100-
}
101100
SaveSystem.instance.saveQuestionCatalogueToJson(createdQuestionCatalogue);
102101

103102

@@ -174,7 +173,7 @@ public void updateStatistic(string label, int score) //Can be called after every
174173
SaveSystem.instance.savePlayerProfileToJson(playerProfile);
175174
}
176175
}
177-
176+
//Recent Score hinzufügen (auch in SaveData)
178177

179178

180179
}

LearningForDummies/Assets/Scripts/Manager.cs.meta renamed to LearningForDummies/Assets/Revised SE Skripts/SaveManager.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LearningForDummies/Assets/Revised SE Skripts/SaveSystem.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using SaveData;
5+
6+
public class SessionData
7+
{
8+
QuestionCatalogue sessionCatalogue;
9+
List<Question> questionList;
10+
Question activeQuestion;
11+
string questionString, answer_1, answer_2, answer_3, answer_4;
12+
int rightAnswerPosition, questionCount_total, questionCount_current, questionIndex = 0;
13+
14+
public void fillSessionData(float percentage)
15+
{
16+
questionList = sessionCatalogue.questions;
17+
questionCount_total = questionList.Count;
18+
19+
for (int i = 0; i < questionCount_total; i++) //List Shuffle
20+
{
21+
Question tempQ = questionList[i];
22+
int randomIndex = Random.Range(i, questionCount_total);
23+
questionList[i] = questionList[randomIndex];
24+
questionList[randomIndex] = tempQ;
25+
}
26+
27+
28+
29+
}
30+
31+
32+
}

0 commit comments

Comments
 (0)