Skip to content

Commit

Permalink
Merge pull request #33 from UnioGame/feature/ui-toolkit-support
Browse files Browse the repository at this point in the history
Feature/UI toolkit support
  • Loading branch information
Mefodei authored Mar 17, 2023
2 parents e1b598e + 13560cc commit 65ca1dc
Show file tree
Hide file tree
Showing 166 changed files with 3,605 additions and 662 deletions.
2 changes: 1 addition & 1 deletion Assets/Settings/ViewSystemSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MonoBehaviour:
addressableGroupName:
sources: []
layoutFlow: {fileID: 11400000, guid: c22cfe04dc8dc9e43b8b9b36576fab63, type: 2}
viewModelResolvers:
viewModelResolver:
modelFactoryTimeoutMs: 500
modelResolvers: []
references:
Expand Down
24 changes: 24 additions & 0 deletions Editor/Assets/View Model Resolver.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 704e8248ced7d3f4da0354ef06dd8e1d, type: 3}
m_Name: View Model Resolver
m_EditorClassIdentifier:
modelProviders:
- value:
rid: 6782068358873612332
assetValue: {fileID: 0}
references:
version: 2
RefIds:
- rid: 6782068358873612332
type: {class: DefaultConstructorViewModelFactory, ns: UniGame.ViewSystem.Runtime,
asm: unigame.viewsystem.runtime}
8 changes: 8 additions & 0 deletions Editor/Assets/View Model Resolver.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Editor/Assets/ViewSystemEditorSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ MonoBehaviour:
m_Name: ViewSystemEditorSettings
m_EditorClassIdentifier:
prototypeFolder: {fileID: 102900000, guid: 3c8989b1f4edac6479cba3f1ca6742f2, type: 3}
viewSystemSettingsAsset: {fileID: 11400000, guid: 34e95cd46455c054faf02eb8a96b0270, type: 2}
viewPrefab: {fileID: 7387079578667170277, guid: cbb186b66f51e0844a835be6e43d55e6, type: 3}
viewSystemSettingsAsset: {fileID: 11400000, guid: 34e95cd46455c054faf02eb8a96b0270,
type: 2}
viewPrefab: {fileID: 7387079578667170277, guid: cbb186b66f51e0844a835be6e43d55e6,
type: 3}
viewModelFactory: {fileID: 11400000, guid: 20f709556179e1d429e0cb352e944f70, type: 2}
defaultFlowAsset: {fileID: 11400000, guid: c22cfe04dc8dc9e43b8b9b36576fab63, type: 2}
defaultLayoutType: {fileID: 11400000, guid: 3b063ea60dca1d6449cc6838450bbf68, type: 2}
6 changes: 3 additions & 3 deletions Editor/Tests/ViewSelectionTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace Taktika.Tests.UnitTests.Editor.ViewSystem
namespace UniGame.Tests.UnitTests.Editor.ViewSystem
{
using System.Collections.Generic;
using UniGame.UiSystem.Runtime.Settings;
using NUnit.Framework;
using UniGame.UiSystem.Runtime;
using UniModules.UniGame.Core.Runtime.SerializableType;
using UniModules.UniGame.ViewSystem.Runtime.ContextFlow;
using UniGame.Core.Runtime.SerializableType;
using UniGame.ViewSystem.Runtime;
using UnityEngine.AddressableAssets;

public class ViewSelectionTests
Expand Down
12 changes: 5 additions & 7 deletions Editor/ViewEditor/BuildViewSettingsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using UniGame.UiSystem.Runtime.Settings;
using UniModules.Editor;
using UniModules.UniGame.AddressableExtensions.Editor;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using UniGame.ViewSystem.Runtime;
using UnityEditor;
using UnityEngine;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
public class BuildViewSettingsData : IViewAssemblerCommand
{
Expand Down Expand Up @@ -82,12 +82,10 @@ public UiViewReference CreateViewReference(IView view, bool defaultView,bool ove
}

var viewType = view.GetType();
var viewInterface = viewType.GetInterfaces()
.FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == ViewSystemConstants.BaseViewType);

var modelsArgs = viewInterface.GetGenericArguments();
var modelType = modelsArgs.FirstOrDefault();
var viewModelType = ViewModelsAssemblyMap.GetFirstAssignable(modelType);
var modelType = ViewSystemUtils.GetModelTypeByView(viewType);

var viewModelType = ViewSystemUtils.GetFirstAssignable(modelType);

var viewDescription = new UiViewReference()
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/ViewEditor/IViewAssemblerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UniGame.UiSystem.Runtime.Settings;
using UniModules.UniGame.Core.Runtime.Interfaces;
using UniGame.Core.Runtime;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
public interface IViewAssemblerCommand : ICommand<ViewsSettings, bool>, IResetable
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/ViewEditor/UiViewsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEditor;
using UnityEngine;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
#if !ODIN_INSPECTOR
[CustomEditor(typeof(ViewsSettings),editorForChildClasses:true)]
Expand Down
2 changes: 1 addition & 1 deletion Editor/ViewEditor/ValidateSettingsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UniGame.UiSystem.Runtime.Settings;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
public class ValidateSettingsCommand : IViewAssemblerCommand
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/ViewEditor/ViewAssembler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UniModules.UniCore.Runtime.DataFlow;
using UniModules.UniGame.Core.Runtime.DataFlow.Interfaces;
using UniModules.UniGame.ViewSystem.Editor.UiEditor;
using UniGame.Core.Runtime;
using UniModules.UniGame.ViewSystem;
using UniRx;

namespace UniGame.UiSystem.UI.Editor.UiEdito
Expand Down
2 changes: 1 addition & 1 deletion Editor/ViewEditor/ViewCleanerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UniGame.UiSystem.Runtime.Settings;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
public class ViewCleanerCommand :IViewAssemblerCommand
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/ViewEditor/ViewContextMapSettingsEditor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
using UniModules.UniGame.ViewSystem.Runtime.ContextFlow;
using global::UniGame.ViewSystem.Runtime;
using UnityEditor;
using UnityEngine;

Expand Down
13 changes: 7 additions & 6 deletions Editor/ViewEditor/ViewSystemEditorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
using UniGame.UiSystem.Runtime.ViewsFlow;
using UniModules.Editor;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
using System;
using System.Collections.Generic;
using global::UniGame.ViewSystem.Runtime;
using UniModules.Editor;
using UniModules.UniGame.Core.Runtime.Attributes;
using UniModules.UniGame.UISystem.Runtime.WindowStackControllers.Abstract;
Expand All @@ -18,13 +19,14 @@ namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
[CreateAssetMenu(menuName = "UniGame/ViewSystem/Editor/Editor Template ViewSystemSettings",fileName = nameof(ViewSystemEditorSettings))]
public class ViewSystemEditorSettings : ScriptableObject
{

public Object prototypeFolder;

public ViewSystemSettings viewSystemSettingsAsset;

public GameObject viewPrefab;

public ViewModelResolverSettings viewModelResolver;

#if ODIN_INSPECTOR
[Sirenix.OdinInspector.ValueDropdown(nameof(GetFlowTypes))]
#endif
Expand Down Expand Up @@ -63,11 +65,10 @@ public static ViewSystemEditorSettings ViewEditorSettings
public static void CreateViewSystemPrefab()
{
var activeObject = Selection.activeObject;
if (!activeObject)
return;
if (!activeObject) return;

var path = AssetDatabase.GetAssetPath(activeObject);
path.GetDirectoryPath();
path = path.GetDirectoryPath();

Debug.Log($"ASSET PATH SELECTION : {path}");

Expand All @@ -78,7 +79,7 @@ public static void CreateViewAssets(string path)
{
var viewSystemPrefab = ViewEditorSettings.viewPrefab;
var settings = ViewEditorSettings.viewSystemSettingsAsset;

var view = viewSystemPrefab.CopyAsset<GameViewSystemAsset>(viewSystemPrefab.name,path);
var settingsAsset = settings.CopyAsset<ViewSystemSettings>(settings.name, path);

Expand Down
6 changes: 3 additions & 3 deletions Editor/ViewEditor/ViewsAssemblyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
using UniGame.UiSystem.Runtime.Settings;
using UniModules.Editor;

namespace UniModules.UniGame.ViewSystem.Editor.UiEditor
namespace UniModules.UniGame.ViewSystem
{
using System;
using System.Collections.Generic;
using global::UniGame.ViewSystem.Editor.EditorAssets;
using UniModules.Editor;
using Runtime.ContextFlow;
using global::UniGame.ViewSystem.Runtime;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;

public class ViewsAssemblyBuilder
{
private List<ViewModelResolverSettings> contextViewsMapSettings = new List<ViewModelResolverSettings>();
private List<ViewModelResolver> contextViewsMapSettings = new List<ViewModelResolver>();
private AddressableAssetSettings addressableAssetSettings;
private List<Action> rebuildCommands;
private List<IViewAssemblerCommand> rebuildSettingsCommands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "unigame.uisystem.editor",
"name": "unigame.viewsystem.editor",
"rootNamespace": "",
"references": [
"GUID:5c6e9aa738dad73448283eae914b6a8c",
"GUID:4ebedaede1566e6468edf5f6a097b593",
"GUID:6632c725b5599b14c865359e6ecc36f4",
"GUID:8e4577c9194c10845984cf27eb974fd1",
"GUID:2796129a6c23eb84a8181f62bf7332f1",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ModelViews/Editor/ModelViewsEditorCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using UniGame.UiSystem.Runtime;
using UniModules.UniCore.Runtime.ReflectionUtils;
using UniModules.Editor;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using UniModules.UniGame.ViewSystem.Editor.UiEditor;
using UniGame.ViewSystem.Runtime;
using UniModules.UniGame.ViewSystem;
using UnityEditor;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace UniGame.UiSystem.ModelViews.Editor.PostProcessors
using UniModules.UniCore.Runtime.ReflectionUtils;
using UniModules.UniCore.Runtime.Utils;
using UniModules.Editor;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using ViewSystem.Runtime;
using UnityEditor;

public class UpdateModelViewsSettingsProcessor : AssetModificationProcessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "unigame.uisystem.modelsviewsmodule.runtime",
"rootNamespace": "",
"references": [
"GUID:ab7c9c40a6be6334eb67c4e332935e6a",
"GUID:9f8e6b2872ac2ca4683e584b9ba21f29",
"GUID:0a6c1794e4ebd1a43b1a79f2d16f1cec",
"GUID:6632c725b5599b14c865359e6ecc36f4",
"GUID:8e4577c9194c10845984cf27eb974fd1",
"GUID:2796129a6c23eb84a8181f62bf7332f1",
"GUID:2bd4bfcbafd5d854bb5049e1ec96cd04"
"GUID:2bd4bfcbafd5d854bb5049e1ec96cd04",
"GUID:7aa076d38fb14aa448159faea36ca289"
],
"includePlatforms": [
"Editor"
Expand Down
2 changes: 1 addition & 1 deletion ModelViews/Runtime/Abstract/IModelViewsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
using System;
using System.Collections.Generic;
using UniModules.UniGame.Core.Runtime.SerializableType;
using Core.Runtime.SerializableType;

public interface IModelViewsSettings
{
Expand Down
4 changes: 2 additions & 2 deletions ModelViews/Runtime/Abstract/IViewHandle.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace UniGame.UiSystem.ModelViews.Runtime.Flow
{
using System;
using UniModules.UniGame.Core.Runtime.Interfaces;
using Core.Runtime;
using UniModules.UniGame.UISystem.Runtime;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using ViewSystem.Runtime;
using UniRx;

public interface IViewHandle :
Expand Down
6 changes: 2 additions & 4 deletions ModelViews/Runtime/Flow/FlowCommands.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using UnityEngine;

namespace UniGame.UiSystem.ModelViews.Runtime.Flow
namespace UniGame.UiSystem.ModelViews.Runtime.Flow
{
using System;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using ViewSystem.Runtime;


public static class FlowCommands
Expand Down
5 changes: 2 additions & 3 deletions ModelViews/Runtime/Flow/ModelsViewsFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
using System.Linq;
using Cysharp.Threading.Tasks;
using ModelViewsMap.Runtime.Settings;
using UiSystem.Runtime;
using UniModules.UniCore.Runtime.ObjectPool.Runtime.Extensions;
using UniGame.Runtime.ObjectPool.Extensions;
using UniModules.UniGame.UiSystem.Runtime;
using UniModules.UniGame.UISystem.Runtime;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using ViewSystem.Runtime;
using UniRx;


Expand Down
7 changes: 2 additions & 5 deletions ModelViews/Runtime/ModelViewsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using UnityEngine;

namespace UniGame.ModelViewsMap.Runtime
namespace UniGame.ModelViewsMap.Runtime
{
using UiSystem.Runtime;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using ViewSystem.Runtime;

public class ModelViewsSystem
{
Expand Down
2 changes: 0 additions & 2 deletions ModelViews/Runtime/RxExtensions/RxViewHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
{
using System;
using Flow;
using UniModules.UniGame.UiSystem.Runtime;
using UniModules.UniGame.UISystem.Runtime;
using UniRx;

public static class RxViewHandle
{
Expand Down
19 changes: 9 additions & 10 deletions ModelViews/Runtime/Settings/ModelViewsModuleSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UniModules.UniGame.AddressableTools.Runtime.Extensions;
using UniGame.AddressableTools.Runtime;
using UniGame.Context.Runtime;
using UnityEngine;

namespace UniGame.ModelViewsMap.Runtime.Settings
Expand All @@ -7,19 +8,17 @@ namespace UniGame.ModelViewsMap.Runtime.Settings
using System.Collections.Generic;
using System.Linq;
using Cysharp.Threading.Tasks;
using Taktika.GameRuntime.Types;
using GameRuntime.Types;
using UiSystem.ModelViews.Runtime.Flow;
using UiSystem.Runtime;
using UniModules.UniCore.Runtime.Attributes;
using UniModules.UniGame.Core.Runtime.SerializableType;
using UniModules.UniGame.Context.Runtime.Abstract;
using UniModules.UniGame.Core.Runtime.Interfaces;
using UniModules.UniGame.UISystem.Runtime.Abstract;
using UniModules.UniGame.UISystem.Runtime.DataSources;
using UniCore.Runtime.Attributes;
using Core.Runtime.SerializableType;
using Core.Runtime;
using ViewSystem.Runtime;
using ViewSystem.Runtime.DataSources;


[CreateAssetMenu(menuName = "UniGame/ViewSystem/ModelViewsModuleSettings", fileName = "ModelViewsModuleSettings")]
public class ModelViewsModuleSettings : AsyncContextDataSource, IModelViewsSettings
public class ModelViewsModuleSettings : AsyncSource, IModelViewsSettings
{
private static List<SType> _emptyList = new List<SType>();

Expand Down
4 changes: 1 addition & 3 deletions ModelViews/Runtime/Sources/ViewModelSystemSource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;

public class ViewModelSystemSource : MonoBehaviour
{
Expand Down
Loading

0 comments on commit 65ca1dc

Please sign in to comment.