using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CallerInfo : MonoBehaviour
{
    public Text caller;
    public Text tele;
    public Text location;
    public Text scale;
    public Text reason;
    public Text trapped;
    public Text dangerlv;
    public Text explosive;
    private void Awake()
    {
        if (caller == null)
        {
            caller = transform.Find("CallerName").GetComponent<Text>();
        }
        if (tele == null)
        {
            tele = transform.Find("TeleNumber").GetComponent<Text>();
        }
        if (location == null)
        {
            location = transform.Find("FireLocationInfo").GetComponent<Text>();
        }
        if (scale == null)
        {
            scale = transform.Find("FireScaleValue").GetComponent<Text>();
        }
        if (reason == null)
        {
            reason = transform.Find("FireReasonInfo").GetComponent<Text>();
        }
        if (trapped == null)
        {
            trapped = transform.Find("Trapped").GetComponent<Text>();
        }
        if (dangerlv == null)
        {
            dangerlv = transform.Find("DangerLevelValue").GetComponent<Text>();
        }
        if (explosive == null)
        {
            explosive = transform.Find("Explosive").GetComponent<Text>();
        }
    }
    private void OnEnable()
    {
        if (GameSettings.disasterSetting.policeCallData != null)
        {
            caller.text = GameSettings.disasterSetting.policeCallData.Name;
            tele.text = GameSettings.disasterSetting.policeCallData.Phone;
            location.text = GameSettings.disasterSetting.policeCallData.FirePlace;
            scale.text = GameSettings.disasterSetting.policeCallData.FireArea;
            reason.text = GameSettings.disasterSetting.policeCallData.FireReason;
            trapped.text = GameSettings.disasterSetting.policeCallData.HasTrapped;
            dangerlv.text = GameSettings.disasterSetting.policeCallData.FireLevel;
            explosive.text = GameSettings.disasterSetting.policeCallData.HasDangerous;
        }       
    }
}