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
667ec91f
Commit
667ec91f
authored
Feb 21, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
인벤토리창 버그 고침
parent
6d68fd23
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
31 deletions
+49
-31
AddonDrag.cs
Assets/Scripts/Item/AddonDrag.cs
+39
-31
InventoryManager.cs
Assets/Scripts/Item/InventoryManager.cs
+10
-0
No files found.
Assets/Scripts/Item/AddonDrag.cs
View file @
667ec91f
...
@@ -18,15 +18,19 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
...
@@ -18,15 +18,19 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
}
}
public
void
OnBeginDrag
(
PointerEventData
eventData
)
public
void
OnBeginDrag
(
PointerEventData
eventData
)
{
{
if
(
eventData
.
button
==
PointerEventData
.
InputButton
.
Left
)
transform
.
SetAsLastSibling
();
transform
.
SetAsLastSibling
();
}
}
public
void
OnDrag
(
PointerEventData
eventData
)
public
void
OnDrag
(
PointerEventData
eventData
)
{
{
if
(
eventData
.
button
==
PointerEventData
.
InputButton
.
Left
)
transform
.
position
=
Input
.
mousePosition
;
transform
.
position
=
Input
.
mousePosition
;
}
}
public
void
OnEndDrag
(
PointerEventData
eventData
)
public
void
OnEndDrag
(
PointerEventData
eventData
)
{
if
(
eventData
.
button
==
PointerEventData
.
InputButton
.
Left
)
{
{
if
(
CheckBetween
(
Input
.
mousePosition
,
discardBin
.
position
,
discardBin
.
GetComponent
<
RectTransform
>().
sizeDelta
))
if
(
CheckBetween
(
Input
.
mousePosition
,
discardBin
.
position
,
discardBin
.
GetComponent
<
RectTransform
>().
sizeDelta
))
{
{
...
@@ -56,8 +60,11 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
...
@@ -56,8 +60,11 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
}
}
manager
.
SetOnPosition
();
manager
.
SetOnPosition
();
}
}
}
public
void
OnPointerClick
(
PointerEventData
eventData
)
public
void
OnPointerClick
(
PointerEventData
eventData
)
{
if
(
eventData
.
button
==
PointerEventData
.
InputButton
.
Right
)
{
{
if
(
num
<
9
)
if
(
num
<
9
)
{
{
...
@@ -73,6 +80,7 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
...
@@ -73,6 +80,7 @@ public class AddonDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDra
manager
.
DetachAddon
(
ui
.
selectedItem
,
(
AddonType
)(
num
-
9
));
manager
.
DetachAddon
(
ui
.
selectedItem
,
(
AddonType
)(
num
-
9
));
manager
.
SetOnPosition
();
manager
.
SetOnPosition
();
}
}
}
bool
CheckBetween
(
Vector3
mouse
,
Vector3
center
,
Vector2
size
)
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
;
return
Mathf
.
Abs
(
mouse
.
x
-
center
.
x
)
<=
size
.
x
/
2f
&&
Mathf
.
Abs
(
mouse
.
y
-
center
.
y
)
<=
size
.
y
/
2f
;
...
...
Assets/Scripts/Item/InventoryManager.cs
View file @
667ec91f
...
@@ -145,6 +145,11 @@ public class InventoryManager : Singleton<InventoryManager> {
...
@@ -145,6 +145,11 @@ public class InventoryManager : Singleton<InventoryManager> {
{
{
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
if
(
itemPool
[
i
].
Contains
(
str
))
itemPool
[
i
].
Remove
(
str
);
tmpItem
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpItem
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
PopoutGenerator
(
tmpItem
,
popoutStrength
);
PopoutGenerator
(
tmpItem
,
popoutStrength
);
}
}
...
@@ -183,6 +188,11 @@ public class InventoryManager : Singleton<InventoryManager> {
...
@@ -183,6 +188,11 @@ public class InventoryManager : Singleton<InventoryManager> {
{
{
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Addon
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Addon
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
if
(
addonPool
[
i
].
Contains
(
str
))
addonPool
[
i
].
Remove
(
str
);
tmpItem
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpItem
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
PopoutGenerator
(
tmpItem
,
popoutStrength
);
PopoutGenerator
(
tmpItem
,
popoutStrength
);
}
}
...
...
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