123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using UnityEngine;
- [RequireComponent(typeof(WfFadeBasic))]
- public class SceneEditNameSettingPanel : MonoBehaviour
- {
- public Maid maid
- {
- get
- {
- return GameMain.Instance.CharacterMgr.GetMaid(0);
- }
- }
- public void Awake()
- {
- if (Product.isEnglish)
- {
- Vector3 localPosition = this.lastNameInput.transform.parent.localPosition;
- Vector3 localPosition2 = this.firstNameInput.transform.parent.localPosition;
- this.lastNameInput.transform.parent.localPosition = localPosition2;
- this.firstNameInput.transform.parent.localPosition = localPosition;
- }
- this.fadeBasic = base.GetComponent<WfFadeBasic>();
- EventDelegate.Add(this.lastNameInput.onChange, new EventDelegate.Callback(this.OnInputName));
- EventDelegate.Add(this.firstNameInput.onChange, new EventDelegate.Callback(this.OnInputName));
- EventDelegate.Add(this.enterButton.onClick, new EventDelegate.Callback(this.Close));
- EventDelegate.Add(this.cancelButton.onClick, new EventDelegate.Callback(this.Chancel));
- EventDelegate.Add(this.lastNameRandomButton.onClick, delegate()
- {
- this.lastNameInput.RemoveFocus();
- this.lastNameInput.value = MaidRandomName.GetLastName();
- });
- EventDelegate.Add(this.firstNameRandomButton.onClick, delegate()
- {
- this.firstNameInput.RemoveFocus();
- this.firstNameInput.value = MaidRandomName.GetFirstName();
- });
- this.fadeBasic.onCompleteFadeInAction = delegate(WfFadeBasic execFade)
- {
- this.lastNameInput.isSelected = true;
- };
- }
- public void Call()
- {
- this.backupLastName = this.maid.status.lastName;
- this.backupFirstName = this.maid.status.firstName;
- this.lastNameInput.value = this.backupLastName;
- this.firstNameInput.value = this.backupFirstName;
- this.fadeBasic.alpha = 0f;
- WfFadeJob.Create(this.fadeBasic, null, 0.3f, iTween.EaseType.linear);
- }
- public void Chancel()
- {
- if (this.fadeBasic.alpha != 1f)
- {
- return;
- }
- this.maid.status.lastName = this.backupLastName;
- this.maid.status.firstName = this.backupFirstName;
- this.Close();
- }
- public void Close()
- {
- this.lastNameInput.RemoveFocus();
- this.firstNameInput.RemoveFocus();
- this.fadeBasic.alpha = 1f;
- WfFadeJob.Create(null, this.fadeBasic, 0.3f, iTween.EaseType.linear);
- }
- private void OnInputName()
- {
- if (UIInput.current == this.lastNameInput)
- {
- this.maid.status.lastName = UIInput.current.value;
- }
- else
- {
- this.maid.status.firstName = UIInput.current.value;
- }
- UIInput.current.value = ((!(UIInput.current == this.lastNameInput)) ? this.maid.status.firstName : this.maid.status.lastName);
- }
- [SerializeField]
- private UIInput lastNameInput;
- [SerializeField]
- private UIButton lastNameRandomButton;
- [SerializeField]
- private UIInput firstNameInput;
- [SerializeField]
- private UIButton firstNameRandomButton;
- [SerializeField]
- private UIButton enterButton;
- [SerializeField]
- private UIButton cancelButton;
- private WfFadeBasic fadeBasic;
- private string backupLastName;
- private string backupFirstName;
- }
|