Skip to content

Commit

Permalink
1.增加资源编辑器扩展
Browse files Browse the repository at this point in the history
2.增加字体在配置里配置
  • Loading branch information
It-Life committed Nov 18, 2022
1 parent b3db293 commit 3bc474e
Show file tree
Hide file tree
Showing 24 changed files with 65,422 additions and 60,387 deletions.
124,162 changes: 64,676 additions & 59,486 deletions Assets/Deer/AssetsNative/Font/wryhSDF.asset

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Assets/Deer/AssetsNative/Font/zh-cn_Commonly_used.txt

Large diffs are not rendered by default.

295 changes: 126 additions & 169 deletions Assets/Deer/GameConfigs/ResourceCollection.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
using System.Collections.Generic;
using UnityEngine;

public enum ProcedureEnum
{
ProcedureMain,
ProcedureArCatch,
ProcedureBattle
}

public static partial class Constant
{
public static class Scene
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,133 +11,112 @@
using GameFramework;
using GameFramework.UI;
using Main.Runtime;
using Main.Runtime.Procedure;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;

namespace HotfixFramework.Runtime
/// <summary>
/// Please modify the description.
/// </summary>
public static class UIExtension
{
private static Transform m_InstanceRoot;
private static IUIManager m_UIManager;
private static string m_UIGroupHelperTypeName = "Main.Runtime.DeerUIGroupHelper";
private static UIGroupHelperBase m_CustomUIGroupHelper = null;

/// <summary>
/// Please modify the description.
/// 血条节点
/// </summary>
public static class UIExtension
private static HealthbarRoot m_HealthbarRoot;
public static HealthbarRoot HealthbarRoot
{
private static Transform m_InstanceRoot;
private static IUIManager m_UIManager;
private static string m_UIGroupHelperTypeName = "Main.Runtime.DeerUIGroupHelper";
private static UIGroupHelperBase m_CustomUIGroupHelper = null;

/// <summary>
/// 血条节点
/// </summary>
private static HealthbarRoot m_HealthbarRoot;
public static HealthbarRoot HealthbarRoot
get
{
get
if (m_HealthbarRoot == null)
{
if (m_HealthbarRoot == null)
{
m_HealthbarRoot = GameEntry.UI.GetInstanceRoot().Find("HealthbarRoot").gameObject.GetOrAddComponent<HealthbarRoot>();
m_HealthbarRoot.gameObject.SetActive(true);
}
return m_HealthbarRoot;
m_HealthbarRoot = GameEntry.UI.GetInstanceRoot().Find("HealthbarRoot").gameObject.GetOrAddComponent<HealthbarRoot>();
m_HealthbarRoot.gameObject.SetActive(true);
}
return m_HealthbarRoot;
}
/// <summary>
/// 飘字节点
/// </summary>
private static ShootTextRoot m_ShootTextRoot;
public static ShootTextRoot ShootTextRoot
}
/// <summary>
/// 飘字节点
/// </summary>
private static ShootTextRoot m_ShootTextRoot;
public static ShootTextRoot ShootTextRoot
{
get
{
get
if (m_ShootTextRoot == null)
{
if (m_ShootTextRoot == null)
{
m_ShootTextRoot = GameEntry.UI.GetInstanceRoot().Find("ShootTextRoot").gameObject.GetOrAddComponent<ShootTextRoot>();
m_ShootTextRoot.gameObject.SetActive(true);
}
return m_ShootTextRoot;
m_ShootTextRoot = GameEntry.UI.GetInstanceRoot().Find("ShootTextRoot").gameObject.GetOrAddComponent<ShootTextRoot>();
m_ShootTextRoot.gameObject.SetActive(true);
}
return m_ShootTextRoot;
}
/// <summary>
/// 获取血条节点
/// </summary>
/// <param name="uiComponent"></param>
/// <returns></returns>
public static HealthbarRoot GetHealthbarRoot(this UIComponent uiComponent)
}
/// <summary>
/// 获取血条节点
/// </summary>
/// <param name="uiComponent"></param>
/// <returns></returns>
public static HealthbarRoot GetHealthbarRoot(this UIComponent uiComponent)
{
return HealthbarRoot;
}
/// <summary>
/// 获取飘字界面
/// </summary>
/// <returns></returns>
public static ShootTextRoot GetShootTextRoot(this UIComponent uiComponent)
{
return ShootTextRoot;
}
public static bool HasUIForm(this UIComponent uiComponent, UIFormId uiFormId, string uiGroupName = null)
{
return uiComponent.HasUIForm((int)uiFormId, uiGroupName);
}
public static bool HasUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
{
return HealthbarRoot;
return false;
}
/// <summary>
/// 获取飘字界面
/// </summary>
/// <returns></returns>
public static ShootTextRoot GetShootTextRoot(this UIComponent uiComponent)

string assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
if (string.IsNullOrEmpty(uiGroupName))
{
return ShootTextRoot;
return uiComponent.HasUIForm(assetName);
}
public static bool HasUIForm(this UIComponent uiComponent, UIFormId uiFormId, string uiGroupName = null)

IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
if (uiGroup == null)
{
return uiComponent.HasUIForm((int)uiFormId, uiGroupName);
return false;
}
public static bool HasUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
{
return false;
}

string assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
if (string.IsNullOrEmpty(uiGroupName))
{
return uiComponent.HasUIForm(assetName);
}

IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
if (uiGroup == null)
{
return false;
}
return uiGroup.HasUIForm(assetName);
}

return uiGroup.HasUIForm(assetName);
}
public static UIBaseForm GetUIForm(this UIComponent uiComponent, UIFormId uiFormId, string uiGroupName = null)
{
return uiComponent.GetUIForm((int)uiFormId, uiGroupName);
}

public static UIBaseForm GetUIForm(this UIComponent uiComponent, UIFormId uiFormId, string uiGroupName = null)
public static UIBaseForm GetUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
{
return uiComponent.GetUIForm((int)uiFormId, uiGroupName);
return null;
}

public static UIBaseForm GetUIForm(this UIComponent uiComponent, int uiFormId, string uiGroupName = null)
string assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
UIForm uiForm = null;
if (string.IsNullOrEmpty(uiGroupName))
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
{
return null;
}
string assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
UIForm uiForm = null;
if (string.IsNullOrEmpty(uiGroupName))
{
uiForm = uiComponent.GetUIForm(assetName);
if (uiForm == null)
{
return null;
}

return (UIBaseForm)uiForm.Logic;
}

IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
if (uiGroup == null)
{
return null;
}

uiForm = (UIForm)uiGroup.GetUIForm(assetName);
uiForm = uiComponent.GetUIForm(assetName);
if (uiForm == null)
{
return null;
Expand All @@ -146,73 +125,87 @@ public static UIBaseForm GetUIForm(this UIComponent uiComponent, int uiFormId, s
return (UIBaseForm)uiForm.Logic;
}

public static void CloseUIForm(this UIComponent uiComponent, UIBaseForm uiForm)
IUIGroup uiGroup = uiComponent.GetUIGroup(uiGroupName);
if (uiGroup == null)
{
return null;
}

uiForm = (UIForm)uiGroup.GetUIForm(assetName);
if (uiForm == null)
{
uiComponent.CloseUIForm(uiForm.UIForm);
return null;
}

public static int? OpenUIForm(this UIComponent uiComponent, UIFormId uiFormId, object userData = null)
return (UIBaseForm)uiForm.Logic;
}

public static void CloseUIForm(this UIComponent uiComponent, UIBaseForm uiForm)
{
uiComponent.CloseUIForm(uiForm.UIForm);
}

public static int? OpenUIForm(this UIComponent uiComponent, UIFormId uiFormId, object userData = null)
{
return uiComponent.OpenUIForm((int)uiFormId, userData);
}

public static int? OpenUIForm(this UIComponent uiComponent, int uiFormId, object userData = null)
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
{
return uiComponent.OpenUIForm((int)uiFormId, userData);
Log.Warning("Can not load UI form '{0}' from data table.", uiFormId.ToString());
return null;
}

public static int? OpenUIForm(this UIComponent uiComponent, int uiFormId, object userData = null)
string assetName = string.Empty;
switch (uIForm_Config.FormType)
{
case (int)Constant.UI.UIFormType.MainForm:
assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
break;
case (int)Constant.UI.UIFormType.SubForm:
assetName = AssetUtility.UI.GetUISubFormAsset(uIForm_Config.AssetName);
break;
case (int)Constant.UI.UIFormType.ComSubForm:
assetName = AssetUtility.UI.GetUIComSubFormAsset(uIForm_Config.AssetName);
break;
}
if (!uIForm_Config.AllowMultiInstance)
{
UIForm_Config uIForm_Config = GameEntry.Config.Tables.TbUIForm_Config.Get(uiFormId);
if (uIForm_Config == null)
if (uiComponent.IsLoadingUIForm(assetName))
{
Log.Warning("Can not load UI form '{0}' from data table.", uiFormId.ToString());
return null;
}

string assetName = string.Empty;
switch (uIForm_Config.FormType)
{
case (int)Constant.UI.UIFormType.MainForm:
assetName = AssetUtility.UI.GetUIFormAsset(uIForm_Config.AssetName);
break;
case (int)Constant.UI.UIFormType.SubForm:
assetName = AssetUtility.UI.GetUISubFormAsset(uIForm_Config.AssetName);
break;
case (int)Constant.UI.UIFormType.ComSubForm:
assetName = AssetUtility.UI.GetUIComSubFormAsset(uIForm_Config.AssetName);
break;
}
if (!uIForm_Config.AllowMultiInstance)
if (uiComponent.HasUIForm(assetName))
{
if (uiComponent.IsLoadingUIForm(assetName))
{
return null;
}

if (uiComponent.HasUIForm(assetName))
{
return null;
}
return null;
}

return uiComponent.OpenUIForm(assetName, uIForm_Config.UiGroupName, Constant.AssetPriority.UIFormAsset, uIForm_Config.PauseCoveredUIForm, userData);
}

public static void OpenDialog(this UIComponent uiComponent, DialogParams dialogParams)
{
uiComponent.OpenUIForm(UIFormId.DialogForm, dialogParams);
}
/// <summary>
/// 打开飘字提示框
/// </summary>
/// <param name="uIComponent"></param>
/// <param name="tips">显示内容</param>
/// <param name="color">颜色(默认白色)</param>
/// <param name="openBg">背景框(默认打开)</param>
public static void OpenTips(this UIComponent uIComponent, string tips, Color? color = null, bool openBg = true)
{
MessengerInfo info = ReferencePool.Acquire<MessengerInfo>();
info.param1 = tips;
info.param2 = color ?? Color.white;
info.param3 = openBg;
return uiComponent.OpenUIForm(assetName, uIForm_Config.UiGroupName, Constant.AssetPriority.UIFormAsset, uIForm_Config.PauseCoveredUIForm, userData);
}

uIComponent.OpenUIForm(UIFormId.UITipsForm, info);
}
public static void OpenDialog(this UIComponent uiComponent, DialogParams dialogParams)
{
uiComponent.OpenUIForm(UIFormId.DialogForm, dialogParams);
}
/// <summary>
/// 打开飘字提示框
/// </summary>
/// <param name="uIComponent"></param>
/// <param name="tips">显示内容</param>
/// <param name="color">颜色(默认白色)</param>
/// <param name="openBg">背景框(默认打开)</param>
public static void OpenTips(this UIComponent uIComponent, string tips, Color? color = null, bool openBg = true)
{
MessengerInfo info = ReferencePool.Acquire<MessengerInfo>();
info.param1 = tips;
info.param2 = color ?? Color.white;
info.param3 = openBg;

uIComponent.OpenUIForm(UIFormId.UITipsForm, info);
}
}
Loading

0 comments on commit 3bc474e

Please sign in to comment.