初始化仓库
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using StarForce;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class AboutForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private RectTransform _rectTransform = null;
|
||||
[SerializeField] private float _scrollSpeed = 1f;
|
||||
|
||||
private float _initPosition = 0f;
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnInit(object userData)
|
||||
#else
|
||||
protected internal override void OnInit(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnInit(userData);
|
||||
|
||||
CanvasScaler canvasScaler = GetComponentInParent<CanvasScaler>();
|
||||
if (canvasScaler == null)
|
||||
{
|
||||
Log.Warning("Can not find CanvasScaler component.");
|
||||
return;
|
||||
}
|
||||
|
||||
_initPosition = -0.5f * canvasScaler.referenceResolution.x * Screen.height / Screen.width;
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnOpen(object userData)
|
||||
#else
|
||||
protected internal override void OnOpen(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
_rectTransform.SetLocalPositionY(_initPosition);
|
||||
|
||||
// 换个音乐
|
||||
GameEntry.Sound.PlayMusic(3);
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
#else
|
||||
protected internal override void OnClose(bool isShutdown, object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnClose(isShutdown, userData);
|
||||
|
||||
// 还原音乐
|
||||
GameEntry.Sound.PlayMusic(1);
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
_rectTransform.AddLocalPositionY(_scrollSpeed * elapseSeconds);
|
||||
if (_rectTransform.localPosition.y > _rectTransform.sizeDelta.y - _initPosition)
|
||||
{
|
||||
_rectTransform.SetLocalPositionY(_initPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d18eec7c2f2d3d4ca59e310ef625db1
|
||||
timeCreated: 1528026160
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,128 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class CommonButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler,
|
||||
IPointerUpHandler
|
||||
{
|
||||
private const float FadeTime = 0.3f;
|
||||
private const float OnHoverAlpha = 0.7f;
|
||||
private const float OnClickAlpha = 0.6f;
|
||||
|
||||
[SerializeField] private UnityEvent _onPointerEnterAction = null;
|
||||
|
||||
[SerializeField] private UnityEvent _onClickAction = null;
|
||||
|
||||
[SerializeField] private UnityEvent _onPointerExitAction = null;
|
||||
|
||||
private CanvasGroup _canvasGroup = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_canvasGroup = gameObject.GetOrAddComponent<CanvasGroup>();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_canvasGroup.alpha = 1f;
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(_canvasGroup.FadeToAlpha(OnHoverAlpha, FadeTime));
|
||||
_onPointerEnterAction.Invoke();
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(_canvasGroup.FadeToAlpha(1f, FadeTime));
|
||||
_onPointerExitAction?.Invoke();
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_canvasGroup.alpha = OnClickAlpha;
|
||||
_onClickAction.Invoke();
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button != PointerEventData.InputButton.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_canvasGroup.alpha = OnHoverAlpha;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册鼠标相关事件
|
||||
/// </summary>
|
||||
/// <param name="actionId">0、1、2 分别是 Enter、Click、Exit</param>
|
||||
/// <param name="action">回调事件</param>
|
||||
public void RegisterAction(int actionId, UnityAction action)
|
||||
{
|
||||
switch (actionId)
|
||||
{
|
||||
case 0:
|
||||
_onPointerEnterAction.AddListener(action);
|
||||
break;
|
||||
case 1:
|
||||
_onClickAction.AddListener(action);
|
||||
break;
|
||||
case 2:
|
||||
_onPointerExitAction.AddListener(action);
|
||||
break;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("actionId 无效");
|
||||
}
|
||||
}
|
||||
|
||||
public void UnRegisterAction(int actionId, UnityAction action)
|
||||
{
|
||||
switch (actionId)
|
||||
{
|
||||
case 0:
|
||||
_onPointerEnterAction.RemoveListener(action);
|
||||
break;
|
||||
case 1:
|
||||
_onClickAction.RemoveListener(action);
|
||||
break;
|
||||
case 2:
|
||||
_onPointerExitAction.RemoveListener(action);
|
||||
break;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("actionId 无效");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5079836f95c2a44b96fa331487ebb70
|
||||
timeCreated: 1528026160
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,189 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class DialogForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private TMP_Text _titleText = null;
|
||||
[SerializeField] private TMP_Text _messageText = null;
|
||||
[SerializeField] private GameObject[] _modeObjects = null;
|
||||
[SerializeField] private TMP_Text[] _confirmTexts = null;
|
||||
[SerializeField] private TMP_Text[] _cancelTexts = null;
|
||||
[SerializeField] private TMP_Text[] _otherTexts = null;
|
||||
|
||||
private int _dialogMode = 1;
|
||||
private bool _pauseGame = false;
|
||||
private object _userData = null;
|
||||
private GameFrameworkAction<object> _onClickConfirmGFAction = null;
|
||||
private GameFrameworkAction<object> _onClickCancelGFAction = null;
|
||||
private GameFrameworkAction<object> _onClickOtherGFAction = null;
|
||||
|
||||
public int DialogMode => _dialogMode;
|
||||
|
||||
public bool PauseGame => _pauseGame;
|
||||
|
||||
public object UserData => _userData;
|
||||
|
||||
public void OnConfirmButtonClick()
|
||||
{
|
||||
Close();
|
||||
|
||||
if (_onClickConfirmGFAction != null)
|
||||
{
|
||||
_onClickConfirmGFAction(_userData);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCancelButtonClick()
|
||||
{
|
||||
Close();
|
||||
|
||||
if (_onClickCancelGFAction != null)
|
||||
{
|
||||
_onClickCancelGFAction(_userData);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnOtherButtonClick()
|
||||
{
|
||||
Close();
|
||||
|
||||
if (_onClickOtherGFAction != null)
|
||||
{
|
||||
_onClickOtherGFAction(_userData);
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnOpen(object userData)
|
||||
#else
|
||||
protected internal override void OnOpen(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
DialogParams dialogParams = (DialogParams)userData;
|
||||
if (dialogParams == null)
|
||||
{
|
||||
Log.Warning("DialogParams is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
_dialogMode = dialogParams.Mode;
|
||||
RefreshDialogMode();
|
||||
|
||||
_titleText.text = dialogParams.Title;
|
||||
_messageText.text = dialogParams.Message;
|
||||
|
||||
_pauseGame = dialogParams.PauseGame;
|
||||
RefreshPauseGame();
|
||||
|
||||
_userData = dialogParams.UserData;
|
||||
|
||||
RefreshConfirmText(dialogParams.ConfirmText);
|
||||
_onClickConfirmGFAction = dialogParams.OnClickConfirm;
|
||||
|
||||
RefreshCancelText(dialogParams.CancelText);
|
||||
_onClickCancelGFAction = dialogParams.OnClickCancel;
|
||||
|
||||
RefreshOtherText(dialogParams.OtherText);
|
||||
_onClickOtherGFAction = dialogParams.OnClickOther;
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
#else
|
||||
protected internal override void OnClose(bool isShutdown, object userData)
|
||||
#endif
|
||||
{
|
||||
if (_pauseGame)
|
||||
{
|
||||
GameEntry.Base.ResumeGame();
|
||||
}
|
||||
|
||||
_dialogMode = 1;
|
||||
_titleText.text = string.Empty;
|
||||
_messageText.text = string.Empty;
|
||||
_pauseGame = false;
|
||||
_userData = null;
|
||||
|
||||
RefreshConfirmText(string.Empty);
|
||||
_onClickConfirmGFAction = null;
|
||||
|
||||
RefreshCancelText(string.Empty);
|
||||
_onClickCancelGFAction = null;
|
||||
|
||||
RefreshOtherText(string.Empty);
|
||||
_onClickOtherGFAction = null;
|
||||
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
|
||||
private void RefreshDialogMode()
|
||||
{
|
||||
for (int i = 1; i <= _modeObjects.Length; i++)
|
||||
{
|
||||
_modeObjects[i - 1].SetActive(i == _dialogMode);
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshPauseGame()
|
||||
{
|
||||
if (_pauseGame)
|
||||
{
|
||||
GameEntry.Base.PauseGame();
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshConfirmText(string confirmText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(confirmText))
|
||||
{
|
||||
confirmText = GameEntry.Localization.GetString("Dialog.ConfirmButton");
|
||||
}
|
||||
|
||||
for (int i = 0; i < _confirmTexts.Length; i++)
|
||||
{
|
||||
_confirmTexts[i].text = confirmText;
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshCancelText(string cancelText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cancelText))
|
||||
{
|
||||
cancelText = GameEntry.Localization.GetString("Dialog.CancelButton");
|
||||
}
|
||||
|
||||
for (int i = 0; i < _cancelTexts.Length; i++)
|
||||
{
|
||||
_cancelTexts[i].text = cancelText;
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshOtherText(string otherText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(otherText))
|
||||
{
|
||||
otherText = GameEntry.Localization.GetString("Dialog.OtherButton");
|
||||
}
|
||||
|
||||
for (int i = 0; i < _otherTexts.Length; i++)
|
||||
{
|
||||
_otherTexts[i].text = otherText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c04f3be6bab0c7748bc236f9023e47f9
|
||||
timeCreated: 1528026160
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,116 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 对话框显示数据。
|
||||
/// </summary>
|
||||
public class DialogParams
|
||||
{
|
||||
/// <summary>
|
||||
/// 模式,即按钮数量。取值 1、2、3。
|
||||
/// </summary>
|
||||
public int Mode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标题。
|
||||
/// </summary>
|
||||
public string Title
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容。
|
||||
/// </summary>
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 弹出窗口时是否暂停游戏。
|
||||
/// </summary>
|
||||
public bool PauseGame
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认按钮文本。
|
||||
/// </summary>
|
||||
public string ConfirmText
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确定按钮回调。
|
||||
/// </summary>
|
||||
public GameFrameworkAction<object> OnClickConfirm
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮文本。
|
||||
/// </summary>
|
||||
public string CancelText
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取消按钮回调。
|
||||
/// </summary>
|
||||
public GameFrameworkAction<object> OnClickCancel
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 中立按钮文本。
|
||||
/// </summary>
|
||||
public string OtherText
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 其它按钮回调。
|
||||
/// </summary>
|
||||
public GameFrameworkAction<object> OnClickOther
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户自定义数据。
|
||||
/// </summary>
|
||||
public string UserData
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad9ca3c36c52b0a4e8b25c8b451966da
|
||||
timeCreated: 1528026160
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16815ca7d82e7ea4c91dd017189eeacb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
using Procedure;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class GoodsItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Image _iconImage;
|
||||
[SerializeField] private TMP_Text _titleText;
|
||||
[SerializeField] private TMP_Text _typeText;
|
||||
[SerializeField] private TMP_Text _descriptionText;
|
||||
[SerializeField] private TMP_Text _costText;
|
||||
[SerializeField] private CommonButton _purchaseButton;
|
||||
|
||||
private int _cost;
|
||||
private GameStateShop _stateShop;
|
||||
|
||||
#region Init
|
||||
|
||||
public void Init(GameStateShop stateShop, GoodsItemViewData data)
|
||||
{
|
||||
_stateShop = stateShop;
|
||||
_iconImage.sprite = data.Icon;
|
||||
_titleText.text = data.Title;
|
||||
_typeText.text = data.Type;
|
||||
_descriptionText.text = data.Description;
|
||||
_costText.text = data.Price.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 271f2a0727c521c4280eb2d47fd8de33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Text;
|
||||
using DataTable;
|
||||
using Definition.DataStruct;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class GoodsItemViewData
|
||||
{
|
||||
public string Title;
|
||||
public string Type;
|
||||
public Sprite Icon;
|
||||
public string Description;
|
||||
public int Price;
|
||||
|
||||
public static string CreateWeaponDescription(DRWeapon drWeapon)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"伤害:{drWeapon.Attack}\n");
|
||||
sb.Append($"冷却:{drWeapon.Cooldown}\n");
|
||||
sb.Append($"范围:{drWeapon.AttackRange}\n");
|
||||
sb.Append(CreatePropDescription(drWeapon.Modifiers));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string CreatePropDescription(StatModifier[] modifiers)
|
||||
{
|
||||
if (modifiers == null || modifiers.Length == 0) return null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var modifier in modifiers)
|
||||
{
|
||||
sb.Append(modifier.ToString());
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9d0b321b02be5f41a27cc0a8bf84e34
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
using Components;
|
||||
using CustomEvent;
|
||||
using Entity;
|
||||
using GameFramework.Event;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class HudForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private float _sliderFadeDuration = 0.5f;
|
||||
|
||||
[SerializeField] private Slider _hpSlider;
|
||||
private float _currentHpPercent = 0;
|
||||
private Coroutine _hpSliderFadeCoroutine;
|
||||
|
||||
[SerializeField] private Slider _expSlider;
|
||||
private float _currentExpPercent = 0;
|
||||
private Coroutine _expSliderFadeCoroutine;
|
||||
|
||||
[SerializeField] private TMP_Text _coinText;
|
||||
private int _currentCoin = 0;
|
||||
|
||||
#region FSM
|
||||
|
||||
protected override void OnInit(object userData)
|
||||
{
|
||||
base.OnInit(userData);
|
||||
|
||||
GameEntry.Event.Subscribe(PlayerHealthChangeEventArgs.EventId, OnPlayerHpChange);
|
||||
GameEntry.Event.Subscribe(PlayerExpChangeEventArgs.EventId, OnPlayerExpChange);
|
||||
GameEntry.Event.Subscribe(PlayerCoinChangeEventArgs.EventId, OnPlayerCoinChange);
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
{
|
||||
GameEntry.Event.Unsubscribe(PlayerHealthChangeEventArgs.EventId, OnPlayerHpChange);
|
||||
GameEntry.Event.Unsubscribe(PlayerExpChangeEventArgs.EventId, OnPlayerExpChange);
|
||||
GameEntry.Event.Unsubscribe(PlayerCoinChangeEventArgs.EventId, OnPlayerCoinChange);
|
||||
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void OnPlayerHpChange(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is PlayerHealthChangeEventArgs args)) return;
|
||||
float percent = (float)args.CurrentHealth / args.MaxHealth;
|
||||
if (Mathf.Approximately(_currentHpPercent, percent)) return;
|
||||
|
||||
_currentHpPercent = percent;
|
||||
|
||||
if (_hpSliderFadeCoroutine != null) StopCoroutine(_hpSliderFadeCoroutine);
|
||||
_hpSliderFadeCoroutine = StartCoroutine(_hpSlider.SmoothValue(percent, _sliderFadeDuration));
|
||||
}
|
||||
|
||||
private void OnPlayerExpChange(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is PlayerExpChangeEventArgs args)) return;
|
||||
float percent = (float)args.CurrentExp / args.MaxExp;
|
||||
if (Mathf.Approximately(_currentExpPercent, percent)) return;
|
||||
|
||||
_currentExpPercent = percent;
|
||||
|
||||
if (_expSliderFadeCoroutine != null) StopCoroutine(_expSliderFadeCoroutine);
|
||||
_expSliderFadeCoroutine = StartCoroutine(_expSlider.SmoothValue(percent, _sliderFadeDuration));
|
||||
}
|
||||
|
||||
private void OnPlayerCoinChange(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is PlayerCoinChangeEventArgs args)) return;
|
||||
if (_currentCoin == args.CoinCount) return;
|
||||
|
||||
_coinText.text = args.CoinCount.ToString();
|
||||
_currentCoin = args.CoinCount;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Test
|
||||
|
||||
private Player _player;
|
||||
|
||||
public void CauseDamageToPlayer()
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
_player = FindObjectOfType<Player>();
|
||||
}
|
||||
|
||||
if (_player == null) return;
|
||||
|
||||
_player.GetComponent<HealthComponent>().TakeDamage(2);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd4c4d6e8d4b0f54c830e2cfef46848e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,101 @@
|
||||
using CustomEvent;
|
||||
using GameFramework.Event;
|
||||
using Procedure;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ShopForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private TMP_Text _titleText;
|
||||
|
||||
[SerializeField] private TMP_Text _continueButtonText;
|
||||
|
||||
[SerializeField] private TMP_Text _refreshPriceText;
|
||||
|
||||
[SerializeField] private TMP_Text _playerCoinText;
|
||||
private int _currentCoin = 0;
|
||||
|
||||
[SerializeField] private GoodsItem[] _goodsItems;
|
||||
|
||||
private GameStateShop _stateShop;
|
||||
|
||||
public void UpdateForm(ShopFormContext context)
|
||||
{
|
||||
_stateShop = context.GameStateShop;
|
||||
|
||||
_titleText.text = $"商店(第{context.CurrentLevel}波)";
|
||||
_continueButtonText.text = $"继续(第{context.CurrentLevel + 1}波)";
|
||||
_refreshPriceText.text = $"-{context.RefreshPrice}";
|
||||
_playerCoinText.text = $"{context.PlayerCoin}";
|
||||
|
||||
for (int i = 0; i < _goodsItems.Length; i++)
|
||||
{
|
||||
if (i < context.GoodsItems.Count)
|
||||
{
|
||||
_goodsItems[i].Init(context.GameStateShop, context.GoodsItems[i]);
|
||||
_goodsItems[i].gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_goodsItems[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ButtonClick
|
||||
|
||||
public void OnContinueButtonClick()
|
||||
{
|
||||
_stateShop.ShopOver();
|
||||
}
|
||||
|
||||
public void OnPurchaseButtonClick(int index)
|
||||
{
|
||||
_stateShop.PurchaseGoods(index);
|
||||
}
|
||||
|
||||
public void OnRefreshButtonClick()
|
||||
{
|
||||
_stateShop.RefreshGoods();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FSM
|
||||
|
||||
protected override void OnOpen(object userData)
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
GameEntry.Event.Subscribe(PlayerCoinChangeEventArgs.EventId, OnPlayerCoinChange);
|
||||
|
||||
ShopFormContext context = (ShopFormContext)userData;
|
||||
UpdateForm(context);
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
{
|
||||
_stateShop = null;
|
||||
|
||||
GameEntry.Event.Unsubscribe(PlayerCoinChangeEventArgs.EventId, OnPlayerCoinChange);
|
||||
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void OnPlayerCoinChange(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is PlayerCoinChangeEventArgs args)) return;
|
||||
if (args.CoinCount == _currentCoin) return;
|
||||
|
||||
_currentCoin = args.CoinCount;
|
||||
_playerCoinText.text = _currentCoin.ToString();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6f22432e5701804d9a78d0c07f4c334
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2241cff158a1fd944a80b77bf6e6debd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c13ac6879bf568a42b12d798738efd84
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using DataTable;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class RoleItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CommonButton _button = null;
|
||||
[SerializeField] private Image _roleImage = null;
|
||||
private SelectRoleForm _selectRoleForm = null;
|
||||
private DRRole _role = null;
|
||||
|
||||
public void OnInit(SelectRoleForm selectRoleForm, DRRole role)
|
||||
{
|
||||
this._selectRoleForm = selectRoleForm;
|
||||
this._role = role;
|
||||
GameEntry.SpriteCache.GetSprite(role.IconName, sprite => _roleImage.sprite = sprite);
|
||||
|
||||
_button.RegisterAction(0, OnPointerEnter);
|
||||
_button.RegisterAction(1, OnPointerClick);
|
||||
_button.RegisterAction(2, OnPointerExit);
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
this._selectRoleForm = null;
|
||||
this._role = null;
|
||||
|
||||
_button.UnRegisterAction(0, OnPointerEnter);
|
||||
_button.UnRegisterAction(1, OnPointerClick);
|
||||
_button.UnRegisterAction(2, OnPointerExit);
|
||||
}
|
||||
|
||||
private void OnPointerEnter()
|
||||
{
|
||||
_selectRoleForm.UpdateShowRole(_role);
|
||||
}
|
||||
|
||||
private void OnPointerClick()
|
||||
{
|
||||
_selectRoleForm.StartGame();
|
||||
}
|
||||
|
||||
private void OnPointerExit()
|
||||
{
|
||||
_selectRoleForm.UpdateShowRole(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35de2974f065de547952f8d5cbb9f6fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Text;
|
||||
using DataTable;
|
||||
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;
|
||||
|
||||
public void OnInit(DRRole role)
|
||||
{
|
||||
_roleNameText.text = role.RoleName;
|
||||
// _roleAvatar.texture = AssetUtility.GetUITextureIcon(role.IconName);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (role.InitialProperties != null)
|
||||
{
|
||||
foreach (var modifier in role.InitialProperties)
|
||||
{
|
||||
sb.Append($"{modifier.ToString()}\n");
|
||||
}
|
||||
}
|
||||
_roleInitialPropertyText.text = sb.ToString();
|
||||
|
||||
|
||||
// foreach (var item in role.InitialItemIds)
|
||||
// {
|
||||
// var itemGO = Instantiate(_roleInitialItemParent.GetChild(0), _roleInitialItemParent);
|
||||
// itemGO.GetComponent<RoleItem>().OnInit(item.Key, item.Value);
|
||||
// }
|
||||
}
|
||||
|
||||
public void OnReset(object userData = null)
|
||||
{
|
||||
// _roleNameText.text = string.Empty;
|
||||
// _roleAvatar.texture = null;
|
||||
// _roleInitialPropertyText.text = string.Empty;
|
||||
// foreach (Transform item in _roleInitialItemParent)
|
||||
// {
|
||||
// Destroy(item.gameObject);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e82dc413a4cd277429ec1e3f2de69434
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,106 @@
|
||||
using System.Linq;
|
||||
using DataTable;
|
||||
using GameFramework.DataTable;
|
||||
using Procedure;
|
||||
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 DRRole _currentRole = null;
|
||||
private IDataTable<DRRole> _roleDataTable = null;
|
||||
private DRRole[] _roleList = null;
|
||||
private RoleItem[] _roleItems = null;
|
||||
|
||||
private ProcedureStartMenu _procedure;
|
||||
|
||||
#region FSM
|
||||
|
||||
protected override void OnInit(object userData)
|
||||
{
|
||||
base.OnInit(userData);
|
||||
|
||||
if (userData is ProcedureStartMenu procedure)
|
||||
{
|
||||
_procedure = procedure;
|
||||
}
|
||||
|
||||
_roleDataTable = GameEntry.DataTable.GetDataTable<DRRole>();
|
||||
_roleItems = this.transform.GetComponentsInChildren<RoleItem>();
|
||||
_roleList = _roleDataTable.GetAllDataRows();
|
||||
}
|
||||
|
||||
protected override void OnOpen(object userData)
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
Log.Debug($"{_roleList.Length} || {_roleItems.Length}");
|
||||
for (int i = 0; i < _roleItems.Length; i++)
|
||||
{
|
||||
if (i < _roleList.Length)
|
||||
{
|
||||
_roleItems[i].gameObject.SetActive(true);
|
||||
_roleItems[i].OnInit(this, _roleList[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_roleItems[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
{
|
||||
base.OnClose(isShutdown, userData);
|
||||
|
||||
foreach (var item in _roleItems)
|
||||
{
|
||||
item.OnReset();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void OnReturnButtonClick()
|
||||
{
|
||||
GameEntry.UI.CloseUIForm(this);
|
||||
}
|
||||
|
||||
public void UpdateShowRole(DRRole role)
|
||||
{
|
||||
_currentRole = role;
|
||||
|
||||
if (role == null)
|
||||
{
|
||||
_randomRoleCard.SetActive(true);
|
||||
_roleCard.SetActive(false);
|
||||
_propertyArea.OnReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_randomRoleCard.SetActive(false);
|
||||
_propertyArea.OnInit(role);
|
||||
_roleCard.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
if (_currentRole == null)
|
||||
{
|
||||
int roleIndex = Random.Range(0, _roleList.Length);
|
||||
_currentRole = _roleList[roleIndex];
|
||||
}
|
||||
|
||||
_procedure?.StartGame(_currentRole.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 665710bc9ed5c5547a40f0cc2d92ba2e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SelectRoleShowArea : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ec6493d4e6c45d489e1dd3d5c6228a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02bbd1c1f00c17842b1449ae2b66a932
|
||||
timeCreated: 1528026161
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
using Definition.Enum;
|
||||
using Procedure;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class StartMenuForm : UGuiForm
|
||||
{
|
||||
private ProcedureStartMenu _procedureStartMenu = null;
|
||||
|
||||
public void OnStartButtonClick()
|
||||
{
|
||||
_procedureStartMenu.OpenSelectForm();
|
||||
}
|
||||
|
||||
public void OnFileButtonClick()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnGuideButtonClick()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void OnSettingButtonClick()
|
||||
{
|
||||
GameEntry.UI.OpenUIForm(UIFormType.SettingForm);
|
||||
}
|
||||
|
||||
public void OnQuitButtonClick()
|
||||
{
|
||||
GameEntry.UI.OpenDialog(new DialogParams()
|
||||
{
|
||||
Mode = 2,
|
||||
Title = GameEntry.Localization.GetString("AskQuitGame.Title"),
|
||||
Message = GameEntry.Localization.GetString("AskQuitGame.Message"),
|
||||
OnClickConfirm = delegate(object userData)
|
||||
{
|
||||
UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Quit);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public void OnAboutButtonClick()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
protected override void OnOpen(object userData)
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
if (userData is ProcedureStartMenu procedure)
|
||||
{
|
||||
_procedureStartMenu = procedure;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
{
|
||||
_procedureStartMenu = null;
|
||||
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d448bbb919fe8454da81331191044ead
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,245 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using StarForce;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public abstract class UGuiForm : UIFormLogic
|
||||
{
|
||||
public const int DepthFactor = 100;
|
||||
private const float FadeTime = 0.3f;
|
||||
|
||||
private static Font _mainFont = null;
|
||||
private static TMP_FontAsset _mainTMPFont = null;
|
||||
private Canvas _cachedCanvas = null;
|
||||
private CanvasGroup _canvasGroup = null;
|
||||
private List<Canvas> _cachedCanvasContainer = new List<Canvas>();
|
||||
|
||||
public int OriginalDepth { get; private set; }
|
||||
|
||||
public int Depth => _cachedCanvas.sortingOrder;
|
||||
|
||||
public void Close(bool ignoreFade = false)
|
||||
{
|
||||
StopAllCoroutines();
|
||||
|
||||
if (ignoreFade)
|
||||
{
|
||||
GameEntry.UI.CloseUIForm(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCoroutine(CloseCo(FadeTime));
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayUISound(int uiSoundId)
|
||||
{
|
||||
GameEntry.Sound.PlayUISound(uiSoundId);
|
||||
}
|
||||
|
||||
public static void SetMainFont(Font mainFont)
|
||||
{
|
||||
if (mainFont == null)
|
||||
{
|
||||
Log.Error("Main font is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
_mainFont = mainFont;
|
||||
}
|
||||
|
||||
public static void SetMainTMPFont(TMP_FontAsset mainTMPFont)
|
||||
{
|
||||
if (mainTMPFont == null)
|
||||
{
|
||||
Log.Error("Main font is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
_mainTMPFont = mainTMPFont;
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnInit(object userData)
|
||||
#else
|
||||
protected internal override void OnInit(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnInit(userData);
|
||||
|
||||
_cachedCanvas = gameObject.GetOrAddComponent<Canvas>();
|
||||
_cachedCanvas.overrideSorting = true;
|
||||
OriginalDepth = _cachedCanvas.sortingOrder;
|
||||
|
||||
_canvasGroup = gameObject.GetOrAddComponent<CanvasGroup>();
|
||||
|
||||
RectTransform rect = GetComponent<RectTransform>();
|
||||
rect.anchorMin = Vector2.zero;
|
||||
rect.anchorMax = Vector2.one;
|
||||
rect.anchoredPosition = Vector2.zero;
|
||||
rect.sizeDelta = Vector2.zero;
|
||||
|
||||
gameObject.GetOrAddComponent<GraphicRaycaster>();
|
||||
|
||||
if (_mainTMPFont == null)
|
||||
{
|
||||
Log.Warning("Main TMP font isn't set.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var tmp_texts = GetComponentsInChildren<TMP_Text>(true);
|
||||
foreach (var text in tmp_texts)
|
||||
{
|
||||
text.font = _mainTMPFont;
|
||||
// if (!string.IsNullOrEmpty(text.text))
|
||||
// {
|
||||
// text.text = GameEntry.Localization.GetString(text.text);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (_mainFont == null)
|
||||
{
|
||||
Log.Warning("Main font isn't set.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var texts = GetComponentsInChildren<Text>(true);
|
||||
foreach (var text in texts)
|
||||
{
|
||||
text.font = _mainFont;
|
||||
// if (!string.IsNullOrEmpty(text.text))
|
||||
// {
|
||||
// text.text = GameEntry.Localization.GetString(text.text);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnRecycle()
|
||||
#else
|
||||
protected internal override void OnRecycle()
|
||||
#endif
|
||||
{
|
||||
base.OnRecycle();
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnOpen(object userData)
|
||||
#else
|
||||
protected internal override void OnOpen(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
_canvasGroup.alpha = 0f;
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(_canvasGroup.FadeToAlpha(1f, FadeTime));
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
#else
|
||||
protected internal override void OnClose(bool isShutdown, object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnPause()
|
||||
#else
|
||||
protected internal override void OnPause()
|
||||
#endif
|
||||
{
|
||||
base.OnPause();
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnResume()
|
||||
#else
|
||||
protected internal override void OnResume()
|
||||
#endif
|
||||
{
|
||||
base.OnResume();
|
||||
|
||||
_canvasGroup.alpha = 0f;
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(_canvasGroup.FadeToAlpha(1f, FadeTime));
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnCover()
|
||||
#else
|
||||
protected internal override void OnCover()
|
||||
#endif
|
||||
{
|
||||
base.OnCover();
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnReveal()
|
||||
#else
|
||||
protected internal override void OnReveal()
|
||||
#endif
|
||||
{
|
||||
base.OnReveal();
|
||||
}
|
||||
|
||||
#if UNITY_2017_3_OR_NEWER
|
||||
protected override void OnRefocus(object userData)
|
||||
#else
|
||||
protected internal override void OnRefocus(object userData)
|
||||
#endif
|
||||
{
|
||||
base.OnRefocus(userData);
|
||||
}
|
||||
|
||||
#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 UNITY_2017_3_OR_NEWER
|
||||
protected override void OnDepthChanged(int uiGroupDepth, int depthInUIGroup)
|
||||
#else
|
||||
protected internal override void OnDepthChanged(int uiGroupDepth, int depthInUIGroup)
|
||||
#endif
|
||||
{
|
||||
int oldDepth = Depth;
|
||||
base.OnDepthChanged(uiGroupDepth, depthInUIGroup);
|
||||
int deltaDepth = UGuiGroupHelper.DepthFactor * uiGroupDepth + DepthFactor * depthInUIGroup - oldDepth +
|
||||
OriginalDepth;
|
||||
GetComponentsInChildren(true, _cachedCanvasContainer);
|
||||
for (int i = 0; i < _cachedCanvasContainer.Count; i++)
|
||||
{
|
||||
_cachedCanvasContainer[i].sortingOrder += deltaDepth;
|
||||
}
|
||||
|
||||
_cachedCanvasContainer.Clear();
|
||||
}
|
||||
|
||||
private IEnumerator CloseCo(float duration)
|
||||
{
|
||||
yield return _canvasGroup.FadeToAlpha(0f, duration);
|
||||
GameEntry.UI.CloseUIForm(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b92f84dc56dc764a9c261fe47df5520
|
||||
timeCreated: 1528026161
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
/// <summary>
|
||||
/// uGUI 界面组辅助器。
|
||||
/// </summary>
|
||||
public class UGuiGroupHelper : UIGroupHelperBase
|
||||
{
|
||||
public const int DepthFactor = 10000;
|
||||
|
||||
private int m_Depth = 0;
|
||||
private Canvas m_CachedCanvas = null;
|
||||
|
||||
/// <summary>
|
||||
/// 设置界面组深度。
|
||||
/// </summary>
|
||||
/// <param name="depth">界面组深度。</param>
|
||||
public override void SetDepth(int depth)
|
||||
{
|
||||
m_Depth = depth;
|
||||
m_CachedCanvas.overrideSorting = true;
|
||||
m_CachedCanvas.sortingOrder = DepthFactor * depth;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_CachedCanvas = gameObject.GetOrAddComponent<Canvas>();
|
||||
gameObject.GetOrAddComponent<GraphicRaycaster>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_CachedCanvas.overrideSorting = true;
|
||||
m_CachedCanvas.sortingOrder = DepthFactor * m_Depth;
|
||||
|
||||
RectTransform rect = GetComponent<RectTransform>();
|
||||
rect.anchorMin = Vector2.zero;
|
||||
rect.anchorMax = Vector2.one;
|
||||
rect.anchoredPosition = Vector2.zero;
|
||||
rect.sizeDelta = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05a35a4a1f7dd5646a70cb1a73348780
|
||||
timeCreated: 1528026161
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,181 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework.DataTable;
|
||||
using GameFramework.UI;
|
||||
using System.Collections;
|
||||
using DataTable;
|
||||
using Definition;
|
||||
using Definition.Enum;
|
||||
using Procedure;
|
||||
using Game.Utility;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public static class UIExtension
|
||||
{
|
||||
public static IEnumerator FadeToAlpha(this CanvasGroup canvasGroup, float alpha, float duration)
|
||||
{
|
||||
float time = 0f;
|
||||
float originalAlpha = canvasGroup.alpha;
|
||||
while (time < duration)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
canvasGroup.alpha = Mathf.Lerp(originalAlpha, alpha, time / duration);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
canvasGroup.alpha = alpha;
|
||||
}
|
||||
|
||||
public static IEnumerator SmoothValue(this Slider slider, float value, float duration)
|
||||
{
|
||||
float time = 0f;
|
||||
float originalValue = slider.value;
|
||||
while (time < duration)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
slider.value = Mathf.Lerp(originalValue, value, time / duration);
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
|
||||
slider.value = value;
|
||||
}
|
||||
|
||||
public static bool HasUIForm(this UIComponent uiComponent, UIFormType uiFormType, string uiGroupName = null)
|
||||
{
|
||||
return uiComponent.HasUIForm((int)uiFormType, uiGroupName);
|
||||
}
|
||||
|
||||
public static bool HasUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
|
||||
{
|
||||
IDataTable<DRUIForm> dtUIForm = GameEntry.DataTable.GetDataTable<DRUIForm>();
|
||||
DRUIForm drUIForm = dtUIForm.GetDataRow(uiFormId);
|
||||
if (drUIForm == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string assetName = AssetUtility.GetUIFormAsset(drUIForm.AssetName);
|
||||
if (string.IsNullOrEmpty(uiGroupName))
|
||||
{
|
||||
return uiComponent.HasUIForm(assetName);
|
||||
}
|
||||
|
||||
IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
|
||||
if (uiGroup == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return uiGroup.HasUIForm(assetName);
|
||||
}
|
||||
|
||||
public static UGuiForm GetUIForm(this UIComponent uiComponent, UIFormType uiFormType, string uiGroupName = null)
|
||||
{
|
||||
return uiComponent.GetUIForm((int)uiFormType, uiGroupName);
|
||||
}
|
||||
|
||||
public static UGuiForm GetUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
|
||||
{
|
||||
IDataTable<DRUIForm> dtUIForm = GameEntry.DataTable.GetDataTable<DRUIForm>();
|
||||
DRUIForm drUIForm = dtUIForm.GetDataRow(uiFormId);
|
||||
if (drUIForm == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string assetName = AssetUtility.GetUIFormAsset(drUIForm.AssetName);
|
||||
UIForm uiForm = null;
|
||||
if (string.IsNullOrEmpty(uiGroupName))
|
||||
{
|
||||
uiForm = uiComponent.GetUIForm(assetName);
|
||||
if (uiForm == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (UGuiForm)uiForm.Logic;
|
||||
}
|
||||
|
||||
IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
|
||||
if (uiGroup == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
uiForm = (UIForm)uiGroup.GetUIForm(assetName);
|
||||
if (uiForm == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (UGuiForm)uiForm.Logic;
|
||||
}
|
||||
|
||||
public static void CloseUIForm(this UIComponent uiComponent, UGuiForm uiForm)
|
||||
{
|
||||
uiComponent.CloseUIForm(uiForm.UIForm);
|
||||
}
|
||||
|
||||
public static int? OpenUIForm(this UIComponent uiComponent, UIFormType uiFormType, object userData = null)
|
||||
{
|
||||
return uiComponent.OpenUIForm((int)uiFormType, userData);
|
||||
}
|
||||
|
||||
public static int? OpenUIForm(this UIComponent uiComponent, int uiFormId, object userData = null)
|
||||
{
|
||||
IDataTable<DRUIForm> dtUIForm = GameEntry.DataTable.GetDataTable<DRUIForm>();
|
||||
DRUIForm drUIForm = dtUIForm.GetDataRow(uiFormId);
|
||||
if (drUIForm == null)
|
||||
{
|
||||
Log.Warning("Can not load UI form '{0}' from data table.", uiFormId.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
string assetName = AssetUtility.GetUIFormAsset(drUIForm.AssetName);
|
||||
if (!drUIForm.AllowMultiInstance)
|
||||
{
|
||||
if (uiComponent.IsLoadingUIForm(assetName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (uiComponent.HasUIForm(assetName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return uiComponent.OpenUIForm(assetName, drUIForm.UIGroupName, Constant.AssetPriority.UIFormAsset, drUIForm.PauseCoveredUIForm, userData);
|
||||
}
|
||||
|
||||
public static void OpenDialog(this UIComponent uiComponent, DialogParams dialogParams)
|
||||
{
|
||||
if (((ProcedureBase)GameEntry.Procedure.CurrentProcedure).UseNativeDialog)
|
||||
{
|
||||
OpenNativeDialog(dialogParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiComponent.OpenUIForm(UIFormType.DialogForm, dialogParams);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OpenNativeDialog(DialogParams dialogParams)
|
||||
{
|
||||
// TODO:这里应该弹出原生对话框,先简化实现为直接按确认按钮
|
||||
if (dialogParams.OnClickConfirm != null)
|
||||
{
|
||||
dialogParams.OnClickConfirm(dialogParams.UserData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9cfc2c881ce240349901812c61f4476b
|
||||
timeCreated: 1528026162
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class UpdateResourceForm : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Text m_DescriptionText = null;
|
||||
|
||||
[SerializeField]
|
||||
private Slider m_ProgressSlider = null;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetProgress(float progress, string description)
|
||||
{
|
||||
m_ProgressSlider.value = progress;
|
||||
m_DescriptionText.text = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d8946ea9933b16499cd11174ad3c410
|
||||
timeCreated: 1504077253
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user