Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
tetra-tower
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Oenos
tetra-tower
Commits
89782746
Commit
89782746
authored
Feb 22, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
애드온에 손올리면 정보뜸
parent
667ec91f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
992 additions
and
370 deletions
+992
-370
AddonInfo.prefab
Assets/Prefabs/UI/In-Game UI/InventoryUI/AddonInfo.prefab
+539
-0
AddonInfo.prefab.meta
...s/Prefabs/UI/In-Game UI/InventoryUI/AddonInfo.prefab.meta
+8
-0
InventoryCanvas.prefab
.../Prefabs/UI/In-Game UI/InventoryUI/InventoryCanvas.prefab
+371
-369
AddonDrag.cs
Assets/Scripts/Item/AddonDrag.cs
+37
-1
InventoryUI.cs
Assets/Scripts/Item/InventoryUI.cs
+37
-0
No files found.
Assets/Prefabs/UI/In-Game UI/InventoryUI/AddonInfo.prefab
0 → 100644
View file @
89782746
This diff is collapsed.
Click to expand it.
Assets/Prefabs/UI/In-Game UI/InventoryUI/AddonInfo.prefab.meta
0 → 100644
View file @
89782746
fileFormatVersion: 2
guid: b14e5a385d9465448931ccf15d2518e9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/UI/In-Game UI/InventoryUI/InventoryCanvas.prefab
View file @
89782746
This diff is collapsed.
Click to expand it.
Assets/Scripts/Item/AddonDrag.cs
View file @
89782746
...
...
@@ -3,14 +3,17 @@ using System.Collections.Generic;
using
UnityEngine
;
using
UnityEngine.EventSystems
;
public
class
AddonDrag
:
MonoBehaviour
,
IBeginDragHandler
,
IDragHandler
,
IEndDragHandler
,
IPointerClickHandler
public
class
AddonDrag
:
MonoBehaviour
,
IBeginDragHandler
,
IDragHandler
,
IEndDragHandler
,
IPointerClickHandler
,
IPointerEnterHandler
,
IPointerExitHandler
{
public
int
num
;
InventoryUI
ui
;
InventoryManager
manager
;
Transform
addonGroup
,
discardBin
;
bool
pointerOn
;
void
Start
()
{
pointerOn
=
false
;
ui
=
GameObject
.
Find
(
"InventoryCanvas"
).
GetComponent
<
InventoryUI
>();
manager
=
InventoryManager
.
Instance
;
addonGroup
=
ui
.
gameObject
.
transform
.
Find
(
"AddonGroup"
);
...
...
@@ -18,6 +21,7 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
}
public
void
OnBeginDrag
(
PointerEventData
eventData
)
{
pointerOn
=
false
;
if
(
eventData
.
button
==
PointerEventData
.
InputButton
.
Left
)
transform
.
SetAsLastSibling
();
}
...
...
@@ -81,8 +85,40 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
manager
.
SetOnPosition
();
}
}
public
void
OnPointerEnter
(
PointerEventData
eventData
)
{
pointerOn
=
true
;
StartCoroutine
(
AddonInfoReveal
());
}
public
void
OnPointerExit
(
PointerEventData
eventData
)
{
pointerOn
=
false
;
}
IEnumerator
AddonInfoReveal
()
{
if
(
num
<
9
)
{
for
(
float
timer
=
0
;
timer
<
0.5f
;
timer
+=
Time
.
deltaTime
)
{
yield
return
null
;
if
(!
pointerOn
)
yield
break
;
}
ui
.
SetAddonInfo
(
num
);
while
(
pointerOn
)
{
yield
return
null
;
}
ui
.
SetAddonInfo
();
}
}
bool
CheckBetween
(
Vector3
mouse
,
Vector3
center
,
Vector2
size
)
{
return
Mathf
.
Abs
(
mouse
.
x
-
center
.
x
)
<=
size
.
x
/
2f
&&
Mathf
.
Abs
(
mouse
.
y
-
center
.
y
)
<=
size
.
y
/
2f
;
}
}
Assets/Scripts/Item/InventoryUI.cs
View file @
89782746
...
...
@@ -32,12 +32,18 @@ public class InventoryUI : MonoBehaviour {
public
GameObject
[]
comboCharPrefab
;
public
GameObject
[]
comboNameFrame
;
public
float
pixelBetweenChar
;
public
GameObject
addonInfoPrefab
;
GameObject
[,]
comboChars
=
new
GameObject
[
3
,
8
];
GameObject
[]
infoAddons
;
GameObject
addonInfo
;
public
int
selectedItem
=
-
1
;
string
[]
qualityString
=
new
string
[
4
]
{
"습작"
,
"범작"
,
"수작"
,
"걸작"
};
InventoryManager
inventoryManager
;
void
Awake
()
{
inventoryManager
=
InventoryManager
.
Instance
;
items
=
new
GameObject
[
9
];
addons
=
new
GameObject
[
9
];
infoAddons
=
new
GameObject
[
4
];
...
...
@@ -71,7 +77,38 @@ public class InventoryUI : MonoBehaviour {
}
infoSpace
.
transform
.
Find
(
"Frame"
).
gameObject
.
SetActive
(
false
);
addonInfo
=
Instantiate
(
addonInfoPrefab
,
transform
);
addonInfo
.
SetActive
(
false
);
}
public
void
SetAddonInfo
()
{
addonInfo
.
SetActive
(
false
);
}
public
void
SetAddonInfo
(
int
addonNum
)
{
if
(
addons
[
addonNum
].
activeSelf
)
{
addonInfo
.
SetActive
(
true
);
addonInfo
.
transform
.
position
=
addonCell
[
addonNum
].
transform
.
position
+
new
Vector3
(
0
,
200
,
0
);
addonInfo
.
transform
.
position
+=
new
Vector3
(-
addonInfo
.
transform
.
position
.
x
+
Mathf
.
Min
(
addonInfo
.
transform
.
position
.
x
,
1650
),
0
,
0
);
Addon
currentAddon
=
inventoryManager
.
addonList
[
addonNum
];
GameObject
tmpObj
=
addonInfo
.
transform
.
Find
(
"AddonPrefab"
).
gameObject
;
tmpObj
.
GetComponent
<
Image
>().
sprite
=
addonFrameQuality
[(
int
)
currentAddon
.
type
*
4
+
(
int
)
currentAddon
.
quality
];
tmpObj
.
transform
.
Find
(
"Sprite"
).
gameObject
.
GetComponent
<
Image
>().
sprite
=
currentAddon
.
sprite
;
tmpObj
.
transform
.
Find
(
"Sprite"
).
gameObject
.
GetComponent
<
RectTransform
>().
sizeDelta
=
currentAddon
.
sizeInventory
;
tmpObj
.
SetActive
(
true
);
addonInfo
.
transform
.
Find
(
"Quality"
).
GetComponent
<
Text
>().
text
=
qualityString
[(
int
)
currentAddon
.
quality
];
addonInfo
.
transform
.
Find
(
"Name"
).
GetComponent
<
Text
>().
text
=
currentAddon
.
name
;
addonInfo
.
transform
.
Find
(
"Description"
).
GetComponent
<
Text
>().
text
=
currentAddon
.
addonDescription
;
addonInfo
.
transform
.
Find
(
"Info"
).
GetComponent
<
Text
>().
text
=
currentAddon
.
addonInfo
;
}
}
public
void
SetOnPosition
(
List
<
Item
>
itemList
,
List
<
Addon
>
addonList
)
{
for
(
int
i
=
0
;
i
<
itemList
.
Count
;
i
++)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment