123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.Events;
- [RequireComponent(typeof(Localize))]
- [RequireComponent(typeof(UILabel))]
- public class NGUILabelSpacingHold : MonoBehaviour
- {
- private void Awake()
- {
- if (this.callAwake)
- {
- return;
- }
- this.callAwake = true;
- this.localize = base.GetComponent<Localize>();
- this.label = base.GetComponent<UILabel>();
- if (this.localize != null && this.label != null)
- {
- this.localize.LocalizeEvent.AddListener(new UnityAction(this.OnLocalize));
- if (this.label.useFloatSpacing)
- {
- this.HoldSpacingX = this.label.floatSpacingX;
- this.HoldSpacingY = this.label.floatSpacingY;
- }
- else
- {
- this.HoldSpacingX = (float)this.label.spacingX;
- this.HoldSpacingY = (float)this.label.spacingY;
- }
- this.updateReq = true;
- this.OnLocalize();
- }
- }
- public void OnLocalize()
- {
- if (!this.callAwake)
- {
- this.Awake();
- }
- if (!this.updateReq)
- {
- return;
- }
- if (LocalizationManager.CurrentLanguageCode == "ja")
- {
- if (this.label.useFloatSpacing)
- {
- this.label.floatSpacingX = this.HoldSpacingX;
- this.label.floatSpacingY = this.HoldSpacingY;
- }
- else
- {
- this.label.spacingX = (int)this.HoldSpacingX;
- this.label.spacingY = (int)this.HoldSpacingY;
- }
- }
- else if (this.label.useFloatSpacing)
- {
- UILabel uilabel = this.label;
- float num = 0f;
- this.label.floatSpacingY = num;
- uilabel.floatSpacingX = num;
- }
- else
- {
- UILabel uilabel2 = this.label;
- int num2 = 0;
- this.label.spacingY = num2;
- uilabel2.spacingX = num2;
- }
- }
- private float HoldSpacingX;
- private float HoldSpacingY;
- private bool updateReq;
- private bool callAwake;
- private Localize localize;
- private UILabel label;
- }
|