migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
83
Assets/_/Features/MenuSystem/Runtime/NewGame/NewGame.cs
Normal file
83
Assets/_/Features/MenuSystem/Runtime/NewGame/NewGame.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using Player.Runtime;
|
||||
using Quests.Runtime;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MenuSystem.Runtime
|
||||
{
|
||||
public class NewGame : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void CreateProfile()
|
||||
{
|
||||
if (_guildName.text != "")
|
||||
{
|
||||
string rawName = _guildName.text;
|
||||
string cleanedName = CleanInput(rawName);
|
||||
PlayerClass newPlayerClass = new PlayerClass(cleanedName, 1, 1000, 5);
|
||||
string saveName = newPlayerClass.GuildName.Replace(" ", "_");
|
||||
|
||||
/* Creation du FakeProfile "Continuer" */
|
||||
SetFact<string>("profile", saveName, FactPersistence.Persistent);;
|
||||
SaveFacts("continue");
|
||||
RemoveFact<string>("profile");
|
||||
|
||||
/* Création du profile joueur */
|
||||
SetFact<PlayerClass>(saveName, newPlayerClass, FactPersistence.Persistent);
|
||||
SetFact<GameTime>("game_time", new GameTime(), FactPersistence.Persistent);
|
||||
SetFact<List<AdventurerClass>>("my_adventurers", new List<AdventurerClass>(), FactPersistence.Persistent);
|
||||
SetFact<List<QuestClass>>("quests", new List<QuestClass>(), FactPersistence.Persistent);
|
||||
SetFact<List<QuestClass>>("active_quests", new List<QuestClass>(), FactPersistence.Persistent);
|
||||
SetFact<List<QuestClass>>("completed_quests", new List<QuestClass>(), FactPersistence.Persistent);
|
||||
SetFact<Dictionary<Guid, List<QuestEventLog>>>("events_quests_history", new Dictionary<Guid, List<QuestEventLog>>(), FactPersistence.Persistent);
|
||||
GameManager.Instance.Profile = saveName;
|
||||
SaveFacts();
|
||||
|
||||
|
||||
|
||||
SceneLoader.Instance.LoadScene("Game");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
string CleanInput(string input)
|
||||
{
|
||||
return Regex.Replace(input.Trim(), @"[\u200B-\u200D\uFEFF]", ""); // supprime les espaces invisibles
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] private TextMeshProUGUI _guildName;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c982040e65ab4046a77203bc6e1f24b2
|
||||
timeCreated: 1754055252
|
||||
Loading…
Add table
Add a link
Reference in a new issue