ProcedureCustomRole.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. using GameFramework;
  8. using GameFramework.Event;
  9. using UnityEngine;
  10. using UnityGameFramework.Runtime;
  11. using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
  12. namespace MetaClient
  13. {
  14. public class ProcedureCustomRole : ProcedureBase
  15. {
  16. private bool m_SelectComplete = false;
  17. private CustomRoleForm m_SkinForm = null;
  18. private Transform m_PreviewPos = null;
  19. private bool m_StartGame = false;
  20. private string m_NextSceneName = "";
  21. private GameMode m_NextGameMode;
  22. public override bool UseNativeDialog
  23. {
  24. get
  25. {
  26. return false;
  27. }
  28. }
  29. private GameObject m_CurPreviewShow = null;
  30. protected override void OnEnter(ProcedureOwner procedureOwner)
  31. {
  32. base.OnEnter(procedureOwner);
  33. m_SelectComplete = false;
  34. Log.Info("开始捏角色!");
  35. CustomManager.Instance.Init();
  36. GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);
  37. GameEntry.UI.OpenUIForm(UIFormId.CustomRole, this);
  38. //CustomRoleUtility.ShowFile();
  39. }
  40. protected override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown)
  41. {
  42. base.OnLeave(procedureOwner, isShutdown);
  43. GameEntry.Event.Unsubscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);
  44. if (m_SkinForm != null)
  45. {
  46. m_SkinForm.Close(true);
  47. m_SkinForm = null;
  48. }
  49. }
  50. public void StartSingleGame()
  51. {
  52. }
  53. public void StartMultiGame()
  54. {
  55. }
  56. public void StartMiniGame()
  57. {
  58. }
  59. protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
  60. {
  61. base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
  62. if (m_SelectComplete && m_StartGame && m_NextSceneName != "")
  63. {
  64. procedureOwner.SetData<VarByte>("GameMode", (byte)m_NextGameMode);
  65. procedureOwner.SetData<VarString>("NextScene", m_NextSceneName);
  66. ChangeState<ProcedureChangeScene>(procedureOwner);
  67. }
  68. }
  69. private void OnOpenUIFormSuccess(object sender, GameEventArgs e)
  70. {
  71. OpenUIFormSuccessEventArgs ne = (OpenUIFormSuccessEventArgs)e;
  72. if (ne.UserData != this)
  73. {
  74. return;
  75. }
  76. //m_SkinForm = (CustomRoleForm)ne.UIForm.Logic;
  77. }
  78. }
  79. }