mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
95
JNFrame2/临时存储/GameScripts/FGui/FGuiManager.cs
Normal file
95
JNFrame2/临时存储/GameScripts/FGui/FGuiManager.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Common;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using FairyGUI;
|
||||
// using HotScripts.GameLauncher;
|
||||
using JNGame.Runtime.System;
|
||||
using MainUI;
|
||||
using SHFrame;
|
||||
|
||||
namespace HotScripts.GameScripts.FGui
|
||||
{
|
||||
|
||||
public enum UILayerEnum
|
||||
{
|
||||
View,
|
||||
}
|
||||
|
||||
public enum UIID
|
||||
{
|
||||
Component1
|
||||
}
|
||||
|
||||
/**
|
||||
* UI 配置结构体
|
||||
*/
|
||||
public struct UIConfigStruct
|
||||
{
|
||||
public readonly string PkgName;
|
||||
public readonly string ResName;
|
||||
public readonly UILayerEnum Layer;
|
||||
|
||||
public UIConfigStruct(string pkgName, string resName, UILayerEnum layer)
|
||||
{
|
||||
PkgName = pkgName;
|
||||
ResName = resName;
|
||||
Layer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
public class FGuiManager : SystemBase
|
||||
{
|
||||
|
||||
private UI_MainUI _mainUI;
|
||||
|
||||
public static Dictionary<UIID, UIConfigStruct> UIConfigMap = new();
|
||||
public static Dictionary<UILayerEnum, GComponent> LayerMap = new();
|
||||
|
||||
public override async Task OnInit()
|
||||
{
|
||||
await UniTask.DelayFrame(1);
|
||||
Log.Debug($"UI 初始化中");
|
||||
// App.EventLauncher.DispatchEvent(HotLauncherEvent.InitSystem,$"UI 初始化中");
|
||||
|
||||
BindAll();
|
||||
BindUI();
|
||||
|
||||
await SHFrameModule.UI.AddPackageASync("MainUI");
|
||||
|
||||
_mainUI = UI_MainUI.CreateInstance();
|
||||
_mainUI.MakeFullScreen();
|
||||
GRoot.inst.AddChildAt(_mainUI,0);
|
||||
_mainUI.Center();
|
||||
|
||||
LayerMap.Add(UILayerEnum.View,_mainUI.m_View);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定UI包
|
||||
/// </summary>
|
||||
private void BindAll()
|
||||
{
|
||||
MainUIBinder.BindAll();
|
||||
CommonBinder.BindAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定UI配置
|
||||
/// </summary>
|
||||
private void BindUI()
|
||||
{
|
||||
UIConfigMap.Add(UIID.Component1,new UIConfigStruct("Common", "Component1", UILayerEnum.View));
|
||||
}
|
||||
|
||||
|
||||
public async UniTask Open<TClassType>(UIID id, params object[] param)
|
||||
where TClassType : UIBase, new()
|
||||
{
|
||||
if (!UIConfigMap.ContainsKey(id)) return;
|
||||
var config = UIConfigMap[id];
|
||||
await SHFrameModule.UI.Open<TClassType>(config.PkgName, config.ResName, LayerMap[config.Layer], param);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
3
JNFrame2/临时存储/GameScripts/FGui/FGuiManager.cs.meta
Normal file
3
JNFrame2/临时存储/GameScripts/FGui/FGuiManager.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffd157506c074a2f8ff4779145edd5c7
|
||||
timeCreated: 1729070320
|
8
JNFrame2/临时存储/GameScripts/FGui/Publish.meta
Normal file
8
JNFrame2/临时存储/GameScripts/FGui/Publish.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53684cc614eb0d94093256725a1ff85c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
JNFrame2/临时存储/GameScripts/FGui/Publish/Common.meta
Normal file
8
JNFrame2/临时存储/GameScripts/FGui/Publish/Common.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec925952c92c52d46a374f4996e7fcf9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public class CommonBinder
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(UI_Component1.URL, typeof(UI_Component1));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b2179ed09e9d7f4a9dd5e03d08b08da
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,25 @@
|
||||
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public partial class UI_Component1 : GComponent
|
||||
{
|
||||
public GTextField m_text;
|
||||
public const string URL = "ui://k5vyqumwed8i0";
|
||||
|
||||
public static UI_Component1 CreateInstance()
|
||||
{
|
||||
return (UI_Component1)UIPackage.CreateObject("Common", "Component1");
|
||||
}
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
m_text = (GTextField)GetChildAt(1);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2944078da6fa13c44aa673e785abacc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
JNFrame2/临时存储/GameScripts/FGui/Publish/MainUI.meta
Normal file
8
JNFrame2/临时存储/GameScripts/FGui/Publish/MainUI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b25135b33b98e84e95daed24165f505
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace MainUI
|
||||
{
|
||||
public class MainUIBinder
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(UI_MainUI.URL, typeof(UI_MainUI));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 721eb44138614964c8dec2ce404398bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
JNFrame2/临时存储/GameScripts/FGui/Publish/MainUI/UI_MainUI.cs
Normal file
25
JNFrame2/临时存储/GameScripts/FGui/Publish/MainUI/UI_MainUI.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
/** This is an automatically generated class by FairyGUI. Please do not modify it. **/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
|
||||
namespace MainUI
|
||||
{
|
||||
public partial class UI_MainUI : GComponent
|
||||
{
|
||||
public GComponent m_View;
|
||||
public const string URL = "ui://r71rr38pue300";
|
||||
|
||||
public static UI_MainUI CreateInstance()
|
||||
{
|
||||
return (UI_MainUI)UIPackage.CreateObject("MainUI", "MainUI");
|
||||
}
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
m_View = (GComponent)GetChildAt(0);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28a105b28e995ad4e98285dadd478b9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
3
JNFrame2/临时存储/GameScripts/FGui/Scripts.meta
Normal file
3
JNFrame2/临时存储/GameScripts/FGui/Scripts.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd7951464b584f01817913ada89e1e39
|
||||
timeCreated: 1729070943
|
27
JNFrame2/临时存储/GameScripts/FGui/Scripts/UIScriptDefault.cs
Normal file
27
JNFrame2/临时存储/GameScripts/FGui/Scripts/UIScriptDefault.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using SHFrame;
|
||||
|
||||
namespace HotScripts.GameScripts.FGui.Scripts
|
||||
{
|
||||
public class UIScriptDefault : UIBase
|
||||
{
|
||||
public override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnOpen(params object[] param)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddListener()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnClose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void RemoveListener()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e13b365d0e74205977b79a2cd6fe711
|
||||
timeCreated: 1729071032
|
Reference in New Issue
Block a user