123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using wf;
- 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_uiMsg.gameObject.AddComponent<Localize>();
- 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_uiLabelA.gameObject.AddComponent<Localize>();
- 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>();
- this.m_uiLabelB.gameObject.AddComponent<Localize>();
- this.m_goSelectC = UTY.GetChildObject(base.gameObject, "Base/SelectC", true);
- if (this.m_goSelectC != null)
- {
- this.m_uiBtnSelectC = this.m_goSelectC.GetComponent<UIButton>();
- this.m_uiLabelC = UTY.GetChildObject(this.m_goSelectC, "label", false).GetComponent<UILabel>();
- this.m_uiLabelC.gameObject.AddComponent<Localize>();
- this.m_goSelectC.SetActive(false);
- }
- EventDelegate.Set(this.m_uiBtnSelectA.onClick, new EventDelegate.Callback(this.OnClickA));
- EventDelegate.Set(this.m_uiBtnSelectB.onClick, new EventDelegate.Callback(this.OnClickB));
- if (this.m_uiBtnSelectC != null)
- {
- EventDelegate.Set(this.m_uiBtnSelectC.onClick, new EventDelegate.Callback(this.OnClickC));
- }
- base.gameObject.SetActive(false);
- }
- public void SetOnClickCallBack(string f_strA, FFNameDialog.OnClick f_dgA, string f_strB, FFNameDialog.OnClick f_dgB, string f_strC, FFNameDialog.OnClick f_dgC)
- {
- this.m_dgOnClickA = f_dgA;
- this.m_dgOnClickB = f_dgB;
- this.m_dgOnClickC = f_dgC;
- 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);
- }
- if (this.m_dgOnClickC == null)
- {
- this.m_dgOnClickC = new FFNameDialog.OnClick(this.OnCloseDefaultEvent);
- }
- if (!string.IsNullOrEmpty(f_strA))
- {
- this.m_uiLabelA.text = f_strA;
- }
- if (!string.IsNullOrEmpty(f_strB))
- {
- this.m_uiLabelB.text = f_strB;
- }
- if (this.m_uiLabelC != null && !string.IsNullOrEmpty(f_strC))
- {
- this.m_uiLabelC.text = f_strC;
- }
- }
- public void Show(string f_strMsg, string f_strA, FFNameDialog.OnClick f_dgA, string f_strB, FFNameDialog.OnClick f_dgB, string f_strC, FFNameDialog.OnClick f_dgC)
- {
- if (this.selectABPostion != null)
- {
- this.selectABPostion.Apply();
- }
- NDebug.Assert(this.m_bDecided, "ダイアログの二重呼出しはできません。");
- if (!string.IsNullOrEmpty(f_strMsg))
- {
- this.m_uiMsg.text = f_strMsg;
- Utility.SetLocalizeTerm(this.m_uiMsg, f_strMsg, false);
- }
- this.SetOnClickCallBack(f_strA, f_dgA, f_strB, f_dgB, f_strC, f_dgC);
- 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)
- {
- Utility.SetLocalizeTerm(this.m_uiMsg, messageTerm, true);
- Utility.SetLocalizeTerm(this.m_uiLabelA, resultATerm, true);
- Utility.SetLocalizeTerm(this.m_uiLabelB, resultBTerm, true);
- this.Show(null, null, f_dgA, null, f_dgB, null, null);
- }
- public void ShowFromLanguageTerm(string messageTerm, string resultATerm, FFNameDialog.OnClick f_dgA, string resultBTerm, FFNameDialog.OnClick f_dgB, string resultCTerm, FFNameDialog.OnClick f_dgC)
- {
- Utility.SetLocalizeTerm(this.m_uiMsg, messageTerm, true);
- Utility.SetLocalizeTerm(this.m_uiLabelA, resultATerm, true);
- Utility.SetLocalizeTerm(this.m_uiLabelB, resultBTerm, true);
- Utility.SetLocalizeTerm(this.m_uiLabelC, resultCTerm, true);
- this.Show(null, null, f_dgA, null, f_dgB, null, f_dgC);
- if (this.selectCPostion != null)
- {
- this.selectCPostion.Apply();
- }
- }
- 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;
- this.m_dgOnClickC = 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 OnClickC()
- {
- this.m_bDecided = true;
- if (this.m_dgOnClickC != null)
- {
- FFNameDialog.OnClick dgOnClickC = this.m_dgOnClickC;
- this.m_dgOnClickC = null;
- dgOnClickC();
- }
- }
- private void OnCloseDefaultEvent()
- {
- GameMain.Instance.SysDlg.Close();
- }
- [SerializeField]
- private UIWFPositionStore selectABPostion;
- [SerializeField]
- private UIWFPositionStore selectCPostion;
- 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_goSelectC;
- private UIButton m_uiBtnSelectC;
- private UILabel m_uiLabelC;
- private GameObject m_goMsg;
- private UILabel m_uiMsg;
- private UIPanel m_uiPanel;
- private FFNameDialog.OnClick m_dgOnClickA;
- private FFNameDialog.OnClick m_dgOnClickB;
- private FFNameDialog.OnClick m_dgOnClickC;
- private bool m_bDecided = true;
- public delegate void OnClick();
- }
|