SceneSingleEffect.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class SceneSingleEffect : MonoBehaviour
  6. {
  7. public void Awake()
  8. {
  9. this.effect_obj_dic_.Clear();
  10. this.effect_obj_dic_.Add("MVP", UTY.GetChildObject(base.gameObject, "MVPEffect", false));
  11. this.effect_obj_dic_.Add("CharaInfo", UTY.GetChildObject(base.gameObject, "CharacterIntroduction", false));
  12. this.effect_obj_dic_.Add("CharaInfo2", UTY.GetChildObject(base.gameObject, "CharacterIntroduction2", false));
  13. this.effect_obj_dic_.Add("VS", UTY.GetChildObject(base.gameObject, "VSEffect", false));
  14. this.effect_obj_dic_.Add("Win", UTY.GetChildObject(base.gameObject, "WinEffect", false));
  15. this.effect_obj_dic_.Add("BattleScroll", UTY.GetChildObject(base.gameObject, "BattleScroll", false));
  16. this.effect_obj_dic_.Add("Smoke", GameObject.Find("Smoke_Floor"));
  17. this.effect_obj_dic_.Add("SpotLight", GameObject.Find("Spot light"));
  18. this.effect_obj_dic_["Smoke"].SetActive(false);
  19. this.effect_obj_dic_["SpotLight"].SetActive(false);
  20. }
  21. public void Start()
  22. {
  23. this.adv_kag_ = GameMain.Instance.ScriptMgr.adv_kag;
  24. this.adv_kag_.kag.AddTagCallBack("stopeffect", new KagScript.KagTagCallBack(this.TagStopEffect));
  25. this.adv_kag_.kag.AddTagCallBack("startkamifubuki", new KagScript.KagTagCallBack(this.TagStartKamiFubuki));
  26. this.adv_kag_.kag.AddTagCallBack("startmvpeffect", new KagScript.KagTagCallBack(this.TagStartMvpEffect));
  27. this.adv_kag_.kag.AddTagCallBack("startcharainfoeffect", new KagScript.KagTagCallBack(this.TagStartCharaInfoEffect));
  28. this.adv_kag_.kag.AddTagCallBack("startvseffect", new KagScript.KagTagCallBack(this.TagStartVsEffect));
  29. this.adv_kag_.kag.AddTagCallBack("startwineffect", new KagScript.KagTagCallBack(this.TagStartWinEffect));
  30. this.adv_kag_.kag.AddTagCallBack("battlescroll", new KagScript.KagTagCallBack(this.TagBattleScroll));
  31. this.adv_kag_.kag.AddTagCallBack("smoke", new KagScript.KagTagCallBack(this.TagSmoke));
  32. this.adv_kag_.kag.AddTagCallBack("stagelightanime", new KagScript.KagTagCallBack(this.TagStageLightAnime));
  33. this.adv_kag_.kag.AddTagCallBack("spotlight", new KagScript.KagTagCallBack(this.TagSpotLight));
  34. this.adv_kag_.Exec();
  35. }
  36. public void OnPreFinalize()
  37. {
  38. this.adv_kag_ = null;
  39. }
  40. public void OnDestroy()
  41. {
  42. if (this.adv_kag_ != null)
  43. {
  44. if (this.adv_kag_.kag != null)
  45. {
  46. this.adv_kag_.kag.RemoveTagCallBack("stopeffect");
  47. this.adv_kag_.kag.RemoveTagCallBack("startkamifubuki");
  48. this.adv_kag_.kag.RemoveTagCallBack("startmvpeffect");
  49. this.adv_kag_.kag.RemoveTagCallBack("startcharainfoeffect");
  50. this.adv_kag_.kag.RemoveTagCallBack("startvseffect");
  51. this.adv_kag_.kag.RemoveTagCallBack("startwineffect");
  52. this.adv_kag_.kag.RemoveTagCallBack("battlescroll");
  53. this.adv_kag_.kag.RemoveTagCallBack("smoke");
  54. this.adv_kag_.kag.RemoveTagCallBack("stagelightanime");
  55. this.adv_kag_.kag.RemoveTagCallBack("spotlight");
  56. }
  57. this.adv_kag_ = null;
  58. }
  59. }
  60. public bool TagStopEffect(KagTagSupport tag_data)
  61. {
  62. foreach (KeyValuePair<string, GameObject> keyValuePair in this.effect_obj_dic_)
  63. {
  64. keyValuePair.Value.SetActive(false);
  65. }
  66. GameObject gameObject = GameObject.Find("__GameMain__/BG");
  67. if (gameObject != null && 0 < gameObject.transform.childCount)
  68. {
  69. GameObject childObject = UTY.GetChildObject(gameObject.transform.GetChild(0).gameObject, "PKamihubuki", false);
  70. if (childObject != null)
  71. {
  72. UnityEngine.Object.DestroyImmediate(childObject);
  73. }
  74. }
  75. return false;
  76. }
  77. public bool TagStartKamiFubuki(KagTagSupport tag_data)
  78. {
  79. GameObject gameObject = GameObject.Find("__GameMain__/BG");
  80. if (gameObject.transform.childCount <= 0)
  81. {
  82. return false;
  83. }
  84. GameObject gameObject2 = gameObject.transform.GetChild(0).gameObject;
  85. GameObject gameObject3 = Utility.CreatePrefab(gameObject, "Prefab/Particle/PKamihubuki", true);
  86. gameObject3.name = "PKamihubuki";
  87. Vector3 localPosition = gameObject3.transform.localPosition;
  88. localPosition.y = 3.5f;
  89. gameObject3.transform.localPosition = localPosition;
  90. gameObject3.transform.parent = gameObject2.transform;
  91. return false;
  92. }
  93. public bool TagStartMvpEffect(KagTagSupport tag_data)
  94. {
  95. bool flag = true;
  96. this.effect_obj_dic_["MVP"].SetActive(flag);
  97. if (flag)
  98. {
  99. GameObject gameObject = GameObject.Find("__GameMain__/BG/Salon(Clone)");
  100. if (gameObject != null)
  101. {
  102. GameObject gameObject2 = Utility.CreatePrefab(gameObject, "Prefab/Particle/PKamihubuki", true);
  103. Vector3 localPosition = gameObject2.transform.localPosition;
  104. localPosition.y = 3.5f;
  105. gameObject2.transform.localPosition = localPosition;
  106. }
  107. }
  108. return false;
  109. }
  110. public bool TagStartCharaInfoEffect(KagTagSupport tag_data)
  111. {
  112. return false;
  113. }
  114. public bool TagStartVsEffect(KagTagSupport tag_data)
  115. {
  116. this.effect_obj_dic_["VS"].SetActive(true);
  117. return false;
  118. }
  119. public bool TagStartWinEffect(KagTagSupport tag_data)
  120. {
  121. this.effect_obj_dic_["Win"].SetActive(true);
  122. return false;
  123. }
  124. public bool TagBattleScroll(KagTagSupport tag_data)
  125. {
  126. this.effect_obj_dic_["BattleScroll"].SetActive(tag_data.IsValid("on"));
  127. return false;
  128. }
  129. public bool TagSmoke(KagTagSupport tag_data)
  130. {
  131. bool flag = tag_data.IsValid("on");
  132. ParticleEmitter component = this.effect_obj_dic_["Smoke"].GetComponent<ParticleEmitter>();
  133. if (flag)
  134. {
  135. if (!component.gameObject.activeSelf)
  136. {
  137. component.gameObject.SetActive(true);
  138. }
  139. component.maxSize = 0.7f;
  140. }
  141. else
  142. {
  143. component.maxSize = 0f;
  144. if (tag_data.IsValid("forc"))
  145. {
  146. component.gameObject.SetActive(false);
  147. }
  148. }
  149. return false;
  150. }
  151. public bool TagStageLightAnime(KagTagSupport tag_data)
  152. {
  153. if (GameMain.Instance.BgMgr.GetBGName() != "Salon")
  154. {
  155. return false;
  156. }
  157. bool flag = tag_data.IsValid("on");
  158. Func<string, string, Animation> func = delegate(string obj_name, string anm_name)
  159. {
  160. GameObject childObject = UTY.GetChildObject(GameMain.Instance.BgMgr.current_bg_object, obj_name, false);
  161. Animation animation2;
  162. if (childObject.GetComponent<Animation>() == null)
  163. {
  164. animation2 = childObject.AddComponent<Animation>();
  165. }
  166. else
  167. {
  168. animation2 = childObject.GetComponent<Animation>();
  169. }
  170. if (animation2.GetClip(anm_name) == null)
  171. {
  172. animation2.AddClip((AnimationClip)UnityEngine.Object.Instantiate(Resources.Load("SceneSingleEffect/Anim/" + anm_name)), anm_name);
  173. }
  174. return animation2;
  175. };
  176. foreach (KeyValuePair<string, string> keyValuePair in new Dictionary<string, string>
  177. {
  178. {
  179. "Light01",
  180. "ALLway01_Light01"
  181. },
  182. {
  183. "Light02",
  184. "ALLway01_Light01"
  185. },
  186. {
  187. "Light03",
  188. "ALLway01_Light03"
  189. },
  190. {
  191. "Light04",
  192. "ALLway01_Light04"
  193. },
  194. {
  195. "Light05",
  196. "ALLway01_Light05"
  197. },
  198. {
  199. "Light06",
  200. "ALLway01_Light06"
  201. },
  202. {
  203. "Light07",
  204. "ALLway01_Light07"
  205. },
  206. {
  207. "Light08",
  208. "ALLway01_Light08"
  209. },
  210. {
  211. "Light09",
  212. "ALLway01_Light09"
  213. }
  214. })
  215. {
  216. Animation animation = func(keyValuePair.Key, keyValuePair.Value);
  217. if (flag)
  218. {
  219. animation.Play(keyValuePair.Value);
  220. }
  221. else
  222. {
  223. animation.Stop();
  224. }
  225. }
  226. return false;
  227. }
  228. public bool TagSpotLight(KagTagSupport tag_data)
  229. {
  230. Light component = this.effect_obj_dic_["SpotLight"].GetComponent<Light>();
  231. if (tag_data.IsValid("on"))
  232. {
  233. component.gameObject.SetActive(true);
  234. }
  235. else if (tag_data.IsValid("off"))
  236. {
  237. component.gameObject.SetActive(false);
  238. }
  239. Vector3 localPosition = component.transform.localPosition;
  240. if (tag_data.IsValid("px"))
  241. {
  242. localPosition.x = tag_data.GetTagProperty("px").AsReal();
  243. }
  244. if (tag_data.IsValid("py"))
  245. {
  246. localPosition.y = tag_data.GetTagProperty("py").AsReal();
  247. }
  248. if (tag_data.IsValid("pz"))
  249. {
  250. localPosition.z = tag_data.GetTagProperty("pz").AsReal();
  251. }
  252. component.transform.localPosition = localPosition;
  253. Vector3 eulerAngles = component.transform.localRotation.eulerAngles;
  254. if (tag_data.IsValid("rx"))
  255. {
  256. eulerAngles.x = tag_data.GetTagProperty("rx").AsReal();
  257. }
  258. if (tag_data.IsValid("ry"))
  259. {
  260. eulerAngles.y = tag_data.GetTagProperty("ry").AsReal();
  261. }
  262. if (tag_data.IsValid("rz"))
  263. {
  264. eulerAngles.z = tag_data.GetTagProperty("rz").AsReal();
  265. }
  266. if (tag_data.IsValid("rx") || tag_data.IsValid("ry") || tag_data.IsValid("rz"))
  267. {
  268. component.transform.localRotation = Quaternion.Euler(eulerAngles);
  269. }
  270. Color color = component.color;
  271. if (tag_data.IsValid("r"))
  272. {
  273. color.r = tag_data.GetTagProperty("r").AsReal();
  274. }
  275. if (tag_data.IsValid("g"))
  276. {
  277. color.g = tag_data.GetTagProperty("g").AsReal();
  278. }
  279. if (tag_data.IsValid("b"))
  280. {
  281. color.b = tag_data.GetTagProperty("b").AsReal();
  282. }
  283. component.color = color;
  284. if (tag_data.IsValid("range"))
  285. {
  286. component.range = tag_data.GetTagProperty("range").AsReal();
  287. }
  288. if (tag_data.IsValid("angle"))
  289. {
  290. component.spotAngle = tag_data.GetTagProperty("angle").AsReal();
  291. }
  292. if (tag_data.IsValid("intensity"))
  293. {
  294. component.intensity = tag_data.GetTagProperty("intensity").AsReal();
  295. }
  296. return false;
  297. }
  298. private ADVKagManager adv_kag_;
  299. private Dictionary<string, GameObject> effect_obj_dic_ = new Dictionary<string, GameObject>();
  300. }