init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// namespace UI
|
||||
// {
|
||||
// public class RoleItemContext : UIContext
|
||||
// {
|
||||
// public int RoleId;
|
||||
// public string IconName;
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
// namespace UI
|
||||
// {
|
||||
// public class RolePropertyAreaContext : UIContext
|
||||
// {
|
||||
// public string RoleName;
|
||||
// public string InitialPropertyText;
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,9 @@
|
||||
// namespace UI
|
||||
// {
|
||||
// public class SelectRoleFormContext : UIContext
|
||||
// {
|
||||
// public RoleItemContext[] RoleItemContexts;
|
||||
// public RolePropertyAreaContext RolePropertyAreaContext;
|
||||
// public int[] RoleIds;
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,6 @@
|
||||
// namespace UI
|
||||
// {
|
||||
// public class StartMenuFormContext : UIContext
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
@@ -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.");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace UI
|
||||
{
|
||||
public class SelectRoleFormRawData
|
||||
{
|
||||
public int[] RoleIds;
|
||||
public string[] RoleIconNames;
|
||||
public int SelectedRoleId;
|
||||
public string SelectedRoleName;
|
||||
public string SelectedRoleInitialPropertyText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace UI
|
||||
{
|
||||
public class StartMenuFormRawData
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// using System.Text;
|
||||
// using DataTable;
|
||||
// using GameFramework.DataTable;
|
||||
// using Procedure;
|
||||
// using UnityEngine;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class SelectRoleFormUseCase : IUIUseCase
|
||||
// {
|
||||
// private readonly IDataTable<DRRole> _roleDataTable;
|
||||
//
|
||||
// private readonly ProcedureStartMenu _procedureStartMenu;
|
||||
//
|
||||
// public int SelectedRoleId { get; private set; }
|
||||
//
|
||||
// public SelectRoleFormUseCase(ProcedureStartMenu procedureStartMenu)
|
||||
// {
|
||||
// _procedureStartMenu = procedureStartMenu;
|
||||
// _roleDataTable = GameEntry.DataTable.GetDataTable<DRRole>();
|
||||
// }
|
||||
//
|
||||
// public SelectRoleFormRawData CreateModel()
|
||||
// {
|
||||
// return BuildModel(0);
|
||||
// }
|
||||
//
|
||||
// public SelectRoleFormRawData SelectRole(int roleId)
|
||||
// {
|
||||
// SelectedRoleId = roleId;
|
||||
// return BuildModel(roleId);
|
||||
// }
|
||||
//
|
||||
// public bool ConfirmSelectedRole()
|
||||
// {
|
||||
// DRRole[] roles = _roleDataTable != null ? _roleDataTable.GetAllDataRows() : null;
|
||||
// if (roles == null || roles.Length == 0)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (SelectedRoleId < 0 || _roleDataTable.GetDataRow(SelectedRoleId) == null)
|
||||
// {
|
||||
// int randomIndex = Random.Range(0, roles.Length);
|
||||
// SelectedRoleId = roles[randomIndex].Id;
|
||||
// }
|
||||
//
|
||||
// bool result = SelectedRoleId >= 0;
|
||||
// if (result)
|
||||
// {
|
||||
// _procedureStartMenu.StartGame(SelectedRoleId);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// private SelectRoleFormRawData BuildModel(int selectedRoleId)
|
||||
// {
|
||||
// DRRole[] roles = _roleDataTable.GetAllDataRows();
|
||||
// int count = _roleDataTable.Count;
|
||||
// int[] roleIds = new int[count];
|
||||
// string[] iconNames = new string[count];
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// roleIds[i] = roles[i].Id;
|
||||
// iconNames[i] = roles[i].IconName;
|
||||
// }
|
||||
//
|
||||
// DRRole selectedRole = selectedRoleId > 0 ? _roleDataTable.GetDataRow(selectedRoleId) : null;
|
||||
// return new SelectRoleFormRawData
|
||||
// {
|
||||
// RoleIds = roleIds,
|
||||
// RoleIconNames = iconNames,
|
||||
// SelectedRoleId = selectedRole?.Id ?? -1,
|
||||
// SelectedRoleName = selectedRole?.RoleName,
|
||||
// SelectedRoleInitialPropertyText = selectedRole != null
|
||||
// ? BuildRoleInitialPropertyText(selectedRole)
|
||||
// : null
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// private static string BuildRoleInitialPropertyText(DRRole role)
|
||||
// {
|
||||
// if (role == null || role.InitialProperties == null || role.InitialProperties.Length == 0)
|
||||
// {
|
||||
// return string.Empty;
|
||||
// }
|
||||
//
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (int i = 0; i < role.InitialProperties.Length; i++)
|
||||
// {
|
||||
// sb.Append(role.InitialProperties[i]);
|
||||
// sb.Append('\n');
|
||||
// }
|
||||
//
|
||||
// return sb.ToString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,40 @@
|
||||
// using CustomEvent;
|
||||
// using UnityEngine;
|
||||
// using UnityEngine.UI;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class RoleItem : MonoBehaviour
|
||||
// {
|
||||
// [SerializeField] private Image _roleImage = null;
|
||||
//
|
||||
// private RoleItemContext _context = null;
|
||||
//
|
||||
// public void OnInit(RoleItemContext context)
|
||||
// {
|
||||
// _context = context;
|
||||
// if (_context == null || string.IsNullOrEmpty(_context.IconName))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GameEntry.SpriteCache.GetSprite(_context.IconName, sprite => _roleImage.sprite = sprite);
|
||||
// }
|
||||
//
|
||||
// public void OnReset()
|
||||
// {
|
||||
// _context = null;
|
||||
// }
|
||||
//
|
||||
// public void UpdateShowRole()
|
||||
// {
|
||||
// int roleId = _context?.RoleId ?? -1;
|
||||
// GameEntry.Event.Fire(this, MenuSelectRoleSelectedEventArgs.Create(roleId));
|
||||
// }
|
||||
//
|
||||
// public void OnConfirmRoleClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuSelectRoleConfirmEventArgs.Create());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,37 @@
|
||||
// using TMPro;
|
||||
// using UnityEngine;
|
||||
// using UnityEngine.UI;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class RolePropertyArea : MonoBehaviour
|
||||
// {
|
||||
// [SerializeField] private TMP_Text _roleNameText;
|
||||
//
|
||||
// [SerializeField] private RawImage _roleAvatar;
|
||||
//
|
||||
// [SerializeField] private TMP_Text _roleInitialPropertyText;
|
||||
//
|
||||
// [SerializeField] private Transform _roleInitialItemParent;
|
||||
//
|
||||
// private RolePropertyAreaContext _context;
|
||||
//
|
||||
// public void OnInit(RolePropertyAreaContext context)
|
||||
// {
|
||||
// _context = context;
|
||||
// if (_context == null)
|
||||
// {
|
||||
// OnReset();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _roleNameText.text = _context.RoleName;
|
||||
// _roleInitialPropertyText.text = _context.InitialPropertyText;
|
||||
// }
|
||||
//
|
||||
// public void OnReset(object userData = null)
|
||||
// {
|
||||
// _context = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,100 @@
|
||||
// using System;
|
||||
// using CustomEvent;
|
||||
// using UnityEngine;
|
||||
// using UnityGameFramework.Runtime;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class SelectRoleForm : UGuiForm
|
||||
// {
|
||||
// [SerializeField] private GameObject _randomRoleCard = null;
|
||||
//
|
||||
// [SerializeField] private GameObject _roleCard = null;
|
||||
//
|
||||
// [SerializeField] private RolePropertyArea _propertyArea = null;
|
||||
//
|
||||
// private SelectRoleFormContext _context = null;
|
||||
//
|
||||
// private RoleItem[] _roleItems = null;
|
||||
//
|
||||
// public void RefreshUI(SelectRoleFormContext context)
|
||||
// {
|
||||
// _context = context;
|
||||
//
|
||||
// int itemIndex = 1, roleIndex = 0;
|
||||
// while (itemIndex < _roleItems.Length)
|
||||
// {
|
||||
// if (roleIndex < _context.RoleItemContexts.Length)
|
||||
// {
|
||||
// _roleItems[itemIndex].OnInit(_context.RoleItemContexts[roleIndex]);
|
||||
// _roleItems[itemIndex].gameObject.SetActive(true);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _roleItems[itemIndex].gameObject.SetActive(false);
|
||||
// _roleItems[itemIndex].OnReset();
|
||||
// }
|
||||
//
|
||||
// itemIndex++;
|
||||
// roleIndex++;
|
||||
// }
|
||||
//
|
||||
// UpdateShowRole(_context.RolePropertyAreaContext);
|
||||
// }
|
||||
//
|
||||
// #region FSM
|
||||
//
|
||||
// protected override void OnInit(object userData)
|
||||
// {
|
||||
// base.OnInit(userData);
|
||||
// _roleItems = this.transform.GetComponentsInChildren<RoleItem>();
|
||||
// }
|
||||
//
|
||||
// protected override void OnOpen(object userData)
|
||||
// {
|
||||
// base.OnOpen(userData);
|
||||
//
|
||||
// if (userData is SelectRoleFormContext context)
|
||||
// {
|
||||
// RefreshUI(context);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Log.Warning("SelectRoleForm requires SelectRoleFormContext as userData.");
|
||||
// }
|
||||
//
|
||||
// protected override void OnClose(bool isShutdown, object userData)
|
||||
// {
|
||||
// base.OnClose(isShutdown, userData);
|
||||
//
|
||||
// _context = null;
|
||||
// foreach (var item in _roleItems)
|
||||
// {
|
||||
// item.OnReset();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// public void UpdateShowRole(RolePropertyAreaContext propertyAreaContext)
|
||||
// {
|
||||
// if (propertyAreaContext == null)
|
||||
// {
|
||||
// _randomRoleCard.SetActive(true);
|
||||
// _roleCard.SetActive(false);
|
||||
// _propertyArea.OnReset();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _randomRoleCard.SetActive(false);
|
||||
// _propertyArea.OnInit(propertyAreaContext);
|
||||
// _roleCard.SetActive(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void OnReturnButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuSelectRoleReturnEventArgs.Create());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,189 @@
|
||||
// //------------------------------------------------------------
|
||||
// // Game Framework
|
||||
// // Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// // Homepage: https://gameframework.cn/
|
||||
// // Feedback: mailto:ellan@gameframework.cn
|
||||
// //------------------------------------------------------------
|
||||
//
|
||||
// using Definition;
|
||||
// using GameFramework.Localization;
|
||||
// using StarForce;
|
||||
// using UnityEngine;
|
||||
// using UnityEngine.UI;
|
||||
// using UnityGameFramework.Runtime;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class SettingForm : UGuiForm
|
||||
// {
|
||||
// [SerializeField] private Toggle _musicMuteToggle = null;
|
||||
// [SerializeField] private Slider _musicVolumeSlider = null;
|
||||
//
|
||||
// [SerializeField] private Toggle _soundMuteToggle = null;
|
||||
// [SerializeField] private Slider _soundVolumeSlider = null;
|
||||
//
|
||||
// [SerializeField] private Toggle _uiSoundMuteToggle = null;
|
||||
// [SerializeField] private Slider _uiSoundVolumeSlider = null;
|
||||
//
|
||||
// [SerializeField] private CanvasGroup _languageTipsCanvasGroup = null;
|
||||
//
|
||||
// [SerializeField] private Toggle _englishToggle = null;
|
||||
// [SerializeField] private Toggle _chineseSimplifiedToggle = null;
|
||||
// [SerializeField] private Toggle _chineseTraditionalToggle = null;
|
||||
// [SerializeField] private Toggle _koreanToggle = null;
|
||||
//
|
||||
// private Language _selectedLanguage = Language.Unspecified;
|
||||
//
|
||||
// public void OnMusicMuteChanged(bool isOn)
|
||||
// {
|
||||
// GameEntry.Sound.Mute("Music", !isOn);
|
||||
// _musicVolumeSlider.gameObject.SetActive(isOn);
|
||||
// }
|
||||
//
|
||||
// public void OnMusicVolumeChanged(float volume)
|
||||
// {
|
||||
// GameEntry.Sound.SetVolume("Music", volume);
|
||||
// }
|
||||
//
|
||||
// public void OnSoundMuteChanged(bool isOn)
|
||||
// {
|
||||
// GameEntry.Sound.Mute("Sound", !isOn);
|
||||
// _soundVolumeSlider.gameObject.SetActive(isOn);
|
||||
// }
|
||||
//
|
||||
// public void OnSoundVolumeChanged(float volume)
|
||||
// {
|
||||
// GameEntry.Sound.SetVolume("Sound", volume);
|
||||
// }
|
||||
//
|
||||
// public void OnUISoundMuteChanged(bool isOn)
|
||||
// {
|
||||
// GameEntry.Sound.Mute("UISound", !isOn);
|
||||
// _uiSoundVolumeSlider.gameObject.SetActive(isOn);
|
||||
// }
|
||||
//
|
||||
// public void OnUISoundVolumeChanged(float volume)
|
||||
// {
|
||||
// GameEntry.Sound.SetVolume("UISound", volume);
|
||||
// }
|
||||
//
|
||||
// public void OnEnglishSelected(bool isOn)
|
||||
// {
|
||||
// if (!isOn)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _selectedLanguage = Language.English;
|
||||
// RefreshLanguageTips();
|
||||
// }
|
||||
//
|
||||
// public void OnChineseSimplifiedSelected(bool isOn)
|
||||
// {
|
||||
// if (!isOn)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _selectedLanguage = Language.ChineseSimplified;
|
||||
// RefreshLanguageTips();
|
||||
// }
|
||||
//
|
||||
// public void OnChineseTraditionalSelected(bool isOn)
|
||||
// {
|
||||
// if (!isOn)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _selectedLanguage = Language.ChineseTraditional;
|
||||
// RefreshLanguageTips();
|
||||
// }
|
||||
//
|
||||
// public void OnKoreanSelected(bool isOn)
|
||||
// {
|
||||
// if (!isOn)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// _selectedLanguage = Language.Korean;
|
||||
// RefreshLanguageTips();
|
||||
// }
|
||||
//
|
||||
// public void OnSubmitButtonClick()
|
||||
// {
|
||||
// if (_selectedLanguage == GameEntry.Localization.Language)
|
||||
// {
|
||||
// Close();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// GameEntry.Setting.SetString(Constant.Setting.Language, _selectedLanguage.ToString());
|
||||
// GameEntry.Setting.Save();
|
||||
//
|
||||
// GameEntry.Sound.StopMusic();
|
||||
// UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Restart);
|
||||
// }
|
||||
//
|
||||
// #if UNITY_2017_3_OR_NEWER
|
||||
// protected override void OnOpen(object userData)
|
||||
// #else
|
||||
// protected internal override void OnOpen(object userData)
|
||||
// #endif
|
||||
// {
|
||||
// base.OnOpen(userData);
|
||||
//
|
||||
// _musicMuteToggle.isOn = !GameEntry.Sound.IsMuted("Music");
|
||||
// _musicVolumeSlider.value = GameEntry.Sound.GetVolume("Music");
|
||||
//
|
||||
// _soundMuteToggle.isOn = !GameEntry.Sound.IsMuted("Sound");
|
||||
// _soundVolumeSlider.value = GameEntry.Sound.GetVolume("Sound");
|
||||
//
|
||||
// _uiSoundMuteToggle.isOn = !GameEntry.Sound.IsMuted("UISound");
|
||||
// _uiSoundVolumeSlider.value = GameEntry.Sound.GetVolume("UISound");
|
||||
//
|
||||
// _selectedLanguage = GameEntry.Localization.Language;
|
||||
// switch (_selectedLanguage)
|
||||
// {
|
||||
// case Language.English:
|
||||
// _englishToggle.isOn = true;
|
||||
// break;
|
||||
//
|
||||
// case Language.ChineseSimplified:
|
||||
// _chineseSimplifiedToggle.isOn = true;
|
||||
// break;
|
||||
//
|
||||
// case Language.ChineseTraditional:
|
||||
// _chineseTraditionalToggle.isOn = true;
|
||||
// break;
|
||||
//
|
||||
// case Language.Korean:
|
||||
// _koreanToggle.isOn = true;
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// #if UNITY_2017_3_OR_NEWER
|
||||
// protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
// #else
|
||||
// protected internal override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
// #endif
|
||||
// {
|
||||
// base.OnUpdate(elapseSeconds, realElapseSeconds);
|
||||
//
|
||||
// if (_languageTipsCanvasGroup.gameObject.activeSelf)
|
||||
// {
|
||||
// _languageTipsCanvasGroup.alpha = 0.5f + 0.5f * Mathf.Sin(Mathf.PI * Time.time);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void RefreshLanguageTips()
|
||||
// {
|
||||
// _languageTipsCanvasGroup.gameObject.SetActive(_selectedLanguage != GameEntry.Localization.Language);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,64 @@
|
||||
// using CustomEvent;
|
||||
// using UnityGameFramework.Runtime;
|
||||
//
|
||||
// namespace UI
|
||||
// {
|
||||
// public class StartMenuForm : UGuiForm
|
||||
// {
|
||||
// public void RefreshUI(StartMenuFormContext context)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// #region Lifecycle
|
||||
//
|
||||
// protected override void OnOpen(object userData)
|
||||
// {
|
||||
// base.OnOpen(userData);
|
||||
//
|
||||
// if (userData is StartMenuFormContext context)
|
||||
// {
|
||||
// RefreshUI(context);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Log.Warning("StartMenuForm requires StartMenuFormContext as userData.");
|
||||
// }
|
||||
//
|
||||
// protected override void OnClose(bool isShutdown, object userData)
|
||||
// {
|
||||
// base.OnClose(isShutdown, userData);
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// public void OnStartButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuStartGameEventArgs.Create());
|
||||
// }
|
||||
//
|
||||
// public void OnFileButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuFileButtonClickEventArgs.Create());
|
||||
// }
|
||||
//
|
||||
// public void OnGuideButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuGuideButtonClickEventArgs.Create());
|
||||
// }
|
||||
//
|
||||
// public void OnSettingButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuSettingButtonClickEventArgs.Create());
|
||||
// }
|
||||
//
|
||||
// public void OnQuitButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuQuitButtonClickEventArgs.Create());
|
||||
// }
|
||||
//
|
||||
// public void OnAboutButtonClick()
|
||||
// {
|
||||
// GameEntry.Event.Fire(this, MenuAboutButtonClickEventArgs.Create());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user