Initial commit: Unity WordConnect project
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 638001c13c68462d95a6b5ddfc1be60d
|
||||
timeCreated: 1744637318
|
||||
@ -0,0 +1,123 @@
|
||||
// // ©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;
|
||||
using UnityEngine.SceneManagement;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
using WordsToolkit.Scripts.Audio;
|
||||
using WordsToolkit.Scripts.Data;
|
||||
using WordsToolkit.Scripts.GUI;
|
||||
using WordsToolkit.Scripts.GUI.ExtraWordBar;
|
||||
using WordsToolkit.Scripts.GUI.Labels;
|
||||
using WordsToolkit.Scripts.Infrastructure.Factories;
|
||||
using WordsToolkit.Scripts.Localization;
|
||||
using WordsToolkit.Scripts.Services;
|
||||
using WordsToolkit.Scripts.Services.IAP;
|
||||
using WordsToolkit.Scripts.Settings;
|
||||
using WordsToolkit.Scripts.Services.BannedWords;
|
||||
using WordsToolkit.Scripts.Gameplay;
|
||||
using WordsToolkit.Scripts.Gameplay.Managers;
|
||||
using WordsToolkit.Scripts.Infrastructure.Service;
|
||||
using WordsToolkit.Scripts.Popups;
|
||||
using WordsToolkit.Scripts.System;
|
||||
using WordsToolkit.Scripts.Levels;
|
||||
using WordsToolkit.Scripts.NLP;
|
||||
using WordsToolkit.Scripts.Gameplay.WordValidator;
|
||||
using WordsToolkit.Scripts.GUI.Buttons;
|
||||
using WordsToolkit.Scripts.GUI.Buttons.Boosts;
|
||||
using WordsToolkit.Scripts.Debugger;
|
||||
|
||||
namespace WordsToolkit.Scripts.Infrastructure.DI
|
||||
{
|
||||
public class GameLifetimeScope : LifetimeScope
|
||||
{
|
||||
[SerializeField] private GameSettings gameSettings;
|
||||
[SerializeField] private DebugSettings debugSettings;
|
||||
[SerializeField] private SpinSettings spinSettings;
|
||||
[SerializeField] private AdsSettings adsSettings;
|
||||
[SerializeField] private DailyBonusSettings dailyBonusSettings;
|
||||
[SerializeField] private BannedWordsConfiguration bannedWordsConfiguration;
|
||||
[SerializeField] private LanguageConfiguration languageConfiguration;
|
||||
[SerializeField] private TutorialSettings tutorialSettings;
|
||||
[SerializeField] private GiftsSettings giftSettings;
|
||||
protected override void Configure(IContainerBuilder builder)
|
||||
{
|
||||
if (!Application.isPlaying && !SceneManager.GetActiveScene().isLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
builder.RegisterInstance(gameSettings);
|
||||
builder.RegisterInstance(debugSettings);
|
||||
builder.RegisterInstance(spinSettings);
|
||||
builder.RegisterInstance(adsSettings);
|
||||
builder.RegisterInstance(dailyBonusSettings);
|
||||
builder.RegisterInstance(bannedWordsConfiguration);
|
||||
builder.RegisterInstance(languageConfiguration);
|
||||
builder.RegisterInstance(tutorialSettings);
|
||||
builder.RegisterInstance(giftSettings);
|
||||
|
||||
// Register EntryPoints - LanguageService must initialize before GameManager
|
||||
builder.RegisterEntryPoint<LanguageService>().As<ILanguageService>();
|
||||
builder.RegisterEntryPoint<GameManager>().AsSelf();
|
||||
builder.RegisterEntryPoint<TutorialManager>().AsSelf();
|
||||
|
||||
// Register interfaces and their implementations
|
||||
builder.Register<IBannedWordsService, BannedWordsService>(Lifetime.Singleton);
|
||||
builder.Register<IExtraWordService, PlayerPrefsExtraWordService>(Lifetime.Singleton);
|
||||
builder.Register<IPopupFactory, DefaultPopupFactory>(Lifetime.Singleton);
|
||||
builder.Register<ICoinsFactory, CoinsFactory>(Lifetime.Singleton);
|
||||
builder.Register<IModelController, ModelController>(Lifetime.Singleton);
|
||||
builder.Register<ICustomWordRepository, CustomWordRepository>(Lifetime.Singleton);
|
||||
builder.Register<IInitializeGamingServices, InitializeGamingServices>(Lifetime.Singleton);
|
||||
builder.Register<IIAPManager, IAPManager>(Lifetime.Singleton);
|
||||
builder.Register<IIAPService, IAPController>(Lifetime.Singleton);
|
||||
builder.Register<ILevelLoaderService, LevelLoaderService>(Lifetime.Singleton);
|
||||
builder.Register<IWordValidator, DefaultWordValidator>(Lifetime.Singleton);
|
||||
builder.Register<ButtonViewController>(Lifetime.Singleton);
|
||||
|
||||
// Register audio service
|
||||
builder.RegisterComponentInHierarchy<SoundBase>()
|
||||
.As<IAudioService>();
|
||||
|
||||
// Register ads manager
|
||||
builder.RegisterComponentInHierarchy<AdsManager>()
|
||||
.As<IAdsManager>();
|
||||
|
||||
// Register other components
|
||||
builder.RegisterComponentInHierarchy<StateManager>();
|
||||
builder.RegisterComponentInHierarchy<ResourceManager>();
|
||||
builder.RegisterComponentInHierarchy<GiftButton>();
|
||||
builder.RegisterComponentInHierarchy<UIManager>();
|
||||
builder.RegisterComponentInHierarchy<LanguageSelectionButton>();
|
||||
builder.RegisterComponentInHierarchy<TimerDisplay>();
|
||||
builder.RegisterComponentInHierarchy<LevelManager>();
|
||||
builder.RegisterComponentInHierarchy<FieldManager>();
|
||||
builder.RegisterComponentInHierarchy<SceneLoader>();
|
||||
builder.RegisterComponentInHierarchy<MenuManager>();
|
||||
builder.RegisterComponentInHierarchy<BaseBoostButton>();
|
||||
builder.RegisterComponentInHierarchy<Popup>();
|
||||
builder.RegisterComponentInHierarchy<BaseExtraWordsProgressBar>();
|
||||
builder.RegisterComponentInHierarchy<CustomButton>();
|
||||
builder.RegisterComponentInHierarchy<WordSelectionManager>();
|
||||
builder.RegisterComponentInHierarchy<LabelAnim>();
|
||||
builder.RegisterComponentInHierarchy<BackgroundChanger>();
|
||||
builder.RegisterComponentInHierarchy<CrosswordWordsDebug>();
|
||||
|
||||
// Register localization components
|
||||
builder.RegisterComponentInHierarchy<LocalizationManager>()
|
||||
.As<ILocalizationService>();
|
||||
builder.RegisterComponentInHierarchy<LocalizedTextMeshProUGUI>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212011d08de343138c055f6d14c5ec3a
|
||||
timeCreated: 1744637334
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb10985f861e478083cefa2f0d53891f
|
||||
timeCreated: 1744977207
|
||||
@ -0,0 +1,47 @@
|
||||
// // ©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;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
using WordsToolkit.Scripts.Audio;
|
||||
using WordsToolkit.Scripts.GUI;
|
||||
using WordsToolkit.Scripts.GUI.Buttons;
|
||||
using WordsToolkit.Scripts.Utils;
|
||||
|
||||
namespace WordsToolkit.Scripts.Infrastructure.Factories
|
||||
{
|
||||
public class CoinsFactory : ICoinsFactory
|
||||
{
|
||||
private readonly IObjectResolver _container;
|
||||
private IAudioService audioService;
|
||||
|
||||
public CoinsFactory(IObjectResolver container, IAudioService audioService)
|
||||
{
|
||||
_container = container;
|
||||
this.audioService = audioService;
|
||||
}
|
||||
|
||||
public void CreateCoins(GameObject prefabFX)
|
||||
{
|
||||
audioService.PlayCoins();
|
||||
var fx = _container.Instantiate(prefabFX, CustomButton.latestClickedButton.transform.position, Quaternion.identity);
|
||||
fx.transform.position = fx.transform.position.SnapZ();
|
||||
fx.transform.localScale = Vector3.one;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICoinsFactory
|
||||
{
|
||||
void CreateCoins(GameObject prefabFX);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8a5c0ed58694b3ea79ad86fdfdad06f
|
||||
timeCreated: 1744977269
|
||||
@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace WordsToolkit.Scripts.Popups
|
||||
{
|
||||
public class DefaultPopupFactory : IPopupFactory
|
||||
{
|
||||
private readonly IObjectResolver _container;
|
||||
|
||||
public DefaultPopupFactory(IObjectResolver container)
|
||||
{
|
||||
_container = container;
|
||||
}
|
||||
|
||||
public Popup CreatePopup(string pathWithType, Transform parent)
|
||||
{
|
||||
var popupPrefab = Resources.Load<Popup>(pathWithType);
|
||||
if (popupPrefab == null)
|
||||
{
|
||||
Debug.LogError("Popup prefab not found in Resources folder: " + pathWithType);
|
||||
return null;
|
||||
}
|
||||
return CreatePopup(popupPrefab, parent);
|
||||
}
|
||||
|
||||
public T CreatePopup<T>(Transform parent) where T : Popup
|
||||
{
|
||||
return (T)CreatePopup("Popups/" + typeof(T).Name, parent);
|
||||
}
|
||||
|
||||
public Popup CreatePopup(Popup popupPrefab, Transform parent)
|
||||
{
|
||||
var popup = _container.Instantiate(popupPrefab, parent);
|
||||
var rectTransform = popup.GetComponent<RectTransform>();
|
||||
if (rectTransform != null)
|
||||
{
|
||||
rectTransform.anchoredPosition = Vector2.zero;
|
||||
rectTransform.sizeDelta = Vector2.zero;
|
||||
}
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa30083c0f51d4de49d6288f2ef5e572
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19849295c06f4716b0c115c31371028d
|
||||
timeCreated: 1744637571
|
||||
@ -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