Added WindowComponents class
This commit is contained in:
@@ -605,13 +605,16 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1867692259}
|
||||
- component: {fileID: 1867692262}
|
||||
- component: {fileID: 1867692261}
|
||||
- component: {fileID: 1867692260}
|
||||
m_Layer: 5
|
||||
m_Name: SampleChild
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1867692259
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -631,6 +634,57 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1867692260
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1867692258}
|
||||
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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
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!222 &1867692261
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1867692258}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1867692262
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1867692258}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5a14e8386dd24e3793287ff572cb78f8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
<WindowImage>k__BackingField: {fileID: 1867692260}
|
||||
--- !u!1 &2038986851
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace InterfaceOff
|
||||
{
|
||||
public abstract class WindowBase : MonoBehaviour
|
||||
{
|
||||
public WindowComponents Components { get; set; }
|
||||
|
||||
public void InstantiateWindowBase()
|
||||
{
|
||||
}
|
||||
|
||||
10
Assets/Scripts/WindowComponents.cs
Normal file
10
Assets/Scripts/WindowComponents.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace InterfaceOff
|
||||
{
|
||||
public class WindowComponents : MonoBehaviour
|
||||
{
|
||||
[field: SerializeField] public Image WindowImage { get; private set; }
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/WindowComponents.cs.meta
Normal file
3
Assets/Scripts/WindowComponents.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a14e8386dd24e3793287ff572cb78f8
|
||||
timeCreated: 1768300161
|
||||
@@ -36,15 +36,18 @@ namespace InterfaceOff
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
GameObject go = Instantiate(SampleChild, GameCanvas.transform);
|
||||
Type type = WindowTypes.GetRandom();
|
||||
go.SetActive(true);
|
||||
|
||||
Type type = WindowTypes.GetRandom();
|
||||
WindowBase windowBase = go.AddComponent(type) as WindowBase;
|
||||
|
||||
if (DebugUtils.IsNull(windowBase))
|
||||
{
|
||||
Debug.LogError("How did this happen");
|
||||
return;
|
||||
}
|
||||
|
||||
windowBase.Components = go.GetComponent<WindowComponents>();
|
||||
windowBase.InstantiateWindowBase();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user