| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 | using System;using I2.Loc;using UnityEngine;public class SystemDialog : MonoBehaviour{	public bool IsDecided	{		get		{			return this.m_bDecided;		}	}	private void Awake()	{	}	public void Init()	{		this.m_uiPanel = base.gameObject.GetComponent<UIPanel>();		this.m_goMsg = UTY.GetChildObject(base.gameObject, "Base/Message", false);		this.m_uiMsg = this.m_goMsg.GetComponent<UILabel>();		this.m_goOk = UTY.GetChildObject(base.gameObject, "Base/Ok", false);		this.m_uiBtnOk = this.m_goOk.GetComponent<UIButton>();		this.m_goCancel = UTY.GetChildObject(base.gameObject, "Base/Cancel", false);		this.m_uiBtnCancel = this.m_goCancel.GetComponent<UIButton>();		this.m_goOk.SetActive(false);		this.m_goCancel.SetActive(false);		EventDelegate.Set(this.m_uiBtnOk.onClick, new EventDelegate.Callback(this.OnClickOk));		EventDelegate.Set(this.m_uiBtnCancel.onClick, new EventDelegate.Callback(this.OnClickCancel));		base.gameObject.SetActive(false);	}	private void Start()	{	}	public void SetOnClickCallBack(SystemDialog.OnClick f_dgOk, SystemDialog.OnClick f_dgCancel = null)	{		this.m_dgOnClickOk = f_dgOk;		this.m_dgOnClickCancel = f_dgCancel;	}	public void Show(string f_strMsg, SystemDialog.TYPE f_eType, SystemDialog.OnClick f_dgOk = null, SystemDialog.OnClick f_dgCancel = null)	{		if (!this.m_bDecided)		{			NDebug.Assert("ダイアログの二重呼出しはできません。", false);		}		if (string.IsNullOrEmpty(f_strMsg))		{			f_strMsg = string.Empty;		}		this.m_uiMsg.text = f_strMsg.Replace('|', '\n');		this.m_goOk.SetActive(true);		if (f_eType == SystemDialog.TYPE.OK_CANCEL || f_eType == SystemDialog.TYPE.YES_NO)		{			this.m_goCancel.SetActive(true);		}		else		{			this.m_goCancel.SetActive(false);		}		if (f_eType == SystemDialog.TYPE.OK_CANCEL || f_eType == SystemDialog.TYPE.OK)		{			this.m_goOk.GetComponent<UIButton>().normalSprite = "cm3d2_dialog_buttom_ok";			this.m_goCancel.GetComponent<UIButton>().normalSprite = "cm3d2_dialog_buttom_cancel";		}		else if (f_eType == SystemDialog.TYPE.YES_NO)		{			this.m_goOk.GetComponent<UIButton>().normalSprite = "cm3d2_dialog_buttom_yes";			this.m_goCancel.GetComponent<UIButton>().normalSprite = "cm3d2_dialog_buttom_no";		}		if (f_dgOk == null)		{			f_dgOk = new SystemDialog.OnClick(this.OnCloseDefaultEvent);		}		if (f_dgCancel == null)		{			f_dgCancel = new SystemDialog.OnClick(this.OnCloseDefaultEvent);		}		if (f_dgOk != null)		{			if (f_dgCancel == null)			{				this.SetOnClickCallBack(f_dgOk, null);			}			else			{				this.SetOnClickCallBack(f_dgOk, f_dgCancel);			}		}		base.gameObject.SetActive(true);		iTween.StopByName(base.gameObject, "sysdlg");		iTween.ValueTo(base.gameObject, iTween.Hash(new object[]		{			"name",			"sysdlg",			"from",			this.m_uiPanel.alpha,			"to",			1.0,			"time",			0.3 * (double)GameMain.Instance.CMSystem.FadeSpeedRate,			"onUpdate",			"UpdateAlpha"		}));		this.m_bDecided = false;	}	public void ShowFromLanguageTerm(string messageTerm, SystemDialog.TYPE f_eType, SystemDialog.OnClick f_dgOk = null, SystemDialog.OnClick f_dgCancel = null)	{		this.Show(LocalizationManager.GetTranslation(messageTerm, true, 0, true, false, null, null), f_eType, f_dgOk, f_dgCancel);	}	public void UpdateAlpha(float f_fNewValue)	{		this.m_uiPanel.alpha = f_fNewValue;	}	public void CompleteHide()	{		this.Hide();	}	public void Hide()	{		base.gameObject.SetActive(false);		this.m_goOk.SetActive(false);		this.m_goCancel.SetActive(false);		this.m_dgOnClickOk = null;		this.m_dgOnClickCancel = null;	}	public void Close()	{		if (base.gameObject.activeSelf)		{			iTween.StopByName(base.gameObject, "sysdlg");			iTween.ValueTo(base.gameObject, iTween.Hash(new object[]			{				"name",				"sysdlg",				"from",				this.m_uiPanel.alpha,				"to",				0.0,				"time",				0.3 * (double)GameMain.Instance.CMSystem.FadeSpeedRate,				"onUpdate",				"UpdateAlpha",				"onComplete",				"CompleteHide"			}));		}	}	private void OnClickOk()	{		this.m_bDecided = true;		if (this.m_dgOnClickOk != null)		{			SystemDialog.OnClick dgOnClickOk = this.m_dgOnClickOk;			this.m_dgOnClickOk = null;			dgOnClickOk();		}	}	private void OnClickCancel()	{		this.m_bDecided = true;		if (this.m_dgOnClickCancel != null)		{			SystemDialog.OnClick dgOnClickCancel = this.m_dgOnClickCancel;			this.m_dgOnClickCancel = null;			dgOnClickCancel();		}	}	private void OnCloseDefaultEvent()	{		GameMain.Instance.SysDlg.Close();	}	private void Update()	{	}	private GameObject m_goOk;	private UIButton m_uiBtnOk;	private GameObject m_goCancel;	private UIButton m_uiBtnCancel;	private GameObject m_goMsg;	private UILabel m_uiMsg;	private UIPanel m_uiPanel;	private SystemDialog.OnClick m_dgOnClickOk;	private SystemDialog.OnClick m_dgOnClickCancel;	private bool m_bDecided = true;	public delegate void OnClick();	public enum TYPE	{		OK,		OK_CANCEL,		YES_NO	}}
 |