123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using wf;
- public class BGWindow : BaseMaidPhotoWindow
- {
- public override void Awake()
- {
- base.Awake();
- PhotoBGData.Create();
- Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
- Dictionary<string, List<KeyValuePair<string, object>>> dictionary2 = new Dictionary<string, List<KeyValuePair<string, object>>>();
- foreach (KeyValuePair<string, List<PhotoBGData>> keyValuePair in PhotoBGData.category_list)
- {
- if (!dictionary2.ContainsKey(keyValuePair.Key))
- {
- dictionary2.Add(keyValuePair.Key, new List<KeyValuePair<string, object>>());
- dictionary.Add(keyValuePair.Key, new List<string>());
- }
- for (int i = 0; i < keyValuePair.Value.Count; i++)
- {
- dictionary2[keyValuePair.Key].Add(new KeyValuePair<string, object>(keyValuePair.Value[i].name, keyValuePair.Value[i]));
- dictionary[keyValuePair.Key].Add(keyValuePair.Value[i].nameTerm);
- }
- }
- if (!Product.SPP)
- {
- dictionary = null;
- }
- this.PopupAndTabList.SetData(dictionary2, dictionary, false);
- this.PopupAndTabList.onChangePopUpListValue.Add(new Action<KeyValuePair<string, UnityEngine.Object>>(this.OnChangePopUpList));
- this.PopupAndTabList.onSelect.Add(new Action<object>(this.OnSelectItem));
- this.PopupAndTabList.popup_term_list = ((!Product.SPP) ? null : PhotoBGData.popup_category_term_list);
- this.PopupAndTabList.popup_value_list = PhotoBGData.popup_category_list;
- this.CheckSolidColor.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckSolidColorCheckBox));
- this.ColorInput.onChangeValue.Add(new Action<WindowPartsInputColorrPalette, Color>(this.OnChangeValueColorInput));
- }
- public override void Start()
- {
- base.Start();
- this.UpdateChildren();
- this.PopupAndTabList.SetPopupValue(PhotoBGData.popup_category_list[0].Key);
- this.PopupAndTabList.SetSelectButton(PhotoBGData.init_data, true);
- this.CheckSolidColor.check = false;
- this.ColorInput.visible = false;
- this.ColorInput.ResetNum = GameMain.Instance.MainCamera.camera.backgroundColor;
- this.ColorInput.OnReset();
- }
- private void OnSelectItem(object select_data_obj)
- {
- if (select_data_obj == null)
- {
- return;
- }
- PhotoBGData photoBGData = select_data_obj as PhotoBGData;
- Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
- if (!woldStoreData.ContainsKey("ベース背景"))
- {
- woldStoreData["ベース背景"] = new Dictionary<string, string>();
- }
- woldStoreData["ベース背景"]["id"] = photoBGData.id;
- this.SetBg(photoBGData);
- }
- private void OnChangeValueColorInput(WindowPartsInputColorrPalette obj, Color color)
- {
- this.Apply();
- }
- protected void OnChangePopUpList(KeyValuePair<string, UnityEngine.Object> popup_val)
- {
- }
- private void SetBg(PhotoBGData bg_data)
- {
- ObjectManagerWindow objectManagerWindow = base.mgr.GetWindow(PhotoWindowManager.WindowType.ObjectManager) as ObjectManagerWindow;
- objectManagerWindow.RemoveTransTargetObject(GameMain.Instance.BgMgr.current_bg_object);
- bg_data.Apply();
- List<GameObject> list = new List<GameObject>();
- Transform transform = GameMain.Instance.BgMgr.current_bg_object.transform;
- for (int i = 0; i < transform.childCount; i++)
- {
- if (!transform.GetChild(i).gameObject.activeSelf)
- {
- list.Add(transform.GetChild(i).gameObject);
- }
- }
- foreach (GameObject obj in list)
- {
- UnityEngine.Object.DestroyImmediate(obj);
- }
- objectManagerWindow.AddTransTargetObject(GameMain.Instance.BgMgr.current_bg_object, bg_data.name, bg_data.nameTerm, PhotoTransTargetObject.Type.BG);
- }
- public override void OnReset()
- {
- }
- public void OnClickCheckSolidColorCheckBox(WFCheckBox check_box)
- {
- this.Apply();
- }
- public void Apply()
- {
- Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
- Dictionary<string, string> dictionary = woldStoreData["ベース背景"];
- Transform transform = GameMain.Instance.BgMgr.current_bg_object.transform;
- transform.gameObject.SetActive(!this.CheckSolidColor.check);
- if (!transform.gameObject.activeSelf)
- {
- this.ColorInput.visible = true;
- this.PopupAndTabList.gameObject.SetActive(false);
- }
- else
- {
- this.ColorInput.visible = false;
- this.PopupAndTabList.gameObject.SetActive(true);
- }
- GameMain.Instance.MainCamera.camera.backgroundColor = this.ColorInput.value;
- }
- public override void OnSerializeEvent()
- {
- base.OnSerializeEvent();
- Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
- Dictionary<string, string> dictionary = woldStoreData["ベース背景"];
- Transform transform = GameMain.Instance.BgMgr.current_bg_object.transform;
- dictionary["position"] = transform.position.ToString("G9");
- dictionary["rotation"] = transform.rotation.ToString("G9");
- dictionary["scale"] = transform.localScale.ToString("G9");
- dictionary["visible"] = transform.gameObject.activeSelf.ToString();
- dictionary["背景色"] = GameMain.Instance.MainCamera.camera.backgroundColor.ToString("G9");
- }
- public override void OnDeserializeEvent()
- {
- this.ColorInput.visible = true;
- this.PopupAndTabList.gameObject.SetActive(true);
- Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
- Dictionary<string, string> dictionary = woldStoreData["ベース背景"];
- PhotoBGData photoBGData = PhotoBGData.Get(dictionary["id"]);
- if (photoBGData == null)
- {
- photoBGData = PhotoBGData.init_data;
- }
- string categoryNameFromSelectButton = this.PopupAndTabList.GetCategoryNameFromSelectButton(photoBGData);
- if (!string.IsNullOrEmpty(categoryNameFromSelectButton))
- {
- this.PopupAndTabList.SetPopupValue(categoryNameFromSelectButton);
- this.PopupAndTabList.SetSelectButton(photoBGData, true);
- }
- Transform transform = GameMain.Instance.BgMgr.current_bg_object.transform;
- transform.position = Parse.Vector3(dictionary["position"]);
- transform.rotation = Parse.Quaternion(dictionary["rotation"]);
- transform.localScale = Parse.Vector3(dictionary["scale"]);
- this.CheckSolidColor.check = !bool.Parse(dictionary["visible"]);
- if (!dictionary.ContainsKey("背景色"))
- {
- dictionary["背景色"] = Color.black.ToString("G9");
- }
- this.ColorInput.value = Parse.Color(dictionary["背景色"]);
- }
- public PopupAndTabList PopupAndTabList;
- public WFCheckBox CheckSolidColor;
- public WindowPartsInputColorrPalette ColorInput;
- }
|