UserEditAPI.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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_texIcon == 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_texIcon);
  98. UnityEngine.Object.Destroy(smenuItem.m_texIconRandomColor);
  99. }
  100. this.m_listHead.Clear();
  101. if (this.m_man != null)
  102. {
  103. this.m_man.body0.SetChinkoVisible(true);
  104. this.m_man.Visible = false;
  105. }
  106. }
  107. public void EndNextScene(CameraMain.dgOnCompleteFade f_dgEnd)
  108. {
  109. GameMain.Instance.MainCamera.FadeOut(1f, false, f_dgEnd, true, default(Color));
  110. }
  111. public void SetName(string f_strName)
  112. {
  113. if (this.m_man == null)
  114. {
  115. return;
  116. }
  117. GameMain.Instance.CharacterMgr.status.playerName = f_strName;
  118. }
  119. public string GetName()
  120. {
  121. if (this.m_man == null)
  122. {
  123. return string.Empty;
  124. }
  125. return GameMain.Instance.CharacterMgr.status.playerName;
  126. }
  127. public void SetFat(float f_fRate)
  128. {
  129. if (this.m_man == null)
  130. {
  131. return;
  132. }
  133. MaidProp prop = this.m_man.GetProp(MPN.Hara);
  134. int val = (int)((float)prop.min + (float)(prop.max - prop.min) * f_fRate + 0.5f);
  135. this.m_man.SetProp(MPN.Hara, val, false);
  136. this.m_man.AllProcProp();
  137. }
  138. public float GetFat()
  139. {
  140. if (this.m_man == null)
  141. {
  142. return 0f;
  143. }
  144. MaidProp prop = this.m_man.GetProp(MPN.Hara);
  145. return (float)(prop.value - prop.min) / (float)(prop.max - prop.min);
  146. }
  147. public void SetColor(Color f_col)
  148. {
  149. if (this.m_man == null)
  150. {
  151. return;
  152. }
  153. this.m_man.ManColor = f_col;
  154. this.m_man.ManColorUpdate();
  155. }
  156. public Color GetColor()
  157. {
  158. if (this.m_man == null)
  159. {
  160. return Color.black;
  161. }
  162. return this.m_man.ManColor;
  163. }
  164. public bool IsSelected(MPN f_mpn, SceneEdit.SMenuItem f_menu)
  165. {
  166. if (this.m_man == null)
  167. {
  168. return false;
  169. }
  170. MaidProp prop = this.m_man.GetProp(f_mpn);
  171. return prop.nFileNameRID == f_menu.m_nMenuFileRID;
  172. }
  173. public void ProcMenu(SceneEdit.SMenuItem f_menu)
  174. {
  175. if (this.m_man == null)
  176. {
  177. return;
  178. }
  179. this.m_man.SetProp(f_menu.m_mpn, f_menu.m_strMenuFileName, f_menu.m_nMenuFileRID, false, false);
  180. this.m_man.AllProcProp();
  181. }
  182. private Maid m_man;
  183. private List<SceneEdit.SMenuItem> m_listHead = new List<SceneEdit.SMenuItem>();
  184. private UserEditAPI.dgOnCharaLoadedCallBack m_dgLoadFinish;
  185. private bool m_bFirstMan = true;
  186. public delegate void dgOnCharaLoadedCallBack();
  187. }