Initial commit: Unity WordConnect project
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
// ©2015 - 2025 Candy Smith
|
||||
// All rights reserved
|
||||
// Redistribution of this software is strictly not allowed.
|
||||
// Copy of this software can be obtained from unity asset store only.
|
||||
|
||||
using System;
|
||||
using WordsToolkit.Scripts.Levels;
|
||||
|
||||
namespace WordsToolkit.Scripts.Infrastructure.Service
|
||||
{
|
||||
public interface ILevelLoaderService
|
||||
{
|
||||
event Action<Level> OnLevelLoaded;
|
||||
void NotifyBeforeLevelLoaded(Level level);
|
||||
void NotifyLevelLoaded(Level level);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc62647d79aec474598c28a4e1d079bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,29 @@
|
||||
// ©2015 - 2025 Candy Smith
|
||||
// All rights reserved
|
||||
// Redistribution of this software is strictly not allowed.
|
||||
// Copy of this software can be obtained from unity asset store only.
|
||||
|
||||
using System;
|
||||
using WordsToolkit.Scripts.Enums;
|
||||
using WordsToolkit.Scripts.Levels;
|
||||
using WordsToolkit.Scripts.System;
|
||||
|
||||
namespace WordsToolkit.Scripts.Infrastructure.Service
|
||||
{
|
||||
public class LevelLoaderService : ILevelLoaderService
|
||||
{
|
||||
public event Action<Level> OnLevelLoaded;
|
||||
public event Action<Level> OnBeforeLevelLoaded;
|
||||
|
||||
public void NotifyBeforeLevelLoaded(Level level)
|
||||
{
|
||||
OnBeforeLevelLoaded?.Invoke(level);
|
||||
}
|
||||
|
||||
public void NotifyLevelLoaded(Level level)
|
||||
{
|
||||
OnLevelLoaded?.Invoke(level);
|
||||
EventManager.GetEvent<Level>(EGameEvent.LevelLoaded).Invoke(level);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3aa4077d83494d2cadf9a494e074a62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,42 @@
|
||||
// // ©2015 - 2025 Candy Smith
|
||||
// // All rights reserved
|
||||
// // Redistribution of this software is strictly not allowed.
|
||||
// // Copy of this software can be obtained from unity asset store only.
|
||||
// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// // FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// // THE SOFTWARE.
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace WordsToolkit.Scripts.Infrastructure.Service
|
||||
{
|
||||
public interface IExtraWordService
|
||||
{
|
||||
void IncrementTotalExtraWords();
|
||||
int GetTotalExtraWords();
|
||||
void ResetTotalExtraWords();
|
||||
}
|
||||
|
||||
public class PlayerPrefsExtraWordService : IExtraWordService
|
||||
{
|
||||
private const string Key = "TotalExtraWordsFound";
|
||||
|
||||
public void IncrementTotalExtraWords()
|
||||
{
|
||||
int current = PlayerPrefs.GetInt(Key, 0);
|
||||
PlayerPrefs.SetInt(Key, current + 1);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
public int GetTotalExtraWords() => PlayerPrefs.GetInt(Key, 0);
|
||||
public void ResetTotalExtraWords()
|
||||
{
|
||||
PlayerPrefs.SetInt(Key, 0);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1d953888e594348967d780483367529
|
||||
timeCreated: 1744637592
|
||||
Reference in New Issue
Block a user