123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- using System;
- using I2.Loc;
- using UnityEngine;
- public class FFNameDialog : MonoBehaviour
- {
- public bool IsDecided
- {
- get
- {
- return this.m_bDecided;
- }
- }
- 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_goSelectA = UTY.GetChildObject(base.gameObject, "Base/SelectA", false);
- this.m_uiBtnSelectA = this.m_goSelectA.GetComponent<UIButton>();
- this.m_uiLabelA = UTY.GetChildObject(this.m_goSelectA, "label", false).GetComponent<UILabel>();
- this.m_goSelectB = UTY.GetChildObject(base.gameObject, "Base/SelectB", false);
- this.m_uiBtnSelectB = this.m_goSelectB.GetComponent<UIButton>();
- this.m_uiLabelB = UTY.GetChildObject(this.m_goSelectB, "label", false).GetComponent<UILabel>();
- EventDelegate.Set(this.m_uiBtnSelectA.onClick, new EventDelegate.Callback(this.OnClickA));
- EventDelegate.Set(this.m_uiBtnSelectB.onClick, new EventDelegate.Callback(this.OnClickB));
- base.gameObject.SetActive(false);
- }
- public void SetOnClickCallBack(string f_strA, FFNameDialog.OnClick f_dgA, string f_strB, FFNameDialog.OnClick f_dgB = null)
- {
- this.m_dgOnClickA = f_dgA;
- this.m_dgOnClickB = f_dgB;
- if (this.m_dgOnClickA == null)
- {
- this.m_dgOnClickA = new FFNameDialog.OnClick(this.OnCloseDefaultEvent);
- }
- if (this.m_dgOnClickB == null)
- {
- this.m_dgOnClickB = new FFNameDialog.OnClick(this.OnCloseDefaultEvent);
- }
- this.m_uiLabelA.text = f_strA;
- this.m_uiLabelB.text = f_strB;
- }
- public void Show(string f_strMsg, string f_strA, FFNameDialog.OnClick f_dgA, string f_strB, FFNameDialog.OnClick f_dgB = null)
- {
- NDebug.Assert(this.m_bDecided, "ダイアログの二重呼出しはできません。");
- this.m_uiMsg.text = f_strMsg;
- this.SetOnClickCallBack(f_strA, f_dgA, f_strB, f_dgB);
- base.gameObject.SetActive(true);
- iTween.StopByName(base.gameObject, "ffdlg");
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "name",
- "ffdlg",
- "from",
- this.m_uiPanel.alpha,
- "to",
- 1.0,
- "time",
- 0.3,
- "onUpdate",
- "UpdateAlpha"
- }));
- this.m_bDecided = false;
- }
- public void ShowFromLanguageTerm(string messageTerm, string resultATerm, FFNameDialog.OnClick f_dgA, string resultBTerm, FFNameDialog.OnClick f_dgB = null)
- {
- messageTerm = LocalizationManager.GetTranslation(messageTerm, true, 0, true, false, null, null);
- resultATerm = LocalizationManager.GetTranslation(resultATerm, true, 0, true, false, null, null);
- resultBTerm = LocalizationManager.GetTranslation(resultBTerm, true, 0, true, false, null, null);
- this.Show(messageTerm, resultATerm, f_dgA, resultBTerm, f_dgB);
- }
- 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_dgOnClickA = null;
- this.m_dgOnClickB = null;
- }
- public void Close()
- {
- if (base.gameObject.activeSelf)
- {
- iTween.StopByName(base.gameObject, "ffdlg");
- iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
- {
- "name",
- "ffdlg",
- "from",
- this.m_uiPanel.alpha,
- "to",
- 0.0,
- "time",
- 0.3,
- "onUpdate",
- "UpdateAlpha",
- "onComplete",
- "CompleteHide"
- }));
- }
- }
- private void OnClickA()
- {
- this.m_bDecided = true;
- if (this.m_dgOnClickA != null)
- {
- FFNameDialog.OnClick dgOnClickA = this.m_dgOnClickA;
- this.m_dgOnClickA = null;
- dgOnClickA();
- }
- }
- private void OnClickB()
- {
- this.m_bDecided = true;
- if (this.m_dgOnClickB != null)
- {
- FFNameDialog.OnClick dgOnClickB = this.m_dgOnClickB;
- this.m_dgOnClickB = null;
- dgOnClickB();
- }
- }
- private void OnCloseDefaultEvent()
- {
- GameMain.Instance.SysDlg.Close();
- }
- private GameObject m_goSelectA;
- private UIButton m_uiBtnSelectA;
- private UILabel m_uiLabelA;
- private GameObject m_goSelectB;
- private UIButton m_uiBtnSelectB;
- private UILabel m_uiLabelB;
- private GameObject m_goMsg;
- private UILabel m_uiMsg;
- private UIPanel m_uiPanel;
- private FFNameDialog.OnClick m_dgOnClickA;
- private FFNameDialog.OnClick m_dgOnClickB;
- private bool m_bDecided = true;
- public delegate void OnClick();
- }
|