123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- using System;
- using System.Collections.Generic;
- using MaidStatus;
- using UnityEngine;
- using wf;
- namespace Kasizuki
- {
- public class MaidMiniStatusCtrl : NGUIWindow, IStatusCtrl<Maid>
- {
- protected override void Awake()
- {
- base.Awake();
- base.CacheChildObject<UILabel>("FirstName/Value", "FirstName");
- base.CacheChildObject<UILabel>("LastName/Value", "LastName");
- base.CacheChildObject<UILabel>("Column1/Character/Value", "Personal");
- base.CacheChildObject<UILabel>("Column1/SexExperience/Value", "SexualExp");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Height/Value", "Height");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Weight/Value", "Weight");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Bust/Value", "Bust");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Bust/Cup/Value", "Cup");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Waist/Value", "Waist");
- base.CacheChildObject<UILabel>("Column1/BodySize/Parent/Hip/Value", "Hip");
- base.CacheChildObject<UILabel>("WorkCount/Value", "WorkCount");
- MaidAppealComment maidAppealComment = base.CacheChildObject<MaidAppealComment>("AppealComment", "Appeal");
- MaidAppealComment maidAppealComment2 = maidAppealComment;
- maidAppealComment2.onClickRight = (Action)Delegate.Combine(maidAppealComment2.onClickRight, new Action(delegate
- {
- this.ChangeMaidAppeal(1);
- }));
- MaidAppealComment maidAppealComment3 = maidAppealComment;
- maidAppealComment3.onClickLeft = (Action)Delegate.Combine(maidAppealComment3.onClickLeft, new Action(delegate
- {
- this.ChangeMaidAppeal(-1);
- }));
- UIInput uiinput = base.CacheChildObject<UIInput>("FreeCommentWindow/FreeComment", "FreeComment");
- EventDelegate.Add(uiinput.onChange, new EventDelegate.Callback(this.OnChangeFreeComment));
- this.m_IsAwaked = true;
- }
- public void SetData(Maid maid)
- {
- if (maid == null)
- {
- NDebug.Warning("情報を表示するメイドにnullが指定されました。");
- return;
- }
- this.m_TargetMaid = maid;
- this.UpdateNGUILabel();
- }
- public void UpdateMaidInfo()
- {
- if (this.m_TargetMaid == null)
- {
- NDebug.Warning("情報を表示するメイドがnullでした。SetMaid( Maid )関数で、情報を表示するメイドを指定してください。");
- return;
- }
- this.UpdateNGUILabel();
- }
- private void UpdateNGUILabel()
- {
- if (!this.m_IsAwaked)
- {
- base.gameObject.SetActive(true);
- }
- Maid targetMaid = this.m_TargetMaid;
- Status status = targetMaid.status;
- base.GetCache<UILabel>("FirstName").text = status.firstName;
- base.GetCache<UILabel>("LastName").text = status.lastName;
- UILabel cache = base.GetCache<UILabel>("Personal");
- cache.fontSize = 25;
- cache.text = status.personal.drawName;
- Utility.ResizeUILabelFontSize(cache, 251);
- base.GetCache<UILabel>("SexualExp").text = EnumConvert.GetString(status.seikeiken);
- base.GetCache<UILabel>("Height").text = status.body.height.ToString();
- base.GetCache<UILabel>("Weight").text = status.body.weight.ToString();
- base.GetCache<UILabel>("Bust").text = status.body.bust.ToString();
- base.GetCache<UILabel>("Cup").text = status.body.cup;
- base.GetCache<UILabel>("Waist").text = status.body.waist.ToString();
- base.GetCache<UILabel>("Hip").text = status.body.hip.ToString();
- int maidData = GameMain.Instance.KasizukiMgr.GetMaidData<int>(targetMaid, MaidDataType.仕事回数, false);
- base.GetCache<UILabel>("WorkCount").text = maidData.ToString();
- string maidData2 = GameMain.Instance.KasizukiMgr.GetMaidData<string>(targetMaid, MaidDataType.フリ\u30FCコメント, false);
- base.GetCache<UIInput>("FreeComment").value = maidData2;
- this.ChangeMaidAppeal(0);
- }
- private void ChangeMaidAppeal(int relativeIndex)
- {
- MaidAppealComment cache = base.GetCache<MaidAppealComment>("Appeal");
- Maid targetMaid = this.m_TargetMaid;
- int maidData = GameMain.Instance.KasizukiMgr.GetMaidData<int>(targetMaid, MaidDataType.アピ\u30FCル欄, false);
- List<AppealData.Data> datas = AppealData.GetDatas(targetMaid);
- if (AppealData.Contains(maidData))
- {
- AppealData.Data relativeAppealData = this.GetRelativeAppealData(datas, AppealData.GetData(maidData), relativeIndex);
- if (relativeAppealData != null)
- {
- this.SetAppealImage(relativeAppealData);
- }
- }
- else if (datas.Count > 0)
- {
- this.SetAppealImage(datas[0]);
- }
- }
- private void SetAppealImage(AppealData.Data data)
- {
- MaidAppealComment cache = base.GetCache<MaidAppealComment>("Appeal");
- cache.ChangeImage(data.GetTexture());
- GameMain.Instance.KasizukiMgr.SetMaidData<int>(this.m_TargetMaid, MaidDataType.アピ\u30FCル欄, data.ID, false);
- }
- private AppealData.Data GetRelativeAppealData(List<AppealData.Data> list, AppealData.Data now, int index)
- {
- if (list == null || now == null)
- {
- return null;
- }
- int num = -1;
- if (list.Count > 0)
- {
- num = list.IndexOf(now);
- }
- if (num >= 0 && 0 <= num + index && num + index < list.Count)
- {
- return list[num + index];
- }
- return null;
- }
- private void OnChangeFreeComment()
- {
- if (this.m_TargetMaid == null)
- {
- Debug.LogWarning("フリーコメント欄に文字が入力されましたが、選択中のメイドが存在しないので何もしません。");
- return;
- }
- string value = UIInput.current.value;
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- kasizukiMgr.SetMaidData<string>(this.m_TargetMaid, MaidDataType.フリ\u30FCコメント, value, false);
- }
- private string AdjustStrLengthIfOver(string str, int length)
- {
- if (str.Length > length)
- {
- str = str.Substring(length);
- Debug.LogError(string.Format("入力された文字数が最大文字数を超えています。入力文字={0}, 最大文字数={1}", str, length));
- }
- return str;
- }
- private const int MAX_FREE_COMMENT_LENGTH = 70;
- private Maid m_TargetMaid;
- private bool m_IsAwaked;
- }
- }
|