254 lines
9.7 KiB
C#
254 lines
9.7 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
using TMPro;
|
||
|
|
using Com.LuisPedroFonseca.ProCamera2D;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
|
||
|
|
public class SummaryController : MonoBehaviour {
|
||
|
|
[SerializeField] TextMeshProUGUI textPatrons;
|
||
|
|
[SerializeField] TextMeshProUGUI textMoney;
|
||
|
|
[SerializeField] TextMeshProUGUI textGrade;
|
||
|
|
// TODO: TMPros for each talent's summary
|
||
|
|
[SerializeField] TextMeshProUGUI textElaineXP;
|
||
|
|
[SerializeField] TextMeshProUGUI textIridaXP;
|
||
|
|
[SerializeField] TextMeshProUGUI textClemXP;
|
||
|
|
[SerializeField] TextMeshProUGUI textSchroderXP;
|
||
|
|
|
||
|
|
// Not owned.
|
||
|
|
[HideInInspector] GameStateController gameStateController;
|
||
|
|
[HideInInspector] ProCamera2DTransitionsFX transition;
|
||
|
|
|
||
|
|
// Makes up a grade given the game state.
|
||
|
|
public string GetGrade() {
|
||
|
|
Debug.Log("GetGrade not yet implemented");
|
||
|
|
if (gameStateController.moneyEarned < gameStateController.moneyGoal) {
|
||
|
|
return "F";
|
||
|
|
}
|
||
|
|
string[] grades = { "C", "B", "A", "S", "SS" };
|
||
|
|
int i = 0;
|
||
|
|
while (i < grades.Length &&
|
||
|
|
gameStateController.moneyEarned > gameStateController.moneyGoal * gameStateController.gradeDistribution[i]) {
|
||
|
|
i++;
|
||
|
|
}
|
||
|
|
return grades[i - 1];
|
||
|
|
}
|
||
|
|
|
||
|
|
void Start() {
|
||
|
|
gameStateController = GameObject.FindGameObjectWithTag("GameStateController").GetComponent<GameStateController>();
|
||
|
|
transition = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<ProCamera2DTransitionsFX>();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void SetText() {
|
||
|
|
ProcessAndShowEXP();
|
||
|
|
textPatrons.SetText(gameStateController.patrons.ToString());
|
||
|
|
textMoney.SetText(gameStateController.moneyEarned.ToString());
|
||
|
|
textGrade.SetText(GetGrade());
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void GoToManagement() {
|
||
|
|
SceneManager.LoadScene("Manager");
|
||
|
|
}
|
||
|
|
|
||
|
|
// For when the player unlocks something that starts with a scene.
|
||
|
|
public void GoToDialogue() {
|
||
|
|
SceneManager.LoadScene("SceneViewer");
|
||
|
|
}
|
||
|
|
|
||
|
|
public Dialogue ReturnDialogueIfUnlock(Unlockable u, Dialogue d) {
|
||
|
|
if (!GameData.IsUnlocked(u)) {
|
||
|
|
GameData.Unlock(u);
|
||
|
|
return d;
|
||
|
|
}
|
||
|
|
return Dialogue.None;
|
||
|
|
}
|
||
|
|
|
||
|
|
public Dialogue ProcessUnlockables() {
|
||
|
|
|
||
|
|
// Character-specific scenes.
|
||
|
|
if (GameData.StatsOf(Employee.Elaine).level >= 3) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Elaine_Voyeurism);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.StatsOf(Employee.Elaine).level >= 6) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Elaine_Femdom);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.StatsOf(Employee.Elaine).level >= 9) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Elaine_Foodplay);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Irida) &&
|
||
|
|
GameData.StatsOf(Employee.Irida).level >= 4) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Irida_Anal);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Irida) &&
|
||
|
|
GameData.StatsOf(Employee.Irida).level >= 6) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Irida_Boobies);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Irida) &&
|
||
|
|
GameData.StatsOf(Employee.Irida).level >= 8) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Irida_Oral);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Clem) &&
|
||
|
|
GameData.StatsOf(Employee.Clem).level >= 4) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Clem_FFM);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Clem) &&
|
||
|
|
GameData.StatsOf(Employee.Clem).level >= 6) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Clem_Exploration);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Clem) &&
|
||
|
|
GameData.StatsOf(Employee.Clem).level >= 8) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Clem_Confession);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Schroder) &&
|
||
|
|
GameData.StatsOf(Employee.Schroder).level >= 5) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Schroder_Packing);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Schroder) &&
|
||
|
|
GameData.StatsOf(Employee.Schroder).level >= 8) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Schroder_Anal);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Schroder) &&
|
||
|
|
GameData.StatsOf(Employee.Schroder).level >= 9) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Schroder_Dom);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Schroder) &&
|
||
|
|
GameData.StatsOf(Employee.Schroder).level >= 10) {
|
||
|
|
GameData.Unlock(Unlockable.Dialogue_Schroder_Lapdance);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Backrooms: Unlock all characters
|
||
|
|
if (GameData.IsUnlocked(Unlockable.IridaPlayable) &&
|
||
|
|
GameData.IsUnlocked(Unlockable.ClemPlayable) &&
|
||
|
|
GameData.IsUnlocked(Unlockable.SchroderPlayable)) {
|
||
|
|
GameData.Unlock(Unlockable.Backrooms);
|
||
|
|
}
|
||
|
|
|
||
|
|
Debug.Log("TODO: Schroder special condition of stripper assignment");
|
||
|
|
|
||
|
|
// Irida: Clear 3 days and Elaine level 3+
|
||
|
|
if (GameData.StatsOf(Employee.Elaine).level >= 3
|
||
|
|
&& GameData.GLOBAL.day > 3) {
|
||
|
|
return ReturnDialogueIfUnlock(
|
||
|
|
Unlockable.IridaPlayable,
|
||
|
|
Dialogue.Unlock_Irida);
|
||
|
|
}
|
||
|
|
// Clem: Clear 8 days and Elaine and Irida level 5+
|
||
|
|
else if (
|
||
|
|
GameData.StatsOf(Employee.Elaine).level >= 5
|
||
|
|
&& GameData.StatsOf(Employee.Irida).level >= 5
|
||
|
|
&& GameData.GLOBAL.day > 8) {
|
||
|
|
return ReturnDialogueIfUnlock(
|
||
|
|
Unlockable.ClemPlayable,
|
||
|
|
Dialogue.Unlock_Clem);
|
||
|
|
}
|
||
|
|
// Schroder: Clear 14 days and Elaine, Irida, Clem level 7+
|
||
|
|
else if (
|
||
|
|
GameData.StatsOf(Employee.Elaine).level >= 7
|
||
|
|
&& GameData.StatsOf(Employee.Irida).level >= 7
|
||
|
|
&& GameData.StatsOf(Employee.Clem).level >= 7
|
||
|
|
&& GameData.GLOBAL.day > 14) {
|
||
|
|
return ReturnDialogueIfUnlock(
|
||
|
|
Unlockable.SchroderPlayable,
|
||
|
|
Dialogue.Unlock_Schroder);
|
||
|
|
}
|
||
|
|
return Dialogue.None;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Process GameData after completing a day.
|
||
|
|
private void ProcessAndShowEXP(bool won = true) {
|
||
|
|
Debug.Log("TODO: Calculate exp gain per employee based on daily activities");
|
||
|
|
Debug.Log("TODO: Build summary around results of above calculation (pre-calculate)");
|
||
|
|
int[] previousLevels = {
|
||
|
|
GameData.StatsOf(Employee.Elaine).level,
|
||
|
|
GameData.StatsOf(Employee.Irida).level,
|
||
|
|
GameData.StatsOf(Employee.Clem).level,
|
||
|
|
GameData.StatsOf(Employee.Schroder).level,
|
||
|
|
};
|
||
|
|
int[] previousExp = {
|
||
|
|
GameData.StatsOf(Employee.Elaine).exp,
|
||
|
|
GameData.StatsOf(Employee.Irida).exp,
|
||
|
|
GameData.StatsOf(Employee.Clem).exp,
|
||
|
|
GameData.StatsOf(Employee.Schroder).exp,
|
||
|
|
};
|
||
|
|
Debug.Log("TODO: Implement ability to lose and not gain exp/money/day");
|
||
|
|
if (won) {
|
||
|
|
for (int i = 0; i < 4; i++) {
|
||
|
|
GameData.StatsOf((Employee)i).GainExp(
|
||
|
|
gameStateController.talentState[i].exp);
|
||
|
|
}
|
||
|
|
GameData.GLOBAL.money += gameStateController.moneyEarned;
|
||
|
|
GameData.GLOBAL.day += 1;
|
||
|
|
}
|
||
|
|
Debug.Log("bruh");
|
||
|
|
textElaineXP.SetText(
|
||
|
|
"LV" +
|
||
|
|
previousLevels[0].ToString() + " " +
|
||
|
|
previousExp[0].ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[previousLevels[0]] + " => " +
|
||
|
|
GameData.StatsOf(Employee.Elaine).level.ToString() + " " +
|
||
|
|
GameData.StatsOf(Employee.Elaine).exp.ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[GameData.StatsOf(Employee.Elaine).level]);
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Irida)) {
|
||
|
|
textIridaXP.SetText(
|
||
|
|
"LV" +
|
||
|
|
previousLevels[1].ToString() + " " +
|
||
|
|
previousExp[1].ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[previousLevels[1]] + " => " +
|
||
|
|
GameData.StatsOf(Employee.Irida).level.ToString() + " " +
|
||
|
|
GameData.StatsOf(Employee.Irida).exp.ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[GameData.StatsOf(Employee.Irida).level]);
|
||
|
|
}
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Clem)) {
|
||
|
|
textClemXP.SetText(
|
||
|
|
"LV" +
|
||
|
|
previousLevels[2].ToString() + " " +
|
||
|
|
previousExp[2].ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[previousLevels[2]] + " => " +
|
||
|
|
GameData.StatsOf(Employee.Clem).level.ToString() + " " +
|
||
|
|
GameData.StatsOf(Employee.Clem).exp.ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[GameData.StatsOf(Employee.Clem).level]);
|
||
|
|
}
|
||
|
|
if (GameData.IsPlayerUnlocked(Employee.Schroder)) {
|
||
|
|
textSchroderXP.SetText(
|
||
|
|
"LV" +
|
||
|
|
previousLevels[3].ToString() + " " +
|
||
|
|
previousExp[3].ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[previousLevels[3]] + " => " +
|
||
|
|
GameData.StatsOf(Employee.Schroder).level.ToString() + " " +
|
||
|
|
GameData.StatsOf(Employee.Schroder).exp.ToString() + " / " +
|
||
|
|
EmployeeStats.expRequirement[GameData.StatsOf(Employee.Schroder).level]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Continue() {
|
||
|
|
Dialogue unlockedScene = ProcessUnlockables();
|
||
|
|
Debug.Log("TODO: Autosave toggle as option");
|
||
|
|
GameData.Save();
|
||
|
|
if (unlockedScene != Dialogue.None) {
|
||
|
|
VNData.NextScene = unlockedScene;
|
||
|
|
transition.OnTransitionExitEnded = GoToDialogue;
|
||
|
|
} else {
|
||
|
|
transition.OnTransitionExitEnded = GoToManagement;
|
||
|
|
}
|
||
|
|
transition.TransitionExit();
|
||
|
|
}
|
||
|
|
}
|