스킬 드래그로 착용
This commit is contained in:
parent
d39216f9b6
commit
0df93a4238
|
|
@ -95,7 +95,8 @@ messageinfo 엄청 느린 버그
|
|||
- 맵1처럼 부분 분할 필요
|
||||
- 기본 컬러 94,94,94
|
||||
|
||||
스킬 드래그로 착용
|
||||
맵1~3 최적화
|
||||
- 바위 등 메시 옵티마이즈
|
||||
|
||||
|
||||
|
||||
|
|
@ -103,4 +104,6 @@ messageinfo 엄청 느린 버그
|
|||
- 테스트맵
|
||||
- 보스 이펙트
|
||||
- pc 애님 (캐스팅 추가)
|
||||
- pc 프리팹
|
||||
- pc 프리팹
|
||||
- 스킬 드래그로 착용
|
||||
-
|
||||
|
|
@ -579,81 +579,6 @@ MonoBehaviour:
|
|||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &5641889882583879855
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6730958588570254048}
|
||||
- component: {fileID: 4313858018977191423}
|
||||
- component: {fileID: 2611921259136813526}
|
||||
m_Layer: 5
|
||||
m_Name: icon
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6730958588570254048
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5641889882583879855}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 9013564077672272476}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 73, y: 78}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4313858018977191423
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5641889882583879855}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2611921259136813526
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5641889882583879855}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 3de6be90f6bd88749aff84b2516f0fe0, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &5661378587943002927
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1552,23 +1477,6 @@ PrefabInstance:
|
|||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 4460242486586314136}
|
||||
m_Modifications:
|
||||
- target: {fileID: 67439331489394908, guid: ba9d3a9dca146764c9eab1afcce6c695,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 79ed91652c5ba0c4a9b13c86ce407722,
|
||||
type: 3}
|
||||
- target: {fileID: 1189055321421896372, guid: ba9d3a9dca146764c9eab1afcce6c695,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 79ed91652c5ba0c4a9b13c86ce407722,
|
||||
type: 3}
|
||||
- target: {fileID: 1740112032792105139, guid: ba9d3a9dca146764c9eab1afcce6c695,
|
||||
type: 3}
|
||||
propertyPath: images.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 2611921259136813526}
|
||||
- target: {fileID: 3755946904853327015, guid: ba9d3a9dca146764c9eab1afcce6c695,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
|
|
@ -1676,11 +1584,7 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: 6245114044720075376, guid: ba9d3a9dca146764c9eab1afcce6c695,
|
||||
type: 3}
|
||||
insertIndex: 1
|
||||
addedObject: {fileID: 6730958588570254048}
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ba9d3a9dca146764c9eab1afcce6c695, type: 3}
|
||||
--- !u!114 &3718733369362845855 stripped
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 65f581562538e304cbbfe8ee3beab09c, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 79ed91652c5ba0c4a9b13c86ce407722, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
|
@ -488,7 +488,7 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 65f581562538e304cbbfe8ee3beab09c, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 79ed91652c5ba0c4a9b13c86ce407722, type: 3}
|
||||
m_Type: 3
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
|
|
@ -755,7 +755,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
|
|
|
|||
|
|
@ -55681,7 +55681,7 @@ RectTransform:
|
|||
m_Father: {fileID: 8846584700612234991}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0.076, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
|
|
@ -99201,7 +99201,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &2647977513349308266
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -144281,12 +144281,12 @@ PrefabInstance:
|
|||
- target: {fileID: 6641322232018589546, guid: b7647c1153b54fe4c95030106c8c8ab3,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
value: 0.845
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6641322232018589546, guid: b7647c1153b54fe4c95030106c8c8ab3,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6957816333201879133, guid: b7647c1153b54fe4c95030106c8c8ab3,
|
||||
type: 3}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ public class BattleUI : MonoBehaviour
|
|||
Set_Auto();
|
||||
|
||||
DSUtil.InActivateGameObjects(gos);
|
||||
switch (m_BattleUIType)
|
||||
{
|
||||
case eUICardType.UI: gos[1].SetActive(true); break;
|
||||
case eUICardType.Use: gos[0].SetActive(true); break;
|
||||
case eUICardType.UIEquip:
|
||||
break;
|
||||
}
|
||||
//switch (m_BattleUIType)
|
||||
//{
|
||||
// case eUICardType.UI: gos[1].SetActive(true); break;
|
||||
// case eUICardType.Use: gos[0].SetActive(true); break;
|
||||
// case eUICardType.UIEquip:
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
public void Set_Avoid(float cooltime)
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ using UnityEngine;
|
|||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SkillCard : CardCoolTimeBase
|
||||
public class SkillCard : CardCoolTimeBase, IDropHandler
|
||||
{
|
||||
public static Dictionary<int, Func<bool>> dic_button = new Dictionary<int, Func<bool>>();
|
||||
|
||||
public Image[] images; // 0 아이콘
|
||||
public Image[] images; // 0 아이콘, 1 버튼
|
||||
public GameObject[] gos; // 0 장착중, 1 잠김
|
||||
|
||||
SkillDragItem m_skillDragItem;
|
||||
SkillListTableData m_Data;
|
||||
int m_Slot, m_PetId, m_Petlv;
|
||||
|
||||
|
|
@ -59,6 +60,9 @@ public class SkillCard : CardCoolTimeBase
|
|||
case eUICardType.UI:
|
||||
et.enabled = false;
|
||||
images[1].GetComponent<Button>().onClick.AddListener(OnClick_SkillUI);
|
||||
if (DSUtil.CheckNull(m_skillDragItem))
|
||||
m_skillDragItem = images[0].gameObject.AddComponent<SkillDragItem>();
|
||||
m_skillDragItem.m_skillID = m_Data.n_SkillID;
|
||||
break;
|
||||
case eUICardType.Use:
|
||||
et.enabled = true;
|
||||
|
|
@ -73,6 +77,23 @@ public class SkillCard : CardCoolTimeBase
|
|||
}
|
||||
}
|
||||
|
||||
public void OnDrop(PointerEventData eventData)
|
||||
{
|
||||
if (CardType == eUICardType.UIEquip)
|
||||
{
|
||||
var draggedSkill = eventData.pointerDrag.GetComponent<SkillDragItem>();
|
||||
if (!DSUtil.CheckNull(draggedSkill))
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
int unequipid = 0;
|
||||
if (!DSUtil.CheckNull(m_Data))
|
||||
unequipid = m_Data.n_SkillID;
|
||||
sdata.Equip.Set_Equip(eItem.Skill, draggedSkill.m_skillID, m_Slot, unequipid);
|
||||
NewGameUI.Ins.m_SkillUI.Set_UI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClick_SkillUI()
|
||||
{ // UI 스킬 카드
|
||||
NewGameUI.Ins.m_SkillUI.m_SkillUI_SkillInfo.Set(m_Data);
|
||||
|
|
@ -82,13 +103,7 @@ public class SkillCard : CardCoolTimeBase
|
|||
{ // 실제 스킬 사용
|
||||
if (CardType == eUICardType.UIEquip)
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
int unequipid = 0;
|
||||
if (!DSUtil.CheckNull(m_Data))
|
||||
unequipid = m_Data.n_SkillID;
|
||||
sdata.Equip.Set_Equip(eItem.Skill, NewGameUI.Ins.m_SkillUI.m_SkillUI_SkillInfo.Get_Data().n_SkillID, m_Slot, unequipid);
|
||||
NewGameUI.Ins.m_SkillUI.Set_UI();
|
||||
NewGameUI.Ins.m_SkillUI.m_SkillEquipUI.Set(eUICardType.UIEquip);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SkillDragItem : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerDownHandler, IPointerUpHandler
|
||||
{
|
||||
private Image skillIcon; // 현재 오브젝트의 이미지
|
||||
private GameObject dragPreview; // 따라다니는 복사 이미지
|
||||
private Canvas canvas; // 최상위 캔버스
|
||||
private ScrollRect parentScroll;
|
||||
|
||||
public int m_skillID { get; set; }
|
||||
float clickThreshold = 10f;
|
||||
Vector2 pressPos;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
skillIcon = GetComponent<Image>();
|
||||
canvas = GetComponentInParent<Canvas>();
|
||||
parentScroll = GetComponentInParent<ScrollRect>();
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
parentScroll?.OnBeginDrag(eventData);
|
||||
|
||||
// 프리뷰 오브젝트 생성
|
||||
dragPreview = new GameObject("DragPreview", typeof(CanvasGroup), typeof(Image));
|
||||
dragPreview.transform.SetParent(canvas.transform, false);
|
||||
dragPreview.transform.SetAsLastSibling(); // 맨 위로
|
||||
|
||||
Image img = dragPreview.GetComponent<Image>();
|
||||
img.sprite = skillIcon.sprite;
|
||||
img.raycastTarget = false; // 이벤트 막지 않게
|
||||
//img.SetNativeSize(); // 원래 사이즈
|
||||
|
||||
// 알파 낮춰서 느낌 주기
|
||||
dragPreview.GetComponent<CanvasGroup>().alpha = 0.7f;
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
parentScroll?.OnDrag(eventData);
|
||||
|
||||
if (!DSUtil.CheckNull(dragPreview))
|
||||
{
|
||||
// 마우스 따라다니게
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(
|
||||
canvas.transform as RectTransform,
|
||||
eventData.position,
|
||||
eventData.pressEventCamera,
|
||||
out Vector2 localPoint
|
||||
);
|
||||
dragPreview.transform.localPosition = localPoint;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
parentScroll?.OnEndDrag(eventData);
|
||||
|
||||
if (!DSUtil.CheckNull(dragPreview))
|
||||
Destroy(dragPreview); // 삭제
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
pressPos = eventData.position;
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
if (Vector2.Distance(pressPos, eventData.position) < clickThreshold)
|
||||
GetComponentInParent<SkillCard>().OnClick_SkillUI();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d457928ded797164684b23e732e869c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -54,7 +54,7 @@ public class SkillUI : BotMenuBase
|
|||
var data = m_SkillUI_SkillInfo.Get_Data();
|
||||
m_SkillUI_SkillInfo.Set(DSUtil.CheckNull(data) ? list_CardBase[0].Get_Data() as SkillListTableData : data);
|
||||
|
||||
m_BattleUI.Set(eUICardType.UI, sdata.Equip.Preset);
|
||||
m_BattleUI.Set(eUICardType.UIEquip, sdata.Equip.Preset);
|
||||
}
|
||||
|
||||
public void OnClick_SkillType()
|
||||
|
|
@ -68,6 +68,6 @@ public class SkillUI : BotMenuBase
|
|||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
sdata.Equip.Preset = m_Tab.Get_Index() + 1;
|
||||
m_BattleUI.Set(eUICardType.UI, sdata.Equip.Preset);
|
||||
m_BattleUI.Set(eUICardType.UIEquip, sdata.Equip.Preset);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue