This commit is contained in:
liuliang 2024-12-18 17:07:08 +08:00
commit b6db82d9b6
15 changed files with 259 additions and 62 deletions

View File

@ -1,5 +1,6 @@
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
public class SnowHpControl : MonoBehaviour
{
@ -7,7 +8,7 @@ public class SnowHpControl : MonoBehaviour
public Vector3 maxScale = new Vector3(1.5f, 1.5f, 1f); // 最大缩放
public float duration = 1f; // 动画的总持续时间
public float moveDistance = 5f; // 跳跃的水平距离
public float fadeDuration = 1f; // 消失时间
public float fadeDuration = 0.5f; // 消失时间
public Canvas targetCanvas; // 目标画布用于确保UI元素在该画布上移动
private Renderer rend; // 用于获取物体的Renderer来控制透明度
@ -46,20 +47,21 @@ public class SnowHpControl : MonoBehaviour
Sequence sequence = DOTween.Sequence();
// 1. 跳跃并逐渐变大
sequence.Append(transform.DOJump(new Vector3(initialPosition.x + randomX + moveDistance, initialPosition.y+randomY),0.3f,1, 1f)
sequence.Append(transform.DOJump(new Vector3(initialPosition.x + randomX + moveDistance, initialPosition.y+randomY),0.3f,1, 0.5f)
.SetEase(Ease.OutQuad) // 跳跃效果使用OutQuad让跳跃过程中速度逐渐变慢
);
//sequence.Join(transform.DOMoveY(initialPosition.y -( randomY + moveDistance) / 2f, 0.6f)
// .SetEase(Ease.OutQuad) // 跳跃的高度跟X轴的跳跃配合
//);
sequence.Join(transform.DOScale(maxScale, 1f) // 同时控制大小,从初始值到最大值
sequence.Join(transform.DOScale(maxScale, 0.5f) // 同时控制大小,从初始值到最大值
.SetEase(Ease.OutBack) // 使用OutBack让物体变大时有一个“弹跳”的效果
);
// 2. 动画完成后,逐渐变淡并销毁
sequence.Append(transform.DOScale(new Vector3(0.4f, 0.4f, 0.4f), 0.5f).SetEase(Ease.Linear)); // 缩小效果,模拟消失的感觉
sequence.Append(transform.GetComponent<Renderer>().material.DOFade(0f, fadeDuration).OnComplete(() =>
sequence.Append(transform.DOScale(Vector3.zero, 0.5f).SetEase(Ease.Linear)); // 缩小效果,模拟消失的感觉
sequence.Append(transform.GetComponent<Text>().DOFade(0f, fadeDuration).OnComplete(() =>
{
Destroy(gameObject); // 动画完成后销毁对象
}));
}

View File

@ -31,14 +31,15 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7467116312563346090}
- {fileID: 4868537472617793602}
m_Father: {fileID: 5609612011295970173}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -10, y: 448.8}
m_SizeDelta: {x: -0.8, y: -1743.8}
m_AnchoredPosition: {x: -9.700012, y: 448.8}
m_SizeDelta: {x: 19.4, y: -1743.8}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1105083700936425670
CanvasRenderer:
@ -61,7 +62,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_Color: {r: 0, g: 0, b: 0, a: 0.8}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 0
@ -91,6 +92,82 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_ShowMaskGraphic: 1
--- !u!1 &4183642663284617997
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7467116312563346090}
- component: {fileID: 744592432927293251}
- component: {fileID: 605146830908541898}
m_Layer: 5
m_Name: tianchongYello
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7467116312563346090
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4183642663284617997}
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: 1
m_Children: []
m_Father: {fileID: 4233861956062694457}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 5.81, y: 0}
m_SizeDelta: {x: 11.72, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &744592432927293251
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4183642663284617997}
m_CullTransparentMesh: 1
--- !u!114 &605146830908541898
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4183642663284617997}
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: 0.5019608}
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: be7cd7587e113e04c886efa8d506cf14, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4394176608275501679
GameObject:
m_ObjectHideFlags: 0
@ -253,7 +330,8 @@ MonoBehaviour:
camp: 1
hp: 100
dieIndex: 1
Hpfiil: {fileID: 6236648196338733329}
Hpfiil: {fileID: 1566038940701374259}
HpfiilYello: {fileID: 605146830908541898}
HpTextPrefab: {fileID: 6292166076641120080, guid: 4a7236e471dd72b4299671c7330ec483, type: 3}
_Canvas: {fileID: 4205844203331515742}
spriteRenderers: {fileID: 4703411402842800734}
@ -326,6 +404,7 @@ MonoBehaviour:
attackClass: {fileID: 0}
CurrentIndex: 33
enemyId:
moveSpeed: 3
harmNumber: 0
--- !u!210 &6468108308622956862
SortingGroup:
@ -503,7 +582,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: f4576d09b35f51b44b673ff5b732789b, type: 3}
m_Sprite: {fileID: 21300000, guid: 72a01706836824e40a2c6e4285bd237f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
@ -648,7 +727,7 @@ RectTransform:
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 4233861956062694457}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}

