123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using MaidStatus;
- using SceneEditWindow;
- using UnityEngine;
- public class PresetButtonCtrl : MonoBehaviour
- {
- public void Init(GameObject goPresetButtonPanel, Maid maid)
- {
- this.m_goPresetButtonPanel = goPresetButtonPanel;
- this.m_maid = maid;
- this.m_goItemPresetsViewer = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer", false);
- this.m_listPresetBtn = new Dictionary<string, PresetButtonCtrl.PresetButton>();
- this.m_listItemPresetBtn = new Dictionary<string, PresetButtonCtrl.PresetButton>();
- IEnumerator enumerator = Enum.GetValues(typeof(PresetButtonCtrl.LeftButtons)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- this.initBtnList("LeftButtons", ((PresetButtonCtrl.LeftButtons)obj).ToString());
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- IEnumerator enumerator2 = Enum.GetValues(typeof(PresetButtonCtrl.RightButtons)).GetEnumerator();
- try
- {
- while (enumerator2.MoveNext())
- {
- object obj2 = enumerator2.Current;
- this.initBtnList("RightButtons", ((PresetButtonCtrl.RightButtons)obj2).ToString());
- }
- }
- finally
- {
- IDisposable disposable2;
- if ((disposable2 = (enumerator2 as IDisposable)) != null)
- {
- disposable2.Dispose();
- }
- }
- this.m_goParentItemBtn = UTY.GetChildObject(this.m_goItemPresetsViewer, "Scroll View/Grid", false);
- UIButton component = UTY.GetChildObject(this.m_goPresetButtonPanel, "PresetButtons/LeftButtons/View", false).GetComponent<UIButton>();
- this.activeColor = new Color(component.defaultColor.r, component.defaultColor.g, component.defaultColor.b, 1f);
- this.inActiveColor = component.defaultColor;
- this.m_sbScrollBar = UTY.GetChildObject(this.m_goItemPresetsViewer, "Scroll Bar", false).GetComponent<UIScrollBar>();
- this.m_goItemScrollView = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer/Scroll View", false);
- this.m_pItemScrollViewPanel = this.m_goItemScrollView.GetComponent<UIPanel>();
- GameObject childObject = UTY.GetChildObject(this.m_goPresetButtonPanel, "ItemPresetsViewer/BG", false);
- this.m_spScrollViewBG = childObject.GetComponent<UISprite>();
- this.m_maxScrollViewWidth = (int)this.m_pItemScrollViewPanel.baseClipRegion.z;
- this.m_scrollViewSize = new Vector4(0f, 0f, (float)this.m_maxScrollViewWidth, (float)((int)this.m_pItemScrollViewPanel.baseClipRegion.w));
- this.m_scrollViewSoftnessX = (int)this.m_pItemScrollViewPanel.clipSoftness.x;
- this.m_nguiContentWidth = base.GetComponentInParent<UIRoot>().GetComponent<UIRoot>().manualWidth;
- this.m_ajustedNguiContentWidth = this.m_nguiContentWidth - 650;
- GameObject childObject2 = UTY.GetChildObject(this.m_goPresetButtonPanel, "PresetButtons", false);
- float x = UTY.GetChildObject(childObject2, "LeftButtons/Pose", false).transform.position.x;
- float x2 = UTY.GetChildObject(childObject2, "LeftButtons/Clothes", false).transform.position.x;
- float x3 = UTY.GetChildObject(childObject2, "LeftButtons/PriSave", false).transform.position.x;
- float x4 = UTY.GetChildObject(childObject2, "RightButtons/Voice", false).transform.position.x;
- float x5 = UTY.GetChildObject(childObject2, "RightButtons/BG", false).transform.position.x;
- this.dicBtnPosX = new Dictionary<string, float>
- {
- {
- "Pose",
- x
- },
- {
- "Clothes",
- x2
- },
- {
- "PriSave",
- x3
- },
- {
- "Voice",
- x4
- },
- {
- "BG",
- x5
- }
- };
- this.m_goItemSpriteBtn = (Resources.Load("SceneEdit/PresetButton/Prefabs/ItemSpritePresetButton") as GameObject);
- this.m_goItemTxtrBtn = (Resources.Load("SceneEdit/PresetButton/Prefabs/ItemTxtrPresetButton") as GameObject);
- this.m_spItemIcon = this.m_goItemSpriteBtn.GetComponent<UISprite>();
- this.m_sceneEdit = GameObject.Find("__SceneEdit__").GetComponent<SceneEdit>();
- this.m_goItemPresetsViewer.SetActive(false);
- if (this.m_sceneEdit.IsVRComMode)
- {
- UIButton component2 = UTY.GetChildObject(childObject2, "RightButtons/BG", false).GetComponent<UIButton>();
- component2.disabledColor.a = 0.5f;
- component2.SetState(UIButtonColor.State.Disabled, true);
- component2.isEnabled = false;
- UIButton component3 = UTY.GetChildObject(childObject2, "LeftButtons/View", false).GetComponent<UIButton>();
- component3.disabledColor.a = 0.5f;
- component3.SetState(UIButtonColor.State.Disabled, true);
- component3.isEnabled = false;
- }
- UIButton component4 = UTY.GetChildObject(this.m_goPresetButtonPanel, "HowToName", false).GetComponent<UIButton>();
- if (component4.onClick.Count == 0)
- {
- EventDelegate.Add(component4.onClick, new EventDelegate.Callback(this.m_sceneEdit.CallHowToNameDialog));
- }
- if (this.m_sceneEdit.modeType == SceneEdit.ModeType.OriginalChara || this.m_sceneEdit.modeType == SceneEdit.ModeType.MainChara || this.m_sceneEdit.modeType == SceneEdit.ModeType.CostumeEdit || maid.status.heroineType == HeroineType.Sub)
- {
- component4.gameObject.SetActive(false);
- }
- else
- {
- component4.gameObject.SetActive(true);
- }
- UIButton component5 = UTY.GetChildObject(this.m_goPresetButtonPanel, "SettingName", false).GetComponent<UIButton>();
- if (component5.onClick.Count == 0)
- {
- EventDelegate.Add(component5.onClick, new EventDelegate.Callback(this.m_sceneEdit.CallSettingNamePanel));
- }
- component5.gameObject.SetActive(maid.status.heroineType == HeroineType.Sub);
- if (this.m_sceneEdit.modeType == SceneEdit.ModeType.CostumeEdit)
- {
- UTY.GetChildObject(this.m_goPresetButtonPanel, "WindowVoice/Button", false).GetComponent<UIButton>().isEnabled = false;
- UTY.GetChildObject(this.m_goPresetButtonPanel, "WindowPresetSave/Button", false).GetComponent<UIButton>().isEnabled = false;
- }
- }
- public void CreateItemPresetsViewer(string type, string clickBtnName, string prevActiveBtnName)
- {
- if (!string.IsNullOrEmpty(this.last_draw_type_))
- {
- if (this.last_draw_type_ == PresetButtonMgr.ItemTypes.Pose.ToString())
- {
- this.backup_pose_scroll_pos_ = this.m_sbScrollBar.value;
- }
- else if (this.last_draw_type_ == PresetButtonMgr.ItemTypes.BG.ToString())
- {
- this.backup_bg_scroll_pos_ = this.m_sbScrollBar.value;
- }
- }
- this.m_dicItem = new Dictionary<string, PresetButtonCtrl.ItemPreset>();
- if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString())
- {
- this.m_dicItem = this.LoadItemData(clickBtnName);
- }
- else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Clothes.ToString())
- {
- this.m_dicItem = this.LoadClothesData();
- }
- else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.PriSave.ToString())
- {
- this.m_dicItem = this.LoadPriSaveData();
- }
- else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString())
- {
- this.m_dicItem = this.LoadItemData(clickBtnName);
- }
- else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
- {
- this.m_dicItem = this.LoadItemData(clickBtnName);
- }
- this.last_draw_type_ = clickBtnName;
- List<PresetButtonCtrl.ItemPreset> list = new List<PresetButtonCtrl.ItemPreset>();
- foreach (KeyValuePair<string, PresetButtonCtrl.ItemPreset> keyValuePair in this.m_dicItem)
- {
- if (keyValuePair.Key.StartsWith(clickBtnName))
- {
- list.Add(keyValuePair.Value);
- }
- }
- if (list.Count == 0 && clickBtnName != "View")
- {
- Debug.LogError(string.Format("アイテムビューワに表示するアイテムが存在しません。押下されたボタン={0}", clickBtnName));
- return;
- }
- this.LoadItemBtn(list, clickBtnName);
- this.initItemBtnList(list);
- this.AdjustItemPresets(type, clickBtnName, prevActiveBtnName);
- if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString())
- {
- this.m_sbScrollBar.value = this.backup_pose_scroll_pos_;
- }
- else if (type == "PresetButtons" && clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
- {
- this.m_sbScrollBar.value = this.backup_bg_scroll_pos_;
- }
- }
- private void initBtnList(string btnType, string btnName)
- {
- string text = null;
- bool flag = false;
- PresetButtonCtrl.PresetButton presetButton = new PresetButtonCtrl.PresetButton();
- if (btnType == "LeftButtons" || btnType == "RightButtons")
- {
- text = "PresetButtons/" + btnType + "/" + btnName;
- flag = true;
- }
- else if (btnType == "itemPresetButtons")
- {
- text = "ItemPresetsViewer/Scroll View/Grid/" + btnName;
- flag = false;
- }
- UIButton component = UTY.GetChildObject(this.m_goPresetButtonPanel, text, false).GetComponent<UIButton>();
- GameObject childObject = UTY.GetChildObject(this.m_goPresetButtonPanel, text + "/SelectCursor", false);
- childObject.SetActive(false);
- if (flag && btnName != "View")
- {
- GameObject childObject2 = UTY.GetChildObject(this.m_goPresetButtonPanel, text + "/WindowArrow", false);
- childObject2.SetActive(false);
- presetButton.m_goWindowArrow = childObject2;
- }
- presetButton.m_btnButton = component;
- presetButton.m_name = btnName;
- presetButton.m_goSelectCursor = childObject;
- if (btnType == "LeftButtons" || btnType == "RightButtons")
- {
- this.m_listPresetBtn.Add(presetButton.m_name, presetButton);
- }
- else if (btnType == "itemPresetButtons")
- {
- this.m_listItemPresetBtn[presetButton.m_name] = presetButton;
- }
- }
- public void LoadItemBtn(List<PresetButtonCtrl.ItemPreset> listItemPreset, string clickBtnName)
- {
- if (clickBtnName == PresetButtonMgr.ItemTypes.Pose.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.BG.ToString())
- {
- this.m_goItemBtn = this.m_goItemTxtrBtn;
- }
- else if (clickBtnName == PresetButtonMgr.ItemTypes.Clothes.ToString() || clickBtnName == PresetButtonMgr.ItemTypes.PriSave.ToString())
- {
- this.m_goItemBtn = this.m_goItemSpriteBtn;
- }
- IEnumerator enumerator = this.m_goParentItemBtn.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_goParentItemBtn.transform.DetachChildren();
- this.m_listItemPresetBtn.Clear();
- foreach (PresetButtonCtrl.ItemPreset itemPreset in listItemPreset)
- {
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goItemBtn);
- switch (itemPreset.m_itemType)
- {
- case PresetButtonMgr.ItemTypes.Pose:
- case PresetButtonMgr.ItemTypes.Voice:
- case PresetButtonMgr.ItemTypes.BG:
- {
- UITexture component = gameObject.GetComponent<UITexture>();
- component.mainTexture = itemPreset.m_txtItemIcon;
- this.m_currentItemIconWidth = component.width;
- break;
- }
- case PresetButtonMgr.ItemTypes.Clothes:
- case PresetButtonMgr.ItemTypes.PriSave:
- {
- UISprite component2 = gameObject.GetComponent<UISprite>();
- string b = null;
- if (itemPreset.m_atlasName != b)
- {
- component2.atlas = Resources.Load<UIAtlas>(itemPreset.m_atlasName);
- b = itemPreset.m_atlasName;
- }
- component2.spriteName = itemPreset.m_spriteName;
- this.m_currentItemIconWidth = component2.width;
- break;
- }
- }
- gameObject.transform.name = itemPreset.m_name;
- gameObject.transform.parent = this.m_goParentItemBtn.transform;
- gameObject.transform.localScale = Vector3.one;
- gameObject.transform.localPosition = Vector3.zero;
- gameObject.transform.rotation = Quaternion.identity;
- switch (itemPreset.m_itemType)
- {
- case PresetButtonMgr.ItemTypes.Pose:
- {
- UIButton component3 = gameObject.GetComponent<UIButton>();
- EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickPose));
- break;
- }
- case PresetButtonMgr.ItemTypes.Clothes:
- {
- UIButton component3 = gameObject.GetComponent<UIButton>();
- EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickClothes));
- break;
- }
- case PresetButtonMgr.ItemTypes.PriSave:
- {
- UIButton component3 = gameObject.GetComponent<UIButton>();
- EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.PresetSave));
- break;
- }
- case PresetButtonMgr.ItemTypes.Voice:
- {
- UIButton component3 = gameObject.GetComponent<UIButton>();
- EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickVoice));
- break;
- }
- case PresetButtonMgr.ItemTypes.BG:
- {
- UIButton component3 = gameObject.GetComponent<UIButton>();
- EventDelegate.Add(component3.onClick, new EventDelegate.Callback(this.ClickBG));
- break;
- }
- }
- }
- }
- public void initItemBtnList(List<PresetButtonCtrl.ItemPreset> listItemPreset)
- {
- foreach (PresetButtonCtrl.ItemPreset itemPreset in listItemPreset)
- {
- this.initBtnList("itemPresetButtons", itemPreset.m_name);
- }
- }
- public void AdjustItemPresets(string type, string clickBtnName, string prevActiveBtnName)
- {
- PresetButtonCtrl.PresetButton btn = new PresetButtonCtrl.PresetButton();
- PresetButtonCtrl.PresetButton btn2 = new PresetButtonCtrl.PresetButton();
- if (type == "PresetButtons")
- {
- btn = this.m_listPresetBtn[clickBtnName];
- if (prevActiveBtnName != null)
- {
- btn2 = this.m_listPresetBtn[prevActiveBtnName];
- }
- }
- else if (type == "ItemPresetsViewer")
- {
- btn = this.m_listItemPresetBtn[clickBtnName];
- if (prevActiveBtnName != null)
- {
- btn2 = this.m_listItemPresetBtn[prevActiveBtnName];
- }
- }
- this.SetActiveBtn(btn, true);
- if (prevActiveBtnName != null)
- {
- this.SetActiveBtn(btn2, false);
- }
- if (type == "PresetButtons")
- {
- if (clickBtnName == PresetButtonCtrl.LeftButtons.View.ToString())
- {
- this.m_goItemPresetsViewer.SetActive(false);
- }
- else
- {
- this.AdjustScrollViewWidth();
- this.m_goItemPresetsViewer.transform.position = new Vector2(this.dicBtnPosX[clickBtnName], this.m_goItemPresetsViewer.transform.position.y);
- float num = -this.m_goItemPresetsViewer.transform.localPosition.x + (float)(this.m_spScrollViewBG.width / 2) - (float)(this.m_nguiContentWidth / 2);
- if (num > 0f)
- {
- this.m_goItemPresetsViewer.transform.localPosition = new Vector2(this.m_goItemPresetsViewer.transform.localPosition.x + num, this.m_goItemPresetsViewer.transform.localPosition.y);
- }
- this.m_goItemPresetsViewer.SetActive(true);
- this.m_goParentItemBtn.GetComponent<UIGrid>().Reposition();
- this.AdjustScrollViewItemPos();
- if (this.m_scrollViewWidthOver)
- {
- this.m_sbScrollBar.value = 0f;
- }
- }
- }
- }
- private void AdjustScrollViewItemPos()
- {
- UIScrollView component = this.m_goItemScrollView.GetComponent<UIScrollView>();
- component.ResetPosition();
- }
- public void SetDefaultScrollBarPos()
- {
- this.m_sbScrollBar.value = 0f;
- }
- private void AdjustScrollViewWidth()
- {
- this.m_scrollViewWidthOver = false;
- int num = (this.m_currentItemIconWidth + this.itemIconOffsetX) * this.m_listItemPresetBtn.Count + this.m_scrollViewSoftnessX;
- if (num > this.m_maxScrollViewWidth)
- {
- num = this.m_maxScrollViewWidth;
- this.m_scrollViewWidthOver = true;
- }
- this.m_scrollViewSize.z = (float)(num + 10);
- this.m_pItemScrollViewPanel.baseClipRegion = this.m_scrollViewSize;
- int num2 = this.m_currentItemIconWidth * 3;
- int num3 = num2 + num;
- if (num3 > this.m_ajustedNguiContentWidth)
- {
- num3 = this.m_ajustedNguiContentWidth;
- }
- this.m_spScrollViewBG.width = num3;
- UIGrid component = this.m_goParentItemBtn.GetComponent<UIGrid>();
- component.cellWidth = (float)(this.m_currentItemIconWidth + this.itemIconOffsetX);
- }
- private void SetActiveBtn(PresetButtonCtrl.PresetButton btn, bool active)
- {
- if (Enum.IsDefined(typeof(PresetButtonMgr.ItemTypes), btn.m_name))
- {
- btn.m_goSelectCursor.SetActive(active);
- if (btn.m_goWindowArrow != null)
- {
- btn.m_goWindowArrow.SetActive(active);
- }
- if (active)
- {
- btn.m_btnButton.defaultColor = this.activeColor;
- }
- else
- {
- btn.m_btnButton.defaultColor = this.inActiveColor;
- }
- }
- }
- public void SetActiveBtn(string btnName, bool active)
- {
- PresetButtonCtrl.PresetButton btn = this.m_listPresetBtn[btnName];
- this.SetActiveBtn(btn, active);
- }
- private Dictionary<string, PresetButtonCtrl.ItemPreset> LoadPriSaveData()
- {
- Dictionary<string, PresetButtonCtrl.ItemPreset> dictionary = new Dictionary<string, PresetButtonCtrl.ItemPreset>();
- PresetButtonCtrl.ItemPreset itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.PriSaveButton.PriSave_WearAndBody.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_priset_buttom_clothes_body";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.PriSave;
- dictionary.Add(itemPreset.m_name, itemPreset);
- itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.PriSaveButton.PriSave_Wear.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_priset_buttom_clothes";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.PriSave;
- dictionary.Add(itemPreset.m_name, itemPreset);
- itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.PriSaveButton.PriSave_Body.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_preset_buttom_body";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.PriSave;
- dictionary.Add(itemPreset.m_name, itemPreset);
- return dictionary;
- }
- private Dictionary<string, PresetButtonCtrl.ItemPreset> LoadClothesData()
- {
- Dictionary<string, PresetButtonCtrl.ItemPreset> dictionary = new Dictionary<string, PresetButtonCtrl.ItemPreset>();
- PresetButtonCtrl.ItemPreset itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.ClothesButton.Clothes_Dress.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_clothesicon_dress";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
- dictionary.Add(itemPreset.m_name, itemPreset);
- itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.ClothesButton.Clothes_Lingerie.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_clothesicon_lingerie";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
- dictionary.Add(itemPreset.m_name, itemPreset);
- itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = PresetButtonCtrl.ClothesButton.Clothes_Nude.ToString();
- itemPreset.m_atlasName = "SceneEdit/Preset/Atlas/AtlasPreset";
- itemPreset.m_spriteName = "cm3d2_edit_clothesicon_nude";
- itemPreset.m_spItemIcon = this.m_spItemIcon;
- itemPreset.m_itemType = PresetButtonMgr.ItemTypes.Clothes;
- dictionary.Add(itemPreset.m_name, itemPreset);
- return dictionary;
- }
- private Dictionary<string, PresetButtonCtrl.ItemPreset> LoadItemData(string clickBtnName)
- {
- Dictionary<string, PresetButtonCtrl.ItemPreset> dictionary = new Dictionary<string, PresetButtonCtrl.ItemPreset>();
- Personal.Data personal = this.m_maid.status.personal;
- SceneEdit.PVBInfo[] array = null;
- if (clickBtnName == PresetButtonMgr.ItemTypes.Voice.ToString())
- {
- array = this.m_sceneEdit.m_dicVoice[personal].ToArray();
- }
- int num = 0;
- foreach (SceneEdit.PVBInfo pvbinfo in array)
- {
- PresetButtonCtrl.ItemPreset itemPreset = new PresetButtonCtrl.ItemPreset();
- itemPreset.m_name = clickBtnName + "_" + num;
- itemPreset.m_itemType = (PresetButtonMgr.ItemTypes)Enum.Parse(typeof(PresetButtonMgr.ItemTypes), clickBtnName);
- itemPreset.m_pvbInfo = pvbinfo;
- itemPreset.m_txtItemIcon = pvbinfo.texIcon;
- dictionary.Add(itemPreset.m_name, itemPreset);
- num++;
- }
- return dictionary;
- }
- public void PresetSaveType(PresetSaveWindow.SaveType type)
- {
- PresetMgr.Filter filter = PresetMgr.Filter.None;
- if (type == PresetSaveWindow.SaveType.All)
- {
- Debug.Log("「服/体」が押下されました");
- if (Input.GetKey(KeyCode.RightAlt) || Input.GetKey(KeyCode.LeftAlt))
- {
- GameMain.Instance.CharacterMgr.PresetSaveAsQRCode(this.m_maid, CharacterMgr.PresetType.All);
- GameMain.Instance.SysDlg.Show("QRコードとして保存しました\n(通常の保存を行いたい場合は「Alt」を押さずに保存してください)", SystemDialog.TYPE.OK, null, null);
- }
- else
- {
- GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.All);
- filter = PresetMgr.Filter.All;
- }
- }
- else if (type == PresetSaveWindow.SaveType.ClothesOnly)
- {
- Debug.Log("「服」が押下されました");
- if (Input.GetKey(KeyCode.RightAlt) || Input.GetKey(KeyCode.LeftAlt))
- {
- GameMain.Instance.CharacterMgr.PresetSaveAsQRCode(this.m_maid, CharacterMgr.PresetType.Wear);
- GameMain.Instance.SysDlg.Show("QRコードとして保存しました\n(通常の保存を行いたい場合は「Alt」を押さずに保存してください)", SystemDialog.TYPE.OK, null, null);
- }
- else
- {
- GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.Wear);
- filter = PresetMgr.Filter.Wear;
- }
- }
- else if (type == PresetSaveWindow.SaveType.BodyOnly)
- {
- if (Input.GetKey(KeyCode.RightAlt) || Input.GetKey(KeyCode.LeftAlt))
- {
- GameMain.Instance.CharacterMgr.PresetSaveAsQRCode(this.m_maid, CharacterMgr.PresetType.Body);
- GameMain.Instance.SysDlg.Show("QRコードとして保存しました\n(通常の保存を行いたい場合は「Alt」を押さずに保存してください)", SystemDialog.TYPE.OK, null, null);
- }
- else
- {
- Debug.Log("「体」が押下されました");
- GameMain.Instance.CharacterMgr.PresetSave(this.m_maid, CharacterMgr.PresetType.Body);
- filter = PresetMgr.Filter.Body;
- }
- }
- else
- {
- Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", type.ToString()));
- }
- if (this.isActivePresetPanel())
- {
- float scrollBarValue = BaseMgr<PresetMgr>.Instance.GetScrollBarValue();
- BaseMgr<PresetMgr>.Instance.UpdatePresetList();
- Debug.Log("Call UpdatePresetList");
- if (PresetMgr.m_currentActiveFilterBtnName != PresetMgr.Filter.None)
- {
- BaseMgr<PresetMgr>.Instance.UpdateFilterPreset(PresetMgr.m_currentActiveFilterBtnName);
- Debug.Log("Call UpdateFilterPreset");
- if (PresetMgr.m_currentActiveFilterBtnName != PresetMgr.Filter.NotFilter && PresetMgr.m_currentActiveFilterBtnName != filter)
- {
- BaseMgr<PresetMgr>.Instance.SetScrollBar(scrollBarValue);
- }
- }
- }
- }
- private void PresetSave()
- {
- string name = UIButton.current.name;
- if (name == PresetButtonCtrl.PriSaveButton.PriSave_WearAndBody.ToString())
- {
- this.PresetSaveType(PresetSaveWindow.SaveType.All);
- }
- else if (name == PresetButtonCtrl.PriSaveButton.PriSave_Wear.ToString())
- {
- this.PresetSaveType(PresetSaveWindow.SaveType.ClothesOnly);
- }
- else if (name == PresetButtonCtrl.PriSaveButton.PriSave_Body.ToString())
- {
- this.PresetSaveType(PresetSaveWindow.SaveType.BodyOnly);
- }
- else
- {
- Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
- }
- }
- private bool isActivePresetPanel()
- {
- UIRoot componentInParent = base.GetComponentInParent<UIRoot>();
- GameObject gameObject = componentInParent.transform.Find("PresetPanel").gameObject;
- return gameObject.activeSelf;
- }
- private void ClickClothes()
- {
- string name = UIButton.current.name;
- this.ClickClothesByButtonName(name);
- }
- public void ClickClothesByButtonName(string clickBtnName)
- {
- if (clickBtnName == "Clothes_Nude")
- {
- this.m_sceneEdit.ClothesState(SceneEditInfo.ClothesState.Nude);
- }
- else if (clickBtnName == "Clothes_Dress")
- {
- this.m_sceneEdit.ClothesState(SceneEditInfo.ClothesState.Wear);
- }
- else if (clickBtnName == "Clothes_Lingerie")
- {
- this.m_sceneEdit.ClothesState(SceneEditInfo.ClothesState.Underwear);
- }
- Debug.Log(string.Format("{0}が押下(実行)されました。", clickBtnName));
- }
- private void ClickBG()
- {
- }
- private void ClickVoice()
- {
- string name = UIButton.current.name;
- PresetButtonCtrl.ItemPreset itemPreset;
- if (this.m_dicItem.TryGetValue(name, out itemPreset))
- {
- this.m_sceneEdit.Voice(itemPreset.m_pvbInfo);
- Debug.Log(string.Format("{0}が押下されました。", name));
- }
- else
- {
- Debug.LogError(string.Format("不適切なボタンが押下されました。ボタン名={0}", name));
- }
- }
- private void ClickPose()
- {
- }
- [SerializeField]
- private int itemIconOffsetX = 15;
- private Maid m_maid;
- private SceneEdit m_sceneEdit;
- private Dictionary<string, PresetButtonCtrl.PresetButton> m_listPresetBtn;
- private Dictionary<string, PresetButtonCtrl.PresetButton> m_listItemPresetBtn;
- private Dictionary<string, PresetButtonCtrl.ItemPreset> m_dicItem;
- private GameObject m_goPresetButtonPanel;
- private GameObject m_goItemBtn;
- private GameObject m_goItemPresetsViewer;
- private GameObject m_goItemScrollView;
- private GameObject m_goParentItemBtn;
- private UISprite m_spItemIcon;
- private UISprite m_spScrollViewBG;
- private UIPanel m_pItemScrollViewPanel;
- private UIScrollBar m_sbScrollBar;
- private bool m_scrollViewWidthOver;
- private GameObject m_goItemSpriteBtn;
- private GameObject m_goItemTxtrBtn;
- private Color activeColor;
- private Color inActiveColor;
- private int m_currentItemIconWidth;
- private Vector4 m_scrollViewSize;
- private int m_maxScrollViewWidth;
- private int m_scrollViewSoftnessX;
- private int m_ajustedNguiContentWidth;
- private int m_nguiContentWidth;
- private Dictionary<string, float> dicBtnPosX;
- private const string ITEM_SPRITE_PRESET_BUTTON_PATH = "SceneEdit/PresetButton/Prefabs/ItemSpritePresetButton";
- private const string ITEM_TXTR_PRESET_BUTTON_PATH = "SceneEdit/PresetButton/Prefabs/ItemTxtrPresetButton";
- private const string ATLAS_PRESET = "SceneEdit/Preset/Atlas/AtlasPreset";
- private const string PRISAVE_CLOTHES_BODY_SPRITE_NAME = "cm3d2_edit_priset_buttom_clothes_body";
- private const string PRISAVE_CLOTHES_SPRITE_NAME = "cm3d2_edit_priset_buttom_clothes";
- private const string PRISAVE_BODY_SPRITE_NAME = "cm3d2_edit_preset_buttom_body";
- private const string CLOTHES_NUDE_SPRITE_NAME = "cm3d2_edit_clothesicon_nude";
- private const string CLOTHES_DRESS_SPRITE_NAME = "cm3d2_edit_clothesicon_dress";
- private const string CLOTHES_LINGERIE_SPRITE_NAME = "cm3d2_edit_clothesicon_lingerie";
- private const int RIGHT_OFFSET = 650;
- private string last_draw_type_;
- private float backup_pose_scroll_pos_;
- private float backup_bg_scroll_pos_;
- private enum LeftButtons
- {
- View,
- Clothes,
- PriSave
- }
- private enum RightButtons
- {
- Voice
- }
- private enum PriSaveButton
- {
- PriSave_Wear,
- PriSave_Body,
- PriSave_WearAndBody
- }
- private enum ClothesButton
- {
- Clothes_Nude,
- Clothes_Dress,
- Clothes_Lingerie
- }
- public class ItemPreset
- {
- public string m_name { get; set; }
- public PresetButtonMgr.ItemTypes m_itemType { get; set; }
- public string m_atlasName { get; set; }
- public string m_spriteName { get; set; }
- public UISprite m_spItemIcon { get; set; }
- public SceneEdit.PVBInfo m_pvbInfo { get; set; }
- public Texture2D m_txtItemIcon { get; set; }
- }
- private class PresetButton
- {
- public string m_name { get; set; }
- public UIButton m_btnButton { get; set; }
- public GameObject m_goSelectCursor { get; set; }
- public GameObject m_goWindowArrow { get; set; }
- }
- }
|