This commit is contained in:
parent
c613c4ffd3
commit
7e16699f94
|
|
@ -401,3 +401,6 @@ MonoBehaviour:
|
|||
bg: {fileID: 7002883869800419636}
|
||||
text_Content: {fileID: 8594377904747112240}
|
||||
text_Title: {fileID: 5145926162580700466}
|
||||
currColor: {r: 1, g: 0.9647059, b: 0, a: 0}
|
||||
doneColor: {r: 1, g: 1, b: 1, a: 0}
|
||||
endColorChangeLength: 0
|
||||
|
|
|
|||
|
|
@ -3419,8 +3419,6 @@ GameObject:
|
|||
- component: {fileID: 3997430791354934165}
|
||||
- component: {fileID: 8078121093365208981}
|
||||
- component: {fileID: 6110699544305837595}
|
||||
- component: {fileID: 4165361031096262234}
|
||||
- component: {fileID: 6038333696606425501}
|
||||
m_Layer: 5
|
||||
m_Name: Bg
|
||||
m_TagString: Untagged
|
||||
|
|
@ -3441,14 +3439,15 @@ RectTransform:
|
|||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4668732912196552638}
|
||||
- {fileID: 3224853875109865157}
|
||||
m_Father: {fileID: 3371371867588176321}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 40, y: -98}
|
||||
m_AnchoredPosition: {x: 300, y: -98}
|
||||
m_SizeDelta: {x: 260, y: 676.4996}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &8078121093365208981
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -3487,46 +3486,6 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &4165361031096262234
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3547628013606699840}
|
||||
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: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &6038333696606425501
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3547628013606699840}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 0
|
||||
--- !u!1 &3805272273331250094
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -4084,7 +4043,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 180, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &2863701735228047296
|
||||
CanvasRenderer:
|
||||
|
|
@ -5598,6 +5557,12 @@ MonoBehaviour:
|
|||
- {fileID: 6672875250636715790}
|
||||
- {fileID: 9149981731159942754}
|
||||
- {fileID: 6296556775557808310}
|
||||
LeftOpen_Spr:
|
||||
- {fileID: 21300000, guid: ccf011945648a38468c61381245bba6c, type: 3}
|
||||
- {fileID: 21300000, guid: 9d591b8646952e548a50921bbe7bc8e2, type: 3}
|
||||
MoveImage: {fileID: 3547628013606699840}
|
||||
idleTime: 15
|
||||
isLeft: 0
|
||||
--- !u!1 &6325379169560023408
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -5801,6 +5766,127 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &6548886829472181918
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3224853875109865157}
|
||||
- component: {fileID: 2761813221392313527}
|
||||
- component: {fileID: 6243973107190679914}
|
||||
- component: {fileID: 4082652937529547201}
|
||||
m_Layer: 5
|
||||
m_Name: LeftOpen_Btn
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3224853875109865157
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6548886829472181918}
|
||||
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: 3997430791354934165}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 65, y: 95}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &2761813221392313527
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6548886829472181918}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6243973107190679914
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6548886829472181918}
|
||||
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: 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_Sprite: {fileID: 21300000, guid: ccf011945648a38468c61381245bba6c, type: 3}
|
||||
m_Type: 0
|
||||
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 &4082652937529547201
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6548886829472181918}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 6243973107190679914}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &6588102233761783436
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ MonoBehaviour:
|
|||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_Interactable: 0
|
||||
m_TargetGraphic: {fileID: 4393350400899337070}
|
||||
m_FillRect: {fileID: 4393350401150486687}
|
||||
m_HandleRect: {fileID: 4393350400899337065}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,9 @@ MonoBehaviour:
|
|||
DataBtn: {fileID: 0}
|
||||
ContentTrans: {fileID: 8404470364145622164}
|
||||
LineTips: {fileID: 9038525972232528669}
|
||||
blinkSpeed: 1
|
||||
minAlpha: 0.2
|
||||
maxAlpha: 0.8
|
||||
--- !u!1 &2191928868238950237
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1070,7 +1073,7 @@ RectTransform:
|
|||
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.3496, y: -0.2782}
|
||||
m_AnchoredPosition: {x: 0.34960175, y: -0.27819824}
|
||||
m_SizeDelta: {x: 222.0991, y: 137.4551}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1097103042514336636
|
||||
|
|
@ -1866,6 +1869,7 @@ GameObject:
|
|||
- component: {fileID: 5311454092380190010}
|
||||
- component: {fileID: 1598233547813555746}
|
||||
- component: {fileID: 6692345761169356743}
|
||||
- component: {fileID: 4341681987526448607}
|
||||
m_Layer: 5
|
||||
m_Name: "\u80CC\u666F\u63D0\u793A"
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1889,11 +1893,11 @@ RectTransform:
|
|||
m_Father: {fileID: 8404470364145622164}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1787, y: -177.8277}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -17, y: -100}
|
||||
m_SizeDelta: {x: 232, y: 155.6554}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &1598233547813555746
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1932,3 +1936,15 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!225 &4341681987526448607
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9038525972232528669}
|
||||
m_Enabled: 1
|
||||
m_Alpha: 1
|
||||
m_Interactable: 1
|
||||
m_BlocksRaycasts: 1
|
||||
m_IgnoreParentGroups: 0
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e6326550e2d6654b91bfec2bc26eae5
|
||||
guid: 77710922164ad844ea492a2240169b86
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
|
@ -27,18 +27,18 @@ TextureImporter:
|
|||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 1
|
||||
seamlessCubemap: 1
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 0
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
|
|
@ -54,7 +54,7 @@ TextureImporter:
|
|||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
|
|
@ -71,18 +71,6 @@ TextureImporter:
|
|||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 100
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
|
|
@ -90,7 +78,7 @@ TextureImporter:
|
|||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
|
|
@ -11,6 +12,17 @@ public class UI_ExperimentChooesPanel : BasePanel
|
|||
/// ¿ÆÄ¿
|
||||
/// </summary>
|
||||
public List<Toggle> SubjectTog;
|
||||
private Button LeftOpen_Btn;
|
||||
public List<Sprite> LeftOpen_Spr;
|
||||
public GameObject MoveImage; //移动面板
|
||||
|
||||
// 未点击的超时时间(秒)
|
||||
public float idleTime = 15f;
|
||||
// 记录最后一次点击按钮的时间
|
||||
private float lastClickTime;
|
||||
// 标记是否已经打印过提示(避免每一帧都打印)
|
||||
private bool hasPrinted = false;
|
||||
public bool isLeft;
|
||||
protected override void Awake()
|
||||
{
|
||||
instance = this;
|
||||
|
|
@ -20,7 +32,9 @@ public class UI_ExperimentChooesPanel : BasePanel
|
|||
|
||||
public void OnInit()
|
||||
{
|
||||
|
||||
LeftOpen_Btn = GetControl<Button>("LeftOpen_Btn");
|
||||
//MoveImage.transform.position = n
|
||||
lastClickTime = Time.time;
|
||||
}
|
||||
public override void ShowMe()
|
||||
{
|
||||
|
|
@ -32,6 +46,32 @@ public class UI_ExperimentChooesPanel : BasePanel
|
|||
base.HideMe();
|
||||
SubjectTog[0].isOn = true;
|
||||
}
|
||||
|
||||
protected override void OnClick(string btnPath)
|
||||
{
|
||||
base.OnClick(btnPath);
|
||||
switch (btnPath)
|
||||
{
|
||||
case "LeftOpen_Btn":
|
||||
Debug.Log(btnPath);
|
||||
// 更新最后点击时间为当前时间
|
||||
lastClickTime = Time.time;
|
||||
Debug.Log("按钮被点击了!重置计时");
|
||||
if (!isLeft)
|
||||
{
|
||||
MoveImage.transform.DOLocalMove(new Vector3(-660, 442, 0), 1f);
|
||||
isLeft = true;
|
||||
LeftOpen_Btn.GetComponent<Image>().sprite = LeftOpen_Spr[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveImage.transform.DOLocalMove(new Vector3(-960, 442, 0), 1f);
|
||||
isLeft = false;
|
||||
LeftOpen_Btn.GetComponent<Image>().sprite = LeftOpen_Spr[1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected override void OnChangeToggle(string btnPath, bool isOn)
|
||||
{
|
||||
base.OnClick(btnPath);
|
||||
|
|
@ -69,11 +109,27 @@ public class UI_ExperimentChooesPanel : BasePanel
|
|||
break;
|
||||
case "5-5-2":
|
||||
LineManager.instance.ChangeClass(552);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// 计算当前时间与最后点击时间的差值
|
||||
float timeSinceLastClick = Time.time - lastClickTime;
|
||||
if (timeSinceLastClick >= idleTime && !hasPrinted)
|
||||
{
|
||||
Debug.Log("按钮已经超过3秒没有被点击了!");
|
||||
hasPrinted = true; // 标记为已打印,避免重复输出
|
||||
MoveImage.transform.DOLocalMove(new Vector3(-960, 442, 0), 1f);
|
||||
isLeft = false;
|
||||
LeftOpen_Btn.GetComponent<Image>().sprite = LeftOpen_Spr[1];
|
||||
}
|
||||
// 如果重新点击了按钮(时间差小于3秒),重置打印标记
|
||||
else if (timeSinceLastClick < idleTime && hasPrinted)
|
||||
{
|
||||
hasPrinted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class UI_TopTipPanel : BaseItem
|
||||
|
|
@ -13,10 +9,16 @@ public class UI_TopTipPanel : BaseItem
|
|||
public TextMeshProUGUI text_Content;
|
||||
public TextMeshProUGUI text_Title;
|
||||
public static UI_TopTipPanel instance;
|
||||
|
||||
public Color currColor; // 默认颜色
|
||||
public Color doneColor; // 已完成颜色
|
||||
[Header("末尾颜色变化的长度")]
|
||||
public int endColorChangeLength;
|
||||
// 结尾颜色标志
|
||||
private string endColorStr = "</color>";
|
||||
protected override void Awake()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
}
|
||||
public void Init(string title, string content)
|
||||
{
|
||||
|
|
@ -24,10 +26,42 @@ public class UI_TopTipPanel : BaseItem
|
|||
//text_Content = GetControl<TextMeshProUGUI>("Text_Content");
|
||||
//bg = GetControl<Image>("UI_TopTipPanelBG");
|
||||
text_Title.text = "<color=#00EEE6>" + title + "</color>";
|
||||
text_Content.text = "<color=#00CCFF>" + content + "</color>";
|
||||
//text_Content.text = "<color=#00CCFF>" + content + "</color>";
|
||||
StartCoroutine(Typing(text_Content, content, 0.1f));
|
||||
TextMeshProUGUI tempText = text_Title.preferredWidth > text_Content.preferredWidth ? text_Title : text_Content;
|
||||
AdjustImageWidth(tempText, bg.rectTransform, 30, 21);
|
||||
// LineManager.instance.ResetLine();
|
||||
// LineManager.instance.ResetLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="text_Content"></param>
|
||||
/// <param name="typeTime">打字时间间隔</param>
|
||||
/// <returns></returns>
|
||||
IEnumerator Typing(TextMeshProUGUI text_Content, string typeContent, float typeTime)
|
||||
{
|
||||
text_Content.text = string.Empty;
|
||||
string strTemp = string.Empty;
|
||||
|
||||
|
||||
strTemp = GetStartColorStr(doneColor);
|
||||
for (int i = 0; i < typeContent.Length; i++)
|
||||
{
|
||||
yield return new WaitForSeconds(typeTime);
|
||||
strTemp += typeContent[i];
|
||||
|
||||
|
||||
// <> + 已经打出的字 <> + <> 需要显示几个字的不同颜色变化(记得判定结尾是否越界) <>
|
||||
int endChangeLength = endColorChangeLength + 1 + i <= typeContent.Length ? endColorChangeLength : 0;
|
||||
text_Content.text = strTemp + endColorStr + GetStartColorStr(currColor) + typeContent.Substring(i + 1, endChangeLength) + endColorStr;
|
||||
}
|
||||
}
|
||||
// 得到富文本的开头的颜色
|
||||
private string GetStartColorStr(Color color)
|
||||
{
|
||||
string hexColor = ColorUtility.ToHtmlStringRGB(color);
|
||||
return $"<color=#{hexColor}>";
|
||||
}
|
||||
/// <summary>
|
||||
/// Ãæ°åÏûʧ
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@ public class UI_TopTitlePanel : BasePanel
|
|||
public Transform ContentTrans; //生成父物体坐标
|
||||
public GameObject LineTips;//连线提示
|
||||
|
||||
|
||||
// 闪烁速度(值越大闪得越快)
|
||||
public float blinkSpeed = 1f;
|
||||
// 透明度波动范围(0.2~0.8 表示在20%~80%透明度之间闪烁)
|
||||
public float minAlpha = 0.2f;
|
||||
public float maxAlpha = 0.8f;
|
||||
protected override void Awake()
|
||||
{
|
||||
|
||||
|
|
@ -144,6 +150,15 @@ public class UI_TopTitlePanel : BasePanel
|
|||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
CanvasGroup canvasGroup = LineTips.GetComponent<CanvasGroup>();
|
||||
// 使用Mathf.PingPong(乒乓函数)实现0~1之间往复,再映射到目标透明度范围
|
||||
float t = Mathf.PingPong(Time.time * blinkSpeed, 1f);
|
||||
// 插值计算当前透明度
|
||||
canvasGroup.alpha = Mathf.Lerp(minAlpha, maxAlpha, t);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出应用
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue