using System; using System.Collections.Generic; using MaidStatus; using UnityEngine; using wf; namespace Kasizuki { public class MaidMiniStatusCtrl : NGUIWindow, IStatusCtrl { protected override void Awake() { base.Awake(); base.CacheChildObject("FirstName/Value", "FirstName"); base.CacheChildObject("LastName/Value", "LastName"); base.CacheChildObject("Column1/Character/Value", "Personal"); base.CacheChildObject("Column1/SexExperience/Value", "SexualExp"); base.CacheChildObject("Column1/BodySize/Parent/Height/Value", "Height"); base.CacheChildObject("Column1/BodySize/Parent/Weight/Value", "Weight"); base.CacheChildObject("Column1/BodySize/Parent/Bust/Value", "Bust"); base.CacheChildObject("Column1/BodySize/Parent/Bust/Cup/Value", "Cup"); base.CacheChildObject("Column1/BodySize/Parent/Waist/Value", "Waist"); base.CacheChildObject("Column1/BodySize/Parent/Hip/Value", "Hip"); base.CacheChildObject("WorkCount/Value", "WorkCount"); MaidAppealComment maidAppealComment = base.CacheChildObject("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("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("FirstName").text = status.firstName; base.GetCache("LastName").text = status.lastName; UILabel cache = base.GetCache("Personal"); cache.fontSize = 25; cache.text = status.personal.drawName; Utility.ResizeUILabelFontSize(cache, 251); base.GetCache("SexualExp").text = EnumConvert.GetString(status.seikeiken); base.GetCache("Height").text = status.body.height.ToString(); base.GetCache("Weight").text = status.body.weight.ToString(); base.GetCache("Bust").text = status.body.bust.ToString(); base.GetCache("Cup").text = status.body.cup; base.GetCache("Waist").text = status.body.waist.ToString(); base.GetCache("Hip").text = status.body.hip.ToString(); int maidData = GameMain.Instance.KasizukiMgr.GetMaidData(targetMaid, MaidDataType.仕事回数, false); base.GetCache("WorkCount").text = maidData.ToString(); string maidData2 = GameMain.Instance.KasizukiMgr.GetMaidData(targetMaid, MaidDataType.フリ\u30FCコメント, false); base.GetCache("FreeComment").value = maidData2; this.ChangeMaidAppeal(0); } private void ChangeMaidAppeal(int relativeIndex) { MaidAppealComment cache = base.GetCache("Appeal"); Maid targetMaid = this.m_TargetMaid; int maidData = GameMain.Instance.KasizukiMgr.GetMaidData(targetMaid, MaidDataType.アピ\u30FCル欄, false); List 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("Appeal"); cache.ChangeImage(data.GetTexture()); GameMain.Instance.KasizukiMgr.SetMaidData(this.m_TargetMaid, MaidDataType.アピ\u30FCル欄, data.ID, false); } private AppealData.Data GetRelativeAppealData(List 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(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; } }