This commit is contained in:
parent
5020941175
commit
63970152cb
|
@ -114,7 +114,9 @@
|
|||
<Compile Include="Assets\Standard Assets 1\Vehicles\Car\Scripts\CarController.cs" />
|
||||
<Compile Include="Assets\HighlightPlus\Scripts\InputProxy.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Vehicles\Car\Scripts\BrakeLight.cs" />
|
||||
<Compile Include="Assets\Scripts\CharacterEquipWindow\CharacterMirrorManager.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Characters\ThirdPersonCharacter\Scripts\ThirdPersonCharacter.cs" />
|
||||
<Compile Include="Assets\Scripts\CharacterEquipWindow\CharacterEquipManager.cs" />
|
||||
<Compile Include="Assets\Scripts\ToolsPack\ToolsPackWindowItemBtComponent.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\CrossPlatformInput\Scripts\TouchPad.cs" />
|
||||
<Compile Include="Assets\Model\Fantastic City Generator\DayNight\ShiftAtRuntime.cs" />
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GameLauncher : MonoBehaviour
|
|||
//工具包
|
||||
MotionEngine.CreateModule<ToolsPackManager>();
|
||||
//人物装备
|
||||
MotionEngine.CreateModule<CharacterEquipWindowManager>();
|
||||
MotionEngine.CreateModule<CharacterEquipManager>();
|
||||
//数据配置文件
|
||||
MotionEngine.CreateModule<DataConfigManager>();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: edd7479ac6cfd364b9641e6ec96221ce
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,40 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: ToolsScene_MirrorMan
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1920
|
||||
m_Height: 1080
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 8
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a60d345bd29ba204ca7d9ca6b1e0fd6e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1915c67b860597346b1930c3ca5695da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,215 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6749027252962262180
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5395866562595971437}
|
||||
- component: {fileID: 4695796806525574413}
|
||||
- component: {fileID: 3150964284441235137}
|
||||
m_Layer: 5
|
||||
m_Name: Text (Legacy)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5395866562595971437
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6749027252962262180}
|
||||
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: 7773628375646258405}
|
||||
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_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4695796806525574413
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6749027252962262180}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3150964284441235137
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6749027252962262180}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Button
|
||||
--- !u!1 &7722025387657544356
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7773628375646258405}
|
||||
- component: {fileID: 68554330199099924}
|
||||
- component: {fileID: 3718520035792867647}
|
||||
- component: {fileID: 4835224348277378352}
|
||||
- component: {fileID: 6037823727405845051}
|
||||
m_Layer: 5
|
||||
m_Name: CharacterEquipBt
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7773628375646258405
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7722025387657544356}
|
||||
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: 5395866562595971437}
|
||||
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: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &68554330199099924
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7722025387657544356}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3718520035792867647
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7722025387657544356}
|
||||
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: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
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 &4835224348277378352
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7722025387657544356}
|
||||
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: 3718520035792867647}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &6037823727405845051
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7722025387657544356}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 33ac3fcd80ff49cc8bf4a4dfd520d2ec, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7fd9f6611f354c544953c237ec1403fb
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -13,16 +13,7 @@ namespace DefaultNamespace
|
|||
{
|
||||
this.GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
if (isChange)
|
||||
{
|
||||
isChange = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isChange = true;
|
||||
}
|
||||
|
||||
MotionEngine.GetModule<CharacterEquipWindowManager>().ChangeEquip(this.name, isChange);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MotionFramework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
/// <summary>
|
||||
/// 人物窗口装备管理器
|
||||
/// </summary>
|
||||
public class CharacterEquipManager : ModuleSingleton<CharacterEquipManager>, IModule
|
||||
{
|
||||
private Dictionary<string, Material> _equips; //装备集合
|
||||
private List<Material> _cancel; //未穿戴材质球
|
||||
private List<Material> _wear; //穿戴材质球
|
||||
private GameObject equipBt;
|
||||
|
||||
public void OnCreate(object createParam)
|
||||
{
|
||||
_equips = new Dictionary<string, Material>();
|
||||
_cancel = new List<Material>();
|
||||
_wear = new List<Material>();
|
||||
|
||||
_cancel = Resources.LoadAll<Material>("Materials/CharacterEquip/Cancel").ToList();
|
||||
_wear = Resources.LoadAll<Material>("Materials/CharacterEquip/Wear").ToList();
|
||||
equipBt = Resources.Load<GameObject>("Prefabs/Window/CharacterEquip/CharacterEquipBt");
|
||||
|
||||
_equips.Add("帽子", null);
|
||||
_equips.Add("手套", null);
|
||||
_equips.Add("衣服", null);
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
}
|
||||
|
||||
public void ChangeEquip(string equipName, bool isChange)
|
||||
{
|
||||
Material ma = null;
|
||||
|
||||
if (_equips.TryGetValue(equipName, out ma))
|
||||
{
|
||||
if (isChange)
|
||||
{
|
||||
ma = _wear.SingleOrDefault(s => s.name == equipName);
|
||||
}
|
||||
else
|
||||
{
|
||||
ma = _cancel.SingleOrDefault(s => s.name == equipName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetEquipBt()
|
||||
{
|
||||
return equipBt;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 009d985b6c4749cb9ce66407b5fc3c60
|
||||
timeCreated: 1717465702
|
|
@ -1,62 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MotionFramework;
|
||||
using ToolsPack;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
/// <summary>
|
||||
/// 人物窗口装备管理器
|
||||
/// </summary>
|
||||
public class CharacterEquipWindowManager : ModuleSingleton<CharacterEquipWindowManager>, IModule
|
||||
public class CharacterEquipWindowManager : MonoBehaviour
|
||||
{
|
||||
private Dictionary<string, Material> _equips; //装备集合
|
||||
private List<Material> _cancel; //未穿戴材质球
|
||||
private List<Material> _wear; //穿戴材质球
|
||||
|
||||
public void OnCreate(object createParam)
|
||||
private Dictionary<string, List<GameObject>> _toolsNames;
|
||||
|
||||
[SerializeField] private Transform content;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_equips = new Dictionary<string, Material>();
|
||||
_cancel = new List<Material>();
|
||||
_wear = new List<Material>();
|
||||
|
||||
_cancel = Resources.LoadAll<Material>("Materials/CharacterEquip/Cancel").ToList();
|
||||
_wear = Resources.LoadAll<Material>("Materials/CharacterEquip/Wear").ToList();
|
||||
|
||||
_equips.Add("帽子", null);
|
||||
_equips.Add("手套", null);
|
||||
_equips.Add("衣服", null);
|
||||
ChangePage(ModelTypeEnum.工具);
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
public void ChangePage(ModelTypeEnum windw)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ChangeEquip(string equipName, bool isChange)
|
||||
{
|
||||
Material ma = null;
|
||||
|
||||
if (_equips.TryGetValue(equipName, out ma))
|
||||
int count = content.childCount;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (isChange)
|
||||
Destroy(content.GetChild(i).gameObject);
|
||||
}
|
||||
|
||||
|
||||
//初始化工具集
|
||||
_toolsNames = MotionEngine.GetModule<ToolsPackManager>().GetToolsPack();
|
||||
|
||||
GameObject bt = MotionEngine.GetModule<CharacterEquipManager>().GetEquipBt();
|
||||
foreach (var v in _toolsNames)
|
||||
{
|
||||
List<string> li = MotionEngine.GetModule<DataConfigManager>().GetToolsPackData(v.Key);
|
||||
|
||||
if (li == null)
|
||||
{
|
||||
ma = _wear.SingleOrDefault(s => s.name == equipName);
|
||||
if (v.Value[0].GetComponent<ToolsPackGameObjectComponent>().GetModelTypeEnum() == windw)
|
||||
{
|
||||
CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent<CharacterEquipBtOnClick>();
|
||||
btComponent.name = v.Key;
|
||||
// btComponent.Init(v.Key, v.Key, 0);
|
||||
// MotionEngine.GetModule<ToolsPackManager>().AddToolsPackWindowItemBts(btComponent.gameObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ma = _cancel.SingleOrDefault(s => s.name == equipName);
|
||||
foreach (var lis in v.Value)
|
||||
{
|
||||
if (lis.GetComponent<ToolsPackGameObjectComponent>().GetModelTypeEnum() == windw)
|
||||
{
|
||||
foreach (var to in li)
|
||||
{
|
||||
CharacterEquipBtOnClick btComponent = Instantiate(bt, content, false).GetComponent<CharacterEquipBtOnClick>();
|
||||
btComponent.name = to;
|
||||
// btComponent.Init(to, v.Key, lis.GetComponent<ToolsPackGameObjectComponent>().GetIndex());
|
||||
// MotionEngine.GetModule<ToolsPackManager>().AddToolsPackWindowItemBts(btComponent.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 009d985b6c4749cb9ce66407b5fc3c60
|
||||
timeCreated: 1717465702
|
||||
fileFormatVersion: 2
|
||||
guid: a84fb8d3f0d04ff69eaf47fab0e31713
|
||||
timeCreated: 1717585507
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using HighlightPlus;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CharacterMirrorManager : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private GameObject text;
|
||||
[SerializeField] private Image uiImage;
|
||||
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
text.SetActive(true);
|
||||
this.GetComponent<HighlightEffect>().highlighted = true;
|
||||
}
|
||||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
text.SetActive(false);
|
||||
this.GetComponent<HighlightEffect>().highlighted = false;
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if(EventSystem.current.IsPointerOverGameObject())
|
||||
return;
|
||||
|
||||
StartCoroutine(FadeIn(uiImage, 0.5f));
|
||||
}
|
||||
|
||||
private IEnumerator FadeIn(Image image, float duration)
|
||||
{
|
||||
// 初始化透明度为0
|
||||
Color color = image.color;
|
||||
color.a = 0f;
|
||||
image.color = color;
|
||||
|
||||
float elapsedTime = 0f;
|
||||
|
||||
// 渐变透明度
|
||||
while (elapsedTime < duration)
|
||||
{
|
||||
elapsedTime += Time.deltaTime;
|
||||
color.a = Mathf.Clamp01(elapsedTime / duration);
|
||||
image.color = color;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 确保透明度设置为1
|
||||
color.a = 1f;
|
||||
image.color = color;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b00ac4d0ce705234780d8d779872b872
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -15,7 +15,7 @@ TagManager:
|
|||
- UI
|
||||
-
|
||||
-
|
||||
-
|
||||
- man
|
||||
-
|
||||
-
|
||||
-
|
||||
|
|
Loading…
Reference in New Issue