using System; using System.Collections; using System.Collections.Generic; using com.workman.cm3d2.scene.dailyEtc; using UnityEngine; public class UserEditAPI { public List GetMenu(MPN mpn) { return this.m_listHead; } public bool FirstMan() { return this.m_bFirstMan; } public void Init(MonoBehaviour f_parent, UserEditAPI.dgOnCharaLoadedCallBack f_dgLoadedFinish) { Dictionary tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup; string a; if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneUserEdit" && tag_backup.ContainsKey("second")) { this.m_bFirstMan = false; } this.m_dgLoadFinish = f_dgLoadedFinish; GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color)); GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel(); GameMain.Instance.MainLight.Reset(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.08306749f, 1.299064f, 0.0249091f), true); GameMain.Instance.MainCamera.SetDistance(2.2f, true); GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(177.9044f, 2.546583f), true); GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 3f * 2f - (float)Screen.width / 2f, 0f, 0f), false); GameMain.Instance.SoundMgr.PlayBGM("BGM009.ogg", 0.5f, true); if (GameMain.Instance.CharacterMgr.status.isDaytime) { GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg); } else { GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg); } string[] menuFiles = GameUty.MenuFiles; this.m_listHead.Clear(); foreach (string text in menuFiles) { if (text.ToLower().Contains("mhead")) { SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem(); if (SceneEdit.GetMenuItemSetUP(smenuItem, text, true)) { if (smenuItem.m_boDelOnly) { } if (!(smenuItem.m_texIcon == null)) { if (smenuItem.m_bMan) { if (smenuItem.m_mpn == MPN.head) { this.m_listHead.Add(smenuItem); } } } } } } GameMain.Instance.CharacterMgr.DeactivateCharaAll(); this.m_man = GameMain.Instance.CharacterMgr.GetMan(0); this.m_man.Visible = true; this.m_man.AllProcPropSeqStart(); f_parent.StartCoroutine(this.CoCharaLoad()); } private IEnumerator CoCharaLoad() { while (GameMain.Instance.CharacterMgr.IsBusy()) { yield return null; } GameMain.Instance.CharacterMgr.ResetCharaPosAll(); this.m_man.body0.SetChinkoVisible(false); this.m_man.CrossFade("man_porse01.anm", false, true, false, 0f, 1f); GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color)); if (this.m_dgLoadFinish != null) { this.m_dgLoadFinish(); } yield break; } public void Uninit() { if (GameMain.Instance.MainCamera != null) { GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false); } foreach (SceneEdit.SMenuItem smenuItem in this.m_listHead) { UnityEngine.Object.Destroy(smenuItem.m_texIcon); UnityEngine.Object.Destroy(smenuItem.m_texIconRandomColor); } this.m_listHead.Clear(); if (this.m_man != null) { this.m_man.body0.SetChinkoVisible(true); this.m_man.Visible = false; } } public void EndNextScene(CameraMain.dgOnCompleteFade f_dgEnd) { GameMain.Instance.MainCamera.FadeOut(1f, false, f_dgEnd, true, default(Color)); } public void SetName(string f_strName) { if (this.m_man == null) { return; } GameMain.Instance.CharacterMgr.status.playerName = f_strName; } public string GetName() { if (this.m_man == null) { return string.Empty; } return GameMain.Instance.CharacterMgr.status.playerName; } public void SetFat(float f_fRate) { if (this.m_man == null) { return; } MaidProp prop = this.m_man.GetProp(MPN.Hara); int val = (int)((float)prop.min + (float)(prop.max - prop.min) * f_fRate + 0.5f); this.m_man.SetProp(MPN.Hara, val, false); this.m_man.AllProcProp(); } public float GetFat() { if (this.m_man == null) { return 0f; } MaidProp prop = this.m_man.GetProp(MPN.Hara); return (float)(prop.value - prop.min) / (float)(prop.max - prop.min); } public void SetColor(Color f_col) { if (this.m_man == null) { return; } this.m_man.ManColor = f_col; this.m_man.ManColorUpdate(); } public Color GetColor() { if (this.m_man == null) { return Color.black; } return this.m_man.ManColor; } public bool IsSelected(MPN f_mpn, SceneEdit.SMenuItem f_menu) { if (this.m_man == null) { return false; } MaidProp prop = this.m_man.GetProp(f_mpn); return prop.nFileNameRID == f_menu.m_nMenuFileRID; } public void ProcMenu(SceneEdit.SMenuItem f_menu) { if (this.m_man == null) { return; } this.m_man.SetProp(f_menu.m_mpn, f_menu.m_strMenuFileName, f_menu.m_nMenuFileRID, false, false); this.m_man.AllProcProp(); } private Maid m_man; private List m_listHead = new List(); private UserEditAPI.dgOnCharaLoadedCallBack m_dgLoadFinish; private bool m_bFirstMan = true; public delegate void dgOnCharaLoadedCallBack(); }