UserEditAPI.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using com.workman.cm3d2.scene.dailyEtc;
  5. using UnityEngine;
  6. public class UserEditAPI
  7. {
  8. public List<SceneEdit.SMenuItem> GetMenu(MPN mpn)
  9. {
  10. return this.m_listHead;
  11. }
  12. public bool FirstMan()
  13. {
  14. return this.m_bFirstMan;
  15. }
  16. public void Init(MonoBehaviour f_parent, UserEditAPI.dgOnCharaLoadedCallBack f_dgLoadedFinish)
  17. {
  18. Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
  19. string a;
  20. if (tag_backup != null && tag_backup.TryGetValue("name", out a) && a == "SceneUserEdit" && tag_backup.ContainsKey("second"))
  21. {
  22. this.m_bFirstMan = false;
  23. }
  24. this.m_dgLoadFinish = f_dgLoadedFinish;
  25. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  26. GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
  27. GameMain.Instance.MainLight.Reset();
  28. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  29. GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.08306749f, 1.299064f, 0.0249091f), true);
  30. GameMain.Instance.MainCamera.SetDistance(2.2f, true);
  31. GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(177.9044f, 2.546583f), true);
  32. GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 3f * 2f - (float)Screen.width / 2f, 0f, 0f), false);
  33. GameMain.Instance.SoundMgr.PlayBGM("BGM009.ogg", 0.5f, true);
  34. if (GameMain.Instance.CharacterMgr.status.isDaytime)
  35. {
  36. GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg);
  37. }
  38. else
  39. {
  40. GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg);
  41. }
  42. string[] menuFiles = GameUty.MenuFiles;
  43. this.m_listHead.Clear();
  44. foreach (string text in menuFiles)
  45. {
  46. if (text.ToLower().Contains("mhead"))
  47. {
  48. SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem();
  49. if (SceneEdit.GetMenuItemSetUP(smenuItem, text, true))
  50. {
  51. if (smenuItem.m_boDelOnly)
  52. {
  53. }
  54. if (!(smenuItem.m_texIconRef == null))
  55. {
  56. if (smenuItem.m_bMan)
  57. {
  58. if (smenuItem.m_mpn == MPN.head)
  59. {
  60. this.m_listHead.Add(smenuItem);
  61. }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  68. this.m_man = GameMain.Instance.CharacterMgr.GetMan(0);
  69. this.m_man.Visible = true;
  70. this.m_man.AllProcPropSeqStart();
  71. f_parent.StartCoroutine(this.CoCharaLoad());
  72. }
  73. private IEnumerator CoCharaLoad()
  74. {
  75. while (GameMain.Instance.CharacterMgr.IsBusy())
  76. {
  77. yield return null;
  78. }
  79. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  80. this.m_man.body0.SetChinkoVisible(false);
  81. this.m_man.CrossFade("man_porse01.anm", false, true, false, 0f, 1f);
  82. GameMain.Instance.MainCamera.FadeIn(1f, false, null, true, true, default(Color));
  83. if (this.m_dgLoadFinish != null)
  84. {
  85. this.m_dgLoadFinish();
  86. }
  87. yield break;
  88. }
  89. public void Uninit()
  90. {
  91. if (GameMain.Instance.MainCamera != null)
  92. {
  93. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  94. }
  95. foreach (SceneEdit.SMenuItem smenuItem in this.m_listHead)
  96. {
  97. UnityEngine.Object.Destroy(smenuItem.m_texIconRef);
  98. }
  99. this.m_listHead.Clear();
  100. if (this.m_man != null)
  101. {
  102. this.m_man.body0.SetChinkoVisible(true);
  103. this.m_man.Visible = false;
  104. }
  105. }
  106. public void EndNextScene(CameraMain.dgOnCompleteFade f_dgEnd)
  107. {
  108. GameMain.Instance.MainCamera.FadeOut(1f, false, f_dgEnd, true, default(Color));
  109. }
  110. public void SetName(string f_strName)
  111. {
  112. if (this.m_man == null)
  113. {
  114. return;
  115. }
  116. GameMain.Instance.CharacterMgr.status.playerName = f_strName;
  117. }
  118. public string GetName()
  119. {
  120. if (this.m_man == null)
  121. {
  122. return string.Empty;
  123. }
  124. return GameMain.Instance.CharacterMgr.status.playerName;
  125. }
  126. public void SetFat(float f_fRate)
  127. {
  128. if (this.m_man == null)
  129. {
  130. return;
  131. }
  132. MaidProp prop = this.m_man.GetProp(MPN.Hara);
  133. int val = (int)((float)prop.min + (float)(prop.max - prop.min) * f_fRate + 0.5f);
  134. this.m_man.SetProp(MPN.Hara, val, false);
  135. this.m_man.AllProcProp();
  136. }
  137. public float GetFat()
  138. {
  139. if (this.m_man == null)
  140. {
  141. return 0f;
  142. }
  143. MaidProp prop = this.m_man.GetProp(MPN.Hara);
  144. return (float)(prop.value - prop.min) / (float)(prop.max - prop.min);
  145. }
  146. public void SetColor(Color f_col)
  147. {
  148. if (this.m_man == null)
  149. {
  150. return;
  151. }
  152. this.m_man.ManColor = f_col;
  153. this.m_man.ManColorUpdate();
  154. }
  155. public Color GetColor()
  156. {
  157. if (this.m_man == null)
  158. {
  159. return Color.black;
  160. }
  161. return this.m_man.ManColor;
  162. }
  163. public bool IsSelected(MPN f_mpn, SceneEdit.SMenuItem f_menu)
  164. {
  165. if (this.m_man == null)
  166. {
  167. return false;
  168. }
  169. MaidProp prop = this.m_man.GetProp(f_mpn);
  170. return prop.nFileNameRID == f_menu.m_nMenuFileRID;
  171. }
  172. public void ProcMenu(SceneEdit.SMenuItem f_menu)
  173. {
  174. if (this.m_man == null)
  175. {
  176. return;
  177. }
  178. this.m_man.SetProp(f_menu.m_mpn, f_menu.m_strMenuFileName, f_menu.m_nMenuFileRID, false, false);
  179. this.m_man.AllProcProp();
  180. }
  181. private Maid m_man;
  182. private List<SceneEdit.SMenuItem> m_listHead = new List<SceneEdit.SMenuItem>();
  183. private UserEditAPI.dgOnCharaLoadedCallBack m_dgLoadFinish;
  184. private bool m_bFirstMan = true;
  185. public delegate void dgOnCharaLoadedCallBack();
  186. }