ui 관련 editor 코드 정리, tab 오브젝트 생성 코드 추가
This commit is contained in:
parent
5f52c08679
commit
f470c89934
|
|
@ -489,368 +489,4 @@ public static class MyEditorUtil
|
|||
//}
|
||||
|
||||
// 자식까지 포함해서 레이어를 재귀적으로 설정하는 함수
|
||||
static void SetLayerRecursively(GameObject obj, string newLayer = "UI")
|
||||
{
|
||||
obj.layer = LayerMask.NameToLayer(newLayer);
|
||||
|
||||
foreach (Transform child in obj.transform)
|
||||
SetLayerRecursively(child.gameObject, newLayer); // 재귀 호출로 자식까지 처리
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/New Image &i")] // &i는 Alt + I를 의미
|
||||
static void CreateUIImage()
|
||||
{
|
||||
GameObject imageObject = new GameObject("New Image", typeof(Image));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(imageObject, "New Image");
|
||||
|
||||
var img = imageObject.GetComponent<Image>();
|
||||
img.raycastTarget = false;
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
imageObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(imageObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = imageObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/Text Only &t")] // &t는 Alt + T를 의미
|
||||
static void CreateUITextMeshPro()
|
||||
{
|
||||
GameObject textObject = new GameObject("New TMP", typeof(TextMeshProUGUI));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(textObject, "New TMP");
|
||||
|
||||
var tm = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tm.alignment = TextAlignmentOptions.Midline;
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
textObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(textObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = textObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
[MenuItem("GameObject/UI/Text - Local &y")]
|
||||
static void CreateUITextMeshProWithLocal()
|
||||
{
|
||||
GameObject textObject = new GameObject("Local TMP", typeof(TextMeshProUGUI));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(textObject, "Local TMP");
|
||||
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
var tm = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tm.alignment = TextAlignmentOptions.Midline;
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
textObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(textObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = textObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/Button &b")] // Alt + B: Button 생성 (Image, Button, PlayClickSound_Only 추가)
|
||||
static void CreateUIButton()
|
||||
{
|
||||
// 버튼 오브젝트 생성 (Image, Button 컴포넌트 포함)
|
||||
GameObject buttonObject = new GameObject("btn_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(buttonObject, "btn_");
|
||||
|
||||
buttonObject.AddComponent<Image>().sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
buttonObject.AddComponent<Button>();
|
||||
buttonObject.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
// TextMeshPro-UGUI 생성 및 설정
|
||||
GameObject textObject = new GameObject("btnName", typeof(TextMeshProUGUI));
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
TextMeshProUGUI tmp = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tmp.text = "Button";
|
||||
tmp.alignment = TextAlignmentOptions.Midline;
|
||||
|
||||
// Text 객체를 Button의 자식으로 설정
|
||||
textObject.transform.SetParent(buttonObject.transform, false);
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.anchorMin = Vector2.zero;
|
||||
textRect.anchorMax = Vector2.one;
|
||||
textRect.offsetMin = Vector2.zero;
|
||||
textRect.offsetMax = Vector2.zero;
|
||||
|
||||
// 버튼 오브젝트의 부모 설정
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
buttonObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(buttonObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = buttonObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My Slider &%#s")] // Alt + Shift + S: Slider 생성
|
||||
static void CreateUISlider()
|
||||
{
|
||||
GameObject sliderObject = new GameObject("Slider_", typeof(Slider));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(sliderObject, "Slider_");
|
||||
|
||||
sliderObject.GetComponent<RectTransform>().sizeDelta = new Vector2(200f, 20f);
|
||||
Slider slider = sliderObject.GetComponent<Slider>();
|
||||
slider.value = 0.5f;
|
||||
|
||||
// Slider의 자식 오브젝트로 Background 이미지 추가
|
||||
GameObject backgroundObject = new GameObject("Background", typeof(Image));
|
||||
backgroundObject.transform.SetParent(sliderObject.transform, false);
|
||||
var img = backgroundObject.GetComponent<Image>();
|
||||
img.raycastTarget = false;
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
RectTransform bgRect = backgroundObject.GetComponent<RectTransform>();
|
||||
bgRect.anchorMin = new Vector2(0, 0);
|
||||
bgRect.anchorMax = new Vector2(1, 1);
|
||||
bgRect.offsetMin = new Vector2(0, 0); // Custom Stretch 적용
|
||||
bgRect.offsetMax = new Vector2(0, 0); // Custom Stretch 적용
|
||||
|
||||
// Fill Area 오브젝트 추가
|
||||
GameObject fillAreaObject = new GameObject("Fill Area", typeof(RectTransform));
|
||||
fillAreaObject.transform.SetParent(sliderObject.transform, false);
|
||||
RectTransform fillAreaRect = fillAreaObject.GetComponent<RectTransform>();
|
||||
fillAreaRect.anchorMin = new Vector2(0, 0);
|
||||
fillAreaRect.anchorMax = new Vector2(1, 1);
|
||||
fillAreaRect.offsetMin = new Vector2(0, 0); // Custom Stretch 적용
|
||||
fillAreaRect.offsetMax = new Vector2(0, 0); // Custom Stretch 적용
|
||||
|
||||
// Fill Area 자식으로 Fill 이미지 추가
|
||||
GameObject fillObject = new GameObject("Fill", typeof(Image));
|
||||
fillObject.transform.SetParent(fillAreaObject.transform, false);
|
||||
slider.targetGraphic = fillObject.GetComponent<Image>();
|
||||
slider.targetGraphic.color = Color.yellow;
|
||||
slider.targetGraphic.raycastTarget = false;
|
||||
(slider.targetGraphic as Image).sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
RectTransform fillRect = fillObject.GetComponent<RectTransform>();
|
||||
fillRect.anchorMin = new Vector2(0, 0);
|
||||
fillRect.anchorMax = new Vector2(1, 1);
|
||||
fillRect.offsetMin = new Vector2(0, 0);
|
||||
fillRect.offsetMax = new Vector2(0, 0); // Stretch left 적용
|
||||
|
||||
// Fill 이미지 설정
|
||||
slider.fillRect = fillRect;
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
sliderObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(sliderObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = sliderObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My CheckUI &%#c")]
|
||||
static void CreateUICheck()
|
||||
{
|
||||
// 0. "check_" GameObject 생성
|
||||
GameObject gocheck = new GameObject("check_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(gocheck, "check_");
|
||||
|
||||
gocheck.AddComponent<RectTransform>();
|
||||
|
||||
// 1. 자식으로 크기 27x27 Image 추가
|
||||
GameObject imageObject1 = new GameObject("checkbg", typeof(Image));
|
||||
imageObject1.transform.SetParent(gocheck.transform, false); // gocheck의 자식으로 설정
|
||||
RectTransform image1Rect = imageObject1.GetComponent<RectTransform>();
|
||||
image1Rect.sizeDelta = new Vector2(27, 27); // 크기 설정
|
||||
// 버튼 및 버튼음 추가
|
||||
imageObject1.AddComponent<Button>();
|
||||
imageObject1.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
// 2. 1 의 자식으로 크기 39x30 Image 추가
|
||||
GameObject imageObject2 = new GameObject("check", typeof(Image));
|
||||
imageObject2.transform.SetParent(imageObject1.transform, false); // imageObject1의 자식으로 설정
|
||||
RectTransform image2Rect = imageObject2.GetComponent<RectTransform>();
|
||||
image2Rect.sizeDelta = new Vector2(39, 30); // 크기 설정
|
||||
|
||||
// 3. 1의 오른쪽에 1과 같은 깊이로 TMP 추가
|
||||
GameObject textObject = new GameObject("checkName", typeof(TextMeshProUGUI));
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
textObject.transform.SetParent(gocheck.transform, false); // gocheck의 자식으로 설정
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.sizeDelta = new Vector2(100, 30); // TMP의 기본 크기 설정
|
||||
textRect.anchoredPosition = new Vector2(image1Rect.sizeDelta.x + 50, 0); // Image1의 오른쪽으로 배치
|
||||
|
||||
TextMeshProUGUI tmp = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tmp.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
tmp.text = "체크 UI";
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
gocheck.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = gocheck;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My Scroll &#v")] // Alt + Shift + V 단축키
|
||||
static void CreateUIScrollview()
|
||||
{
|
||||
// 0. "scrollview_" GameObject 생성
|
||||
GameObject go_sv = new GameObject("scrollview_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(go_sv, "scrollview_");
|
||||
|
||||
var img = go_sv.AddComponent<Image>();
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
var sr = go_sv.AddComponent<ScrollRect>();
|
||||
sr.horizontal = false;
|
||||
|
||||
// 1. 자식으로 Viewport 추가
|
||||
GameObject go_vp = new GameObject("Viewport", typeof(Image));
|
||||
go_vp.AddComponent<Mask>().showMaskGraphic = false;
|
||||
go_vp.transform.SetParent(go_sv.transform, false); // 자식으로 설정
|
||||
var rt_vp = go_vp.GetComponent<RectTransform>(); // 이미 추가된 RectTransform 가져오기
|
||||
rt_vp.anchorMin = Vector2.zero;
|
||||
rt_vp.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.up;
|
||||
rt_vp.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_vp.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
var img_vp = go_vp.GetComponent<Image>();
|
||||
img_vp.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
|
||||
// ScrollRect의 Viewport를 설정
|
||||
sr.viewport = rt_vp;
|
||||
|
||||
// 2. 1의 자식으로 Content 추가
|
||||
GameObject go_ct = new GameObject("Content");
|
||||
go_ct.transform.SetParent(go_vp.transform, false); // Content를 Viewport의 자식으로 설정
|
||||
go_ct.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize; // ContentSizeFitter 설정
|
||||
var rt_ct = go_ct.GetComponent<RectTransform>();
|
||||
rt_ct.anchorMin = Vector2.up;
|
||||
rt_ct.anchorMax = Vector2.one;
|
||||
rt_ct.pivot = Vector2.up;
|
||||
rt_ct.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_ct.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
|
||||
// ScrollRect의 content 설정
|
||||
sr.content = rt_ct;
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
go_sv.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(go_sv);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = go_sv;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/TMP InputField &%#i")] // Alt + Ctrl + Shift + i 단축키
|
||||
static void CreateTMPInputField()
|
||||
{
|
||||
// 0. GameObject 생성
|
||||
GameObject go_if = new GameObject("inputfield_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(go_if, "inputfield_");
|
||||
|
||||
var img = go_if.AddComponent<Image>();
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
var tmp_if = go_if.AddComponent<TMP_InputField>();
|
||||
var rt_if = go_if.GetComponent<RectTransform>();
|
||||
rt_if.sizeDelta = new Vector2(160, 30);
|
||||
|
||||
// 1. 자식으로 Text Area 추가
|
||||
GameObject go_vp = new GameObject("Text Area", typeof(RectMask2D));
|
||||
go_vp.GetComponent<RectMask2D>().padding = new Vector4(-8, -5, -8, -5);
|
||||
go_vp.transform.SetParent(go_if.transform, false); // 자식으로 설정
|
||||
var rt_vp = go_vp.GetComponent<RectTransform>();
|
||||
rt_vp.anchorMin = Vector2.zero;
|
||||
rt_vp.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.one * 0.5f;
|
||||
rt_vp.offsetMin = Vector2.right * 10f; //
|
||||
rt_vp.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
tmp_if.textViewport = rt_vp;
|
||||
|
||||
// 2. 1의 자식으로 Placeholder 추가
|
||||
GameObject go_ph = new GameObject("Placeholder");
|
||||
go_ph.transform.SetParent(go_vp.transform, false); // 자식으로 설정
|
||||
var text_ph = go_ph.AddComponent<TextMeshProUGUI>();
|
||||
text_ph.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
text_ph.text = "Enter text.";
|
||||
text_ph.color = Color.black;
|
||||
tmp_if.placeholder = text_ph;
|
||||
go_ph.AddComponent<LayoutElement>().ignoreLayout = true;
|
||||
var rt_ph = go_ph.GetComponent<RectTransform>();
|
||||
rt_ph.anchorMin = Vector2.zero;
|
||||
rt_ph.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.one * 0.5f;
|
||||
rt_ph.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_ph.offsetMax = Vector2.one; // Right와 Top을 0으로 설정
|
||||
|
||||
// 3. 1의 자식으로 Text 추가
|
||||
GameObject go_txt = new GameObject("Text");
|
||||
go_txt.transform.SetParent(go_vp.transform, false); // 자식으로 설정
|
||||
var text_txt = go_txt.AddComponent<TextMeshProUGUI>();
|
||||
text_txt.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
text_txt.color = Color.black;
|
||||
tmp_if.textComponent = text_txt;
|
||||
tmp_if.pointSize = 20;
|
||||
tmp_if.fontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>("Assets/ThirdParty/TextMesh Pro/Addressables/Fonts & Materials/Font SDF.asset");
|
||||
var rt_txt = go_txt.GetComponent<RectTransform>();
|
||||
rt_txt.anchorMin = Vector2.zero;
|
||||
rt_txt.anchorMax = Vector2.one;
|
||||
rt_txt.pivot = Vector2.one * 0.5f;
|
||||
rt_txt.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_txt.offsetMax = Vector2.one; // Right와 Top을 0으로 설정
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
go_if.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(go_if);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = go_if;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,458 @@
|
|||
using Codice.CM.SEIDInfo;
|
||||
using DigitalOpus.MB.Core;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public static class MyUIUtil
|
||||
{
|
||||
static void SetLayerRecursively(GameObject obj, string newLayer = "UI")
|
||||
{
|
||||
obj.layer = LayerMask.NameToLayer(newLayer);
|
||||
|
||||
foreach (Transform child in obj.transform)
|
||||
SetLayerRecursively(child.gameObject, newLayer); // 재귀 호출로 자식까지 처리
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/New Image &i")] // &i는 Alt + I를 의미
|
||||
static void CreateUIImage()
|
||||
{
|
||||
GameObject imageObject = new GameObject("New Image", typeof(Image));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(imageObject, "New Image");
|
||||
|
||||
var img = imageObject.GetComponent<Image>();
|
||||
img.raycastTarget = false;
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
imageObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(imageObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = imageObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/Text Only &t")] // &t는 Alt + T를 의미
|
||||
static void CreateUITextMeshPro()
|
||||
{
|
||||
GameObject textObject = new GameObject("New TMP", typeof(TextMeshProUGUI));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(textObject, "New TMP");
|
||||
|
||||
var tm = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tm.alignment = TextAlignmentOptions.Midline;
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
textObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(textObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = textObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
[MenuItem("GameObject/UI/Text - Local &y")]
|
||||
static void CreateUITextMeshProWithLocal()
|
||||
{
|
||||
GameObject textObject = new GameObject("Local TMP", typeof(TextMeshProUGUI));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(textObject, "Local TMP");
|
||||
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
var tm = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tm.alignment = TextAlignmentOptions.Midline;
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
textObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(textObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = textObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/Button &b")] // Alt + B: Button 생성 (Image, Button, PlayClickSound_Only 추가)
|
||||
static void CreateUIButton()
|
||||
{
|
||||
// 버튼 오브젝트 생성 (Image, Button 컴포넌트 포함)
|
||||
GameObject buttonObject = new GameObject("btn_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(buttonObject, "btn_");
|
||||
|
||||
buttonObject.AddComponent<Image>().sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
buttonObject.AddComponent<Button>();
|
||||
buttonObject.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
// TextMeshPro-UGUI 생성 및 설정
|
||||
GameObject textObject = new GameObject("btnName", typeof(TextMeshProUGUI));
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
TextMeshProUGUI tmp = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tmp.text = "Button";
|
||||
tmp.alignment = TextAlignmentOptions.Midline;
|
||||
|
||||
// Text 객체를 Button의 자식으로 설정
|
||||
textObject.transform.SetParent(buttonObject.transform, false);
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.anchorMin = Vector2.zero;
|
||||
textRect.anchorMax = Vector2.one;
|
||||
textRect.offsetMin = Vector2.zero;
|
||||
textRect.offsetMax = Vector2.zero;
|
||||
|
||||
// 버튼 오브젝트의 부모 설정
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
buttonObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(buttonObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = buttonObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My Slider &%#s")] // Alt + Shift + S: Slider 생성
|
||||
static void CreateUISlider()
|
||||
{
|
||||
GameObject sliderObject = new GameObject("Slider_", typeof(Slider));
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(sliderObject, "Slider_");
|
||||
|
||||
sliderObject.GetComponent<RectTransform>().sizeDelta = new Vector2(200f, 20f);
|
||||
Slider slider = sliderObject.GetComponent<Slider>();
|
||||
slider.value = 0.5f;
|
||||
|
||||
// Slider의 자식 오브젝트로 Background 이미지 추가
|
||||
GameObject backgroundObject = new GameObject("Background", typeof(Image));
|
||||
backgroundObject.transform.SetParent(sliderObject.transform, false);
|
||||
var img = backgroundObject.GetComponent<Image>();
|
||||
img.raycastTarget = false;
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
RectTransform bgRect = backgroundObject.GetComponent<RectTransform>();
|
||||
bgRect.anchorMin = new Vector2(0, 0);
|
||||
bgRect.anchorMax = new Vector2(1, 1);
|
||||
bgRect.offsetMin = new Vector2(0, 0); // Custom Stretch 적용
|
||||
bgRect.offsetMax = new Vector2(0, 0); // Custom Stretch 적용
|
||||
|
||||
// Fill Area 오브젝트 추가
|
||||
GameObject fillAreaObject = new GameObject("Fill Area", typeof(RectTransform));
|
||||
fillAreaObject.transform.SetParent(sliderObject.transform, false);
|
||||
RectTransform fillAreaRect = fillAreaObject.GetComponent<RectTransform>();
|
||||
fillAreaRect.anchorMin = new Vector2(0, 0);
|
||||
fillAreaRect.anchorMax = new Vector2(1, 1);
|
||||
fillAreaRect.offsetMin = new Vector2(0, 0); // Custom Stretch 적용
|
||||
fillAreaRect.offsetMax = new Vector2(0, 0); // Custom Stretch 적용
|
||||
|
||||
// Fill Area 자식으로 Fill 이미지 추가
|
||||
GameObject fillObject = new GameObject("Fill", typeof(Image));
|
||||
fillObject.transform.SetParent(fillAreaObject.transform, false);
|
||||
slider.targetGraphic = fillObject.GetComponent<Image>();
|
||||
slider.targetGraphic.color = Color.yellow;
|
||||
slider.targetGraphic.raycastTarget = false;
|
||||
(slider.targetGraphic as Image).sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
RectTransform fillRect = fillObject.GetComponent<RectTransform>();
|
||||
fillRect.anchorMin = new Vector2(0, 0);
|
||||
fillRect.anchorMax = new Vector2(1, 1);
|
||||
fillRect.offsetMin = new Vector2(0, 0);
|
||||
fillRect.offsetMax = new Vector2(0, 0); // Stretch left 적용
|
||||
|
||||
// Fill 이미지 설정
|
||||
slider.fillRect = fillRect;
|
||||
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
sliderObject.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(sliderObject);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = sliderObject;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My CheckUI &%#c")]
|
||||
static void CreateUICheck()
|
||||
{
|
||||
// 0. "check_" GameObject 생성
|
||||
GameObject gocheck = new GameObject("check_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(gocheck, "check_");
|
||||
|
||||
gocheck.AddComponent<RectTransform>();
|
||||
|
||||
// 1. 자식으로 크기 27x27 Image 추가
|
||||
GameObject imageObject1 = new GameObject("checkbg", typeof(Image));
|
||||
imageObject1.transform.SetParent(gocheck.transform, false); // gocheck의 자식으로 설정
|
||||
RectTransform image1Rect = imageObject1.GetComponent<RectTransform>();
|
||||
image1Rect.sizeDelta = new Vector2(27, 27); // 크기 설정
|
||||
// 버튼 및 버튼음 추가
|
||||
imageObject1.AddComponent<Button>();
|
||||
imageObject1.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
// 2. 1 의 자식으로 크기 39x30 Image 추가
|
||||
GameObject imageObject2 = new GameObject("check", typeof(Image));
|
||||
imageObject2.transform.SetParent(imageObject1.transform, false); // imageObject1의 자식으로 설정
|
||||
RectTransform image2Rect = imageObject2.GetComponent<RectTransform>();
|
||||
image2Rect.sizeDelta = new Vector2(39, 30); // 크기 설정
|
||||
|
||||
// 3. 1의 오른쪽에 1과 같은 깊이로 TMP 추가
|
||||
GameObject textObject = new GameObject("checkName", typeof(TextMeshProUGUI));
|
||||
textObject.AddComponent<SetLocalText>();
|
||||
textObject.transform.SetParent(gocheck.transform, false); // gocheck의 자식으로 설정
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.sizeDelta = new Vector2(100, 30); // TMP의 기본 크기 설정
|
||||
textRect.anchoredPosition = new Vector2(image1Rect.sizeDelta.x + 50, 0); // Image1의 오른쪽으로 배치
|
||||
|
||||
TextMeshProUGUI tmp = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tmp.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
tmp.text = "체크 UI";
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
gocheck.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = gocheck;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My Scroll &#v")] // Alt + Shift + V 단축키
|
||||
static void CreateUIScrollview()
|
||||
{
|
||||
// 0. "scrollview_" GameObject 생성
|
||||
GameObject go_sv = new GameObject("scrollview_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(go_sv, "scrollview_");
|
||||
|
||||
var img = go_sv.AddComponent<Image>();
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
var sr = go_sv.AddComponent<ScrollRect>();
|
||||
sr.horizontal = false;
|
||||
|
||||
// 1. 자식으로 Viewport 추가
|
||||
GameObject go_vp = new GameObject("Viewport", typeof(Image));
|
||||
go_vp.AddComponent<Mask>().showMaskGraphic = false;
|
||||
go_vp.transform.SetParent(go_sv.transform, false); // 자식으로 설정
|
||||
var rt_vp = go_vp.GetComponent<RectTransform>(); // 이미 추가된 RectTransform 가져오기
|
||||
rt_vp.anchorMin = Vector2.zero;
|
||||
rt_vp.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.up;
|
||||
rt_vp.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_vp.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
var img_vp = go_vp.GetComponent<Image>();
|
||||
img_vp.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
|
||||
// ScrollRect의 Viewport를 설정
|
||||
sr.viewport = rt_vp;
|
||||
|
||||
// 2. 1의 자식으로 Content 추가
|
||||
GameObject go_ct = new GameObject("Content");
|
||||
go_ct.transform.SetParent(go_vp.transform, false); // Content를 Viewport의 자식으로 설정
|
||||
go_ct.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize; // ContentSizeFitter 설정
|
||||
var rt_ct = go_ct.GetComponent<RectTransform>();
|
||||
rt_ct.anchorMin = Vector2.up;
|
||||
rt_ct.anchorMax = Vector2.one;
|
||||
rt_ct.pivot = Vector2.up;
|
||||
rt_ct.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_ct.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
|
||||
// ScrollRect의 content 설정
|
||||
sr.content = rt_ct;
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
go_sv.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(go_sv);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = go_sv;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/TMP InputField &%#i")] // Alt + Ctrl + Shift + i 단축키
|
||||
static void CreateTMPInputField()
|
||||
{
|
||||
// 0. GameObject 생성
|
||||
GameObject go_if = new GameObject("inputfield_");
|
||||
|
||||
// 생성된 오브젝트에 대한 Undo 기록 추가
|
||||
Undo.RegisterCreatedObjectUndo(go_if, "inputfield_");
|
||||
|
||||
var img = go_if.AddComponent<Image>();
|
||||
img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
var tmp_if = go_if.AddComponent<TMP_InputField>();
|
||||
var rt_if = go_if.GetComponent<RectTransform>();
|
||||
rt_if.sizeDelta = new Vector2(160, 30);
|
||||
|
||||
// 1. 자식으로 Text Area 추가
|
||||
GameObject go_vp = new GameObject("Text Area", typeof(RectMask2D));
|
||||
go_vp.GetComponent<RectMask2D>().padding = new Vector4(-8, -5, -8, -5);
|
||||
go_vp.transform.SetParent(go_if.transform, false); // 자식으로 설정
|
||||
var rt_vp = go_vp.GetComponent<RectTransform>();
|
||||
rt_vp.anchorMin = Vector2.zero;
|
||||
rt_vp.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.one * 0.5f;
|
||||
rt_vp.offsetMin = Vector2.right * 10f; //
|
||||
rt_vp.offsetMax = Vector2.zero; // Right와 Top을 0으로 설정
|
||||
tmp_if.textViewport = rt_vp;
|
||||
|
||||
// 2. 1의 자식으로 Placeholder 추가
|
||||
GameObject go_ph = new GameObject("Placeholder");
|
||||
go_ph.transform.SetParent(go_vp.transform, false); // 자식으로 설정
|
||||
var text_ph = go_ph.AddComponent<TextMeshProUGUI>();
|
||||
text_ph.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
text_ph.text = "Enter text.";
|
||||
text_ph.color = Color.black;
|
||||
tmp_if.placeholder = text_ph;
|
||||
go_ph.AddComponent<LayoutElement>().ignoreLayout = true;
|
||||
var rt_ph = go_ph.GetComponent<RectTransform>();
|
||||
rt_ph.anchorMin = Vector2.zero;
|
||||
rt_ph.anchorMax = Vector2.one;
|
||||
rt_vp.pivot = Vector2.one * 0.5f;
|
||||
rt_ph.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_ph.offsetMax = Vector2.one; // Right와 Top을 0으로 설정
|
||||
|
||||
// 3. 1의 자식으로 Text 추가
|
||||
GameObject go_txt = new GameObject("Text");
|
||||
go_txt.transform.SetParent(go_vp.transform, false); // 자식으로 설정
|
||||
var text_txt = go_txt.AddComponent<TextMeshProUGUI>();
|
||||
text_txt.alignment = TextAlignmentOptions.MidlineLeft;
|
||||
text_txt.color = Color.black;
|
||||
tmp_if.textComponent = text_txt;
|
||||
tmp_if.pointSize = 20;
|
||||
tmp_if.fontAsset = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>("Assets/ThirdParty/TextMesh Pro/Addressables/Fonts & Materials/Font SDF.asset");
|
||||
var rt_txt = go_txt.GetComponent<RectTransform>();
|
||||
rt_txt.anchorMin = Vector2.zero;
|
||||
rt_txt.anchorMax = Vector2.one;
|
||||
rt_txt.pivot = Vector2.one * 0.5f;
|
||||
rt_txt.offsetMin = Vector2.zero; // Left와 Bottom을 0으로 설정
|
||||
rt_txt.offsetMax = Vector2.one; // Right와 Top을 0으로 설정
|
||||
|
||||
// 현재 선택된 오브젝트를 부모로 설정 (선택된 오브젝트가 있을 때만)
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
go_if.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(go_if);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = go_if;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/UI/My Tab H %#q")] // Ctrl + Shift + Q: 탭 생성 (가로)
|
||||
static void CreateUITab_Hori()
|
||||
{
|
||||
Set_Tab_Common<HorizontalLayoutGroup>("tab_layout_h");
|
||||
}
|
||||
[MenuItem("GameObject/UI/My Tab V %#w")] // Ctrl + Shift + W: 탭 생성 (세로)
|
||||
static void CreateUITab_Veti()
|
||||
{
|
||||
Set_Tab_Common<VerticalLayoutGroup>("tab_layout_v");
|
||||
}
|
||||
static void Set_Tab_Common<T>(string layoutName) where T : HorizontalOrVerticalLayoutGroup
|
||||
{
|
||||
GameObject obj = new GameObject(layoutName);
|
||||
var layout = obj.AddComponent<T>();
|
||||
layout.childForceExpandWidth = false;
|
||||
layout.childForceExpandHeight = false;
|
||||
layout.spacing = 5;
|
||||
obj.AddComponent<TabUIBase>().m_Content = obj;
|
||||
obj.GetComponent<RectTransform>().sizeDelta = Vector2.zero;
|
||||
Undo.RegisterCreatedObjectUndo(obj, layoutName);
|
||||
|
||||
GameObject tab = new GameObject("tab_");
|
||||
tab.transform.SetParent(obj.transform, false);
|
||||
var rt = tab.AddComponent<RectTransform>();
|
||||
rt.sizeDelta = new Vector2(110, 60);
|
||||
var tabcard = tab.AddComponent<TabCardBase>();
|
||||
tabcard.images = new Image[2];
|
||||
tabcard.texts = new TextMeshProUGUI[1];
|
||||
|
||||
GameObject tab_bg = new GameObject("i_bg");
|
||||
tab_bg.transform.SetParent(tab.transform, false);
|
||||
var i_bg = tab_bg.AddComponent<Image>();
|
||||
tabcard.images[0] = i_bg;
|
||||
var bgRect = tab_bg.GetComponent<RectTransform>();
|
||||
bgRect.anchorMin = new Vector2(0, 0);
|
||||
bgRect.anchorMax = new Vector2(1, 1);
|
||||
bgRect.offsetMin = new Vector2(0, 0); // Custom Stretch 적용
|
||||
bgRect.offsetMax = new Vector2(0, 0); // Custom Stretch 적용
|
||||
i_bg.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
tab_bg.AddComponent<Button>();
|
||||
tab_bg.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
GameObject tab_img = new GameObject("i_img");
|
||||
tab_img.transform.SetParent(tab.transform, false);
|
||||
var i_img = tab_img.AddComponent<Image>();
|
||||
tabcard.images[1] = i_img;
|
||||
i_img.rectTransform.sizeDelta = new Vector2(100, 50);
|
||||
i_img.raycastTarget = false;
|
||||
i_img.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/ResWork/UI/NewRes/bg/whitebg.png");
|
||||
i_img.color = Color.black;
|
||||
tab_img.AddComponent<Button>();
|
||||
tab_img.AddComponent<PlayClickSound_Only>();
|
||||
|
||||
// TextMeshPro-UGUI 생성 및 설정
|
||||
GameObject textObject = new GameObject("btnName", typeof(TextMeshProUGUI));
|
||||
//textObject.AddComponent<SetLocalText>();
|
||||
TextMeshProUGUI tmp = textObject.GetComponent<TextMeshProUGUI>();
|
||||
tabcard.texts[0] = tmp;
|
||||
tmp.text = "Tab";
|
||||
tmp.alignment = TextAlignmentOptions.Midline;
|
||||
|
||||
// Text 객체의 부모 설정
|
||||
textObject.transform.SetParent(tab.transform, false);
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.anchorMin = Vector2.zero;
|
||||
textRect.anchorMax = Vector2.one;
|
||||
textRect.offsetMin = Vector2.zero;
|
||||
textRect.offsetMax = Vector2.zero;
|
||||
|
||||
// 버튼 오브젝트의 부모 설정
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
obj.transform.SetParent(Selection.activeGameObject.transform, false);
|
||||
SetLayerRecursively(obj);
|
||||
|
||||
// 새로 생성된 오브젝트를 선택
|
||||
Selection.activeGameObject = obj;
|
||||
|
||||
// 씬 뷰에서 해당 오브젝트에 포커스 맞추기
|
||||
//SceneView.lastActiveSceneView.FrameSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e79a94deb1421a5439e358263f83dee6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -34267,18 +34267,18 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3352638603616735713}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 7853837219095294745}
|
||||
m_Father: {fileID: 6913852074128511511}
|
||||
m_Father: {fileID: 6678857581749354256}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -100, y: -100}
|
||||
m_AnchoredPosition: {x: 107.37, y: 0}
|
||||
m_SizeDelta: {x: -314.74, y: -100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2297552932747190140
|
||||
CanvasRenderer:
|
||||
|
|
@ -77741,7 +77741,7 @@ RectTransform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3601566114630573212}
|
||||
- {fileID: 3993528460999206251}
|
||||
- {fileID: 6678857581749354256}
|
||||
m_Father: {fileID: 6291925347982253742}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
|
|
@ -77761,9 +77761,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: f73c79f5002371e40959a8bff4934250, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ScrollRect: {fileID: 7215262625088816806}
|
||||
m_Content: {fileID: 0}
|
||||
go_card: {fileID: 2049222013532293221, guid: 54ac966e49ef67447b0c2768f19f612e, type: 3}
|
||||
--- !u!1 &8034583506025616827
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -88771,6 +88768,58 @@ MonoBehaviour:
|
|||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &9063278578834916780
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6678857581749354256}
|
||||
- component: {fileID: 7333479813124819384}
|
||||
m_Layer: 5
|
||||
m_Name: WorldMap
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6678857581749354256
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9063278578834916780}
|
||||
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:
|
||||
- {fileID: 3993528460999206251}
|
||||
m_Father: {fileID: 6913852074128511511}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7333479813124819384
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9063278578834916780}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: acfc07cdb245dfc48ac1995193349d68, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ScrollRect: {fileID: 0}
|
||||
m_Content: {fileID: 0}
|
||||
go_card: {fileID: 0}
|
||||
--- !u!1 &9063346854215366529
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
using PlayFab.ClientModels;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CardBase : MyCoroutine
|
||||
{
|
||||
public virtual void Set() { Set_Active(); }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TabCardBase : CardBase
|
||||
{
|
||||
public Image[] images; // 0 bg, 1 이미지
|
||||
public TextMeshProUGUI[] texts; // 0 탭 이름
|
||||
|
||||
public void OnClick_Tab()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b90565ce35523545a46489568526eab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class TabUIData
|
||||
{
|
||||
public string btnBGImg_on, btnBGImg_off;
|
||||
public string btnImg_on, btnImg_off;
|
||||
public string btnNameImage_on, btnNameImage_off;
|
||||
public string btnName;
|
||||
|
||||
public Action onClick;
|
||||
}
|
||||
|
||||
public class TabUIBase : uScrollViewMgr
|
||||
{
|
||||
public void Set(List<TabUIData> lst)
|
||||
{
|
||||
Set_ScrollView(lst);
|
||||
list_CardBase.ForEach(f => f.Set());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c59c676661fa80a4d96e1cb19e6a0fb0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -2,11 +2,14 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MapChoiceUI : uScrollViewMgr
|
||||
public class MapChoiceUI : BackKeyAdd
|
||||
{
|
||||
|
||||
int ChoiceTab = 0; // 0 월드맵, 1 던전
|
||||
|
||||
public override void Set()
|
||||
{
|
||||
base.Set();
|
||||
Set_ScrollView(table_battlemapconfig.Ins.Get_DataList());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MapChoiceUI_WorldMap : uScrollViewMgr
|
||||
{
|
||||
public override void Set()
|
||||
{
|
||||
base.Set();
|
||||
Set_ScrollView(table_battlemapconfig.Ins.Get_DataList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: acfc07cdb245dfc48ac1995193349d68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue