From 64ae6ce8dc05979a94960dcb341868b766f96fce Mon Sep 17 00:00:00 2001 From: seiji Date: Mon, 18 Nov 2019 17:41:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AE=E6=AE=8B?= =?UTF-8?q?=E3=82=8A=E6=97=A5=E6=95=B0=E3=81=AE=E8=A1=A8=E7=A4=BA=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・PlaceButtonLayoutクラスを作成し、ボタンの情報の表示をしてくれるようにしました。 --- Assets/Prefab/PlaceDataButton.prefab | 311 ++++++++++++++++++++++ Assets/Prefab/PlaceDataButton.prefab.meta | 7 + Assets/Scenes/MainScene.unity | 2 +- Assets/Script/LayOutTextList.cs | 15 +- Assets/Script/Main_UI.cs | 5 +- Assets/Script/PlaceButtonLayout.cs | 23 ++ Assets/Script/PlaceButtonLayout.cs.meta | 11 + Assets/cleanPlaceData.json | 6 +- 8 files changed, 366 insertions(+), 14 deletions(-) create mode 100644 Assets/Prefab/PlaceDataButton.prefab create mode 100644 Assets/Prefab/PlaceDataButton.prefab.meta create mode 100644 Assets/Script/PlaceButtonLayout.cs create mode 100644 Assets/Script/PlaceButtonLayout.cs.meta diff --git a/Assets/Prefab/PlaceDataButton.prefab b/Assets/Prefab/PlaceDataButton.prefab new file mode 100644 index 0000000..8afb6f0 --- /dev/null +++ b/Assets/Prefab/PlaceDataButton.prefab @@ -0,0 +1,311 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1937658540338841396 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 536362859364056204} + - component: {fileID: 4786355366862777350} + - component: {fileID: 6413193610772337964} + m_Layer: 5 + m_Name: limitTime + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &536362859364056204 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937658540338841396} + 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_Children: [] + m_Father: {fileID: 8097759134289559650} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 81.82501, y: 0} + m_SizeDelta: {x: -163.65, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4786355366862777350 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937658540338841396} + m_CullTransparentMesh: 0 +--- !u!114 &6413193610772337964 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1937658540338841396} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 82 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 14 + m_MaxSize: 82 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button +--- !u!1 &6353647976271927709 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8097759134289559650} + - component: {fileID: 7226254132798090550} + - component: {fileID: 4017220420071378545} + - component: {fileID: 398985314969304470} + - component: {fileID: 4266080359689815398} + - component: {fileID: 7296051779640070793} + m_Layer: 5 + m_Name: PlaceDataButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8097759134289559650 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + 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_Children: + - {fileID: 2286364264971667136} + - {fileID: 536362859364056204} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 474.5988, y: 266.69095} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7226254132798090550 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + m_CullTransparentMesh: 0 +--- !u!114 &4017220420071378545 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + 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: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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!114 &398985314969304470 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 4017220420071378545} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &4266080359689815398 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 1 + m_MinHeight: 83.1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &7296051779640070793 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6353647976271927709} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 050c881062c8c2447bae9c339d2863ca, type: 3} + m_Name: + m_EditorClassIdentifier: + placeText: {fileID: 2222667252034976192} + limitText: {fileID: 6413193610772337964} +--- !u!1 &8456519888541770355 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2286364264971667136} + - component: {fileID: 7253967428476693798} + - component: {fileID: 2222667252034976192} + m_Layer: 5 + m_Name: placeName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2286364264971667136 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8456519888541770355} + 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_Children: [] + m_Father: {fileID: 8097759134289559650} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -72.2, y: 0} + m_SizeDelta: {x: -144.3, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7253967428476693798 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8456519888541770355} + m_CullTransparentMesh: 0 +--- !u!114 &2222667252034976192 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8456519888541770355} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 82 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 14 + m_MaxSize: 82 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button diff --git a/Assets/Prefab/PlaceDataButton.prefab.meta b/Assets/Prefab/PlaceDataButton.prefab.meta new file mode 100644 index 0000000..a9838a0 --- /dev/null +++ b/Assets/Prefab/PlaceDataButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 582cce5389ab50c4fac632a5de4ae99e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index f94b7a7..e400443 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -5243,7 +5243,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d3cce1183fc3224459320fa72f79de0d, type: 3} m_Name: m_EditorClassIdentifier: - textPrefab: {fileID: 5571647834793167347, guid: b4f3cb7a69bd21c4eb9acaee925bc519, + textPrefab: {fileID: 6353647976271927709, guid: 582cce5389ab50c4fac632a5de4ae99e, type: 3} main_ui: {fileID: 648793232} --- !u!114 &1606562829 diff --git a/Assets/Script/LayOutTextList.cs b/Assets/Script/LayOutTextList.cs index 60331db..bdbaf94 100644 --- a/Assets/Script/LayOutTextList.cs +++ b/Assets/Script/LayOutTextList.cs @@ -19,9 +19,10 @@ private void Awake() /// /// textをLayOutに追加する /// - /// - public void AddText(string st) + /// + public void AddText(CleanPlaceData data) { + //ボタンの生成 var obj = Instantiate(textPrefab, rtr.position, Quaternion.identity); textButtonList.Add(obj); @@ -31,8 +32,10 @@ public void AddText(string st) objRtr.localScale = new Vector3(1, 1, 1); //テキストの書き換え - var t= obj.GetComponentInChildren(); - t.text = st; + //var t= obj.GetComponentInChildren(); + //t.text = data; + var test = obj.GetComponent(); + test.SetCleanPlaceData(data); //ボタンに関数を追加 var button = obj.GetComponent