add AutoCookPopcornView.cs

This commit is contained in:
kimura 2022-04-15 13:14:37 +09:00
parent e7e1a3a634
commit 159ebede22
3 changed files with 42 additions and 0 deletions

View File

@ -198,6 +198,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 6831151528247145238}
- component: {fileID: 4548802736317939859}
m_Layer: 0
m_Name: Caution_Popcorn
m_TagString: Untagged
@ -226,6 +227,20 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 126, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4548802736317939859
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6831151528247145225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2df417e1f2b649c2bd38ea6627e453f2, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 2839662489855195786}
amountText: {fileID: 5295873688389667479}
--- !u!1001 &376329890749371454
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,24 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace MyGame.Scenes.Main.Scripts
{
public class AutoCookPopcornView : MonoBehaviour
{
[SerializeField] private Transform target;
[SerializeField] private Text amountText;
public void SetView(ProductData data)
{
target.DestroyAllChildrens();
Instantiate(data.GetIconPrefab(), target);
amountText.text = $"×{data.volume}";
}
public void SetActive(bool active)
{
gameObject.SetActive(active);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2df417e1f2b649c2bd38ea6627e453f2
timeCreated: 1649994565