View File

@ -242,10 +242,12 @@ MonoBehaviour:
role: {fileID: 8433650274028726420}
attackScope: 0.5
damageTyp: 2
attackCooldown: 2
attackCooldown: 10
bulltes: []
animator: {fileID: 8242226501344609213}
fireAni: {fileID: 0}
BulletStartPos: {fileID: 0}
direction: {x: 0, y: 0}
--- !u!58 &1338343970434073545
CircleCollider2D:
m_ObjectHideFlags: 0
@ -331,6 +333,7 @@ MonoBehaviour:
hp: 100
dieIndex: -1
Hpfiil: {fileID: 0}
HpfiilYello: {fileID: 0}
HpTextPrefab: {fileID: 0}
_Canvas: {fileID: 0}
spriteRenderers: {fileID: 0}

View File

@ -15,6 +15,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: Attack
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -36,8 +42,8 @@ AnimatorStateTransition:
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 9124064417411800802}
@ -112,10 +118,7 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 0
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 6374862596792606963}
m_Solo: 0

View File

@ -66,8 +66,8 @@ AnimatorStateTransition:
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 1
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -2194801018154674215}
@ -174,6 +174,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: Attack
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -216,10 +222,7 @@ AnimatorStateTransition:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 6
m_ConditionEvent: State
m_EventTreshold: 0
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -8831474942015023954}
m_Solo: 0
@ -228,8 +231,8 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 0
m_ExitTime: 4
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1

View File

@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8800312809106112679}
- component: {fileID: 4613460312564376388}
m_Layer: 5
m_Name: Asset_Details_item
m_TagString: Untagged
@ -23,7 +24,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8800312809106112678}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
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
@ -38,6 +39,20 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 46.3059}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4613460312564376388
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8800312809106112678}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e3eea65db936075409912a8a7d52d647, type: 3}
m_Name:
m_EditorClassIdentifier:
info: {fileID: 8800312809432703904}
number: {fileID: 8800312810282259072}
--- !u!1 &8800312809432703918
GameObject:
m_ObjectHideFlags: 0

View File

