diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cb5fa51..90ba73c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,23 +26,32 @@ jobs: run: | git fetch --unshallow lastTag=$(git describe --tags --abbrev=0) + currentTag=$(git tag --contains) lastTagMainVersion=$(sed -n 's/^\([0-9]*\.[0-9]*\).*/\1/p' <<<"$lastTag") currentVersion=$(cat VERSION) currentMainVersion=$(sed -n 's/^\([0-9]*\.[0-9]*\).*/\1/p' > $GITHUB_ENV else - echo "New version!" - newVersion="$currentMainVersion".1 - VersionPrefix=$newVersion - echo "newVersion=$newVersion" - echo "newVersion=$newVersion" >> $GITHUB_ENV + if [ "$lastTagMainVersion" = "$currentMainVersion" ] + then + echo "Version the same." + lastTagBuildVersion=$(sed -n 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p' <<<"$lastTag") + newBuildVersion=$((lastTagBuildVersion+1)) + newVersion="$lastTagMainVersion"."$newBuildVersion" + echo "newVersion=$newVersion" + echo "newVersion=$newVersion" >> $GITHUB_ENV + else + echo "New version!" + newVersion="$currentMainVersion".1 + VersionPrefix=$newVersion + echo "newVersion=$newVersion" + echo "newVersion=$newVersion" >> $GITHUB_ENV + fi fi sed -i '' -e "s/\(\)\(.*\)\(<\/Version>\)/\1$newVersion\3/" src/UnityMVVM/UnityMVVM.csproj - name: Run tests @@ -75,8 +84,14 @@ jobs: - name: Tag non-release if: github.ref != 'refs/heads/master' run: | - git tag ${{ env.newVersion }} - git push --tags + lastTag=$(git describe --tags --abbrev=0) + currentTag=$(git tag --contains) + if [ "$lastTag" != "$currentTag" ] + then + echo "New tag ${{ env.newVersion }}" + git tag ${{ env.newVersion }} + git push --tags + fi - name: Expose as artifact uses: actions/upload-artifact@v3.1.3 with: diff --git a/DemoUnityProj/CCG/Assets/.DS_Store b/DemoUnityProj/CCG/Assets/.DS_Store deleted file mode 100644 index 14cb69a..0000000 Binary files a/DemoUnityProj/CCG/Assets/.DS_Store and /dev/null differ diff --git a/DemoUnityProj/CCG/Assets/Code/Core/Camera/CameraModel.cs b/DemoUnityProj/CCG/Assets/Code/Core/Camera/CameraModel.cs index 7be6b1e..1b29e92 100644 --- a/DemoUnityProj/CCG/Assets/Code/Core/Camera/CameraModel.cs +++ b/DemoUnityProj/CCG/Assets/Code/Core/Camera/CameraModel.cs @@ -1,4 +1,5 @@ using AsyncReactAwait.Bindable; +using AsyncReactAwait.Bindable.BindableExtensions; namespace CCG.Core.Camera { diff --git a/DemoUnityProj/CCG/Assets/Code/Core/CoreInstaller.cs b/DemoUnityProj/CCG/Assets/Code/Core/CoreInstaller.cs index dca75c5..0593762 100644 --- a/DemoUnityProj/CCG/Assets/Code/Core/CoreInstaller.cs +++ b/DemoUnityProj/CCG/Assets/Code/Core/CoreInstaller.cs @@ -15,8 +15,10 @@ using CCG.MVVM.MainScreen3d; using CCG.MVVM.PlayButton; using CCG.MVVM.StatsChanger; +using CCG.MVVM.TimeCounter; using CCG.Services.Game; using CCG.Services.Startup; +using SurvivedWarrior.MVVM.Models.Time; using UnityEngine; using UnityMVVM.DI; using UnityMVVM.ViewModelCore; @@ -46,11 +48,14 @@ public override void InstallBindings() () => Resources.Load("Prefabs/Views/LoadingPopup")); Container.InstallView(ViewNames.CoolPopup, () => Resources.Load("Prefabs/Views/CoolPopup/CoolPopup")); + Container.InstallView(); Container.Install(); Container.FastBind(); + Container.FastBindMono(); + Container.GetViewsContainer() .Bind(typeof(ICameraMutableModel), typeof(ICameraModel)) .To().AsSingle(); diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/CoolPopup/CoolPopupView.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/CoolPopup/CoolPopupView.cs index 59fae1c..df33689 100644 --- a/DemoUnityProj/CCG/Assets/Code/MVVM/CoolPopup/CoolPopupView.cs +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/CoolPopup/CoolPopupView.cs @@ -8,6 +8,7 @@ namespace CCG.MVVM.CoolPopup public class CoolPopupView : ViewBehaviour { [SerializeField] private Button _closeBtn; + [SerializeField] private Button _openPopupButton; [SerializeField] private Button _openOtherBth; [SerializeField] private Button _openOtherWithErrorBth; [SerializeField] private Toggle _animationToggle; diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/View/MainScreenView.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/View/MainScreenView.cs index 5ebf6e7..cc44a82 100644 --- a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/View/MainScreenView.cs +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/View/MainScreenView.cs @@ -11,12 +11,20 @@ public class MainScreenView : ViewBehaviour, IPoolableView [SerializeField] private Button _mainMenuButton; [SerializeField] private Transform _cardsContainer; + + [SerializeField] private Button _popupBtn; protected override void OnViewModelSet() { base.OnViewModelSet(); ViewModel!.SetCardsContainer(_cardsContainer); _mainMenuButton.onClick.AddListener(() => ViewModel.OnMainMenuButtonClicked()); + _popupBtn.onClick.AddListener(OnPopupBtn); + } + + private void OnPopupBtn() + { + ViewModel!.OnPopupButtonClicked(); } protected override void OnViewModelClear() @@ -35,6 +43,8 @@ public void OnReturnToPool() transform.SetParent(null); var go = gameObject; go.SetActive(false); + _mainMenuButton.onClick.RemoveAllListeners(); + _popupBtn.onClick.RemoveListener(OnPopupBtn); DontDestroyOnLoad(go); } } diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/IMainScreenViewModel.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/IMainScreenViewModel.cs index 5a0f16d..295787a 100644 --- a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/IMainScreenViewModel.cs +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/IMainScreenViewModel.cs @@ -5,6 +5,7 @@ namespace CCG.MVVM.MainScreen.ViewModel { public interface IMainScreenViewModel : IViewModel { + void OnPopupButtonClicked(); void OnMainMenuButtonClicked(); void SetCardsContainer(Transform container); } diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/MainScreenViewModel.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/MainScreenViewModel.cs index 8796ab5..a8022c8 100644 --- a/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/MainScreenViewModel.cs +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/MainScreen/ViewModel/MainScreenViewModel.cs @@ -4,6 +4,7 @@ using CCG.Models.ImageModel; using CCG.MVVM.Card.Model; using CCG.MVVM.Card.ViewModel; +using CCG.MVVM.CoolPopup.Payload; using CCG.Services.Game; using UnityEngine; using UnityMVVM.ViewManager; @@ -66,6 +67,12 @@ private void IntiGame() }); } + public void OnPopupButtonClicked() + { + _viewManager.Open(ViewLayerIds.Popup, ViewNames.CoolPopup, new CoolPopupPayload(false)) + .OnFail(Debug.LogException); + } + public async void OnMainMenuButtonClicked() { await _gameService.OpenMainMenu(); diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter.meta b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter.meta new file mode 100644 index 0000000..7716aac --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 858b0d8c872844fe824f86bae1ff248a +timeCreated: 1701522304 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs new file mode 100644 index 0000000..8655bce --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs @@ -0,0 +1,10 @@ +using AsyncReactAwait.Bindable; +using UnityMVVM.ViewModelCore; + +namespace CCG.MVVM.TimeCounter +{ + public interface ITimeCounterViewModel : IViewModel + { + IBindable TimeInSeconds { get; } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs.meta b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs.meta new file mode 100644 index 0000000..8e3fe99 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/ITimeCounterViewModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4ba53f1437f84e218ae1a6bf7aba1746 +timeCreated: 1701522315 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs new file mode 100644 index 0000000..329a86b --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs @@ -0,0 +1,28 @@ +using TMPro; +using UnityEngine; +using UnityMVVM; + +namespace CCG.MVVM.TimeCounter +{ + public class TimeCounterView : ViewBehaviour + { + [SerializeField] private TMP_Text _text; + + protected override void OnViewModelSet() + { + base.OnViewModelSet(); + ViewModel!.TimeInSeconds.Bind(OnTimeChanged); + } + + private void OnTimeChanged(float time) + { + _text.text = time.ToString("0.0"); + } + + protected override void OnViewModelClear() + { + base.OnViewModelClear(); + ViewModel!.TimeInSeconds.Unbind(OnTimeChanged); + } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs.meta b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs.meta new file mode 100644 index 0000000..500af28 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: edbf4af8081d47d6b66068b9ffda2d94 +timeCreated: 1701522327 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs new file mode 100644 index 0000000..0250034 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs @@ -0,0 +1,59 @@ +using System; +using AsyncReactAwait.Bindable; +using CCG.Core; +using SurvivedWarrior.MVVM.Models.Time; +using UnityMVVM.ViewManager; +using UnityMVVM.ViewModelCore; +using Zenject; + +namespace CCG.MVVM.TimeCounter +{ + public class TimeCounterViewModel : ViewModel, + IInitializable, + ITimeCounterViewModel + { + private readonly IViewManager _viewManager; + private readonly ITimeManager _timeManager; + + private bool _isCounting; + + private readonly IMutable _timeInSeconds = new Mutable(); + + public IBindable TimeInSeconds => _timeInSeconds; + + public TimeCounterViewModel( + IViewManager viewManager, + ITimeManager timeManager) + { + _viewManager = viewManager; + _timeManager = timeManager; + } + + public void Initialize() + { + _viewManager.HighestBusyLayer.Bind(OnHighestLayerChanged); + _timeManager.CurrentTimestamp.Bind(OnTimeChanged); + } + + private void OnTimeChanged(long prevVal, long newVal) + { + if (_isCounting) + { + _timeInSeconds.Value += (newVal - prevVal) / (float)TimeSpan.TicksPerSecond; + } + } + + private void OnHighestLayerChanged(string layer) + { + _isCounting = layer == ViewLayerIds.MainUI; + } + + protected override void OnDestroyInternal() + { + base.OnDestroyInternal(); + _viewManager.HighestBusyLayer.Unbind(OnHighestLayerChanged); + _timeManager.CurrentTimestamp.Unbind(OnTimeChanged); + _isCounting = false; + } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs.meta b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs.meta new file mode 100644 index 0000000..0c5cd97 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/MVVM/TimeCounter/TimeCounterViewModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e06e99e8a25c4408aa127da09f0dc903 +timeCreated: 1701522365 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time.meta similarity index 77% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29.meta rename to DemoUnityProj/CCG/Assets/Code/Models/Time.meta index 842acf6..4c50185 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29.meta +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ca054d8464a4e4d9cb2f86b710d37bef +guid: 7f18bdcff9db940cf88c036673c12554 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs b/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs new file mode 100644 index 0000000..1b10433 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs @@ -0,0 +1,17 @@ +using System; +using JetBrains.Annotations; + +namespace SurvivedWarrior.MVVM.Models.Time +{ + public class CallbackCancelSource + { + private readonly Action _cancelAction; + + public CallbackCancelSource([NotNull] Action cancelAction) + { + _cancelAction = cancelAction ?? throw new ArgumentNullException(nameof(cancelAction)); + } + + public void Cancel() => _cancelAction(); + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs.meta new file mode 100644 index 0000000..a47157e --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/CallbackCancelSource.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4265e8b3b7b44dea883a6ebda1268681 +timeCreated: 1701478078 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs new file mode 100644 index 0000000..05f2546 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs @@ -0,0 +1,18 @@ +using System; +using AsyncReactAwait.Bindable; +using AsyncReactAwait.Promises; + +namespace SurvivedWarrior.MVVM.Models.Time +{ + public interface ITimeManager + { + IBindable CurrentTimestamp { get; } + long TimestampSinceStart { get; } + long LocalTimeOffset { get; } + void Pause(string timeline); + void Resume(string timeline); + CallbackCancelSource AddCallback(long timestamp, Action callback, string timeLine = "Default"); + DateTime TimestampToLocalTime(long timestamp); + IPromise Await(float seconds); + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs.meta new file mode 100644 index 0000000..ea46131 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e3659203029d4cddbda45ca2fd8be0d2 +timeCreated: 1691434491 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs new file mode 100644 index 0000000..737519f --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs @@ -0,0 +1,10 @@ +using System; + +namespace SurvivedWarrior.MVVM.Models.Time +{ + public interface ITimeline + { + void AddTime(long ticks); + CallbackCancelSource AddCallbackIn(long ticksDelay, Action callback); + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs.meta new file mode 100644 index 0000000..28615bc --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/ITimeline.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d60e2d8156a84d80b2035f4ffa8d89f8 +timeCreated: 1701476376 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs b/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs new file mode 100644 index 0000000..7b60fcb --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AsyncReactAwait.Bindable; +using AsyncReactAwait.Bindable.BindableExtensions; +using AsyncReactAwait.Promises; +using JetBrains.Annotations; +using UnityEngine; + +namespace SurvivedWarrior.MVVM.Models.Time +{ + public class TimeManager : MonoBehaviour, ITimeManager + { + + private long _startupTimestamp; + private long? _localTimeOffset; + + private readonly IMutable _currentTimestamp = new Mutable(); + + private readonly Dictionary _timelines = new(); + private readonly HashSet _pausedTimelines = new(); + + private long CurrentTimestampInternal + { + get + { + if (_startupTimestamp != 0) + { + return _startupTimestamp + TimestampSinceStart; + } + + return DateTime.UtcNow.Ticks; + } + } + + public IBindable CurrentTimestamp + { + get + { + if (_currentTimestamp.Value == 0) + { + Update(); + } + return _currentTimestamp; + } + } + + public long TimestampSinceStart => (long)(UnityEngine.Time.unscaledTimeAsDouble * TimeSpan.TicksPerSecond); + + public long LocalTimeOffset + { + get + { + _localTimeOffset ??= (DateTime.Now - DateTime.UtcNow).Ticks; + return _localTimeOffset.Value; + } + } + + public void Pause(string timeline) + { + _pausedTimelines.Add(timeline); + } + + public void Resume(string timeline) + { + _pausedTimelines.Remove(timeline); + } + + public CallbackCancelSource AddCallback(long timestamp, [NotNull] Action callback, string timeline = "Default") + { + if (callback == null) throw new ArgumentNullException(nameof(callback)); + + Debug.Log($"Delayed callback submitted: {callback.Method.Name} with time = {new DateTime(timestamp)}"); + + if (timestamp < CurrentTimestampInternal) + { + Debug.Log($"Invoke delayed callback: {callback.Method.Name}"); + callback.Invoke(); + return null; + } + + if (!_timelines.ContainsKey(timeline)) + { + _timelines.Add(timeline, new Timeline()); + } + return _timelines[timeline].AddCallbackIn(timestamp - CurrentTimestampInternal, callback); + } + + public DateTime TimestampToLocalTime(long timestamp) + { + return new DateTime(timestamp, DateTimeKind.Utc).ToLocalTime(); + } + + public IPromise Await(float seconds) + { + var promise = new ControllablePromise(); + AddCallback( + CurrentTimestampInternal + (long)(seconds * TimeSpan.TicksPerSecond), + () => promise.Success()); + return promise; + } + + private void Update() + { + if (_startupTimestamp == 0) + { + _startupTimestamp = DateTime.UtcNow.Ticks - TimestampSinceStart; + Debug.Log($"Application start time = {new DateTime(_startupTimestamp)}"); + } + + var prevVal = _currentTimestamp.Value; + var currentTimeStamp = CurrentTimestampInternal; + _currentTimestamp.Set(currentTimeStamp); + foreach (var kvp in _timelines + .Where(t => !_pausedTimelines.Contains(t.Key))) + { + kvp.Value.AddTime(currentTimeStamp - prevVal); + } + } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs.meta new file mode 100644 index 0000000..96bca08 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/TimeManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0ec9975d902844bc842e239721b14d88 +timeCreated: 1691434491 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs b/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs new file mode 100644 index 0000000..ceae6df --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace SurvivedWarrior.MVVM.Models.Time +{ + public class Timeline : ITimeline + { + + private readonly SortedList> _callbacks = new(); + private long _ticks; + + public void AddTime(long ticks) + { + _ticks += ticks; + if (_callbacks.Any()) + { + KeyValuePair> kvp; + while (_callbacks.Any() && (kvp = _callbacks.First()).Key < _ticks) + { + var callbacksCollection = new Action[kvp.Value.Count]; + kvp.Value.CopyTo(callbacksCollection); + foreach (var callback in callbacksCollection) + { + Debug.Log($"Invoke delayed callback: {callback.Method.Name}"); + callback.Invoke(); + } + + _callbacks.Remove(kvp.Key); + } + } + } + + public CallbackCancelSource AddCallbackIn(long ticksDelay, Action callback) + { + var timestamp = _ticks + ticksDelay; + if (!_callbacks.ContainsKey(timestamp)) + { + _callbacks.Add(timestamp, new List()); + } + _callbacks[timestamp].Add(callback); + return new CallbackCancelSource(() => + { + if (_callbacks.ContainsKey(timestamp)) + _callbacks[timestamp].Remove(callback); + }); + } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs.meta b/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs.meta new file mode 100644 index 0000000..90b8fda --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Code/Models/Time/Timeline.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f0988d95019e45598d05115538c29d92 +timeCreated: 1701476530 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Libs/UnityMVVM.dll b/DemoUnityProj/CCG/Assets/Libs/UnityMVVM.dll index cd7bb58..0a7f9f2 100644 Binary files a/DemoUnityProj/CCG/Assets/Libs/UnityMVVM.dll and b/DemoUnityProj/CCG/Assets/Libs/UnityMVVM.dll differ diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2.meta new file mode 100644 index 0000000..cc5e49f --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99ddc41de42624dacb64dc4368de6e52 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/.signature.p7s b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/.signature.p7s similarity index 72% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/.signature.p7s rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/.signature.p7s index 88b8ef4..3fc91d8 100644 Binary files a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/.signature.p7s and b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/.signature.p7s differ diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec similarity index 74% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec index 0af2ff6..b533d54 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec @@ -2,14 +2,14 @@ AsyncReactAwait - 0.8.29 + 0.11.2 kek_chpek - false LICENSE.md https://aka.ms/deprecateLicenseUrl + README.md https://github.com/kekchpek/AsyncReactAwait The tools for building reactive async code. - + diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec.meta similarity index 74% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec.meta index 1731062..adc4256 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/AsyncReactAwait.nuspec.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/AsyncReactAwait.nuspec.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 29812fc8c7f2b4efd9743be3baccd2a2 +guid: ef0b8ed08e50b4d6cbe912ff5cb52c60 DefaultImporter: externalObjects: {} userData: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/LICENSE.md b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/LICENSE.md similarity index 100% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/LICENSE.md rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/LICENSE.md diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/LICENSE.md.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/LICENSE.md.meta similarity index 75% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/LICENSE.md.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/LICENSE.md.meta index 5a546c2..0838a40 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/LICENSE.md.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/LICENSE.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7738c9cafdaf2442fa02fad7e03eb10b +guid: 6ff05328ce7164b8b8160c2d83156f88 TextScriptImporter: externalObjects: {} userData: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md new file mode 100644 index 0000000..99a8e31 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md @@ -0,0 +1,109 @@ +# AsyncReactAwait (Ara) +**Ara** is the development suit for asynchronous and reactive C# development. It contains classes for convenient data changing and handling management. + +## Bindable +`IBindable` and `IMutable` interfaces are supposed to be used for convenient changes handling of fields and properties +### Example +```csharp +public class HumanModel +{ + private IMutable _age = new Mutable(); + public IBindable Age => _age; // keep age being mutable only from inside the class + + private IMutable _name = new Mutable("No-Name"); + public IBindable Name => _name; // keep name being mutable only from inside the class + + public void SetName(string newName) + { + _name.Value = newName; + } + + public void IncrementAge() + { + _age.Value++; + } + +} + +public class HumanView : IDisposable +{ + + private readonly SomeLabel _ageLabel = new SomeLabel(); + private readonly SomeLabel _nameLabel = new SomeLabel(); + + private readonly HumanModel _model; + + public HumanView(HumanModel model) + { + _model = model; + _model.Age.Bind(_ageLabel.SetText); + _model.Name.Bind(_nameLabel.SetText); + } + + public void Dispose() + { + _model.Age.Unbind(_ageLabel.SetText); + _model.Name.Unbind(_nameLabel.SetText); + } + +} +``` + + +Also `IBindable` have methods for awaiting some specific value. +### Example with `async` +```csharp +public class ScoreModel +{ + private IMutable _score = new Mutable(); + public IBindable Score => _score; + + public void AddScore(int score) + { + _score += score; + } + + public async void AddBonus(int bonusValue, int requiredScore) + { + await Score.WillBe(s => + s >= requiredScore); + AddScore(bonusValue); + } +} +``` + +## Promises +Promises are some kind of a replacement for regular C# `Task`. They can also be used as a return type for `async` methods or with `await` like tasks. +But promises have two advantages: + - Promises have an interface. So you can easely substitute them to some other implementation. + - Promises' completition is easier to control from managed code with `Success` and `Fail` methods. +### Example +```csharp + +// The third party class for playing animations +public abstract class ThirdPartyAnimation +{ + protected void Start() {...} + protected virtual void Ended() {...} +} + +// Managed animation implementation. +public class Animation : ThirdPartyAnimation +{ + + private IControllablePromise _playingPromise; + + public async IPromise Play() { + _playingPromise = new ControllablePromise(); + Start(); + await _playingPromise; + } + + protected override void Ended() { + base.Ended(); + _playingPromise?.Success(); + _playingPromise = null; + } + +} +``` diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md.meta new file mode 100644 index 0000000..1c50a3b --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1a8aee84e76704357a2e7d0a8b4820b5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib.meta similarity index 77% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib.meta index 95c3d1a..3a55a63 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 74faa0c195a1446e1ad751f501f19e23 +guid: 8b7d0dbca3ed64157ab2d0d11c640e09 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1.meta similarity index 77% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1.meta index 96cc305..7e6083a 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0666314ac62b542e29ed2bf0ed84aedb +guid: 0aa09ed8cc4cc476da113870637f1ed2 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll new file mode 100644 index 0000000..a8288ab Binary files /dev/null and b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll differ diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll.meta similarity index 91% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll.meta index d9f5d48..73d597a 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.dll.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cf6e65621e71147048d4dd69a5fe0fc2 +guid: 948f2cff71f7e4cb682e8a4b9f04b6d0 labels: - NuGetForUnity PluginImporter: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml similarity index 70% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml index 8a0dfc7..e28aeac 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml @@ -34,12 +34,66 @@ The result of awaited process. - + + + Tools for bindable and mutable objects + + + + + Aggregate two bindable values + + + + + Aggregate three bindable values + + + + + Aggregate four bindable values + + + + + An aggregator for bindable values. + + The aggregated value type. + + + + + + + Constructor for bindable values aggregator. + + + + + + + + + + + + + + + + + + + + + + + Extensions for bindable values. - + Awaits the bindable value becomes specific value. @@ -48,25 +102,67 @@ The value to await. The awaiter for specified value. - + - Value, changes of which could be handled with binded handlers. + Awaits for specific value. - + The bindable value to operate with. + The specific value awaiter. + False if you don't want to check current value - + - Current value. + Converts bindable value to some other value, that depends on source bindable. + The bindable to convert. + The predicate to apply to bindable value. + The type of converted bindable value. + The source bindable value type. + - + - Awaits for specific value. + Sets the value. - The specific value awaiter. - False if you don't want to check current value + Mutable to extend. + New value. - + + + Proxies a value and it's changes from certain bindable object. + Setting a value explicitly breaks proxying. + + The proxying object. + The object to proxy. + The converter from proxy type. + The proxy type. + The proxying type. + + + + Gets the value. + + Bindable to extend. + New value. + + + + Aggregates bindable with other bindable value + + The first bindable to aggregate. + The second bindable to aggregate. + An aggregation function. + A type of the first bindable value. + A type of the second bindable value. + The type of the result of the aggregation. + An aggregated bindable. + + + + Non-generic bindable value. + + + Bind a handler for value changing. @@ -74,8 +170,25 @@ Calls handler instantly when it is set. Handler is null. - - + + + Unbinds the value changing handler. + + Value changing handler. + + + + Value, changes of which could be handled with bound handlers. + + + + + + Current value. + + + + @@ -85,31 +198,60 @@ + + + + + + - Unbinds the value changing handler. + Non-generic bindable value. - Value changing handler. - - + + + Current value. + - - + + + Bind a handler for value changing. + + The handler for value changing. + Apply handler for current value. + + + + + + + Unbinds a handler for value changing. + + The handler for value changing. + + + - Class for representing changable bindable value. + Class for representing changeable bindable value. Bindable value type. - + - Sets the value. + Proxies a value and it's changes from certain bindable object. + Setting a value explicitly breaks proxying. + + The object to proxy. + + + + Breaks proxying other bindable. If it was. - New value. @@ -125,22 +267,37 @@ - Default constructor to create changable mutable value. + Default constructor to create mutable value. Initial value. - + + + + + + + + + + + + + + + + - + @@ -150,14 +307,11 @@ - + - - - Base API for promise awaiter. @@ -262,6 +416,38 @@ + + + Extensions for promises. + + + + + Wraps a value promise inside the non-generic one. + + The promise to wrap. + The return type of wrapped promise. + The non-generic promise. + + + + Wraps a non-result to a promise and evaluate it with a result. + + The promise to wrap. + The result getter, that will be called, when promise will completed. + The return type of wrapped promise. + The promise with a result. + + + + Converts a promise value to other one. + + The promise to convert. + The converter for source promise result. + The type of a promise result. + The type of conversion result. + + The interface to control promise completion. diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml.meta b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml.meta similarity index 75% rename from DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml.meta rename to DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml.meta index a7eca33..5d13430 100644 --- a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.xml.meta +++ b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.11.2/lib/netstandard2.1/AsyncReactAwait.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 13c7796cb45494279aa66eab9ea91798 +guid: b04dcd6c02ed44fb38ab4c8f6e8d46ef TextScriptImporter: externalObjects: {} userData: diff --git a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll b/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll deleted file mode 100644 index 675c347..0000000 Binary files a/DemoUnityProj/CCG/Assets/Packages/AsyncReactAwait.0.8.29/lib/netstandard2.1/AsyncReactAwait.dll and /dev/null differ diff --git a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/CardView.prefab b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/CardView.prefab index 4631a11..f465c64 100644 --- a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/CardView.prefab +++ b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/CardView.prefab @@ -31,7 +31,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4764155502253762932} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -107,7 +106,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -183,7 +181,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -265,7 +262,6 @@ RectTransform: - {fileID: 73902204817573174} - {fileID: 3001500894359281404} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 1} @@ -303,7 +299,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -379,7 +374,6 @@ RectTransform: - {fileID: 1748794537599093438} - {fileID: 5566515691108384477} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 1, y: 0} @@ -418,7 +412,6 @@ RectTransform: m_Children: - {fileID: 1400542962949722896} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -464,7 +457,9 @@ MonoBehaviour: m_GroupId: 0 m_GroupMaxId: 0 m_PositionMode: 0 - m_AutoScaling: 1 + m_AutoScaling: 0 + m_AutoScalingMode: 2 + m_ResetScaleOnEnable: 0 --- !u!1 &1867350607902594980 GameObject: m_ObjectHideFlags: 0 @@ -496,7 +491,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} @@ -572,7 +566,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -642,13 +635,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2119460888003955001} + serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2977569594077316468} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!198 &6107760486835487469 ParticleSystem: @@ -868,6 +861,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -897,6 +891,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 startSize: @@ -1218,6 +1213,7 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 randomizeRotationDirection: 0 + gravitySource: 0 maxNumParticles: 1000 customEmitterVelocity: {x: 0, y: 0, z: 0} size3D: 0 @@ -1947,6 +1943,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -1976,6 +1973,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 UVModule: @@ -4196,6 +4194,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -4225,6 +4224,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 range: {x: 0, y: 1} @@ -4602,6 +4602,7 @@ ParticleSystem: m_RotationOrder: 4 minVertexDistance: 0.2 textureMode: 0 + textureScale: {x: 1, y: 1} ribbonCount: 1 shadowBias: 0.5 worldSpace: 0 @@ -4644,6 +4645,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -4673,6 +4675,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 widthOverTrail: @@ -4760,6 +4763,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -4789,6 +4793,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 CustomDataModule: @@ -4827,6 +4832,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -4856,6 +4862,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 colorLabel0: Color @@ -5109,6 +5116,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -5138,6 +5146,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 colorLabel1: Color @@ -5463,7 +5472,6 @@ RectTransform: - {fileID: 5806083497259054997} - {fileID: 2242929440239978535} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -5565,7 +5573,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} @@ -5641,7 +5648,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -5717,7 +5723,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -5793,7 +5798,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4269524583105360813} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5869,7 +5873,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4764155502253762932} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -6017,7 +6020,6 @@ RectTransform: - {fileID: 3082794753308762835} - {fileID: 4269524583105360813} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -6065,6 +6067,25 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 @@ -6098,6 +6119,12 @@ Rigidbody2D: m_AngularDrag: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 @@ -6133,7 +6160,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -6209,7 +6235,6 @@ RectTransform: - {fileID: 2683095680033221695} - {fileID: 1160313217326781196} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0.5, y: 0} @@ -6241,13 +6266,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4513846480278021815} + serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4842399231630508901} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!198 &2123244298734678455 ParticleSystem: @@ -6467,6 +6492,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -6496,6 +6522,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 startSize: @@ -6817,6 +6844,7 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 randomizeRotationDirection: 0 + gravitySource: 0 maxNumParticles: 1000 customEmitterVelocity: {x: 0, y: 0, z: 0} size3D: 0 @@ -7546,6 +7574,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -7575,6 +7604,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 UVModule: @@ -9795,6 +9825,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -9824,6 +9855,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 range: {x: 0, y: 1} @@ -10201,6 +10233,7 @@ ParticleSystem: m_RotationOrder: 4 minVertexDistance: 0.2 textureMode: 0 + textureScale: {x: 1, y: 1} ribbonCount: 1 shadowBias: 0.5 worldSpace: 0 @@ -10243,6 +10276,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -10272,6 +10306,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 widthOverTrail: @@ -10359,6 +10394,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -10388,6 +10424,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 CustomDataModule: @@ -10426,6 +10463,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -10455,6 +10493,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 colorLabel0: Color @@ -10708,6 +10747,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 minGradient: @@ -10737,6 +10777,7 @@ ParticleSystem: atime6: 0 atime7: 0 m_Mode: 0 + m_ColorSpace: -1 m_NumColorKeys: 2 m_NumAlphaKeys: 2 colorLabel1: Color @@ -11059,7 +11100,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3483511743057499419} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -11194,7 +11234,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4764155502253762932} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 1} @@ -11267,7 +11306,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -11344,7 +11382,6 @@ RectTransform: m_Children: - {fileID: 1317512401665722308} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -11390,7 +11427,9 @@ MonoBehaviour: m_GroupId: 0 m_GroupMaxId: 0 m_PositionMode: 0 - m_AutoScaling: 1 + m_AutoScaling: 0 + m_AutoScalingMode: 2 + m_ResetScaleOnEnable: 0 --- !u!1 &5744665062939396741 GameObject: m_ObjectHideFlags: 0 @@ -11422,7 +11461,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} @@ -11498,7 +11536,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4764155502253762932} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0.5} @@ -11634,7 +11671,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3483511743057499419} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -11716,7 +11752,6 @@ RectTransform: - {fileID: 7395231961079204545} - {fileID: 1340323806859092339} m_Father: {fileID: 4764155502253762932} - m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0.5} @@ -11754,7 +11789,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} @@ -11830,7 +11864,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -11906,7 +11939,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3968071235390951952} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} @@ -11982,7 +12014,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -12058,7 +12089,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4269524583105360813} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -12193,7 +12223,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3082794753308762835} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} @@ -12269,7 +12298,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5591431404652167204} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -12404,7 +12432,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5591431404652167204} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} diff --git a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/MainScreenView.prefab b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/MainScreenView.prefab index fa44849..e491f4f 100644 --- a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/MainScreenView.prefab +++ b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/MainScreenView.prefab @@ -31,7 +31,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -107,7 +106,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} @@ -183,7 +181,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} @@ -259,7 +256,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -335,7 +331,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -411,7 +406,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 718122419084036} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} @@ -490,8 +484,9 @@ RectTransform: - {fileID: 7746569408776331258} - {fileID: 34663232250409695} - {fileID: 1773017137440097364} + - {fileID: 7588955834901248640} + - {fileID: 3212318857897366484} m_Father: {fileID: 1737924058913498882} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -575,7 +570,6 @@ RectTransform: - {fileID: 718121946573069} - {fileID: 718121386918237} m_Father: {fileID: 718122268434758} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.15, y: 0.6} m_AnchorMax: {x: 0.85, y: 1} @@ -600,6 +594,25 @@ BoxCollider2D: m_Enabled: 1 m_Density: 1 m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 @@ -614,7 +627,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 1344, y: 432} + m_Size: {x: 320.6, y: 104.399994} m_EdgeRadius: 0 --- !u!114 &718122419084041 MonoBehaviour: @@ -640,6 +653,306 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6b21a28ceb971114e9ed3555afa60145, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1089449015939444877 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7588955834901248640} + - component: {fileID: 3065598639361849189} + - component: {fileID: 7516506442438061008} + m_Layer: 0 + m_Name: PopupBtn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7588955834901248640 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1089449015939444877} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2527183607806277454} + - {fileID: 8137395838175893647} + m_Father: {fileID: 718122268434758} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 60, y: -120} + m_SizeDelta: {x: 100, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3065598639361849189 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1089449015939444877} + m_CullTransparentMesh: 1 +--- !u!114 &7516506442438061008 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1089449015939444877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8560060097008699670} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &1240137534632377775 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2527183607806277454} + - component: {fileID: 5147490800195742611} + - component: {fileID: 8560060097008699670} + m_Layer: 0 + m_Name: Bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2527183607806277454 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1240137534632377775} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7588955834901248640} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5147490800195742611 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1240137534632377775} + m_CullTransparentMesh: 1 +--- !u!114 &8560060097008699670 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1240137534632377775} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 1bc0c11b60ed7e74d9d5888b454eeadf, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3981249721501042749 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8137395838175893647} + - component: {fileID: 7847459579389836257} + - component: {fileID: 418549691937017764} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8137395838175893647 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3981249721501042749} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7588955834901248640} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.1, y: 0.1} + m_AnchorMax: {x: 0.9, y: 0.9} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7847459579389836257 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3981249721501042749} + m_CullTransparentMesh: 1 +--- !u!114 &418549691937017764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3981249721501042749} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Popup + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 27.6 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 1 + m_fontSizeMax: 32767 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &4462129611979704362 GameObject: m_ObjectHideFlags: 0 @@ -673,7 +986,6 @@ RectTransform: m_Children: - {fileID: 4057838768566248330} m_Father: {fileID: 718122268434758} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -794,7 +1106,6 @@ RectTransform: - {fileID: 718122268434758} - {fileID: 4923694436147864812} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -815,6 +1126,7 @@ MonoBehaviour: m_EditorClassIdentifier: _mainMenuButton: {fileID: 8478204219149940001} _cardsContainer: {fileID: 4923694436147864812} + _popupBtn: {fileID: 7516506442438061008} --- !u!1 &7116756463112345660 GameObject: m_ObjectHideFlags: 0 @@ -846,7 +1158,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 7746569408776331258} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -979,18 +1290,124 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1737924058913498882} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1001 &580171543071872343 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 718122268434758} + m_Modifications: + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_SizeDelta.y + value: 40 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchoredPosition.x + value: 60 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_AnchoredPosition.y + value: -170 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4816246921243298958, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_Name + value: TimeCounter (1) + objectReference: {fileID: 0} + - target: {fileID: 5190050777455915943, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + propertyPath: m_fontSize + value: 28.6 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} +--- !u!224 &3212318857897366484 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2637240257033275011, guid: 6ddaecdc1671b4374b546b0a6900e05b, type: 3} + m_PrefabInstance: {fileID: 580171543071872343} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3355239467757475315 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 718122268434758} m_Modifications: - target: {fileID: 3380816296051697452, guid: 98c17734e8ff35a4ea002563b34474fc, type: 3} @@ -1082,6 +1499,9 @@ PrefabInstance: value: StatsChanger objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 98c17734e8ff35a4ea002563b34474fc, type: 3} --- !u!224 &34663232250409695 stripped RectTransform: @@ -1093,6 +1513,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 718122268434758} m_Modifications: - target: {fileID: 6339856557844490456, guid: f5d91153f609ff64fb224dce7d7ab64f, type: 3} @@ -1216,6 +1637,9 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f5d91153f609ff64fb224dce7d7ab64f, type: 3} --- !u!224 &1773017137440097364 stripped RectTransform: diff --git a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter.meta b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter.meta new file mode 100644 index 0000000..fdace15 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3495d00f264ca4e86903f2e99852f946 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab new file mode 100644 index 0000000..c7dca22 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab @@ -0,0 +1,271 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4816246921243298958 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2637240257033275011} + - component: {fileID: 7440807146942090086} + - component: {fileID: 3204364719753223728} + m_Layer: 0 + m_Name: TimeCounter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2637240257033275011 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4816246921243298958} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7987805806139870029} + - {fileID: 4406184493191914636} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7440807146942090086 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4816246921243298958} + m_CullTransparentMesh: 1 +--- !u!114 &3204364719753223728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4816246921243298958} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: edbf4af8081d47d6b66068b9ffda2d94, type: 3} + m_Name: + m_EditorClassIdentifier: + _text: {fileID: 5190050777455915943} +--- !u!1 &6700764233020899756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7987805806139870029} + - component: {fileID: 767776364064184208} + - component: {fileID: 4252328626630800661} + m_Layer: 0 + m_Name: Bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7987805806139870029 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6700764233020899756} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2637240257033275011} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &767776364064184208 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6700764233020899756} + m_CullTransparentMesh: 1 +--- !u!114 &4252328626630800661 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6700764233020899756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 1bc0c11b60ed7e74d9d5888b454eeadf, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8829309895624881214 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4406184493191914636} + - component: {fileID: 2391404795844544482} + - component: {fileID: 5190050777455915943} + m_Layer: 0 + m_Name: TimeText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4406184493191914636 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8829309895624881214} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2637240257033275011} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.1, y: 0.1} + m_AnchorMax: {x: 0.9, y: 0.9} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2391404795844544482 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8829309895624881214} + m_CullTransparentMesh: 1 +--- !u!114 &5190050777455915943 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8829309895624881214} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 232.3 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 155.4 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 1 + m_fontSizeMax: 32767 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab.meta b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab.meta new file mode 100644 index 0000000..bd152aa --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Resources/Prefabs/Views/TimeCounter/TimeCounter.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6ddaecdc1671b4374b546b0a6900e05b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DemoUnityProj/CCG/Assets/Scenes/MainScene.unity b/DemoUnityProj/CCG/Assets/Scenes/MainScene.unity index 40ac068..913dd3c 100644 --- a/DemoUnityProj/CCG/Assets/Scenes/MainScene.unity +++ b/DemoUnityProj/CCG/Assets/Scenes/MainScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.37311915, g: 0.3807396, b: 0.35872662, a: 1} + m_IndirectSpecularColor: {r: 0.3708708, g: 0.37838137, b: 0.35725543, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -104,7 +104,7 @@ NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: - serializedVersion: 2 + serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 @@ -117,7 +117,7 @@ NavMeshSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: @@ -180,13 +180,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7703474} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &7703477 MonoBehaviour: @@ -263,13 +263,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 152387466} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &487324196 GameObject: @@ -294,13 +294,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 487324196} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &574825035 GameObject: @@ -338,13 +338,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 574825035} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 3.0528862, y: -2.713383, z: -16.517996} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1463709824 GameObject: @@ -376,12 +376,11 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1608189053} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 1600, y: 900} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1463709827 CanvasRenderer: @@ -467,7 +466,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 1 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -486,7 +487,6 @@ RectTransform: - {fileID: 1463709825} - {fileID: 1819522588} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -523,7 +523,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1608189053} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -538,3 +537,12 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1819522587} m_CullTransparentMesh: 1 +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1608189053} + - {fileID: 152387469} + - {fileID: 574825037} + - {fileID: 7703476} + - {fileID: 487324197} diff --git a/DemoUnityProj/CCG/Assets/Tests/EditorTests/Core/TestApplication.cs b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Core/TestApplication.cs index 7d1dfe3..c357483 100644 --- a/DemoUnityProj/CCG/Assets/Tests/EditorTests/Core/TestApplication.cs +++ b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Core/TestApplication.cs @@ -1,6 +1,9 @@ using System; using System.Collections.Generic; using AsyncReactAwait.Promises; +using CCG.Core; +using CCG.MVVM.MainMenu; +using CCG.MVVM.PlayButton; using CCG.Services.Startup; using JetBrains.Annotations; using NUnit.Framework; @@ -58,6 +61,11 @@ public IPromise Start() return _appContainer.Resolve().Startup(); } + public void ClickPlayButton() + { + GetViewModel(ViewLayerIds.MainUI).GetSubview().OnClicked(); + } + public T GetViewModel(string viewLayer) where T : IViewModel { return (T)_appContainer.Resolve().GetView(viewLayer); diff --git a/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs new file mode 100644 index 0000000..32fa656 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs @@ -0,0 +1,88 @@ +using System; +using AsyncReactAwait.Bindable; +using CCG.Core; +using CCG.MVVM.MainMenu; +using CCG.MVVM.MainScreen.ViewModel; +using CCG.MVVM.PlayButton; +using CCG.MVVM.TimeCounter; +using CCG.Tests.Editor.Core; +using NSubstitute; +using NUnit.Framework; +using SurvivedWarrior.MVVM.Models.Time; + +namespace CCG.Tests.Editor +{ + public class TimeCounterTests + { + [Test] + public void TimeChanged_TimeCounted() + { + // Arrange + var timeManager = Substitute.For(); + var timeProp = new Mutable(); + timeManager.CurrentTimestamp.Returns(timeProp); + var testApp = TestApplication.Create(rebindMap: new [] + { + (typeof(ITimeManager), (object)timeManager) + }); + + // Act + testApp.Start(); + testApp.ClickPlayButton(); + var counter = testApp + .GetViewModel(ViewLayerIds.MainUI) + .GetSubview(); + timeProp.Value += TimeSpan.TicksPerSecond; + + // Assert + Assert.AreEqual(1f, counter.TimeInSeconds.Value); + } + + [Test] + public void Initialization_TimeIsZero() + { + // Arrange + var timeManager = Substitute.For(); + var testApp = TestApplication.Create(rebindMap: new [] + { + (typeof(ITimeManager), (object)timeManager) + }); + + // Act + testApp.Start(); + testApp.ClickPlayButton(); + var counter = testApp + .GetViewModel(ViewLayerIds.MainUI) + .GetSubview(); + + // Assert + Assert.AreEqual(0f, counter.TimeInSeconds.Value); + } + + [Test] + public void TimeChanged_ButPopupOpened_TimeNotCounted() + { + // Arrange + var timeManager = Substitute.For(); + var timeProp = new Mutable(); + timeManager.CurrentTimestamp.Returns(timeProp); + var testApp = TestApplication.Create(rebindMap: new [] + { + (typeof(ITimeManager), (object)timeManager) + }); + + // Act + testApp.Start(); + testApp.ClickPlayButton(); + var mainScreen = testApp + .GetViewModel(ViewLayerIds.MainUI); + var counter = mainScreen + .GetSubview(); + mainScreen.OnPopupButtonClicked(); + timeProp.Value += 1000; + + // Assert + Assert.AreEqual(0f, counter.TimeInSeconds.Value); + } + } +} \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs.meta b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs.meta new file mode 100644 index 0000000..b2cc5a9 --- /dev/null +++ b/DemoUnityProj/CCG/Assets/Tests/EditorTests/Tests/TimeCounterTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 512bc1fe392241048868ff35a4d1d9b4 +timeCreated: 1701524492 \ No newline at end of file diff --git a/DemoUnityProj/CCG/Assets/packages.config b/DemoUnityProj/CCG/Assets/packages.config index 97514c3..3c1a226 100644 --- a/DemoUnityProj/CCG/Assets/packages.config +++ b/DemoUnityProj/CCG/Assets/packages.config @@ -1,6 +1,6 @@  - + diff --git a/DemoUnityProj/CCG/Packages/manifest.json b/DemoUnityProj/CCG/Packages/manifest.json index 18d2353..f5b634b 100644 --- a/DemoUnityProj/CCG/Packages/manifest.json +++ b/DemoUnityProj/CCG/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git", "com.unity.ide.rider": "3.0.26", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.6", diff --git a/DemoUnityProj/CCG/Packages/packages-lock.json b/DemoUnityProj/CCG/Packages/packages-lock.json index 309693a..3cd7292 100644 --- a/DemoUnityProj/CCG/Packages/packages-lock.json +++ b/DemoUnityProj/CCG/Packages/packages-lock.json @@ -1,5 +1,12 @@ { "dependencies": { + "com.coffee.ui-particle": { + "version": "https://github.com/mob-sakai/ParticleEffectForUGUI.git", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "4e4b9eb2a756219cf9632525e0acb00aec30aa92" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, diff --git a/DemoUnityProj/QuickStartUnityMVVM/Assets/Libs/UnityMVVM.dll b/DemoUnityProj/QuickStartUnityMVVM/Assets/Libs/UnityMVVM.dll index cd7bb58..0a7f9f2 100644 Binary files a/DemoUnityProj/QuickStartUnityMVVM/Assets/Libs/UnityMVVM.dll and b/DemoUnityProj/QuickStartUnityMVVM/Assets/Libs/UnityMVVM.dll differ diff --git a/VERSION b/VERSION index 4babffb..9b86fd3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.14.x \ No newline at end of file +0.15.x \ No newline at end of file diff --git a/src/.idea/.idea.UnityMVVM/.idea/vcs.xml b/src/.idea/.idea.UnityMVVM/.idea/vcs.xml index 35eb1dd..62bd7a0 100644 --- a/src/.idea/.idea.UnityMVVM/.idea/vcs.xml +++ b/src/.idea/.idea.UnityMVVM/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 695e3ae..e30fce1 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/UnityMVVM/DI/Mapper/ViewToViewModelMapper.cs b/src/UnityMVVM/DI/Mapper/ViewToViewModelMapper.cs index a1bf7fd..a49f275 100644 --- a/src/UnityMVVM/DI/Mapper/ViewToViewModelMapper.cs +++ b/src/UnityMVVM/DI/Mapper/ViewToViewModelMapper.cs @@ -29,11 +29,25 @@ public Type GetViewModelForView(Type viewType) { return _viewToViewModelMap[viewType]; } - throw new Exception($"Can not find corresponing view model type for {viewType.Name}"); + throw new Exception($"Can not find corresponding view model type for {viewType.Name}"); } private void MapInternal(Type viewType, Type viewModelType, bool validate) { + if (_viewToViewModelMap.TryGetValue(viewType, out var mappedType)) + { + if (mappedType == viewModelType) + { + // this view type had already been mapped to this view model. + return; + } + else + { + throw new InvalidOperationException( + $"Unable to map view type {viewType.Name} to view model type {viewModelType.Name}. " + + $"This view type is already mapped to {mappedType.Name}."); + } + } if (validate) { if (!viewType.GetParentTypes().ContainsItem(typeof(MonoBehaviour))) diff --git a/src/UnityMVVM/UnityMVVM.csproj b/src/UnityMVVM/UnityMVVM.csproj index 33bed90..a9f4302 100644 --- a/src/UnityMVVM/UnityMVVM.csproj +++ b/src/UnityMVVM/UnityMVVM.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/UnityMVVM/ViewManager/IViewManager.cs b/src/UnityMVVM/ViewManager/IViewManager.cs index 9479837..78060b9 100644 --- a/src/UnityMVVM/ViewManager/IViewManager.cs +++ b/src/UnityMVVM/ViewManager/IViewManager.cs @@ -1,6 +1,8 @@ using System; +using AsyncReactAwait.Bindable; using AsyncReactAwait.Promises; using UnityEngine; +using UnityMVVM.ViewManager.ViewLayer; using UnityMVVM.ViewModelCore; namespace UnityMVVM.ViewManager @@ -21,7 +23,12 @@ public interface IViewManager /// Fires on any view opened. /// event Action<(string layerId, string viewName)> ViewClosedImplicitly; - + + /// + /// Returns the highest layer, that have an opened view on. + /// + IBindable HighestBusyLayer { get; } + /// /// Returns all view layer ids. /// @@ -73,6 +80,13 @@ public interface IViewManager /// The id of layer to get a view name. /// The view name public string? GetViewName(string viewLayerId); + + /// + /// Gets a layer with specified ID. + /// + /// The id of layer to get. + /// The view layer. + public IViewLayer GetLayer(string viewLayerId); /// /// Gets the view model of the view on the specified layer. diff --git a/src/UnityMVVM/ViewManager/ViewLayer/IViewLayer.cs b/src/UnityMVVM/ViewManager/ViewLayer/IViewLayer.cs index fe4791c..6462c4c 100644 --- a/src/UnityMVVM/ViewManager/ViewLayer/IViewLayer.cs +++ b/src/UnityMVVM/ViewManager/ViewLayer/IViewLayer.cs @@ -1,4 +1,5 @@ -using AsyncReactAwait.Promises; +using AsyncReactAwait.Bindable; +using AsyncReactAwait.Promises; using UnityEngine; using UnityMVVM.ViewModelCore; @@ -21,6 +22,11 @@ public interface IViewLayer /// Transform Container { get; } + /// + /// Current layer view model. + /// + IBindable CurrentView { get; } + /// /// Close root view model. /// @@ -33,13 +39,7 @@ public interface IViewLayer void ClearInstantly(); /// - /// Gets current layer view model. - /// - /// Current layer view model - IViewModel? GetCurrentView(); - - /// - /// Set root view model. Destroy previous if it exists. + /// Set root view model. /// /// View model to be set. void Set(IViewModel viewModel); diff --git a/src/UnityMVVM/ViewManager/ViewLayer/ViewLayerImpl.cs b/src/UnityMVVM/ViewManager/ViewLayer/ViewLayerImpl.cs index f32049d..b5bf122 100644 --- a/src/UnityMVVM/ViewManager/ViewLayer/ViewLayerImpl.cs +++ b/src/UnityMVVM/ViewManager/ViewLayer/ViewLayerImpl.cs @@ -1,5 +1,6 @@ using AsyncReactAwait.Promises; using System; +using AsyncReactAwait.Bindable; using UnityEngine; using UnityMVVM.ViewModelCore; @@ -8,11 +9,11 @@ namespace UnityMVVM.ViewManager.ViewLayer internal class ViewLayerImpl : IViewLayer { - private IViewModel? _currentViewModel; + private readonly IMutable _currentViewModel = new Mutable(); public string Id { get; } - public Transform Container { get; } + public IBindable CurrentView => _currentViewModel; public ViewLayerImpl(string id, Transform container) { @@ -22,40 +23,35 @@ public ViewLayerImpl(string id, Transform container) public IPromise Clear() { - if (_currentViewModel == null) + if (_currentViewModel.Value == null) { var promise = new ControllablePromise(); promise.Success(); return promise; } - return _currentViewModel.Close(); + return _currentViewModel.Value.Close(); } public void ClearInstantly() { - _currentViewModel?.Destroy(); - } - - public IViewModel? GetCurrentView() - { - return _currentViewModel; + _currentViewModel.Value?.Destroy(); } public void Set(IViewModel viewModel) { - if (_currentViewModel != null) + if (_currentViewModel.Value != null) { throw new InvalidOperationException("It is not possible to set new view model for layer, that already has view "); } - _currentViewModel = viewModel; - _currentViewModel.Destroyed += OnViewModelDestroyed; + _currentViewModel.Value = viewModel; + _currentViewModel.Value.Destroyed += OnViewModelDestroyed; } private void OnViewModelDestroyed(IViewModel _) { - if (_currentViewModel == null) return; - _currentViewModel.Destroyed -= OnViewModelDestroyed; - _currentViewModel = null; + if (_currentViewModel.Value == null) return; + _currentViewModel.Value.Destroyed -= OnViewModelDestroyed; + _currentViewModel.Value = null; } } } diff --git a/src/UnityMVVM/ViewManager/ViewManagerImpl.cs b/src/UnityMVVM/ViewManager/ViewManagerImpl.cs index a724225..c01650e 100644 --- a/src/UnityMVVM/ViewManager/ViewManagerImpl.cs +++ b/src/UnityMVVM/ViewManager/ViewManagerImpl.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; +using AsyncReactAwait.Bindable; using UnityEngine; using UnityEngine.Scripting; using UnityMVVM.DI; @@ -23,9 +24,14 @@ internal class ViewManagerImpl : IViewManager private string? _openingLayer; + private readonly IMutable _highestBusyLayer = new Mutable(); + public event Action<(string layerId, string viewName, IPayload? viewPayload)>? ViewOpened; public event Action<(string layerId, string viewName)>? ViewClosedImplicitly; + /// + public IBindable HighestBusyLayer => _highestBusyLayer; + /// /// Default constructor. /// @@ -38,8 +44,30 @@ public ViewManagerImpl( { _layers = layers.ToArray(); _viewsContainer = viewsContainerAdapter; + foreach (var viewLayer in _layers) + { + viewLayer.CurrentView.Bind(OnLayerViewChanged); + } } + private void OnLayerViewChanged() + { + UpdateHighestViewLayer(); + } + + private void UpdateHighestViewLayer() + { + string? highestLayerId = null; + foreach (var l in _layers) + { + if (l.CurrentView.Value != null) + { + highestLayerId = l.Id; + } + } + + _highestBusyLayer.Value = highestLayerId; + } public async IPromise OpenExact(string viewLayerId, string viewName, IPayload? payload = null) { @@ -89,10 +117,16 @@ public async IPromise Close(string viewLayerId) return UnknownViewName; } + /// + public IViewLayer GetLayer(string viewLayerId) + { + return _layers.First(x => x.Id == viewLayerId); + } + /// public IViewModel? GetView(string viewLayerId) { - return _layers.First(x => x.Id == viewLayerId).GetCurrentView(); + return _layers.First(x => x.Id == viewLayerId).CurrentView.Value; } public string[] GetLayerIds() @@ -119,7 +153,7 @@ public IViewModel Create(IViewModel parent, string viewName, Transform container for (int i = _layers.Length - 1; i >= 0; i--) { // close opened view - var openedViewModel = _layers[i].GetCurrentView(); + var openedViewModel = _layers[i].CurrentView.Value; string? openedViewName = null; if (openedViewModel!= null) openedViewName = _createdViewsNames[openedViewModel]; @@ -144,7 +178,6 @@ public IViewModel Create(IViewModel parent, string viewName, Transform container private IViewModel CreateViewOnLayer(string viewName, IViewLayer layer, IPayload? payload) { - var viewModel = _viewsContainer.ResolveViewFactory(viewName).Create(layer, null, layer.Container, payload); _createdViewsNames.Add(viewModel, viewName); viewModel.Destroyed += OnViewModelDestroyed;