123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- using System;
- using System.Collections.Generic;
- using com.workman.cm3d2.scene.dailyEtc;
- using UnityEngine;
- using wf;
- public class SceneUserEditMain : WfScreenChildren
- {
- public override void Awake()
- {
- base.Awake();
- NDebug.Assert(this.colorSliders.Length == 3, "colorSliders配列は3つ,RGBとして設定してください");
- EventDelegate.Add(this.playerNameInput.onChange, new EventDelegate.Callback(this.OnChangePlayerName));
- EventDelegate.Add(this.alphaSlider.onChange, new EventDelegate.Callback(this.OnChangeAlphaSlider));
- EventDelegate.Add(this.abdomenSlider.onChange, new EventDelegate.Callback(this.OnChangeAbdomenSlider));
- this.colorPalette.onChangeValue.Clear();
- this.colorPalette.onChangeValue.Add(new Action<Color>(this.OnChangeBodyColor));
- foreach (UISlider uislider in this.colorSliders)
- {
- EventDelegate.Add(uislider.onChange, new EventDelegate.Callback(this.OnChangeSingleBodyColor));
- }
- EventDelegate.Add(this.playerNameRandomButton.onClick, delegate()
- {
- this.playerNameInput.RemoveFocus();
- this.playerNameInput.value = MaidRandomName.GetPlayerName();
- });
- EventDelegate.Add(this.okButton.onClick, new EventDelegate.Callback(this.OnClickOK));
- this.manEditManager = new PhotoManEditManager();
- List<SceneEdit.SMenuItem>[] array2 = new List<SceneEdit.SMenuItem>[]
- {
- this.manEditManager.man_head_menu_list,
- this.manEditManager.man_body_menu_list
- };
- UIWFTabPanel[] array3 = new UIWFTabPanel[]
- {
- this.HeadItemTabPanel,
- this.BodyItemTabPanel
- };
- EventDelegate.Callback[] array4 = new EventDelegate.Callback[]
- {
- new EventDelegate.Callback(this.OnSelectManHeadItem),
- new EventDelegate.Callback(this.OnSelectManHeadItem)
- };
- for (int j = 0; j < array2.Length; j++)
- {
- UIWFTabPanel uiwftabPanel = array3[j];
- EventDelegate.Callback callback = array4[j];
- foreach (SceneEdit.SMenuItem smenuItem in array2[j])
- {
- GameObject gameObject = Utility.CreatePrefab(uiwftabPanel.gameObject, "ScenePhotoMode/EditItemIcon", true);
- if (smenuItem.m_texIconRef != null)
- {
- Sprite sprite2D = Sprite.Create(smenuItem.m_texIconRef, new Rect(0f, 0f, (float)smenuItem.m_texIconRef.width, (float)smenuItem.m_texIconRef.height), default(Vector2));
- UI2DSprite componentInChildren = gameObject.GetComponentInChildren<UI2DSprite>();
- componentInChildren.sprite2D = sprite2D;
- componentInChildren.SetDimensions(smenuItem.m_texIconRef.width, smenuItem.m_texIconRef.height);
- UISprite component = UTY.GetChildObject(gameObject, "Frame", false).GetComponent<UISprite>();
- component.SetDimensions(74, 74);
- }
- UIWFTabButton component2 = gameObject.GetComponent<UIWFTabButton>();
- component2.name = smenuItem.m_nMenuFileRID.ToString();
- EventDelegate.Add(component2.onSelect, callback);
- }
- Utility.ResetNGUI(uiwftabPanel.GetComponent<UIGrid>());
- Utility.ResetNGUI(uiwftabPanel.transform.parent.GetComponent<UIScrollView>());
- uiwftabPanel.UpdateChildren();
- }
- }
- public void OnDestroy()
- {
- if (this.manEditManager != null)
- {
- this.manEditManager.Destroy();
- this.manEditManager = null;
- }
- if (GameMain.Instance.MainCamera != null)
- {
- GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
- }
- }
- protected override void OnCall()
- {
- this.fadeWaitCount = 0;
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- GameUtility.ResetCameraZero();
- if (!(base.parent_mgr as SceneUserEditManager).isFirstEdist)
- {
- this.playerNameInput.GetComponent<BoxCollider>().enabled = false;
- this.playerNameRandomButton.gameObject.SetActive(false);
- }
- if (GameMain.Instance.CharacterMgr.status.isDaytime)
- {
- GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg);
- }
- else
- {
- GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg);
- }
- GameMain.Instance.SoundMgr.PlayBGM(this.bgmFile, 0.5f, true);
- CameraMain mainCamera = GameMain.Instance.MainCamera;
- mainCamera.Reset(CameraMain.CameraType.Target, true);
- mainCamera.SetTargetPos(new Vector3(0.08306749f, 1.299064f, 0.0249091f), true);
- mainCamera.SetDistance(2.2f, true);
- mainCamera.SetAroundAngle(new Vector2(177.9044f, 2.546583f), true);
- mainCamera.SetTargetOffset(new Vector3((float)Screen.width / 3f * 2f - (float)Screen.width / 2f, 0f, 0f), false);
- Maid man = GameMain.Instance.CharacterMgr.GetMan(0);
- this.manController = new PhotoManEditManager.Controller(man);
- man.Visible = true;
- man.AllProcProp();
- man.body0.SetChinkoVisible(false);
- string fn = "man_porse01.anm";
- man.CrossFade(fn, false, true, false, 0f, 1f);
- this.playerNameInput.value = GameMain.Instance.CharacterMgr.status.playerName;
- string b = man.GetProp("head").nFileNameRID.ToString();
- UIWFTabButton[] componentsInChildren = this.HeadItemTabPanel.GetComponentsInChildren<UIWFTabButton>();
- foreach (UIWFTabButton uiwftabButton in componentsInChildren)
- {
- if (uiwftabButton.name == b)
- {
- this.HeadItemTabPanel.Select(uiwftabButton);
- break;
- }
- }
- string b2 = man.GetProp("body").nFileNameRID.ToString();
- UIWFTabButton[] componentsInChildren2 = this.BodyItemTabPanel.GetComponentsInChildren<UIWFTabButton>();
- foreach (UIWFTabButton uiwftabButton2 in componentsInChildren2)
- {
- if (uiwftabButton2.name == b2)
- {
- this.BodyItemTabPanel.Select(uiwftabButton2);
- break;
- }
- }
- this.alphaSlider.value = (float)this.manController.alpha / 100f;
- this.alphaLabel.text = this.manController.alpha.ToString();
- this.abdomenSlider.value = this.manController.fat;
- float num = (float)System.Math.Round((double)this.manController.fat, 2, MidpointRounding.AwayFromZero) * 100f;
- this.abdomenLabel.text = num.ToString();
- this.colorPalette.SetColor(this.manController.color);
- uGUITutorialPanel.OpenTutorial("SceneUserEdit", null, false);
- }
- public void UpdateBodyColorNumText()
- {
- if (this.manController == null)
- {
- return;
- }
- float[] array = new float[]
- {
- this.manController.color.r,
- this.manController.color.g,
- this.manController.color.b
- };
- for (int i = 0; i < this.colorLabels.Length; i++)
- {
- float num = (float)System.Math.Round((double)array[i], 4, MidpointRounding.AwayFromZero);
- int num2 = (int)(num * 255f);
- this.colorLabels[i].text = num2.ToString();
- }
- }
- protected override bool IsCallFadeIn()
- {
- this.fadeWaitCount++;
- return 2 < this.fadeWaitCount;
- }
- private void OnChangePlayerName()
- {
- GameMain.Instance.CharacterMgr.status.playerName = this.playerNameInput.value;
- if (this.playerNameInput.value != GameMain.Instance.CharacterMgr.status.playerName)
- {
- this.playerNameInput.value = GameMain.Instance.CharacterMgr.status.playerName;
- }
- }
- public void OnSelectManHeadItem()
- {
- UIWFSelectButton current = UIWFSelectButton.current;
- if (this.manController == null || !current.isSelected)
- {
- return;
- }
- bool flag = false;
- int num = int.Parse(current.name);
- List<SceneEdit.SMenuItem>[] array = new List<SceneEdit.SMenuItem>[]
- {
- this.manEditManager.man_head_menu_list,
- this.manEditManager.man_body_menu_list
- };
- foreach (List<SceneEdit.SMenuItem> list in array)
- {
- foreach (SceneEdit.SMenuItem smenuItem in list)
- {
- if (num == smenuItem.m_nMenuFileRID)
- {
- this.manController.SetMenu(smenuItem);
- flag = (smenuItem.m_mpn == MPN.head);
- break;
- }
- }
- }
- if (!flag)
- {
- string fn = "man_porse01.anm";
- this.manController.man.CrossFade(fn, false, true, false, 0f, 1f);
- }
- }
- public override void Update()
- {
- base.Update();
- if (this.manController == null)
- {
- return;
- }
- if (this.manController.alpha.ToString() != this.alphaLabel.text)
- {
- this.alphaSlider.value = (float)this.manController.alpha / 100f;
- }
- }
- private void OnChangeAlphaSlider()
- {
- if (this.manController == null)
- {
- return;
- }
- int alpha = (int)System.Math.Ceiling((double)(this.alphaSlider.value * 100f));
- this.manController.alpha = alpha;
- this.alphaLabel.text = alpha.ToString();
- }
- private void OnChangeAbdomenSlider()
- {
- if (this.manController == null)
- {
- return;
- }
- this.manController.fat = (float)System.Math.Round((double)this.abdomenSlider.value, 2, MidpointRounding.AwayFromZero);
- float num = (float)System.Math.Round((double)this.manController.fat, 2, MidpointRounding.AwayFromZero);
- float num2 = num * 100f;
- this.abdomenLabel.text = num2.ToString();
- }
- private void OnChangeBodyColor(Color color)
- {
- if (this.manController == null)
- {
- return;
- }
- this.manController.color = color;
- color = this.manController.color;
- float[] array = new float[]
- {
- color.r,
- color.g,
- color.b
- };
- for (int i = 0; i < this.colorSliders.Length; i++)
- {
- List<EventDelegate> onChange = this.colorSliders[i].onChange;
- this.colorSliders[i].onChange = new List<EventDelegate>();
- this.colorSliders[i].value = array[i];
- this.colorSliders[i].onChange = onChange;
- }
- this.UpdateBodyColorNumText();
- }
- private void OnChangeSingleBodyColor()
- {
- if (this.manController == null)
- {
- return;
- }
- Color color = new Color(this.colorSliders[0].value, this.colorSliders[1].value, this.colorSliders[2].value);
- this.manController.color = color;
- color = this.manController.color;
- List<Action<Color>> onChangeValue = this.colorPalette.onChangeValue;
- this.colorPalette.onChangeValue = new List<Action<Color>>();
- this.colorPalette.SetColor(color);
- this.colorPalette.onChangeValue = onChangeValue;
- this.UpdateBodyColorNumText();
- }
- protected override void OnFinish()
- {
- if (this.manController != null && this.manController.man != null)
- {
- this.manController.man.Visible = false;
- }
- base.parent_mgr.CallScreen("Move");
- }
- public void OnClickOK()
- {
- this.Finish();
- }
- [SerializeField]
- private string bgmFile = "BGM009.ogg";
- [SerializeField]
- private UIInput playerNameInput;
- [SerializeField]
- private UIButton playerNameRandomButton;
- [SerializeField]
- private UIWFTabPanel HeadItemTabPanel;
- [SerializeField]
- private UIWFTabPanel BodyItemTabPanel;
- [SerializeField]
- private UISlider alphaSlider;
- [SerializeField]
- private UILabel alphaLabel;
- [SerializeField]
- private UISlider abdomenSlider;
- [SerializeField]
- private UILabel abdomenLabel;
- [SerializeField]
- private ColorrPaletteParts colorPalette;
- [SerializeField]
- private UISlider[] colorSliders;
- [SerializeField]
- private UILabel[] colorLabels;
- [SerializeField]
- private UIButton okButton;
- private PhotoManEditManager manEditManager;
- private PhotoManEditManager.Controller manController;
- private int fadeWaitCount;
- }
|