@ -92,8 +92,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 72535d4c13f2ce34ab87fb251511760c, type: 3}
m_Name:
m_EditorClassIdentifier:
time: {fileID: 0}
count: {fileID: 0}
time: {fileID: 3085038605624301837}
count: {fileID: 3085038605682806839}
--- !u!1 &3085038604622350453
GameObject:
m_ObjectHideFlags: 0
@ -130,7 +130,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 35}
m_SizeDelta: {x: 0, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3085038605624301827
GameObject:
@ -166,9 +166,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.09248908, y: 1}
m_AnchoredPosition: {x: -0.5, y: 0}
m_SizeDelta: {x: -1, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: -1.4489136, y: 0}
m_SizeDelta: {x: -2.8979034, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3085038605624301836
CanvasRenderer:
@ -200,16 +200,16 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontSize: 45
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_BestFit: 1
m_MinSize: 30
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 09.16
--- !u!1 &3085038605682806837
@ -245,10 +245,10 @@ RectTransform:
m_Father: {fileID: 3085038604622350452}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0.079}
m_AnchorMin: {x: 0.7737991, y: 0}
m_AnchorMin: {x: 0.6107773, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.43347168, y: 0.5}
m_SizeDelta: {x: 0.9021001, y: -1}
m_AnchoredPosition: {x: 0.8760376, y: 0.5}
m_SizeDelta: {x: -1.7642975, y: -1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3085038605682806838
CanvasRenderer:
@ -280,15 +280,15 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontSize: 45
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_BestFit: 1
m_MinSize: 30
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: "\u603B\u8BA1\uFF1A-\xA5195"

View File

@ -104699,6 +104699,11 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1453243347 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6931136037450377241, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
m_PrefabInstance: {fileID: 1553952861}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1454508580
GameObject:
m_ObjectHideFlags: 0
@ -112948,7 +112953,15 @@ PrefabInstance:
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemPrefab
value:
objectReference: {fileID: 8800312809106112678, guid: 8b02cd965c34edb4ebf6d67db033ccd2, type: 3}
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemBoxPrefab
value:
objectReference: {fileID: 3085038604584877223, guid: ce7baf84b8801624aa22e8f29b4b95b7, type: 3}
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemBoxPrefabParent
value:
objectReference: {fileID: 1453243347}
- target: {fileID: 65411648539017065, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: m_AnchorMax.y
value: 0

@ -1 +1 @@
Subproject commit f3cad5d509e03c353dd16bfc5e599f39105deb26
Subproject commit 2b93b1469921dc657aa3546d0c31ace7748aaee0

View File

@ -5,6 +5,7 @@ using UnityEngine;
public class enemy : Role
{
public string enemyId;
[Header("移动速度")] public float moveSpeed;
[HideInInspector]
public float harmNumber=0;//伤害
@ -23,7 +24,9 @@ public class enemy : Role
public override void Start()
{
base.Start();
// AnimationTree[0].CharacterAnimationFrameInterval =(int)moveSpeed * 4;
if (camp == Camp.Enemy)
{
//开始移动
@ -38,7 +41,7 @@ public class enemy : Role
base.Navigation.waypoints = _waypoints;
//开始移动
Navigation.MoveToNextWaypoint(this.gameObject);
Navigation.MoveToNextWaypoint(this.gameObject,moveSpeed);
}

View File

@ -12,6 +12,11 @@ public class Asset_Details : MonoBehaviour
public Text HaveMoneyText;
public GameObject itemBoxPrefab;
public GameObject itemBoxPrefabParent;
public List<GameObject> itemBoxPrefabList = new List<GameObject>();
public GameObject itemPrefab;
// Start is called before the first frame update
void Start()
@ -27,7 +32,9 @@ public class Asset_Details : MonoBehaviour
/// <param name="type">1±¦Ê¯,2½ð±Ò,3Ë®,4¶ÍÔìÁî</param>
public async void ShowPanel(int type)
{
DeleteAllChildren(itemBoxPrefabParent);
billingStatisticsData info=await Scene_main_jiekou.instance.GetbillingStatisticsData(type);
switch (type)
@ -48,7 +55,18 @@ public class Asset_Details : MonoBehaviour
IcomeList infoIcomeList = await Scene_main_jiekou.instance.GetIncomeList(1,10,type);
foreach (statistics value in infoIcomeList.Data.statistics)
{
GameObject go = GameObject.Instantiate(itemBoxPrefab, itemBoxPrefabParent.transform);
go.GetComponent<Asset_Details_itembox>().init(value.date_time.ToString(), (value.total_income-value.total_expend).ToString());
itemBoxPrefabList.Add(go);
}
foreach (Transaction value in infoIcomeList.Data.List)
{
GameObject.Instantiate(itemPrefab, itemBoxPrefabList[0].transform).GetComponent<Asset_Details_item>().init(value.Income,value.Remark,value.Amount);
}
this.gameObject.SetActive(true);
}
@ -67,4 +85,24 @@ public class Asset_Details : MonoBehaviour
GiveMoneyText.text = "£¤" + give;
HaveMoneyText.text = "£¤" + have;
}
public void DeleteAllChildren(GameObject obg)
{
// 确保父物体不为空
if (obg != null)
{
// 遍历父物体的所有子物体并删除
foreach (Transform child in obg.transform)
{
GameObject.Destroy(child.gameObject);
}
itemBoxPrefabList.Clear();
}
else
{
Debug.LogWarning("itemBoxPrefabParent is not assigned.");
}
}
}

View File

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Asset_Details_item : MonoBehaviour
{
public Text info;
public Text number;
public void init(bool _bool,string info,string number)
{
if (_bool)
{
this.info.text = info;
this.number.text = "<b><color=#FF0000FF>+£¤" + number+ "</color></b>";
}
else
{
this.info.text = info;
this.number.text ="<b><color=red>-£¤" + number+ "</color></b>";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3eea65db936075409912a8a7d52d647
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,12 +6,11 @@ using UnityEngine.UI;
public class Asset_Details_itembox : MonoBehaviour
{
public Text time;
public Text count;
public void init(string time,string count)
{
this.time.text = time;
this.count.text = count;
this.time.text = "时间:" + time;
this.count.text ="总计:"+ count;
}
}

View File

@ -43,7 +43,8 @@ public class IcomeListData
{
public IcomeListPageInfo Pages { get; set; }
public List<Transaction> List { get; set; }
public List<Statistics> Statistics { get; set; }
public List<statistics> statistics { get; set; }
}
public class IcomeListPageInfo
@ -65,9 +66,11 @@ public class Transaction
public string CreateTime { get; set; }
}
public class Statistics
public class statistics
{
public int DateTime { get; set; }
public int TotalExpend { get; set; }
public int TotalIncome { get; set; }
}
public int date_time { get; set; }
public float total_expend { get; set; }
public float total_income { get; set; }
}