123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using I2.Loc;
- using PlayerStatus;
- using UnityEngine;
- using wf;
- public class SceneCasinoShop : KasaSceneMgr<SceneCasinoShop>
- {
- public CasinoShopItem SelectTrywear
- {
- get
- {
- return this.m_SelectTrywear;
- }
- }
- protected override void Awake()
- {
- this.m_ScrollPanel = this.m_ShopItemUI.ScrollView.GetComponent<UIPanel>();
- GameMain.Instance.CharacterMgr.SetActiveMaid(CasinoDataMgr.Instance.DealerMaid, 0);
- this.m_TrywearMaid = CasinoDataMgr.Instance.DealerMaid;
- Facility.CostumeType typeCostume = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
- if (typeCostume != Facility.CostumeType.Heroine)
- {
- if (typeCostume != Facility.CostumeType.Default)
- {
- if (typeCostume == Facility.CostumeType.Edit)
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(this.m_TrywearMaid, false);
- }
- }
- else
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(this.m_TrywearMaid);
- }
- CasinoDataMgr.Instance.DealerMaid.AllProcPropSeqStart();
- }
- this.m_TrywearMaid.Visible = true;
- this.m_TrywearMaid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
- base.Awake();
- this.m_CamMoveSupport = base.GetComponent<WfCameraMoveSupport>();
- this.m_InfoData.UIobj = this.m_ItemInfoUI;
- this.m_InfoData.Icon = this.m_ItemInfoUI.transform.Find("Base/Icon").GetComponent<UI2DSprite>();
- this.m_InfoData.InfoLabel = this.m_ItemInfoUI.transform.Find("Base/Info").GetComponent<UILabel>();
- this.m_InfoData.Namelabel = this.m_ItemInfoUI.transform.Find("Base/Title").GetComponent<UILabel>();
- Localize component = this.m_InfoData.InfoLabel.GetComponent<Localize>();
- if (component == null)
- {
- this.m_InfoData.InfoLabel.gameObject.AddComponent<Localize>();
- }
- component = this.m_InfoData.Namelabel.GetComponent<Localize>();
- if (component == null)
- {
- this.m_InfoData.Namelabel.gameObject.AddComponent<Localize>();
- }
- NDebug.Assert(GameMain.Instance.ScriptMgr.adv_kag.tag_backup.ContainsKey("label"), "OK時のラベルが未指定です");
- this.m_JumpLabel = GameMain.Instance.ScriptMgr.adv_kag.tag_backup["label"];
- EventDelegate.Add(this.m_TrywearButton.onClick, new EventDelegate.Callback(this.TryWear));
- EventDelegate.Add(this.m_TrycancelButton.onClick, new EventDelegate.Callback(this.TryCancel));
- EventDelegate.Add(this.m_CamRecetButton.onClick, new EventDelegate.Callback(this.CamRecet));
- EventDelegate.Add(this.m_OkButton.onClick, new EventDelegate.Callback(this.ClickOKButton));
- this.m_TrywearButton.isEnabled = false;
- this.m_TrycancelButton.isEnabled = false;
- this.CreateCategoryUI();
- }
- private void Start()
- {
- this.m_CategoryUI.TabPanel.Select(this.m_ButtonCategoryPair.Keys.First<UIWFTabButton>());
- ExChangeUI instance = ExChangeUI.Instance;
- instance.FadeOutStartAction = (Action)Delegate.Combine(instance.FadeOutStartAction, new Action(this.UpdateUIState));
- ExChangeUI instance2 = ExChangeUI.Instance;
- instance2.FadeInStartAction = (Action)Delegate.Combine(instance2.FadeInStartAction, new Action(delegate()
- {
- this.m_NguiEnable = false;
- }));
- ExChangeUI instance3 = ExChangeUI.Instance;
- instance3.FadeOutStartAction = (Action)Delegate.Combine(instance3.FadeOutStartAction, new Action(delegate()
- {
- this.m_NguiEnable = true;
- }));
- this.UpdateUIState();
- base.StartCoroutine(this.ScrollRecet());
- }
- private void LateUpdate()
- {
- this.m_NguiCam.EnableProcess &= this.m_NguiEnable;
- }
- private IEnumerator ScrollRecet()
- {
- for (int i = 0; i < 5; i++)
- {
- yield return null;
- }
- this.m_ItemSrollBar.value = 0f;
- yield break;
- }
- protected override void LoadEnd()
- {
- GameMain.Instance.ScriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true, false);
- base.StartCoroutine(this.AnimateWait());
- }
- private IEnumerator AnimateWait()
- {
- for (int i = 0; i < 5; i++)
- {
- yield return null;
- }
- Transform head_bone = this.m_TrywearMaid.body0.GetBone("Bip01 Head");
- this.m_TargetPos = head_bone.position + this.m_HeadCamOffset;
- base.SetCamera();
- this.m_CamMoveSupport.SaveCameraPosition();
- base.LoadEnd();
- yield break;
- }
- private void CreateCategoryUI()
- {
- foreach (CasinoShopItem.Category category in (CasinoShopItem.Category[])Enum.GetValues(typeof(CasinoShopItem.Category)))
- {
- GameObject gameObject = Utility.CreatePrefab(this.m_CategoryUI.Grid.gameObject, "SceneCasinoShop/Prefab/CategoryUI", true);
- UILabel componentInChildren = gameObject.GetComponentInChildren<UILabel>();
- componentInChildren.text = ((category != CasinoShopItem.Category.Costume) ? "施設強化素材" : "コスチューム");
- Utility.SetLocalizeTerm(componentInChildren, (category != CasinoShopItem.Category.Costume) ? "SceneShop/メインカテゴリー/施設強化素材" : "SceneEdit/カテゴリー/サブ/コスチューム", false);
- UIWFTabButton componentInChildren2 = gameObject.GetComponentInChildren<UIWFTabButton>();
- this.m_ButtonCategoryPair.Add(componentInChildren2, category);
- EventDelegate.Add(componentInChildren2.onSelect, new EventDelegate.Callback(this.SelectCategory));
- }
- this.m_CategoryUI.Grid.repositionNow = true;
- this.m_CategoryUI.ScrollView.ResetPosition();
- this.m_CategoryUI.TabPanel.UpdateChildren();
- }
- private void SelectCategory()
- {
- IEnumerator enumerator = this.m_ShopItemUI.Grid.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- UnityEngine.Object.Destroy(transform.gameObject);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- this.m_TrywearButton.isEnabled = false;
- this.CreateItemUI();
- this.m_AllowposStart = this.m_CategoryAllow.transform.position;
- this.m_AllowposEnd = this.m_AllowposStart;
- this.m_AllowposEnd.y = UIWFTabButton.current.transform.position.y;
- base.StartCoroutine(KasaiUtility.TimeCroutine(this.m_AllowMove, new Action<float>(this.AllowMovement), null));
- }
- private void AllowMovement(float time)
- {
- float t = KasaiUtility.SinRate01(time, this.m_AllowMove, false, false);
- this.m_CategoryAllow.transform.position = Vector3.Lerp(this.m_AllowposStart, this.m_AllowposEnd, t);
- }
- private void CreateItemUI()
- {
- CasinoShopItem.Category category = this.m_ButtonCategoryPair[UIWFTabButton.current];
- this.m_ItemUIList.Clear();
- foreach (CasinoShopItem item_data in CasinoDataMgr.Instance.GetShopItem(category))
- {
- GameObject gameObject = Utility.CreatePrefab(this.m_ShopItemUI.Grid.gameObject, "SceneCasinoShop/Prefab/CasinoShopItem", true);
- CasinoItemUI component = gameObject.GetComponent<CasinoItemUI>();
- component.Init(item_data);
- this.m_ItemUIList.Add(component);
- }
- this.m_ShopItemUI.Grid.repositionNow = true;
- this.m_ShopItemUI.ScrollView.ResetPosition();
- this.m_ShopItemUI.TabPanel.UpdateChildren();
- }
- private void RecetTrywear(Action load_end = null)
- {
- Facility.CostumeType costume_type = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
- MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
- foreach (MPN mpn in facilityCostumeEnableMPN)
- {
- if (this.m_BackUpwear.ContainsKey(mpn))
- {
- this.m_TrywearMaid.SetProp(mpn, this.m_BackUpwear[mpn].strFileName, this.m_BackUpwear[mpn].nFileNameRID, false, false);
- }
- }
- this.m_TrywearMaid.body0.SetMaskMode(TBody.MaskMode.None);
- SceneEdit.AllProcPropSeqStart(this.m_TrywearMaid);
- if (costume_type != Facility.CostumeType.Heroine)
- {
- Action end_call = delegate()
- {
- if (costume_type != Facility.CostumeType.Default)
- {
- if (costume_type == Facility.CostumeType.Edit)
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToEditCostume(this.m_TrywearMaid, false);
- }
- }
- else
- {
- CasinoDataMgr.Instance.CurrentCasino.UpdateMaidCostumeToDefaultCostume(this.m_TrywearMaid);
- }
- SceneEdit.AllProcPropSeqStart(this.m_TrywearMaid);
- this.StartCoroutine(KasaiUtility.CharaLoadWait(load_end));
- };
- base.StartCoroutine(KasaiUtility.CharaLoadWait(end_call));
- }
- else
- {
- base.StartCoroutine(KasaiUtility.CharaLoadWait(load_end));
- }
- }
- private void TryWear()
- {
- if (this.m_TrywearMaid.IsBusy || this.m_SelectTrywear == null || !this.m_SelectTrywear.IsCategoryCostume)
- {
- return;
- }
- Facility.CostumeType typeCostume = CasinoDataMgr.Instance.CurrentCasino.typeCostume;
- MPN[] facilityCostumeEnableMPN = FacilityDataTable.GetFacilityCostumeEnableMPN();
- foreach (MPN mpn in facilityCostumeEnableMPN)
- {
- if (typeCostume != Facility.CostumeType.Heroine)
- {
- this.m_TrywearMaid.ResetProp(mpn, false);
- }
- if (this.m_TrywearItem == null)
- {
- if (!this.m_BackUpwear.ContainsKey(mpn))
- {
- MaidProp prop = this.m_TrywearMaid.GetProp(mpn);
- MaidProp maidProp = new MaidProp();
- maidProp.strFileName = prop.strFileName;
- maidProp.nFileNameRID = prop.nFileNameRID;
- this.m_BackUpwear.Add(mpn, maidProp);
- }
- }
- }
- this.m_TrywearItem = this.m_SelectTrywear;
- Action action = delegate()
- {
- this.m_TrywearItem.TryWear(this.m_TrywearMaid);
- SceneEdit.AllProcPropSeqStart(this.m_TrywearMaid);
- this.m_TrycancelButton.isEnabled = true;
- };
- if (typeCostume == Facility.CostumeType.Heroine)
- {
- action();
- }
- else
- {
- SceneEdit.AllProcPropSeqStart(this.m_TrywearMaid);
- base.StartCoroutine(KasaiUtility.CharaLoadWait(action));
- }
- }
- private void TryCancel()
- {
- if (this.m_TrywearMaid.IsBusy || this.m_TrywearItem == null || !this.m_TrywearItem.IsCategoryCostume)
- {
- return;
- }
- this.m_TrycancelButton.isEnabled = false;
- this.RecetTrywear(null);
- this.m_TrywearItem = null;
- this.m_BackUpwear.Clear();
- }
- private void CamRecet()
- {
- this.m_CamMoveSupport.ResetCamera();
- }
- private void ClickOKButton()
- {
- this.FadeOut();
- }
- protected override void FadeOutEnd()
- {
- if (this.m_TrywearItem != null)
- {
- this.RecetTrywear(new Action(base.FadeOutEnd));
- }
- else
- {
- base.FadeOutEnd();
- }
- }
- private void UpdateUIState()
- {
- ExChangeUI.Instance.SetButtonState(true);
- ExChangeUI.Instance.TextUIUpdate();
- ExChangeUI.Instance.UIStateUpdate();
- foreach (CasinoItemUI casinoItemUI in this.m_ItemUIList)
- {
- casinoItemUI.UIUpdate();
- }
- }
- public void ItemBuy(CasinoShopItem item_data)
- {
- Status status = GameMain.Instance.CharacterMgr.status;
- status.casinoCoin -= (long)item_data.Price;
- item_data.ItemBuy();
- this.UpdateUIState();
- string messageTerm = "SceneCasino/ダイアログ/{0}を購入しました";
- string[] array = new string[]
- {
- item_data.Name
- };
- if (Product.supportMultiLanguage)
- {
- array[0] = LocalizationManager.GetTranslation(item_data.NameTerm, true, 0, true, false, null, null);
- }
- GameMain.Instance.SysDlg.ShowFromLanguageTerm(messageTerm, array, SystemDialog.TYPE.OK, null, null);
- }
- public void SetTrywearItem(CasinoShopItem item_data)
- {
- this.m_SelectTrywear = item_data;
- this.m_TrywearButton.isEnabled = true;
- foreach (CasinoItemUI casinoItemUI in this.m_ItemUIList)
- {
- casinoItemUI.SwitchFrame();
- }
- }
- public void RecetTrywearItem()
- {
- this.m_SelectTrywear = null;
- this.m_TrywearButton.isEnabled = false;
- foreach (CasinoItemUI casinoItemUI in this.m_ItemUIList)
- {
- casinoItemUI.SwitchFrame();
- }
- }
- public void ShowItenInfo(CasinoShopItem item_data, Transform offset_base)
- {
- this.m_InfoData.UIobj.SetActive(true);
- this.m_InfoData.Icon.sprite2D = item_data.Icon;
- this.m_InfoData.InfoLabel.text = item_data.Document;
- Utility.SetLocalizeTerm(this.m_InfoData.InfoLabel, item_data.DocumentTerm, false);
- this.m_InfoData.Namelabel.text = item_data.Name;
- Utility.SetLocalizeTerm(this.m_InfoData.Namelabel, item_data.NameTerm, false);
- int num = Mathf.FloorToInt(this.m_ScrollPanel.height / this.m_ShopItemUI.Grid.cellHeight + 0.5f);
- int num2 = CasinoDataMgr.Instance.GetShopItem(item_data.MyCategory).Count - num;
- int num3 = num + Mathf.FloorToInt((float)num2 * this.m_ShopItemUI.ScrollView.verticalScrollBar.value) - 1;
- for (int i = 0; i < CasinoDataMgr.Instance.GetShopItem(item_data.MyCategory).Count; i++)
- {
- CasinoShopItem casinoShopItem = CasinoDataMgr.Instance.GetShopItem(item_data.MyCategory).ElementAt(i);
- if (casinoShopItem == item_data)
- {
- if (i >= num3 - 1)
- {
- this.m_InfoData.UIobj.transform.position = offset_base.TransformPoint(-this.m_OffsetInfo);
- }
- else
- {
- this.m_InfoData.UIobj.transform.position = offset_base.TransformPoint(this.m_OffsetInfo);
- }
- break;
- }
- }
- }
- public void HideItemInfo()
- {
- this.m_InfoData.UIobj.SetActive(false);
- }
- private WfCameraMoveSupport m_CamMoveSupport;
- [SerializeField]
- [Header("メイドの頭とのオフセット値")]
- private Vector3 m_HeadCamOffset = Vector3.zero;
- private Maid m_TrywearMaid;
- [SerializeField]
- [Header("各ボタン")]
- private UIButton m_TrywearButton;
- [SerializeField]
- private UIButton m_TrycancelButton;
- [SerializeField]
- private UIButton m_CamRecetButton;
- [SerializeField]
- private UIButton m_OkButton;
- [SerializeField]
- [Header("カテゴリー列挙用UI")]
- private SceneCasinoShop.ScrollUIData m_CategoryUI;
- [SerializeField]
- private GameObject m_CategoryAllow;
- [SerializeField]
- private float m_AllowMove = 0.5f;
- private Vector3 m_AllowposStart = Vector3.zero;
- private Vector3 m_AllowposEnd = Vector3.zero;
- [SerializeField]
- [Header("アイテム列挙用UI")]
- private SceneCasinoShop.ScrollUIData m_ShopItemUI;
- [SerializeField]
- private UIScrollBar m_ItemSrollBar;
- [SerializeField]
- [Header("アイテム説明用UI")]
- private GameObject m_ItemInfoUI;
- [SerializeField]
- private Vector3 m_OffsetInfo = Vector3.zero;
- [SerializeField]
- private UICamera m_NguiCam;
- private SceneCasinoShop.InfoUIData m_InfoData = new SceneCasinoShop.InfoUIData();
- private CasinoShopItem m_TrywearItem;
- private CasinoShopItem m_SelectTrywear;
- private Dictionary<MPN, MaidProp> m_BackUpwear = new Dictionary<MPN, MaidProp>();
- private Dictionary<UIWFTabButton, CasinoShopItem.Category> m_ButtonCategoryPair = new Dictionary<UIWFTabButton, CasinoShopItem.Category>();
- private List<CasinoItemUI> m_ItemUIList = new List<CasinoItemUI>();
- private UIPanel m_ScrollPanel;
- private bool m_NguiEnable = true;
- [Serializable]
- private class ScrollUIData
- {
- public UIGrid Grid;
- public UIScrollView ScrollView;
- public UIWFTabPanel TabPanel;
- }
- private class InfoUIData
- {
- public GameObject UIobj;
- public UI2DSprite Icon;
- public UILabel Namelabel;
- public UILabel InfoLabel;
- }
- private class BoughtData
- {
- public CasinoShopItem ItemData;
- public UIButton Button;
- public UISprite ButtonIcon;
- }
- }
|