init
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
// using CustomEvent;
|
||||
// using Definition.Enum;
|
||||
// using GameFramework.Event;
|
||||
// using UnityGameFramework.Runtime;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class SelectRoleFormController : UIFormControllerCommonBase<SelectRoleFormContext, SelectRoleForm>
|
||||
// {
|
||||
// private SelectRoleFormUseCase _useCase;
|
||||
//
|
||||
// protected override UIFormType UIFormTypeId => UIFormType.SelectRoleForm;
|
||||
//
|
||||
// protected override void RefreshUI(SelectRoleForm form, SelectRoleFormContext context)
|
||||
// {
|
||||
// form.RefreshUI(context);
|
||||
// }
|
||||
//
|
||||
// protected override void SubscribeCustomEvents()
|
||||
// {
|
||||
// GameEntry.Event.Subscribe(MenuSelectRoleReturnEventArgs.EventId, OnMenuSelectRoleReturn);
|
||||
// GameEntry.Event.Subscribe(MenuSelectRoleSelectedEventArgs.EventId, OnMenuSelectRoleSelected);
|
||||
// GameEntry.Event.Subscribe(MenuSelectRoleConfirmEventArgs.EventId, OnMenuSelectRoleConfirm);
|
||||
// }
|
||||
//
|
||||
// protected override void UnsubscribeCustomEvents()
|
||||
// {
|
||||
// GameEntry.Event.Unsubscribe(MenuSelectRoleReturnEventArgs.EventId, OnMenuSelectRoleReturn);
|
||||
// GameEntry.Event.Unsubscribe(MenuSelectRoleSelectedEventArgs.EventId, OnMenuSelectRoleSelected);
|
||||
// GameEntry.Event.Unsubscribe(MenuSelectRoleConfirmEventArgs.EventId, OnMenuSelectRoleConfirm);
|
||||
// }
|
||||
//
|
||||
// private static SelectRoleFormContext BuildContext(SelectRoleFormRawData rawData)
|
||||
// {
|
||||
// if (rawData == null)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// int count = rawData.RoleIds?.Length ?? 0;
|
||||
// RoleItemContext[] roleItems = new RoleItemContext[count];
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// string iconName = rawData.RoleIconNames != null && i < rawData.RoleIconNames.Length
|
||||
// ? rawData.RoleIconNames[i]
|
||||
// : null;
|
||||
//
|
||||
// roleItems[i] = new RoleItemContext
|
||||
// {
|
||||
// RoleId = rawData.RoleIds[i],
|
||||
// IconName = iconName
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// RolePropertyAreaContext propertyContext = null;
|
||||
// if (rawData.SelectedRoleId >= 0)
|
||||
// {
|
||||
// propertyContext = new RolePropertyAreaContext
|
||||
// {
|
||||
// RoleName = rawData.SelectedRoleName,
|
||||
// InitialPropertyText = rawData.SelectedRoleInitialPropertyText
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// return new SelectRoleFormContext
|
||||
// {
|
||||
// RoleItemContexts = roleItems,
|
||||
// RolePropertyAreaContext = propertyContext,
|
||||
// RoleIds = rawData.RoleIds
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// public override int? OpenUI(object userData = null)
|
||||
// {
|
||||
// if (userData is SelectRoleFormContext selectRoleFormContext)
|
||||
// {
|
||||
// return OpenUIInternal(selectRoleFormContext);
|
||||
// }
|
||||
//
|
||||
// if (userData != null)
|
||||
// {
|
||||
// Log.Warning("SelectRoleFormController.OpenUI() userData type is invalid.");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// if (_useCase == null)
|
||||
// {
|
||||
// Log.Error("SelectRoleFormController.OpenUI() useCase is null.");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// SelectRoleFormRawData rawData = _useCase.CreateModel();
|
||||
// SelectRoleFormContext context = BuildContext(rawData);
|
||||
// return OpenUIInternal(context);
|
||||
// }
|
||||
//
|
||||
// public override void BindUseCase(IUIUseCase useCase)
|
||||
// {
|
||||
// if (!(useCase is SelectRoleFormUseCase selectRoleUseCase))
|
||||
// {
|
||||
// Log.Error("SelectRoleUseCase.BindUseCase() useCase is invalid.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _useCase = selectRoleUseCase;
|
||||
// }
|
||||
//
|
||||
// public void UpdateShowRole(RolePropertyAreaContext rolePropertyAreaContext)
|
||||
// {
|
||||
// if (Context != null)
|
||||
// {
|
||||
// Context.RolePropertyAreaContext = rolePropertyAreaContext;
|
||||
// }
|
||||
//
|
||||
// Form?.UpdateShowRole(rolePropertyAreaContext);
|
||||
// }
|
||||
//
|
||||
// private void OnMenuSelectRoleReturn(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is SelectRoleForm) || !(e is MenuSelectRoleReturnEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// CloseUI();
|
||||
// }
|
||||
//
|
||||
// private void OnMenuSelectRoleSelected(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(e is MenuSelectRoleSelectedEventArgs args))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// SelectRoleFormRawData rawData = _useCase != null ? _useCase.SelectRole(args.RoleId) : null;
|
||||
// SelectRoleFormContext context = BuildContext(rawData);
|
||||
// if (context == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// SetContext(context);
|
||||
// UpdateShowRole(context.RolePropertyAreaContext);
|
||||
// }
|
||||
//
|
||||
// private void OnMenuSelectRoleConfirm(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(e is MenuSelectRoleConfirmEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _useCase?.ConfirmSelectedRole();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,137 @@
|
||||
// using CustomEvent;
|
||||
// using Definition.Enum;
|
||||
// using GameFramework.Event;
|
||||
// using UnityGameFramework.Runtime;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class StartMenuFormController : UIFormControllerCommonBase<StartMenuFormContext, StartMenuForm>
|
||||
// {
|
||||
// protected override UIFormType UIFormTypeId => UIFormType.StartMenuForm;
|
||||
//
|
||||
// protected override void RefreshUI(StartMenuForm form, StartMenuFormContext context)
|
||||
// {
|
||||
// form.RefreshUI(context);
|
||||
// }
|
||||
//
|
||||
// protected override void SubscribeCustomEvents()
|
||||
// {
|
||||
// GameEntry.Event.Subscribe(MenuStartGameEventArgs.EventId, OnMenuStartGameButtonClick);
|
||||
// GameEntry.Event.Subscribe(MenuFileButtonClickEventArgs.EventId, OnMenuFileButtonClick);
|
||||
// GameEntry.Event.Subscribe(MenuGuideButtonClickEventArgs.EventId, OnMenuGuideButtonClick);
|
||||
// GameEntry.Event.Subscribe(MenuSettingButtonClickEventArgs.EventId, OnMenuSettingButtonClick);
|
||||
// GameEntry.Event.Subscribe(MenuQuitButtonClickEventArgs.EventId, OnMenuQuitButtonClick);
|
||||
// GameEntry.Event.Subscribe(MenuAboutButtonClickEventArgs.EventId, OnMenuAboutButtonClick);
|
||||
// }
|
||||
//
|
||||
// protected override void UnsubscribeCustomEvents()
|
||||
// {
|
||||
// GameEntry.Event.Unsubscribe(MenuStartGameEventArgs.EventId, OnMenuStartGameButtonClick);
|
||||
// GameEntry.Event.Unsubscribe(MenuFileButtonClickEventArgs.EventId, OnMenuFileButtonClick);
|
||||
// GameEntry.Event.Unsubscribe(MenuGuideButtonClickEventArgs.EventId, OnMenuGuideButtonClick);
|
||||
// GameEntry.Event.Unsubscribe(MenuSettingButtonClickEventArgs.EventId, OnMenuSettingButtonClick);
|
||||
// GameEntry.Event.Unsubscribe(MenuQuitButtonClickEventArgs.EventId, OnMenuQuitButtonClick);
|
||||
// GameEntry.Event.Unsubscribe(MenuAboutButtonClickEventArgs.EventId, OnMenuAboutButtonClick);
|
||||
// }
|
||||
//
|
||||
// private static StartMenuFormContext BuildStartMenuFormContext()
|
||||
// {
|
||||
// return new StartMenuFormContext();
|
||||
// }
|
||||
//
|
||||
// public override int? OpenUI(object userData = null)
|
||||
// {
|
||||
// if (userData is StartMenuFormContext context)
|
||||
// {
|
||||
// return OpenUIInternal(context);
|
||||
// }
|
||||
//
|
||||
// if (userData != null)
|
||||
// {
|
||||
// Log.Warning("StartMenuFormController.OpenUI() userData type is invalid.");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// return OpenUIInternal(BuildStartMenuFormContext());
|
||||
// }
|
||||
//
|
||||
// public int? OpenUI(StartMenuFormContext context)
|
||||
// {
|
||||
// return OpenUIInternal(context);
|
||||
// }
|
||||
//
|
||||
// public override void BindUseCase(IUIUseCase useCase)
|
||||
// {
|
||||
// Log.Info("StartMenuForm doesn't need UseCase");
|
||||
// }
|
||||
//
|
||||
// private void OnMenuStartGameButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuStartGameEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GameEntry.UIRouter.OpenUI(UIFormType.SelectRoleForm);
|
||||
// }
|
||||
//
|
||||
// private void OnMenuFileButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuFileButtonClickEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Log.Warning("Menu file button click is not implemented.");
|
||||
// }
|
||||
//
|
||||
// private void OnMenuGuideButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuGuideButtonClickEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Log.Warning("Menu guide button click is not implemented.");
|
||||
// }
|
||||
//
|
||||
// private void OnMenuSettingButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuSettingButtonClickEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GameEntry.UIRouter.OpenUI(UIFormType.SettingForm);
|
||||
// }
|
||||
//
|
||||
// private void OnMenuQuitButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuQuitButtonClickEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GameEntry.UIRouter.OpenUI(UIFormType.DialogForm, new DialogFormRawData
|
||||
// {
|
||||
// Mode = 2,
|
||||
// Title = GameEntry.Localization.GetString("AskQuitGame.Title"),
|
||||
// Message = GameEntry.Localization.GetString("AskQuitGame.Message"),
|
||||
// OnClickConfirm = delegate(object userData)
|
||||
// {
|
||||
// UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Quit);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// private void OnMenuAboutButtonClick(object sender, GameEventArgs e)
|
||||
// {
|
||||
// if (!(sender is StartMenuForm) || !(e is MenuAboutButtonClickEventArgs))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Log.Warning("Menu about button click is not implemented.");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user