init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "OSA.Utilities.Editor",
|
||||
"references": [
|
||||
"OSA.Utilities",
|
||||
"OSA.Core.Editor",
|
||||
"OSA.Core",
|
||||
"Unity.TextMeshPro"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c9a8d8d72a2f0347a44d827a409c24b
|
||||
timeCreated: 1638562467
|
||||
licenseType: Store
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e814b62aaab4b3468748de878b3f70c
|
||||
folderAsset: yes
|
||||
timeCreated: 1638562549
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 411436c3e0582f8479168d575002f598
|
||||
folderAsset: yes
|
||||
timeCreated: 1638562559
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor;
|
||||
using Com.ForbiddenByte.OSA.Core;
|
||||
using Com.ForbiddenByte.OSA.CustomAdapters.TableView;
|
||||
using Com.ForbiddenByte.OSA.CustomAdapters.TableView.Tuple;
|
||||
using Com.ForbiddenByte.OSA.CustomAdapters.TableView.Input;
|
||||
|
||||
namespace Com.ForbiddenByte.OSA.Editor.OSAWizard.CustomAdapterConfigurators
|
||||
{
|
||||
[CustomAdapterConfigurator(typeof(ITableAdapter))]
|
||||
public class TableAdapterConfigurator : ICustomAdapterConfigurator
|
||||
{
|
||||
public void ConfigureNewAdapter(IOSA adapter)
|
||||
{
|
||||
var tableAdapter = adapter as ITableAdapter;
|
||||
var p = tableAdapter.TableParameters;
|
||||
var transform = tableAdapter.AsMonoBehaviour.transform;
|
||||
p.Viewport = transform.Find("Viewport") as RectTransform;
|
||||
p.Content = p.Viewport.Find("Content") as RectTransform;
|
||||
|
||||
var pTable = p.Table;
|
||||
var prefabsParent = transform.Find("Prefabs-Hidden");
|
||||
var tuplePrefabsParent = prefabsParent.Find("Tuple") as RectTransform;
|
||||
var columnsTuplePrefabsParent = prefabsParent.Find("ColumnsTuple") as RectTransform;
|
||||
var paths = CWiz.TV.Paths;
|
||||
|
||||
// Some recommended spacing values
|
||||
p.ContentSpacing = 2;
|
||||
if (!p.IsHorizontal)
|
||||
p.ContentPadding.bottom = 320;
|
||||
pTable.ColumnsTupleSize = 60f;
|
||||
pTable.ColumnsTupleSpacing = 5f;
|
||||
|
||||
// Only children scroll on X axis
|
||||
p.ScrollSensivityOnXAxis = 0f;
|
||||
|
||||
// Scrollbar
|
||||
var sbTR = transform.Find("Scrollbar");
|
||||
if (sbTR)
|
||||
{
|
||||
p.Scrollbar = sbTR.GetComponent<Scrollbar>();
|
||||
OSAUtil.ConfigureDinamicallyCreatedScrollbar(p.Scrollbar, adapter, p.Viewport);
|
||||
}
|
||||
|
||||
// Columns Scrollbar
|
||||
var csbTR = transform.Find("ColumnsScrollbar");
|
||||
if (csbTR)
|
||||
pTable.ColumnsScrollbar = csbTR.GetComponent<Scrollbar>();
|
||||
|
||||
// Instantiate the tuple prefab & its value prefab
|
||||
pTable.TuplePrefab = InstantiateFromRes(paths.TUPLE_PREFAB, tuplePrefabsParent);
|
||||
var tupleAdapter = pTable.TuplePrefab.GetComponent(typeof(ITupleAdapter)) as ITupleAdapter;
|
||||
tupleAdapter.TupleParameters.ItemPrefab = InstantiateFromRes(paths.TUPLE_VALUE_PREFAB, tuplePrefabsParent);
|
||||
|
||||
// Allowing resizing of individual tuples manually, by default
|
||||
tupleAdapter.TupleParameters.ResizingMode = TableResizingMode.MANUAL_TUPLES;
|
||||
|
||||
// Instantiate the columns tuple prefab & its value prefab
|
||||
pTable.ColumnsTuplePrefab = InstantiateFromRes(paths.COLUMNS_TUPLE_PREFAB, columnsTuplePrefabsParent);
|
||||
var hTupleAdapter = pTable.ColumnsTuplePrefab.GetComponent(typeof(ITupleAdapter)) as ITupleAdapter;
|
||||
var hTupleValuePrefab = hTupleAdapter.TupleParameters.ItemPrefab = InstantiateFromRes(paths.COLUMNS_TUPLE_VALUE_PREFAB, columnsTuplePrefabsParent);
|
||||
DisableLayoutComponentsInTupleValuePrefab(hTupleValuePrefab);
|
||||
|
||||
// Assign the floating text input and dropdown
|
||||
pTable.FloatingDropdownPrefab = Resources.Load<GameObject>(paths.INPUT__FLOATING_DROPDOWN).transform as RectTransform;
|
||||
pTable.TextInputControllerPrefab = Resources.Load<GameObject>(paths.INPUT__FLOATING_TEXT).GetComponent<TableViewTextInputController>();
|
||||
|
||||
// Assign the options panel
|
||||
pTable.OptionsPanel = transform.Find("OptionsPanel") as RectTransform;
|
||||
|
||||
Debug.Log("TableView instantiated. Resize mode was set to "+ tupleAdapter.TupleParameters.ResizingMode +
|
||||
". If you don't plan to have individual rows resizeable, " +
|
||||
"go over the tuple & column prefabs and their associated value prefabs and remove " +
|
||||
"all Layout components, as they won't be needed. And set ResizeMode to NONE in inspector. " +
|
||||
"This will boost scrolling performance.",
|
||||
adapter.AsMonoBehaviour.gameObject
|
||||
);
|
||||
}
|
||||
|
||||
RectTransform InstantiateFromRes(string respath, RectTransform inParent)
|
||||
{
|
||||
var pref = Resources.Load<GameObject>(respath);
|
||||
var inst = (GameObject.Instantiate(pref, inParent, false) as GameObject).transform as RectTransform;
|
||||
inst.name = inst.name.Replace("(Clone)", "");
|
||||
Debug.Log("Instantiated \"" + respath + "\"", inst.gameObject);
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
// This is to avoid the notification from TupleParams where it finds enabled layout components while resize mode is not NONE
|
||||
void DisableLayoutComponentsInTupleValuePrefab(RectTransform tupleValuePrefab)
|
||||
{
|
||||
var layoutGroup = tupleValuePrefab.GetComponent<LayoutGroup>();
|
||||
if (layoutGroup && layoutGroup.enabled)
|
||||
layoutGroup.enabled = false;
|
||||
|
||||
foreach (RectTransform rt in tupleValuePrefab)
|
||||
{
|
||||
var l = rt.GetComponent<LayoutGroup>();
|
||||
if (l)
|
||||
l.enabled = false;
|
||||
|
||||
var le = rt.GetComponent<LayoutElement>();
|
||||
if (le)
|
||||
le.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1d3a9fa45cb06e4dbd62d36157d510c
|
||||
timeCreated: 1563725050
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1aae29646378114baa7970a6ba8c787
|
||||
folderAsset: yes
|
||||
timeCreated: 1553129474
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* * * * This bare-bones script was auto-generated * * * *
|
||||
* The code commented with "/ * * /" demonstrates how data is retrieved and passed to the adapter, plus other common commands. You can remove/replace it once you've got the idea
|
||||
* Complete it according to your specific use-case
|
||||
* Consult the Example scripts if you get stuck, as they provide solutions to most common scenarios
|
||||
*
|
||||
* Main terms to understand:
|
||||
* Model = class that contains the data associated with an item (title, content, icon etc.)
|
||||
* Views Holder = class that contains references to your views (Text, Image, MonoBehavior, etc.)
|
||||
*
|
||||
* Default expected UI hiererchy:
|
||||
* ...
|
||||
* -Canvas
|
||||
* ...
|
||||
* -MyScrollViewAdapter
|
||||
* -Viewport
|
||||
* -Content
|
||||
* -Scrollbar (Optional)
|
||||
* -ItemPrefab (Optional)
|
||||
*
|
||||
* Note: If using Visual Studio and opening generated scripts for the first time, sometimes Intellisense (autocompletion)
|
||||
* won't work. This is a well-known bug and the solution is here: https://developercommunity.visualstudio.com/content/problem/130597/unity-intellisense-not-working-after-creating-new-1.html (or google "unity intellisense not working new script")
|
||||
*
|
||||
*
|
||||
* Please read the manual under "/Docs", as it contains everything you need to know in order to get started, including FAQ
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using frame8.Logic.Misc.Other.Extensions;
|
||||
using Com.ForbiddenByte.OSA.Core;
|
||||
using Com.ForbiddenByte.OSA.CustomParams;
|
||||
using Com.ForbiddenByte.OSA.DataHelpers;
|
||||
using UnityEditor;
|
||||
using Com.ForbiddenByte.OSA.Util;
|
||||
|
||||
namespace Com.ForbiddenByte.OSA.Editor.Util
|
||||
{
|
||||
[CustomEditor(typeof(PackedGridLayoutGroup), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class PackedGridLayoutGroupEditor : UnityEditor.Editor
|
||||
{
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 524561dd74cbf004488b948188008072
|
||||
timeCreated: 1549173773
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user