初始化仓库

This commit is contained in:
SepComet
2026-02-07 19:38:49 +08:00
commit 88641dae11
1540 changed files with 371772 additions and 0 deletions
@@ -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: