Merge branch 'develop' into 火山美术合入2.11

This commit is contained in:
2026-03-13 22:10:00 +08:00
11 changed files with 491 additions and 39 deletions
+52 -10
View File
@@ -13,6 +13,8 @@ GameObject:
- component: {fileID: 6027689100706873528}
- component: {fileID: 3624986506224747444}
- component: {fileID: 2154443921841158417}
- component: {fileID: 9163890225660695161}
- component: {fileID: 6763940520051960772}
m_Layer: 5
m_Name: Dream Option
m_TagString: Untagged
@@ -32,14 +34,14 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8909982681958940574}
- {fileID: 6963027988603325320}
- {fileID: 8909982681958940574}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 500, y: 60}
m_SizeDelta: {x: 0, y: 60}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &6606548094777468092
CanvasRenderer:
@@ -62,7 +64,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@@ -150,6 +152,46 @@ MonoBehaviour:
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 0
m_FadeDuration: 0
--- !u!114 &9163890225660695161
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3274141711606541777}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 18
m_Right: 40
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 3
m_Spacing: 18
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 1
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &6763940520051960772
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3274141711606541777}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
--- !u!1 &4507535836329041407
GameObject:
m_ObjectHideFlags: 0
@@ -242,7 +284,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &6963027988603325320
RectTransform:
m_ObjectHideFlags: 0
@@ -257,9 +299,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1274478104802664553}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: -30, y: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 32, y: 32}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6473248262291387364
@@ -335,9 +377,9 @@ RectTransform:
m_Father: {fileID: 1274478104802664553}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 68, y: 0}
m_SizeDelta: {x: 0, y: 60}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &8687981993458165584
CanvasRenderer:
+353
View File
@@ -0,0 +1,353 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3157538025219569214
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5463321828217487701}
- component: {fileID: 7304535519653304073}
- component: {fileID: 7335297936485028702}
- component: {fileID: 7167070903262564027}
- component: {fileID: 107040131454302588}
- component: {fileID: 4698362591619572577}
m_Layer: 0
m_Name: "\u5185\u5BB9"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5463321828217487701
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1284103664181101717}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &7304535519653304073
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_CullTransparentMesh: 1
--- !u!114 &7335297936485028702
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: c7fc4cbba4b38a04c8985d4dbce12a73, type: 2}
m_sharedMaterial: {fileID: -5947736473428621296, guid: c7fc4cbba4b38a04c8985d4dbce12a73, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 38
m_fontSizeBase: 38
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 7
m_wordSpacing: 0
m_lineSpacing: 30
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 30, y: 10, z: 20, w: 10}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &7167070903262564027
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e8ace8ced0e81c847968cdca0aeda757, type: 3}
m_Name:
m_EditorClassIdentifier:
typewriterStartsAutomatically: 0
animationLoop: 0
timeScale: 0
_text: "\u4E00\u90E8\u5206\u4E00\u90E8\u5206\u4E00\u90E8\u5206\u4E00\u90E8\u5206"
useDynamicScaling: 1
referenceFontSize: 10
isResettingTimeOnNewText: 1
useDefaultDatabases: 1
databaseBehaviors: {fileID: 11400000, guid: ab7e07cba198f4345b19d351e6a3034f, type: 2}
databaseAppearances: {fileID: 11400000, guid: 71ecf6147756deb4ca20570628f94f96, type: 2}
useDefaultStyleSheet: 1
styleSheet: {fileID: 0}
databaseActions: {fileID: 11400000, guid: de78232a60d74f6459e57e5606304209, type: 2}
defaultAppearancesTags:
- step
defaultDisappearancesTags:
- fade
defaultBehaviorsTags: []
defaultTagsMode: 0
--- !u!114 &107040131454302588
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 57a6945b90dcd0c4b81619c0d8b5c283, type: 3}
m_Name:
m_EditorClassIdentifier:
useTypeWriter: 1
startTypewriterMode: 3
hideAppearancesOnSkip: 0
hideDisappearancesOnSkip: 0
triggerEventsOnSkip: 0
resetTypingSpeedAtStartup: 1
disappearanceOrientation: 0
triggerShowedAfterEffectsEnd: 0
triggerDisappearedAfterEffectsEnd: 0
onTextShowed:
m_PersistentCalls:
m_Calls: []
onTypewriterStart:
m_PersistentCalls:
m_Calls: []
onTextDisappeared:
m_PersistentCalls:
m_Calls: []
onCharacterVisible:
m_PersistentCalls:
m_Calls: []
onMessage:
m_PersistentCalls:
m_Calls: []
waitForNormalChars: 0.03
waitLong: 0.6
waitMiddle: 0.2
avoidMultiplePunctuationWait: 0
waitForNewLines: 1
waitForLastCharacter: 1
useTypewriterWaitForDisappearances: 1
disappearanceWaitTime: 0.015
disappearanceSpeedMultiplier: 1
--- !u!114 &4698362591619572577
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3157538025219569214}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 10
m_MinHeight: -1
m_PreferredWidth: 800
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &8352794458094198668
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1284103664181101717}
- component: {fileID: 988812176523574123}
- component: {fileID: 215275187407609090}
- component: {fileID: 4083462688583332915}
- component: {fileID: 8824620582048436523}
m_Layer: 0
m_Name: OnelineBox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1284103664181101717
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352794458094198668}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5463321828217487701}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -356}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!222 &988812176523574123
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352794458094198668}
m_CullTransparentMesh: 1
--- !u!114 &215275187407609090
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352794458094198668}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -123270858, guid: ca909870d485bde44b1e652490df203f, type: 3}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &4083462688583332915
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352794458094198668}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 15
m_Bottom: 15
m_ChildAlignment: 3
m_Spacing: 15
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &8824620582048436523
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352794458094198668}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 2
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 60f4427b2070be04f90c1486bb86062c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -141,7 +141,7 @@ namespace AibisDream.UI
public void AddText(string text)
{
if (string.IsNullOrEmpty(text))
return;
text = " ";
// 如果使用Typewriter和TextAnimator,使用ShowText方法追加文本并播放动画
if (typewriter != null && textAnimator != null)
+1 -1
View File
@@ -162,7 +162,7 @@ namespace AibisDream
}
// 先去除富文本标签
var width = _bubbleGroup.EstimateTextWidth(line.RemoveRichTextTags(), _lineText.fontSize);
var width = DialogUIManager.Instance.EstimateTextWidth(line.RemoveRichTextTags(), _lineText.fontSize);
if (width > maxWidth)
{
_layoutElement.preferredWidth = maxWidth;
@@ -6,15 +6,12 @@ using System.Threading.Tasks;
using AibisDream.Framework;
using AibisDream.Kit;
using AibisDream.Utility;
using TMPro;
using UnityEngine;
namespace AibisDream
{
public class BubbleGroup : MonoBehaviour, ILineView
{
[SerializeField] private TMP_Text widthEstimation;
private Dictionary<ActorRole, Bubble[]> _bubbleDict = new();
private BubbleFactory _bubbleFactory;
private CancellationTokenSource _autoHideToken;
@@ -94,14 +91,6 @@ namespace AibisDream
}
}
public float EstimateTextWidth(string text, float fontSize)
{
widthEstimation.fontSize = fontSize;
widthEstimation.text = text;
widthEstimation.ForceMeshUpdate();
return widthEstimation.preferredWidth;
}
private async void AfterAdvance()
{
_autoHideToken = new CancellationTokenSource();
@@ -1,6 +1,7 @@
using AibisDream.Framework;
using AibisDream.Kit;
using AibisDream.UI;
using TMPro;
using UnityEngine;
namespace AibisDream
@@ -9,6 +10,7 @@ namespace AibisDream
{
[SerializeField] private LineRunner lineView;
[SerializeField] private OptionView optionView;
[SerializeField] private TMP_Text widthEstimation;
public override void OnSingletonInit()
{
@@ -77,6 +79,14 @@ namespace AibisDream
lineView.LoadBubbleData(data);
optionView.LoadBubbles(data);
}
public float EstimateTextWidth(string text, float fontSize)
{
widthEstimation.fontSize = fontSize;
widthEstimation.text = text;
widthEstimation.ForceMeshUpdate();
return widthEstimation.preferredWidth;
}
}
public enum DialogViewType
+50 -6
View File
@@ -1,8 +1,10 @@
using System;
using System;
using System.Threading;
using System.Threading.Tasks;
using Febucci.UI.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using AibisDream.Framework;
using AibisDream.Utility;
@@ -13,14 +15,21 @@ namespace AibisDream
[SerializeField] private TypewriterCore content;
[SerializeField] private GameObject box;
[Header("排版参数")]
[SerializeField] private int maxWidth = 800;
[SerializeField] private int minWidth = 10;
private LayoutElement _contentLayoutElement;
private TMP_Text _contentText;
private RectTransform _rectTransform;
private CancellationTokenSource _autoHideToken;
private event Action OnTextShowed;
private bool _isInitialized;
// ---------------------------- 显示逻辑 ----------------------------
public void RunLine(LineSyncToken syncToken)
{
Debug.Log("OnelineBox: " + syncToken.lineInfo.lineText);
// 先中断结束事件
_autoHideToken?.Cancel();
_autoHideToken = null;
@@ -32,11 +41,11 @@ namespace AibisDream
// 播放文字
content.TextAnimator.SetText(string.Empty);
Debug.Log("OnelineBox: " + GetOneLineText(syncToken.lineInfo));
var lineText = GetOneLineText(syncToken.lineInfo);
box.SetActive(true);
content.ShowText(GetOneLineText(syncToken.lineInfo));
HandleLayout(lineText);
content.ShowText(lineText);
syncToken.TextStart();
Debug.Log("OnelineBox: TextStart");
}
private string GetOneLineText(LineInfo lineInfo)
@@ -45,10 +54,34 @@ namespace AibisDream
{
return lineInfo.lineText;
}
return $"<notype>{lineInfo.character.GetActorName()}: </notype>{lineInfo.lineText}";
}
private void HandleLayout(string line)
{
if (!_isInitialized)
{
InitRefs();
}
// 去除富文本标签后计算宽度
var width = DialogUIManager.Instance.EstimateTextWidth(line.RemoveRichTextTags(), _contentText.fontSize);
if (width > maxWidth)
{
_contentLayoutElement.preferredWidth = maxWidth;
}
else
{
_contentLayoutElement.preferredWidth = -1; // 自适应
}
_contentLayoutElement.minWidth = minWidth;
LayoutRebuilder.ForceRebuildLayoutImmediate(_rectTransform);
}
private async void AfterAdvance()
{
_autoHideToken = new CancellationTokenSource();
@@ -73,6 +106,17 @@ namespace AibisDream
private void Awake()
{
box.SetActive(false);
InitRefs();
}
private void InitRefs()
{
if (_isInitialized) return;
_rectTransform = box.GetComponent<RectTransform>();
_contentText = content.GetComponent<TMP_Text>();
_contentLayoutElement = content.GetComponent<LayoutElement>();
_isInitialized = true;
}
private void Start()
@@ -1,7 +1,8 @@
using System;
using System;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using AibisDream.Utility;
namespace AibisDream
{
@@ -49,23 +50,23 @@ namespace AibisDream
switch (state)
{
case SelectionType.Normal:
arrow.gameObject.SetActive(false);
arrow.SetAlpha(0f);
SetColor(colorBlock.normalColor);
break;
case SelectionType.Highlighted:
arrow.gameObject.SetActive(true);
arrow.SetAlpha(1f);
SetColor(colorBlock.highlightedColor);
break;
case SelectionType.Pressed:
arrow.gameObject.SetActive(true);
arrow.SetAlpha(1f);
SetColor(colorBlock.pressedColor);
break;
case SelectionType.Selected:
arrow.gameObject.SetActive(true);
arrow.SetAlpha(1f);
SetColor(colorBlock.selectedColor);
break;
case SelectionType.Disabled:
arrow.gameObject.SetActive(false);
arrow.SetAlpha(0f);
SetColor(colorBlock.disabledColor);
break;
}
@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using AibisDream.Framework;
namespace AibisDream
@@ -12,8 +12,6 @@ namespace AibisDream
{
gameObject.SetActive(true);
Debug.Log($"ShowOptions: {dialogOptions.Length}, {dialogOptions[0].Line}");
// 生成新按钮
foreach (var option in dialogOptions)
{
+9 -1
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
@@ -10,6 +10,7 @@ using UnityEngine;
using Object = UnityEngine.Object;
using System.Globalization;
using UnityEditor;
using UnityEngine.UI;
namespace AibisDream.Utility
{
@@ -185,6 +186,13 @@ namespace AibisDream.Utility
renderer.color = color;
}
public static void SetAlpha(this Image image, float targetAlpha)
{
Color color = image.color;
color.a = targetAlpha;
image.color = color;
}
public static void DestroyAllChildren(this Transform self)
{
if (self == null)