Initial commit: Unity WordConnect project
This commit is contained in:
@ -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:
|
||||
Reference in New Issue
Block a user