Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Prepare for publishing to Package Manager #207

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
9283ede
Tmp store.
May 16, 2019
b49f06b
Merge branch 'yczhang' into packman
May 17, 2019
079fc57
Update documentation.
May 17, 2019
733f91a
Implement packman script.
May 17, 2019
786e6b6
Implement asset store script.
May 17, 2019
51f26d9
Merge branch 'yczhang' into asset_store
May 20, 2019
63655ce
Copy Resources for sample.
May 20, 2019
6bc50b8
Update Menu Organization: Move everything into Window/UIWidgets.
May 20, 2019
ea17a50
Merge branch 'yczhang' into packman
May 20, 2019
886b4cc
Update Documentation.
May 21, 2019
e034f28
Merge branch 'yczhang' into asset_store
May 21, 2019
1735cfb
Update script and Documentation.
May 21, 2019
b043c91
Merge branch 'master' into yczhang
May 21, 2019
9af2353
Merge branch 'yczhang' into packman
May 21, 2019
8e59c50
Merge branch 'yczhang' into asset_store
May 21, 2019
e3b38cf
Update packman script.
May 21, 2019
6c018d8
Align with master.
May 21, 2019
b83d325
Improve packman.
May 21, 2019
b041d71
Improve packman.
May 21, 2019
de33c16
Update Documentation to multi-file structure.
May 22, 2019
d6de8ee
Update packman script.
May 22, 2019
b9e5b34
Update packman to generate documentation automatically.
May 22, 2019
22878a1
Fix packman script: copy README-ZH.
May 22, 2019
9bfd832
Merge branch 'yczhang' into asset_store
May 22, 2019
0902a2b
Update document.
May 22, 2019
131edec
Update packman script.
May 22, 2019
792a80a
Modify Images.
May 22, 2019
075a3da
Remove video.
May 23, 2019
31f031f
Fix error on 2019.2+.
May 24, 2019
156986c
Update packman alignment version.
May 24, 2019
926f37a
Merge branch 'asset_store' into yczhang
May 24, 2019
044a981
Merge branch 'master' into yczhang
Jun 4, 2019
d46cea0
Merge branch 'master' into yczhang
Jun 10, 2019
27b1c41
Merge branch 'master' into yczhang
Aug 22, 2019
47c8f52
Merge branch 'master' into yczhang
Aug 27, 2019
ba2314c
Change version to upload to packman.
Aug 27, 2019
11613e1
Merge branch 'master' of https://github.com/UnityTech/UIWidgets into …
Aug 28, 2019
726689e
Update packman uiwidgets target version.
Aug 28, 2019
548ed4c
Update the packman script, add the procedures to execute manually
Aug 28, 2019
4d1673a
Remove references to ugui.
Aug 28, 2019
4ba3ed3
Correct menus.
Aug 28, 2019
6151840
Update README.
Aug 28, 2019
c06d04f
Merge branch 'master' into yczhang
Oct 21, 2019
80d972e
Update uiwidgets version.
Oct 21, 2019
50275e3
Merge branch 'master' into yczhang
Oct 24, 2019
e0a2bec
Update version.
Oct 24, 2019
c8a2c6d
Merge branch 'master' into yczhang
Nov 8, 2019
7a22186
Update uiwidgets version.
Nov 11, 2019
85cef92
Merge branch 'master' into yczhang
Nov 13, 2019
e3ce7d7
Update UIWidgets version.
Nov 14, 2019
a71f5c2
Merge branch 'master' into yczhang
Nov 15, 2019
616b05c
Update uiwidgets version.
Nov 18, 2019
ea7d7cb
Merge branch 'master' of https://github.com/UnityTech/UIWidgets into …
Nov 18, 2019
3535924
Remove samples.
Nov 18, 2019
792b17e
Remove Tests/Resources.
Nov 18, 2019
a91e164
Remove Tests.
Nov 18, 2019
370b92e
Fix README.
Nov 18, 2019
c1a19fb
Merge branch 'master' into yczhang
Nov 19, 2019
f0c8495
Update UIWidgets version.
Nov 21, 2019
5160995
Merge branch 'master' into yczhang
Nov 25, 2019
152f2f7
Update packman scripts.
Nov 25, 2019
235f488
Update UIWidgets Version.
Nov 25, 2019
795ced5
Automatic resource importer.
Nov 26, 2019
3cf8e85
Update Unity Version.
Nov 29, 2019
988f051
Merge branch 'master' of https://github.com/UnityTech/UIWidgets into …
Nov 29, 2019
4fc5ee1
[Feature] Panel Raycast Filter
IIzzaya Nov 7, 2019
1334379
[Fix] Wrong Spelling Name
IIzzaya Nov 7, 2019
d1ebb51
[Raycast] Update
IIzzaya Nov 8, 2019
dd78120
[Raycast] Add UIWidgetsRaycastablePanel
IIzzaya Nov 9, 2019
368dc8f
[Raycast] Remove Debug.Log
IIzzaya Nov 9, 2019
e5b9bd5
[Raycast] Move Files' Location
IIzzaya Nov 30, 2019
abd4336
Update UIWidgets version.
Dec 6, 2019
d8b1506
Merge pull request #366 from IIzzaya/dev_raycast
zhuxingwei Dec 17, 2019
2b4c7ad
Add !UNITY_EDITOR for WebGLInput
Jan 2, 2020
844bac8
Merge branch 'fix_webgl' into yczhang
Jan 2, 2020
bcc17f2
Merge branch 'master' of github.com:UnityTech/UIWidgets into fix_tabl…
zhuxingwei Jan 2, 2020
0158191
fix potential dead loop
zhuxingwei Jan 2, 2020
a4dd4aa
Merge pull request #401 from UnityTech/fix_table_deadloop
Jan 2, 2020
e3c8bcc
Update UIWidgets version.
Jan 2, 2020
b2bdac4
Merge branch 'dev' into yczhang
Jan 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ EmojiUtils.configuration = new EmojiResourceConfiguration(

我们提供了一个包装好的`UnityObjectDetector`组件以及`onRelease`回调函数,借此您可以实现简单地将物体(例如Hierarchy内的场景物体、Project窗口下的文件等)拖拽至区域内,来获得`UnityEngine.Object[] `类型的引用并进行操作。


## 调试UIWidgets应用程序

#### 定义UIWidgets_DEBUG
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ EmojiUtils.configuration = new EmojiResourceConfiguration(

With the provided packaged stateful widget `UnityObjectDetector` and its `onRelease` callback function, you can easily drag some objects (for example GameObject from Hierarchy, files from Project Window, etc) into the area, get the UnityEngine.Object[] references and make further modification.


## Debug UIWidgets Application

#### Define UIWidgets_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion Runtime/debugger/inspector_window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class WidgetsInpsectorWindow : EditorWindow {

List<Action> m_UpdateActions = new List<Action>();

[MenuItem("Window/Analysis/UIWidgets Inspector")]
[MenuItem("Window/UIWidgets/Inspector")]
public static void Init() {
WidgetsInpsectorWindow window =
(WidgetsInpsectorWindow) GetWindow(typeof(WidgetsInpsectorWindow));
Expand Down
139 changes: 139 additions & 0 deletions Runtime/editor/UIWidgetsResourcesImporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#if UNITY_EDITOR
using UnityEngine.Serialization;
using System.IO;
using UnityEngine;
using UnityEditor;

namespace Unity.UIWidgets.editor
{
[System.Serializable]
public class UIWidgetsResourcesImporter
{
bool m_UIWidgetsResourcesImported;

public void OnDestroy()
{
}

public void OnGUI()
{
string packageFullPath = GetPackageFullPath();
m_UIWidgetsResourcesImported = Directory.Exists("Assets/UIWidgetsResources") ||
Directory.Exists(packageFullPath + "/Runtime/Resources/fonts");
// Display options to import Essential resources
GUILayout.BeginVertical(EditorStyles.helpBox);
{
GUILayout.Label("UIWidgets Resources", EditorStyles.boldLabel);
GUILayout.Label("We need to add resources to your project that are essential for using UIWidgets. " +
"These new resources will be placed at the root of your project in the \"UIWidgetsResources\" folder.",
new GUIStyle(EditorStyles.label) { wordWrap = true } );
GUILayout.Space(5f);

GUI.enabled = !m_UIWidgetsResourcesImported;
if (GUILayout.Button("Import UIWidgets Resources"))
{
AssetDatabase.importPackageCompleted += ImportCallback;

AssetDatabase.ImportPackage(packageFullPath + "/Package Resources/UIWidgetsResources.unitypackage", false);
}
GUILayout.Space(5f);
GUI.enabled = true;
}
GUILayout.EndVertical();
GUILayout.Space(5f);
}

internal void RegisterResourceImportCallback()
{
AssetDatabase.importPackageCompleted += ImportCallback;
}

void ImportCallback(string packageName)
{
if (packageName == "UIWidgetsResources")
{
m_UIWidgetsResourcesImported = true;

#if UNITY_2018_3_OR_NEWER
SettingsService.NotifySettingsProviderChanged();
#endif
}

Debug.Log("[" + packageName + "] have been imported.");

AssetDatabase.importPackageCompleted -= ImportCallback;
}

static string GetPackageFullPath()
{
string packagePath = Path.GetFullPath("Packages/com.unity.uiwidgets");
if (Directory.Exists(packagePath))
{
return packagePath;
}

packagePath = Path.GetFullPath("Packages/UIWidgets");
if (Directory.Exists(packagePath))
{
return packagePath;
}

packagePath = Path.GetFullPath("Assets/UIWidgets");
if (Directory.Exists(packagePath))
{
return packagePath;
}

return null;
}
}

public class UIWidgetsResourcesImporterWindow : EditorWindow
{
[FormerlySerializedAs("m_ResourceImporter")] [SerializeField]
UIWidgetsResourcesImporter resourcesImporter;

public static void ShowResourcesImporterWindow()
{
var window = GetWindow<UIWidgetsResourcesImporterWindow>();
window.titleContent = new GUIContent("UIWidgets Resources Importer");
window.Focus();
}

void OnEnable()
{
SetEditorWindowSize();

if (resourcesImporter == null)
resourcesImporter = new UIWidgetsResourcesImporter();
resourcesImporter.RegisterResourceImportCallback();
}

void OnDestroy()
{
resourcesImporter.OnDestroy();
}

void OnGUI()
{
resourcesImporter.OnGUI();
}

void OnInspectorUpdate()
{
Repaint();
}

void SetEditorWindowSize()
{
EditorWindow editorWindow = this;

Vector2 windowSize = new Vector2(640, 110);
editorWindow.minSize = windowSize;
editorWindow.maxSize = windowSize;
}
}

}

#endif
11 changes: 11 additions & 0 deletions Runtime/editor/UIWidgetsResourcesImporter.cs.meta

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

12 changes: 8 additions & 4 deletions Runtime/engine/UIWidgetsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ void _handleViewMetricsChanged(string method, List<JSONNode> args) {
this._displayMetrics.onViewMetricsChanged();
}

protected virtual void InitWindowAdapter() {
D.assert(this._windowAdapter == null);
this._windowAdapter = new UIWidgetWindowAdapter(this);

this._windowAdapter.OnEnable();
}

protected override void OnEnable() {
base.OnEnable();

Expand All @@ -153,10 +160,7 @@ protected override void OnEnable() {
_repaintEvent = new Event {type = EventType.Repaint};
}

D.assert(this._windowAdapter == null);
this._windowAdapter = new UIWidgetWindowAdapter(this);

this._windowAdapter.OnEnable();
this.InitWindowAdapter();

Widget root;
using (this._windowAdapter.getScope()) {
Expand Down
8 changes: 8 additions & 0 deletions Runtime/engine/raycastable.meta

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

125 changes: 125 additions & 0 deletions Runtime/engine/raycastable/RaycastManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

namespace Unity.UIWidgets.engine.raycast {
public class RaycastableRect {
bool _isDirty = true;

public bool isDirty {
get { return this._isDirty; }
}

public float left;
public float right;
public float top;
public float bottom;

public void MarkDirty() {
this._isDirty = true;
}

public void UnmarkDirty() {
this._isDirty = false;
}

public void UpdateRect(float left, float top, float width, float height) {
this.left = left;
this.right = left + width;
this.top = top;
this.bottom = top + height;
}

public bool CheckInRect(Vector2 pos) {
return pos.x >= this.left &&
pos.x < this.right &&
pos.y >= this.top &&
pos.y < this.bottom;
}
}

public class RaycastManager {
static RaycastManager _instance;

public static RaycastManager instance {
get {
if (_instance == null) {
_instance = new RaycastManager();
}

return _instance;
}
}

public readonly Dictionary<int, Dictionary<int, RaycastableRect>> raycastHandlerMap =
new Dictionary<int, Dictionary<int, RaycastableRect>>();

public static void NewWindow(int windowHashCode) {
if (!instance.raycastHandlerMap.ContainsKey(windowHashCode)) {
instance.raycastHandlerMap.Add(windowHashCode, new Dictionary<int, RaycastableRect>());
}
}

public static void DisposeWindow(int windowHashCode) {
if (instance.raycastHandlerMap.ContainsKey(windowHashCode)) {
instance.raycastHandlerMap.Remove(windowHashCode);
}
}

public static void AddToList(int widgetHashCode, int windowHashCode) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}, " +
$"Make sure using UIWidgetsRaycastablePanel instead of UIWidgetsPanel " +
$"while using RaycastableContainer.");
D.assert(!instance.raycastHandlerMap[windowHashCode].ContainsKey(widgetHashCode), () =>
$"Raycast Handler Map already contains Widget {widgetHashCode} at Window {windowHashCode}");

instance.raycastHandlerMap[windowHashCode][widgetHashCode] = new RaycastableRect();
}

public static void MarkDirty(int widgetHashCode, int windowHashCode) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}");
D.assert(instance.raycastHandlerMap[windowHashCode].ContainsKey(widgetHashCode), () =>
$"Raycast Handler Map doesn't contain Widget {widgetHashCode} at Window {windowHashCode}");

instance.raycastHandlerMap[windowHashCode][widgetHashCode].MarkDirty();
}

public static void UpdateSizeOffset(int widgetHashCode, int windowHashCode, Size size, Offset offset) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}");
D.assert(instance.raycastHandlerMap[windowHashCode].ContainsKey(widgetHashCode), () =>
$"Raycast Handler Map doesn't contain Widget {widgetHashCode} at Window {windowHashCode}");

if (instance.raycastHandlerMap[windowHashCode][widgetHashCode].isDirty) {
instance.raycastHandlerMap[windowHashCode][widgetHashCode]
.UpdateRect(offset.dx, offset.dy, size.width, size.height);
instance.raycastHandlerMap[windowHashCode][widgetHashCode].UnmarkDirty();
}
}

public static void RemoveFromList(int widgetHashCode, int windowHashCode) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}");
D.assert(instance.raycastHandlerMap[windowHashCode].ContainsKey(widgetHashCode), () =>
$"Raycast Handler Map doesn't contain Widget {widgetHashCode} at Window {windowHashCode}");

instance.raycastHandlerMap[windowHashCode].Remove(widgetHashCode);
}

public static bool CheckCastThrough(int windowHashCode, Vector2 pos) {
D.assert(instance.raycastHandlerMap.ContainsKey(windowHashCode), () =>
$"Raycast Handler Map doesn't contain Window {windowHashCode}");

foreach (var item in instance.raycastHandlerMap[windowHashCode]) {
if (item.Value.CheckInRect(pos)) {
return false;
}
}

return true;
}
}
}
11 changes: 11 additions & 0 deletions Runtime/engine/raycastable/RaycastManager.cs.meta

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

Loading