Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UFrameIT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FrameIT
UFrameIT
Commits
2cd9b285
Verified
Commit
2cd9b285
authored
9 months ago
by
Björn Eßwein
Browse files
Options
Downloads
Patches
Plain Diff
visualize when a hint is availible
parent
807e5819
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/UI/InGame/WebViewController.cs
+18
-1
18 additions, 1 deletion
Assets/Scripts/UI/InGame/WebViewController.cs
Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html
+15
-1
15 additions, 1 deletion
...eamingAssets/StreamToDataPath_withHandler/scrollView.html
with
33 additions
and
2 deletions
Assets/Scripts/UI/InGame/WebViewController.cs
+
18
−
1
View file @
2cd9b285
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
using
System.Linq
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.Events
;
public
class
WebViewController
:
ScrollView
public
class
WebViewController
:
ScrollView
{
{
...
@@ -34,6 +33,7 @@ private void OnWebViewComponentReady()
...
@@ -34,6 +33,7 @@ private void OnWebViewComponentReady()
webViewComponent
.
onDomDocumentUpdated
+=
DocumentUpdatedHandler
;
webViewComponent
.
onDomDocumentUpdated
+=
DocumentUpdatedHandler
;
SwitchScrollUI
.
activeScrollData
.
OnScrollChanged
.
AddListener
(
SetScrollContent
);
SwitchScrollUI
.
activeScrollData
.
OnScrollChanged
.
AddListener
(
SetScrollContent
);
SwitchScrollUI
.
activeScrollData
.
OnScrollDynamicInfoUpdated
.
AddListener
(
SetScrollContent
);
SwitchScrollUI
.
activeScrollData
.
OnScrollDynamicInfoUpdated
.
AddListener
(
SetScrollContent
);
SwitchScrollUI
.
activeScrollData
.
HintAvailableEvent
.
AddListener
(
OnHintAvailable
);
webViewComponent
.
tab
.
AddJSBinding
(
"applyScroll"
,
ApplyScrollHandler
);
webViewComponent
.
tab
.
AddJSBinding
(
"applyScroll"
,
ApplyScrollHandler
);
webViewComponent
.
tab
.
AddJSBinding
(
"getHint"
,
GetHintHandler
);
webViewComponent
.
tab
.
AddJSBinding
(
"getHint"
,
GetHintHandler
);
if
(
SwitchScrollUI
.
activeScrollData
.
Scroll
is
not
null
)
if
(
SwitchScrollUI
.
activeScrollData
.
Scroll
is
not
null
)
...
@@ -122,6 +122,7 @@ private async void SetScrollContent(Scroll scroll)
...
@@ -122,6 +122,7 @@ private async void SetScrollContent(Scroll scroll)
description
=
$"<scroll-description><p>
{
scroll
.
description
}
</p><div id='lagacySlots'>
{
String
.
Join
(
""
,
factSlots
)}
</div></scroll-description>"
;
description
=
$"<scroll-description><p>
{
scroll
.
description
}
</p><div id='lagacySlots'>
{
String
.
Join
(
""
,
factSlots
)}
</div></scroll-description>"
;
}
}
// display the scroll description
// display the scroll description
dropzones
=
null
;
await
scrollContainer
.
setOuterHtmlAsync
(
$"<div id='scrollContainer'>
{
description
}
</div>"
);
await
scrollContainer
.
setOuterHtmlAsync
(
$"<div id='scrollContainer'>
{
description
}
</div>"
);
RegisterBrowserEventhandlers
();
RegisterBrowserEventhandlers
();
...
@@ -163,6 +164,22 @@ private async void DropzoneAttributeModifiedHandler(attributeModifiedEvent attri
...
@@ -163,6 +164,22 @@ private async void DropzoneAttributeModifiedHandler(attributeModifiedEvent attri
}
}
}
}
private
async
void
OnHintAvailable
(
IReadOnlyList
<
string
>
url
)
{
dropzones
=
await
(
await
webViewComponent
.
tab
.
Document
).
querySelectorAllAsync
(
"[dropzone='copy']"
);
foreach
(
var
dropzone
in
dropzones
)
{
if
(
url
.
Contains
(
dropzone
.
Node
.
attributes
[
"data-slot-id"
]))
{
_
=
dropzone
.
setAttributeValue
(
"data-hint-available"
,
"true"
);
}
else
if
(
dropzone
.
Node
.
attributes
.
ContainsKey
(
"data-hint-available"
))
{
_
=
dropzone
.
removeAttributeAsync
(
"data-hint-available"
);
}
}
}
private
void
ApplyScrollHandler
(
string
button
)
private
void
ApplyScrollHandler
(
string
button
)
{
{
SwitchScrollUI
.
activeScrollData
.
ButtonClicked
(
new
MagicScrollButton
());
SwitchScrollUI
.
activeScrollData
.
ButtonClicked
(
new
MagicScrollButton
());
...
...
This diff is collapsed.
Click to expand it.
Assets/StreamingAssets/StreamToDataPath_withHandler/scrollView.html
+
15
−
1
View file @
2cd9b285
...
@@ -6,6 +6,20 @@
...
@@ -6,6 +6,20 @@
<style>
<style>
[
dropzone
]
{
[
dropzone
]
{
background-color
:
grey
;
background-color
:
grey
;
margin
:
1px
;
border-width
:
1px
;
border-style
:
dashed
;
}
[
data-fact-id
]
{
background-color
:
lightgray
;
}
[
data-hint-available
]
{
background-color
:
yellow
}
math
{
display
:
inline-flex
;
align-items
:
center
;
flex-wrap
:
wrap
;
}
}
.lagacySlot
{
.lagacySlot
{
width
:
100px
;
width
:
100px
;
...
@@ -66,7 +80,7 @@
...
@@ -66,7 +80,7 @@
</math>
</math>
</div>
</div>
<button
type=
"button"
title=
"Apply the scroll"
onclick=
"applyScroll('')"
>
Magic
</button><br>
<button
type=
"button"
title=
"Apply the scroll"
onclick=
"applyScroll('')"
>
Magic
</button><br>
<p>
R
ight click on
a
slot to get a hint.
</p>
<p>
You can r
ight click on
yellow
slot
s
to get a hint.
</p>
</body>
</body>
<script>
<script>
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment