Commit 77b93c7e authored by hex's avatar hex

reomve iTween

parent 07ad0480
Pipeline #38584 failed
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using DG.Tweening;
public class pro1CardShower : MonoBehaviour { public class pro1CardShower : MonoBehaviour {
public UITexture card; public UITexture card;
public UITexture mask; public UITexture mask;
public UITexture disable; public UITexture disable;
public TweenAlpha t;
public void run() public void run()
{ {
mask.gameObject.transform.localPosition = new Vector3(-140, 0, 0); // 1. 将mask的初始位置设置好
iTween.MoveToLocal(mask.gameObject, new Vector3(140, 0, 0), 0.7f); mask.transform.localPosition = new Vector3(-140, 0, 0);
// 2. 使用 DOTween 执行移动动画
// 由于只改变X轴,使用 DOLocalMoveX 意图更明确,性能也略好
mask.transform.DOLocalMoveX(140, 0.7f);
} }
public void Dis() public void Dis()
{ {
iTween.ScaleTo(disable.gameObject, new Vector3(1, 1, 1), 0.7f);
t.duration = 0.7f; // 1. 缩放动画
t.enabled = true; disable.transform.DOScale(Vector3.one, 0.7f);
// 2. Alpha 透明度动画
// 使用 DOTween 的通用数值渐变来替代 NGUI 的 TweenAlpha 组件
// 这让所有动画都由 DOTween 控制,代码更统一,也移除了对 TweenAlpha 的依赖
// 假设目标 alpha 是 1 (完全不透明)
DOTween.To(() => disable.alpha, x => disable.alpha = x, 1f, 0.7f);
} }
} }
...@@ -102,14 +102,6 @@ public class MonoCardInDeckManager : MonoBehaviour ...@@ -102,14 +102,6 @@ public class MonoCardInDeckManager : MonoBehaviour
physicalOFF(); physicalOFF();
physicalHalfON(); physicalHalfON();
isDraging = true; isDraging = true;
// Program.go(
// 1,
// () =>
// {
// iTween.RotateTo(gameObject, new Vector3(90, 0, 0), 0.6f);
// }
// );
transform.DORotate(new Vector3(90, 0, 0), 0.6f).SetDelay(0); transform.DORotate(new Vector3(90, 0, 0), 0.6f).SetDelay(0);
} }
......
using UnityEngine; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
public class gameUIbutton public class gameUIbutton
{ {
...@@ -71,7 +73,7 @@ public class gameInfo : MonoBehaviour ...@@ -71,7 +73,7 @@ public class gameInfo : MonoBehaviour
me.transform.SetParent(gameObject.transform); me.transform.SetParent(gameObject.transform);
opponent = ((GameObject)MonoBehaviour.Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity)).GetComponent<barPngLoader>(); opponent = ((GameObject)MonoBehaviour.Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity)).GetComponent<barPngLoader>();
opponent.transform.SetParent(gameObject.transform); opponent.transform.SetParent(gameObject.transform);
Transform[] Transforms = me.GetComponentsInChildren<Transform>(); Transform[] Transforms = me.GetComponentsInChildren<Transform>();
foreach (Transform child in Transforms) foreach (Transform child in Transforms)
{ {
...@@ -93,7 +95,7 @@ public class gameInfo : MonoBehaviour ...@@ -93,7 +95,7 @@ public class gameInfo : MonoBehaviour
{ {
k = 1.2f; k = 1.2f;
} }
if (k <0.8f) if (k < 0.8f)
{ {
k = 0.8f; k = 0.8f;
} }
...@@ -111,7 +113,7 @@ public class gameInfo : MonoBehaviour ...@@ -111,7 +113,7 @@ public class gameInfo : MonoBehaviour
instance_btnPan.gameObject.transform.localScale = ksb; instance_btnPan.gameObject.transform.localScale = ksb;
opponent.transform.localScale = ks; opponent.transform.localScale = ks;
me.transform.localScale = ks; me.transform.localScale = ks;
if (!swaped) if (!swaped)
{ {
opponent.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14); opponent.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14);
me.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14 - k * (float)(opponent.under.height)); me.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14 - k * (float)(opponent.under.height));
...@@ -187,11 +189,11 @@ public class gameInfo : MonoBehaviour ...@@ -187,11 +189,11 @@ public class gameInfo : MonoBehaviour
{ {
child.gameObject.layer = instance_btnPan.gameObject.layer; child.gameObject.layer = instance_btnPan.gameObject.layer;
} }
hashedButton.gameObject.transform.SetParent(instance_btnPan.transform,false); hashedButton.gameObject.transform.SetParent(instance_btnPan.transform, false);
hashedButton.gameObject.transform.localScale = Vector3.zero; hashedButton.gameObject.transform.localScale = Vector3.zero;
hashedButton.gameObject.transform.localPosition= new Vector3(0, -120, 0); hashedButton.gameObject.transform.localPosition = new Vector3(0, -120, 0);
hashedButton.gameObject.transform.localEulerAngles = Vector3.zero; hashedButton.gameObject.transform.localEulerAngles = Vector3.zero;
iTween.ScaleTo(hashedButton.gameObject, new Vector3(0.9f, 0.9f, 0.9f), 0.3f); hashedButton.gameObject.transform.DOScale(new Vector3(0.9f, 0.9f, 0.9f), 0.3f);
hashedButton.dying = false; hashedButton.dying = false;
HashedButtons.Add(hashedButton); HashedButtons.Add(hashedButton);
refreshLine(); refreshLine();
...@@ -347,28 +349,34 @@ public class gameInfo : MonoBehaviour ...@@ -347,28 +349,34 @@ public class gameInfo : MonoBehaviour
return time[0] < Program.I().ocgcore.timeLimit / 3; return time[0] < Program.I().ocgcore.timeLimit / 3;
} }
void setTimeAbsolutely(int player, int t) private void setTimeAbsolutely(int player, int t)
{ {
if (Program.I().ocgcore.timeLimit == 0) if (Program.I().ocgcore.timeLimit == 0)
{ {
return; return;
} }
if (player == 0) if (player == 0)
{ {
me.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString(); me.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString();
opponent.api_timeHint.text = "waiting"; opponent.api_timeHint.text = "waiting";
UIHelper.clearITWeen(me.api_healthBar.gameObject);
iTween.MoveToLocal(me.api_timeBar.gameObject, new Vector3((float)(me.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(me.api_timeBar.width), me.api_healthBar.gameObject.transform.localPosition.y, me.api_healthBar.gameObject.transform.localPosition.z), 1f); // 停止之前的动画并开始新动画
me.api_timeBar.transform.DOKill();
me.api_timeBar.transform.DOLocalMoveX((float)(me.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(me.api_timeBar.width), 1f);
} }
if (player == 1) if (player == 1)
{ {
opponent.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString(); opponent.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString();
me.api_timeHint.text = "waiting"; me.api_timeHint.text = "waiting";
UIHelper.clearITWeen(opponent.api_healthBar.gameObject);
iTween.MoveToLocal(opponent.api_timeBar.gameObject, new Vector3((float)(opponent.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(opponent.api_timeBar.width), opponent.api_healthBar.gameObject.transform.localPosition.y, opponent.api_healthBar.gameObject.transform.localPosition.z), 1f); // 停止之前的动画并开始新动画
opponent.api_timeBar.transform.DOKill();
opponent.api_timeBar.transform.DOLocalMoveX((float)(opponent.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(opponent.api_timeBar.width), 1f);
} }
} }
public void realize() public void realize()
{ {
me.api_healthHint.text = ((float)Program.I().ocgcore.life_0 > 0 ? Program.I().ocgcore.life_0 : 0).ToString(); me.api_healthHint.text = ((float)Program.I().ocgcore.life_0 > 0 ? Program.I().ocgcore.life_0 : 0).ToString();
...@@ -377,20 +385,22 @@ public class gameInfo : MonoBehaviour ...@@ -377,20 +385,22 @@ public class gameInfo : MonoBehaviour
opponent.api_name.text = Program.I().ocgcore.name_1_c; opponent.api_name.text = Program.I().ocgcore.name_1_c;
me.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_0_c); me.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_0_c);
opponent.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_1_c); opponent.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_1_c);
iTween.MoveToLocal(me.api_healthBar.gameObject, new Vector3(
(float)(me.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_0) / ((float)Program.I().ocgcore.lpLimit) * (float)(me.api_healthBar.width), // 玩家自己
me.api_healthBar.gameObject.transform.localPosition.y, me.api_healthBar.transform.DOKill();
me.api_healthBar.gameObject.transform.localPosition.z), 1f); float myLpTargetX = (float)(me.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_0) / ((float)Program.I().ocgcore.lpLimit) * (float)(me.api_healthBar.width);
iTween.MoveToLocal(opponent.api_healthBar.gameObject, new Vector3( me.api_healthBar.transform.DOLocalMoveX(myLpTargetX, 1f);
(float)(opponent.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_1) / ((float)Program.I().ocgcore.lpLimit) * (float)(opponent.api_healthBar.width), // 对手
opponent.api_healthBar.gameObject.transform.localPosition.y, opponent.api_healthBar.transform.DOKill();
opponent.api_healthBar.gameObject.transform.localPosition.z), 1f); float opLpTargetX = (float)(opponent.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_1) / ((float)Program.I().ocgcore.lpLimit) * (float)(opponent.api_healthBar.width);
opponent.api_healthBar.transform.DOLocalMoveX(opLpTargetX, 1f);
instance_lab.Clear(); instance_lab.Clear();
if (Program.I().ocgcore.confirmedCards.Count>0) if (Program.I().ocgcore.confirmedCards.Count > 0)
{ {
instance_lab.Add(GameStringHelper.yijingqueren); instance_lab.Add(GameStringHelper.yijingqueren);
} }
foreach (var item in Program.I().ocgcore.confirmedCards) foreach (var item in Program.I().ocgcore.confirmedCards)
{ {
instance_lab.Add(item); instance_lab.Add(item);
} }
...@@ -417,7 +427,7 @@ public class gameInfo : MonoBehaviour ...@@ -417,7 +427,7 @@ public class gameInfo : MonoBehaviour
{ {
time[0]--; time[0]--;
} }
if (amIdanger()) if (amIdanger())
{ {
if (Program.I().ocgcore != null) if (Program.I().ocgcore != null)
{ {
...@@ -438,12 +448,12 @@ public class gameInfo : MonoBehaviour ...@@ -438,12 +448,12 @@ public class gameInfo : MonoBehaviour
public enum chainCondition public enum chainCondition
{ {
standard,no,all,smart standard, no, all, smart
} }
public void set_condition(chainCondition c) public void set_condition(chainCondition c)
{ {
switch (c) switch (c)
{ {
case chainCondition.standard: case chainCondition.standard:
toggle_all.value = false; toggle_all.value = false;
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
--- !u!1 &102262 --- !u!1 &102262
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
serializedVersion: 5 m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 497540} - component: {fileID: 497540}
m_Layer: 17 m_Layer: 17
...@@ -15,17 +16,32 @@ GameObject: ...@@ -15,17 +16,32 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &497540
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 102262}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 152.4026, y: 916.32385, z: 820.7068}
m_LocalScale: {x: 360, y: 360, z: 360}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 462074}
- {fileID: 457572}
m_Father: {fileID: 444030}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &104710 --- !u!1 &104710
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
serializedVersion: 5 m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 457572} - component: {fileID: 457572}
- component: {fileID: 1537834}
- component: {fileID: 1280010}
- component: {fileID: 2656486}
m_Layer: 17 m_Layer: 17
m_Name: tri m_Name: tri
m_TagString: Untagged m_TagString: Untagged
...@@ -33,12 +49,28 @@ GameObject: ...@@ -33,12 +49,28 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &457572
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 104710}
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: 497540}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &119794 --- !u!1 &119794
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
serializedVersion: 5 m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 488246} - component: {fileID: 488246}
- component: {fileID: 2091536} - component: {fileID: 2091536}
...@@ -50,236 +82,38 @@ GameObject: ...@@ -50,236 +82,38 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &136044
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 444030}
- component: {fileID: 11491940}
- component: {fileID: 11466520}
- component: {fileID: 5486994}
- component: {fileID: 11473836}
m_Layer: 10
m_Name: UIparticle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &177044
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 462074}
- component: {fileID: 1598580}
- component: {fileID: 1298152}
- component: {fileID: 2655262}
m_Layer: 17
m_Name: square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &444030
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136044}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.0027777778, y: 0.0027777778, z: 0.0027777778}
m_Children:
- {fileID: 488246}
- {fileID: 497540}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &457572
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 104710}
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_Children: []
m_Father: {fileID: 497540}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &462074
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177044}
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_Children: []
m_Father: {fileID: 497540}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &488246 --- !u!4 &488246
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 119794} m_GameObject: {fileID: 119794}
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: -700} m_LocalPosition: {x: 0, y: 0, z: -700}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 444030} m_Father: {fileID: 444030}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &497540
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 102262}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 152.4026, y: 916.32385, z: 820.7068}
m_LocalScale: {x: 360, y: 360, z: 360}
m_Children:
- {fileID: 462074}
- {fileID: 457572}
m_Father: {fileID: 444030}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!12 &1280010
ParticleAnimator:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 104710}
Does Animate Color?: 1
colorAnimation[0]:
serializedVersion: 2
rgba: 4278190335
colorAnimation[1]:
serializedVersion: 2
rgba: 4283957503
colorAnimation[2]:
serializedVersion: 2
rgba: 4294967295
colorAnimation[3]:
serializedVersion: 2
rgba: 3036668834
colorAnimation[4]:
serializedVersion: 2
rgba: 184527434
worldRotationAxis: {x: 0, y: 0, z: 0}
localRotationAxis: {x: 0, y: 0, z: 0}
sizeGrow: 3
rndForce: {x: 0, y: 0, z: 0}
force: {x: 0, y: 0, z: 0}
damping: 0.03
stopSimulation: 0
autodestruct: 0
--- !u!12 &1298152
ParticleAnimator:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177044}
Does Animate Color?: 1
colorAnimation[0]:
serializedVersion: 2
rgba: 4284740095
colorAnimation[1]:
serializedVersion: 2
rgba: 4290442495
colorAnimation[2]:
serializedVersion: 2
rgba: 4294967295
colorAnimation[3]:
serializedVersion: 2
rgba: 3036668834
colorAnimation[4]:
serializedVersion: 2
rgba: 184527434
worldRotationAxis: {x: 0, y: 0, z: 0}
localRotationAxis: {x: 0, y: 0, z: 0}
sizeGrow: 5
rndForce: {x: 0, y: 0, z: 0}
force: {x: 0, y: 0, z: 0}
damping: 0.03
stopSimulation: 0
autodestruct: 0
--- !u!15 &1537834
EllipsoidParticleEmitter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 104710}
serializedVersion: 2
m_Enabled: 1
m_Emit: 0
minSize: 0.2
maxSize: 0.3
minEnergy: 0.6
maxEnergy: 1
minEmission: 20
maxEmission: 20
worldVelocity: {x: 0, y: 0, z: 0}
localVelocity: {x: 0, y: 0, z: 0}
rndVelocity: {x: 3, y: 3, z: 3}
emitterVelocityScale: 0.05
tangentVelocity: {x: 0, y: 0, z: 0}
angularVelocity: 0
rndAngularVelocity: 0
rndRotation: 0
Simulate in Worldspace?: 1
m_OneShot: 0
m_Ellipsoid: {x: 0, y: 0, z: 0}
m_MinEmitterRange: 0
--- !u!15 &1598580
EllipsoidParticleEmitter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177044}
serializedVersion: 2
m_Enabled: 1
m_Emit: 0
minSize: 0.2
maxSize: 0.3
minEnergy: 0.6
maxEnergy: 1
minEmission: 60
maxEmission: 60
worldVelocity: {x: 0, y: 0, z: 0}
localVelocity: {x: 0, y: 0, z: 0}
rndVelocity: {x: 3, y: 3, z: 3}
emitterVelocityScale: 0.05
tangentVelocity: {x: 0, y: 0, z: 0}
angularVelocity: 0
rndAngularVelocity: 0
rndRotation: 0
Simulate in Worldspace?: 1
m_OneShot: 0
m_Ellipsoid: {x: 0, y: 0, z: 0}
m_MinEmitterRange: 0
--- !u!20 &2091536 --- !u!20 &2091536
Camera: Camera:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 119794} m_GameObject: {fileID: 119794}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 3 m_ClearFlags: 3
m_BackGroundColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_BackGroundColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
...@@ -306,114 +140,12 @@ Camera: ...@@ -306,114 +140,12 @@ Camera:
m_OcclusionCulling: 1 m_OcclusionCulling: 1
m_StereoConvergence: 10 m_StereoConvergence: 10
m_StereoSeparation: 0.022 m_StereoSeparation: 0.022
--- !u!26 &2655262
ParticleRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177044}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: ce38205273cfc784fa4f516504226836, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
serializedVersion: 2
m_CameraVelocityScale: 0
m_StretchParticles: 0
m_LengthScale: 2
m_VelocityScale: 0
m_MaxParticleSize: 0.25
UV Animation:
x Tile: 1
y Tile: 1
cycles: 1
--- !u!26 &2656486
ParticleRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 104710}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: 724cd0370cbb68a4e8c7ad776fa66d98, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
serializedVersion: 2
m_CameraVelocityScale: 0
m_StretchParticles: 0
m_LengthScale: 2
m_VelocityScale: 0
m_MaxParticleSize: 0.25
UV Animation:
x Tile: 1
y Tile: 1
cycles: 1
--- !u!54 &5486994
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136044}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &11412860 --- !u!114 &11412860
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 119794} m_GameObject: {fileID: 119794}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
...@@ -450,11 +182,70 @@ MonoBehaviour: ...@@ -450,11 +182,70 @@ MonoBehaviour:
cancelKey0: 27 cancelKey0: 27
cancelKey1: 331 cancelKey1: 331
autoHideCursor: 1 autoHideCursor: 1
--- !u!1 &136044
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 444030}
- component: {fileID: 11491940}
- component: {fileID: 11466520}
- component: {fileID: 5486994}
- component: {fileID: 11473836}
m_Layer: 10
m_Name: UIparticle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &444030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 136044}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.0027777778, y: 0.0027777778, z: 0.0027777778}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 488246}
- {fileID: 497540}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11491940
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 136044}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2c5ecb5660b11414fb042fb826e03b73, type: 3}
m_Name:
m_EditorClassIdentifier:
scalingStyle: 1
manualWidth: 1280
manualHeight: 720
minimumHeight: 320
maximumHeight: 1536
fitWidth: 0
fitHeight: 1
adjustByDPI: 0
shrinkPortraitUI: 0
--- !u!114 &11466520 --- !u!114 &11466520
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 136044} m_GameObject: {fileID: 136044}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
...@@ -495,11 +286,28 @@ MonoBehaviour: ...@@ -495,11 +286,28 @@ MonoBehaviour:
mDepth: 0 mDepth: 0
mSortingOrder: 0 mSortingOrder: 0
mClipOffset: {x: 0, y: 0} mClipOffset: {x: 0, y: 0}
--- !u!54 &5486994
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 136044}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &11473836 --- !u!114 &11473836
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 136044} m_GameObject: {fileID: 136044}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
...@@ -508,34 +316,34 @@ MonoBehaviour: ...@@ -508,34 +316,34 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
camera: {fileID: 2091536} camera: {fileID: 2091536}
trans: {fileID: 497540} trans: {fileID: 497540}
--- !u!114 &11491940 --- !u!1 &177044
MonoBehaviour: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInstance: {fileID: 0}
m_GameObject: {fileID: 136044} m_PrefabAsset: {fileID: 0}
m_Enabled: 1 serializedVersion: 6
m_EditorHideFlags: 0 m_Component:
m_Script: {fileID: 11500000, guid: 2c5ecb5660b11414fb042fb826e03b73, type: 3} - component: {fileID: 462074}
m_Name: m_Layer: 17
m_EditorClassIdentifier: m_Name: square
scalingStyle: 1 m_TagString: Untagged
manualWidth: 1280 m_Icon: {fileID: 0}
manualHeight: 720 m_NavMeshLayer: 0
minimumHeight: 320 m_StaticEditorFlags: 0
maximumHeight: 1536 m_IsActive: 1
fitWidth: 0 --- !u!4 &462074
fitHeight: 1 Transform:
adjustByDPI: 0 m_ObjectHideFlags: 0
shrinkPortraitUI: 0 m_CorrespondingSourceObject: {fileID: 0}
--- !u!1001 &100100000 m_PrefabInstance: {fileID: 0}
Prefab: m_PrefabAsset: {fileID: 0}
m_ObjectHideFlags: 1 m_GameObject: {fileID: 177044}
serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_Modification: m_LocalPosition: {x: 0, y: 0, z: 0}
m_TransformParent: {fileID: 0} m_LocalScale: {x: 1, y: 1, z: 1}
m_Modifications: [] m_ConstrainProportionsScale: 0
m_RemovedComponents: [] m_Children: []
m_ParentPrefab: {fileID: 0} m_Father: {fileID: 497540}
m_RootGameObject: {fileID: 136044} m_RootOrder: 0
m_IsPrefabParent: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
using UnityEngine; using System.Collections;
using System.Collections; using DG.Tweening;
using UnityEngine;
public class faceShower : MonoBehaviour {
void Start () { public class faceShower : MonoBehaviour
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width/2,Screen.height*1.5f,0)); {
iTween.MoveToAction(gameObject, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height/2, 0)),0.6f,()=>{
iTween.ScaleToAction(gameObject,Vector3.zero, 0.6f, () => { void Start()
Destroy(gameObject); {
}, 1f); // 预先计算目标位置,使代码更清晰
},0); Vector3 screenCenterWorldPos = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0));
} // 设置初始位置(这一行与动画无关,保持不变)
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
// 使用 DOTween 的 Sequence 来创建一个动画链
Sequence mySequence = DOTween.Sequence();
// 1. 第一个动画:移动到屏幕中心,耗时 0.6 秒
mySequence.Append(transform.DOMove(screenCenterWorldPos, 0.6f));
// 2. 插入一个 1 秒的延迟
mySequence.AppendInterval(1f);
// 3. 第二个动画:缩小到0,耗时 0.6 秒
mySequence.Append(transform.DOScale(Vector3.zero, 0.6f));
// 4. 设置整个序列完成后的回调:销毁游戏对象
// OnComplete 在序列所有动画和延迟都执行完毕后触发
mySequence.OnComplete(() =>
{
Destroy(gameObject);
});
}
} }
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using DG.Tweening;
public class handShower : MonoBehaviour public class handShower : MonoBehaviour
{ {
...@@ -17,14 +19,35 @@ public class handShower : MonoBehaviour ...@@ -17,14 +19,35 @@ public class handShower : MonoBehaviour
pics[2] = GameTextureManager.get("bu"); pics[2] = GameTextureManager.get("bu");
texture_0.mainTexture = pics[me]; texture_0.mainTexture = pics[me];
texture_1.mainTexture = pics[op]; texture_1.mainTexture = pics[op];
GameObject_0.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_0, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => { // --- 核心修改:使用本地坐标和 DOLocalMove ---
Destroy(GameObject_0,0.3f); // 1. 设置初始位置 (在屏幕外)
}, 0); // NGUI的坐标系通常中心是(0,0),单位接近像素。
GameObject_1.transform.position = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)); // 我们把它们放在屏幕的上下方很远的地方。
iTween.MoveToAction(GameObject_1, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => { GameObject_0.transform.localPosition = new Vector3(0, -1000, 0); // 从下方来
Destroy(GameObject_1, 0.3f); GameObject_1.transform.localPosition = new Vector3(0, 1000, 0); // 从上方来
}, 0); // 2. 定义目标本地坐标
// 不再需要复杂的ScreenToWorldPoint!直接使用像素偏移值。
Vector3 targetPos0 = new Vector3(0, -150, 0); // 停在中心点下方150像素
Vector3 targetPos1 = new Vector3(0, 150, 0); // 停在中心点上方150像素
// 注意:我将80改成了150,因为80的间距可能太小,你可以根据效果调整。
// 3. 执行动画
// 使用 DOLocalMove 而不是 DOMove
GameObject_0.transform.DOLocalMove(targetPos0, 1f).SetEase(Ease.OutCubic).OnComplete(() =>
{
// 添加一个空值检查,这是一个好习惯
if (GameObject_0 != null)
{
Destroy(GameObject_0, 0.3f);
}
});
GameObject_1.transform.DOLocalMove(targetPos1, 1f).SetEase(Ease.OutCubic).OnComplete(() =>
{
if (GameObject_1 != null)
{
Destroy(GameObject_1, 0.3f);
}
});
} }
} }
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using DG.Tweening;
public class toolShift : MonoBehaviour { public class toolShift : MonoBehaviour {
public GameObject ObjectMust = null; public GameObject ObjectMust = null;
...@@ -40,32 +42,31 @@ public class toolShift : MonoBehaviour { ...@@ -40,32 +42,31 @@ public class toolShift : MonoBehaviour {
} }
public void shift() public void shift()
{
// 获取当前对象的本地坐标
Vector3 va = ObjectMust.transform.localPosition;
const float duration = 0.6f;
if (ObjectOption == null)
{
// 目标Y坐标,根据当前位置在 0 和 -100 之间切换
float targetY = (va.y >= 0) ? -100f : 0f;
// 使用 DOTween 的 DOLocalMoveY,因为它只改变Y轴,意图更明确且性能稍好
ObjectMust.transform.DOLocalMoveY(targetY, duration);
}
else
{ {
Vector3 va = ObjectMust.transform.localPosition; Vector3 vb = ObjectOption.transform.localPosition;
if (ObjectOption == null)
if (va.y > vb.y)
{ {
if (va.y >= 0) ObjectMust.transform.DOLocalMoveY(-100f, duration);
{ ObjectOption.transform.DOLocalMoveY(0f, duration);
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
}
else
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f);
}
} }
else else
{ {
Vector3 vb = ObjectOption.transform.localPosition; ObjectMust.transform.DOLocalMoveY(0f, duration);
if (va.y > vb.y) ObjectOption.transform.DOLocalMoveY(-100f, duration);
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
iTween.MoveToLocal(ObjectOption, new Vector3(vb.x, 0, vb.z), 0.6f);
}
else
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f);
iTween.MoveToLocal(ObjectOption, new Vector3(vb.x, -100, vb.z), 0.6f);
}
} }
} }
} }
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using DG.Tweening;
public class CardDescription : Servant public class CardDescription : Servant
{ {
...@@ -100,13 +101,14 @@ public class CardDescription : Servant ...@@ -100,13 +101,14 @@ public class CardDescription : Servant
if (gameObject != null) if (gameObject != null)
{ {
underSprite.height = Screen.height + 4; underSprite.height = Screen.height + 4;
iTween.MoveTo(
gameObject, // 计算目标世界坐标
Program.camera_main_2d.ScreenToWorldPoint( Vector3 hidePosition = Program.camera_main_2d.ScreenToWorldPoint(
new Vector3(-underSprite.width - 20, Screen.height / 2, 0) new Vector3(-underSprite.width - 20, Screen.height / 2, 0)
),
1.2f
); );
// 使用 DOTween 的 DOMove 方法,并添加一个缓动效果使动画更平滑
gameObject.transform.DOMove(hidePosition, 1.2f).SetEase(Ease.OutCubic);
setTitle(""); setTitle("");
resizer.gameObject.GetComponent<BoxCollider>().enabled = false; resizer.gameObject.GetComponent<BoxCollider>().enabled = false;
} }
...@@ -124,13 +126,13 @@ public class CardDescription : Servant ...@@ -124,13 +126,13 @@ public class CardDescription : Servant
offset = 66; offset = 66;
} }
iTween.MoveTo( // 计算目标世界坐标
gameObject, Vector3 showPosition = Program.camera_main_2d.ScreenToWorldPoint(
Program.camera_main_2d.ScreenToWorldPoint( new Vector3(offset, Screen.height / 2, 0)
new Vector3(offset, Screen.height / 2, 0)
),
1.2f
); );
// 执行显示动画
gameObject.transform.DOMove(showPosition, 1.2f).SetEase(Ease.OutCubic);
resizer.gameObject.GetComponent<BoxCollider>().enabled = true; resizer.gameObject.GetComponent<BoxCollider>().enabled = true;
} }
} }
......
using System; using System;
using UnityEngine; using UnityEngine;
using DG.Tweening;
public class TextMaster public class TextMaster
{ {
...@@ -18,8 +20,10 @@ public class TextMaster ...@@ -18,8 +20,10 @@ public class TextMaster
Program.ui_main_3d, Program.ui_main_3d,
false false
); );
UIHelper.clearITWeen(gameObject);
iTween.ScaleTo(gameObject, new Vector3(0.03f, 0.03f, 0.03f), 0.6f); gameObject.transform.DOKill();
gameObject.transform.DOScale(new Vector3(0.03f, 0.03f, 0.03f), 0.6f);
} }
else else
{ {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
...@@ -21,7 +21,7 @@ public static class UIHelper ...@@ -21,7 +21,7 @@ public static class UIHelper
[DllImport("user32")] [DllImport("user32")]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref IntPtr lpdwProcessId); static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref IntPtr lpdwProcessId);
[DllImport("user32")] [DllImport("user32")]
static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)]StringBuilder lpString, int nMaxCount); static extern int GetClassNameW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpString, int nMaxCount);
[DllImport("user32")] [DllImport("user32")]
static extern bool IsZoomed(IntPtr hWnd); static extern bool IsZoomed(IntPtr hWnd);
[DllImport("user32")] [DllImport("user32")]
...@@ -46,7 +46,7 @@ public static class UIHelper ...@@ -46,7 +46,7 @@ public static class UIHelper
StringBuilder ClassName = new StringBuilder(256); StringBuilder ClassName = new StringBuilder(256);
GetClassNameW(hwnd, ClassName, ClassName.Capacity); GetClassNameW(hwnd, ClassName, ClassName.Capacity);
if (string.Compare(ClassName.ToString(), "UnityWndClass", true, System.Globalization.CultureInfo.InvariantCulture) == 0) if (string.Compare(ClassName.ToString(), "UnityWndClass", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
{ {
GetWindowThreadProcessId(hwnd, ref id); GetWindowThreadProcessId(hwnd, ref id);
...@@ -697,15 +697,6 @@ public static class UIHelper ...@@ -697,15 +697,6 @@ public static class UIHelper
return return_value; return return_value;
} }
internal static void clearITWeen(GameObject gameObject)
{
iTween[] iTweens = gameObject.GetComponents<iTween>();
for (int i = 0; i < iTweens.Length; i++)
{
MonoBehaviour.DestroyImmediate(iTweens[i]);
}
}
internal static float get_left_right_index(float left, float right, int i, int count) internal static float get_left_right_index(float left, float right, int i, int count)
{ {
float return_value = 0; float return_value = 0;
......
using System; using System;
using UnityEngine; using UnityEngine;
using DG.Tweening;
public class gameButton : OCGobject public class gameButton : OCGobject
{ {
...@@ -36,7 +37,9 @@ public class gameButton : OCGobject ...@@ -36,7 +37,9 @@ public class gameButton : OCGobject
gameObject.GetComponent<iconSetForButton>().setTexture(type); gameObject.GetComponent<iconSetForButton>().setTexture(type);
gameObject.GetComponent<iconSetForButton>().setText(hint); gameObject.GetComponent<iconSetForButton>().setText(hint);
gameObject.transform.localScale = Vector3.zero; gameObject.transform.localScale = Vector3.zero;
iTween.ScaleTo(gameObject, new Vector3(0.7f * (float)Screen.height / 700f, 0.7f * (float)Screen.height / 700f, 0.7f * (float)Screen.height / 700f), 0.2f);
float targetScale = 0.7f * (float)Screen.height / 700f;
gameObject.transform.DOScale(targetScale, 0.2f);
} }
gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(v); gameObject.transform.position = Program.camera_main_2d.ScreenToWorldPoint(v);
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DG.Tweening;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using DG.Tweening;
public enum gameCardCondition public enum gameCardCondition
...@@ -167,7 +167,7 @@ public class gameCard : OCGobject ...@@ -167,7 +167,7 @@ public class gameCard : OCGobject
{ {
set_overlay_light(0); set_overlay_light(0);
clearCookie(); clearCookie();
UIHelper.clearITWeen(gameObject); gameObject.transform.DOKill();
del_all_decoration(); del_all_decoration();
for (int i = 0; i < allObjects.Count; i++) for (int i = 0; i < allObjects.Count; i++)
{ {
...@@ -566,29 +566,6 @@ public class gameCard : OCGobject ...@@ -566,29 +566,6 @@ public class gameCard : OCGobject
} }
} }
//float deltaTimeCloseUp=0;
//private void ES_excited_handler_close_up_handler()
//{
// float faT = 0.25f;
// deltaTimeCloseUp += Time.deltaTime;
// if (deltaTimeCloseUp > faT)
// {
// deltaTimeCloseUp = faT;
// }
// Vector3 screenposition = Program.camera_game_main.WorldToScreenPoint(accurate_position);
// Vector3 worldposition = Camera.main.ScreenToWorldPoint(new Vector3(screenposition.x, screenposition.y, screenposition.z - 10));
// gameObject.transform.position = new Vector3
// (
// iTween.easeOutQuad(accurate_position.x, worldposition.x, deltaTimeCloseUp / faT),
// iTween.easeOutQuad(accurate_position.y, worldposition.y, deltaTimeCloseUp / faT),
// iTween.easeOutQuad(accurate_position.z, worldposition.z, deltaTimeCloseUp / faT)
// );
// if (game_object_verticle_drawing != null)
// {
// card_verticle_drawing_handler();
// }
//}
private void ES_excited_handler_close_up_handler() private void ES_excited_handler_close_up_handler()
{ {
Vector3 screenposition = Program.camera_game_main.WorldToScreenPoint(accurate_position); Vector3 screenposition = Program.camera_game_main.WorldToScreenPoint(accurate_position);
...@@ -715,14 +692,10 @@ public class gameCard : OCGobject ...@@ -715,14 +692,10 @@ public class gameCard : OCGobject
private void ES_enter_excited() private void ES_enter_excited()
{ {
// iTween[] iTweens = gameObject.GetComponents<iTween>();
// for (int i = 0; i < iTweens.Length; i++)
// MonoBehaviour.DestroyImmediate(iTweens[i]);
DOTween.Kill(gameObject.transform); DOTween.Kill(gameObject.transform);
if (condition == gameCardCondition.floating_clickable) if (condition == gameCardCondition.floating_clickable)
{ {
flash_line_on(); flash_line_on();
// iTween.RotateTo(gameObject, new Vector3(-30, 0, 0), 0.3f);
gameObject.transform.DORotate(new Vector3(-30, 0, 0), 0.3f); gameObject.transform.DORotate(new Vector3(-30, 0, 0), 0.3f);
} }
ES_excited_unsafe_should_not_be_changed_dont_touch_this = true; ES_excited_unsafe_should_not_be_changed_dont_touch_this = true;
...@@ -776,7 +749,6 @@ public class gameCard : OCGobject ...@@ -776,7 +749,6 @@ public class gameCard : OCGobject
// iTween[] iTweens = gameObject.GetComponents<iTween>(); // iTween[] iTweens = gameObject.GetComponents<iTween>();
// for (int i = 0; i < iTweens.Length; i++) // for (int i = 0; i < iTweens.Length; i++)
// MonoBehaviour.DestroyImmediate(iTweens[i]); // MonoBehaviour.DestroyImmediate(iTweens[i]);
DOTween.Kill(gameObject.transform);
flash_line_off(); flash_line_off();
ES_excited_unsafe_should_not_be_changed_dont_touch_this = false; ES_excited_unsafe_should_not_be_changed_dont_touch_this = false;
for (int i = 0; i < buttons.Count; i++) for (int i = 0; i < buttons.Count; i++)
...@@ -802,20 +774,6 @@ public class gameCard : OCGobject ...@@ -802,20 +774,6 @@ public class gameCard : OCGobject
TweenTo(accurate_position, accurate_rotation); TweenTo(accurate_position, accurate_rotation);
} }
private void ES_safe_card_move(Hashtable move_hash, Hashtable rotate_hash)
{
UIHelper.clearITWeen(gameObject);
MonoBehaviour.DestroyImmediate(gameObject.GetComponent<screenFader>());
if (Math.Abs((int)(gameObject.transform.eulerAngles.z)) == 180)
{
Vector3 p = gameObject.transform.eulerAngles;
p.z = 179f;
gameObject.transform.eulerAngles = p;
}
iTween.MoveTo(gameObject, move_hash);
iTween.RotateTo(gameObject, rotate_hash);
}
#endregion #endregion
#region UA_system #region UA_system
...@@ -854,7 +812,7 @@ public class gameCard : OCGobject ...@@ -854,7 +812,7 @@ public class gameCard : OCGobject
UA_reloadCardHintPosition(); UA_reloadCardHintPosition();
if (rush) if (rush)
{ {
UIHelper.clearITWeen(gameObject); gameObject.transform.DOKill();
gameObject.transform.position = gived_position; gameObject.transform.position = gived_position;
gameObject.transform.eulerAngles = gived_rotation; gameObject.transform.eulerAngles = gived_rotation;
} }
...@@ -876,99 +834,6 @@ public class gameCard : OCGobject ...@@ -876,99 +834,6 @@ public class gameCard : OCGobject
} }
} }
// public void TweenTo(Vector3 pos, Vector3 rot, bool exciting = false)
// {
// float time = 0.1f;
// time += Vector3.Distance(pos, gameObject.transform.position) * 0.2f / 30f;
// if (time < 0.1f)
// {
// time = 0.1f;
// }
// if (time > 0.3f)
// {
// time = 0.3f;
// }
// //time *= 20;
// iTween.EaseType e = iTween.EaseType.easeOutQuad;
// if (
// Vector3.Distance(Vector3.zero, pos)
// < Vector3.Distance(Vector3.zero, gameObject.transform.position)
// )
// {
// e = iTween.EaseType.easeInQuad;
// }
// if (
// (
// (
// Math.Abs(gived_rotation.x) < 10
// && Vector3.Distance(pos, gameObject.transform.position) > 1f
// )
// )
// || (
// accurate_position.x == pos.x
// && accurate_position.y < pos.y
// && accurate_position.z == pos.z
// )
// )
// {
// Vector3 from = gameObject.transform.position;
// Vector3 to = pos;
// Vector3[] path = new Vector3[30];
// for (int i = 0; i < 30; i++)
// {
// path[i] =
// from
// + (to - from) * (float)i / 29f
// + (new Vector3(0, 1.5f, 0)) * (float)Math.Sin(3.1415926 * (double)i / 29d);
// }
// if (exciting)
// {
// ES_safe_card_move(
// iTween.Hash("x", pos.x, "y", pos.y, "z", pos.z, "path", path, "time", time),
// iTween.Hash("x", rot.x, "y", rot.y, "z", rot.z, "time", time)
// );
// }
// else
// {
// ES_safe_card_move(
// iTween.Hash(
// "x",
// pos.x,
// "y",
// pos.y,
// "z",
// pos.z,
// "path",
// path,
// "time",
// time,
// "easetype",
// e
// ),
// iTween.Hash("x", rot.x, "y", rot.y, "z", rot.z, "time", time, "easetype", e)
// );
// }
// }
// else
// {
// if (exciting)
// {
// ES_safe_card_move(
// iTween.Hash("x", pos.x, "y", pos.y, "z", pos.z, "time", time),
// iTween.Hash("x", rot.x, "y", rot.y, "z", rot.z, "time", time)
// );
// }
// else
// {
// ES_safe_card_move(
// iTween.Hash("x", pos.x, "y", pos.y, "z", pos.z, "time", time, "easetype", e),
// iTween.Hash("x", rot.x, "y", rot.y, "z", rot.z, "time", time, "easetype", e)
// );
// }
// }
// }
public void TweenTo(Vector3 pos, Vector3 rot, bool exciting = false) public void TweenTo(Vector3 pos, Vector3 rot, bool exciting = false)
{ {
float time = 0.1f; float time = 0.1f;
...@@ -1987,6 +1852,40 @@ public class gameCard : OCGobject ...@@ -1987,6 +1852,40 @@ public class gameCard : OCGobject
#region publicTools #region publicTools
// public void show_number(int number, bool add = false)
// {
// if (add)
// {
// show_number(number_showing * 10 + number);
// return;
// }
// if (number == 0)
// {
// if (obj_number != null)
// {
// obj_number.transform.DOScale(Vector3.zero, 0.3f).OnComplete(() => destroy(obj_number));
// obj_number = null;
// }
// }
// else
// {
// if (obj_number != null && number_showing != number)
// {
// obj_number.transform.DOScale(Vector3.zero, 0.3f).OnComplete(() => destroy(obj_number));
// obj_number = null;
// }
// if (obj_number == null)
// {
// obj_number = create(Program.I().mod_ocgcore_card_number_shower);
// obj_number.transform.GetComponent<TMPro.TextMeshPro>().text = number.ToString();
// obj_number.transform.localScale = Vector3.zero;
// obj_number.transform.DOScale(new Vector3(1, 1, 1), 0.3f);
// obj_number.transform.DORotate(new Vector3(60, 0, 0), 0.3f);
// }
// }
// number_showing = number;
// }
public void show_number(int number, bool add = false) public void show_number(int number, bool add = false)
{ {
if (add) if (add)
...@@ -1994,32 +1893,59 @@ public class gameCard : OCGobject ...@@ -1994,32 +1893,59 @@ public class gameCard : OCGobject
show_number(number_showing * 10 + number); show_number(number_showing * 10 + number);
return; return;
} }
if (number == 0)
// 如果请求显示的数字和当前正在显示的数字相同,则无需任何操作。
if (number_showing == number)
{ {
if (obj_number != null) return;
{
obj_number.transform.DOScale(Vector3.zero, 0.3f).OnComplete(() => destroy(obj_number));
obj_number = null;
}
} }
else
// --- 处理旧数字对象的退场 ---
if (obj_number != null)
{ {
if (obj_number != null && number_showing != number) // 捕获对旧对象的引用,以便在动画回调中使用
{ GameObject numberObjectToDestroy = obj_number;
obj_number.transform.DOScale(Vector3.zero, 0.3f).OnComplete(() => destroy(obj_number));
obj_number = null;
}
if (obj_number == null) // 停止该对象上所有正在运行的DOTween动画,防止冲突
{ DOTween.Kill(numberObjectToDestroy.transform);
obj_number = create(Program.I().mod_ocgcore_card_number_shower);
obj_number.transform.GetComponent<TMPro.TextMeshPro>().text = number.ToString(); // 启动缩小动画,并在动画完成后销毁对象
obj_number.transform.localScale = Vector3.zero; numberObjectToDestroy.transform.DOScale(Vector3.zero, 0.3f)
obj_number.transform.DOScale(new Vector3(1, 1, 1), 0.3f); .SetEase(Ease.InBack) // 使用一个更自然的缓动效果
obj_number.transform.DORotate(new Vector3(60, 0, 0), 0.3f); .OnComplete(() =>
} {
// 只有当这个即将销毁的对象还是当前卡片引用的对象时,才将引用置空。
// 这是一个安全检查,防止销毁了新创建的对象。
if (this.obj_number == numberObjectToDestroy)
{
this.obj_number = null;
}
destroy(numberObjectToDestroy);
});
} }
// --- 处理新数字对象的进场 ---
number_showing = number; number_showing = number;
if (number > 0)
{
// 创建新的数字对象。这会覆盖掉this.obj_number的引用,
// 旧对象的动画和销毁过程不会受影响。
obj_number = create(Program.I().mod_ocgcore_card_number_shower);
obj_number.transform.GetComponent<TMPro.TextMeshPro>().text = number.ToString();
// 从零大小开始放大,创建更流畅的出现效果
obj_number.transform.localScale = Vector3.zero;
// 启动放大和旋转动画
obj_number.transform.DOScale(new Vector3(1, 1, 1), 0.3f).SetEase(Ease.OutBack);
obj_number.transform.DORotate(new Vector3(60, 0, 0), 0.3f);
}
else // 如果 number <= 0,意味着我们只是想隐藏数字
{
// 我们已经在上面启动了旧对象的销毁动画,现在只需将主引用置空。
obj_number = null;
}
} }
...@@ -2441,148 +2367,6 @@ public class gameCard : OCGobject ...@@ -2441,148 +2367,6 @@ public class gameCard : OCGobject
animation_confirm_common(null, rotation, time_move, time_still, true); animation_confirm_common(null, rotation, time_move, time_still, true);
} }
// public void animation_confirm(
// Vector3 position,
// Vector3 rotation,
// float time_move,
// float time_still
// )
// {
// ES_lock(time_move + time_move + time_still);
// confirm_step_time_still = time_still;
// confirm_step_time_move = time_move;
// confirm_step_r = rotation;
// iTween[] iTweens = gameObject.GetComponents<iTween>();
// for (int i = 0; i < iTweens.Length; i++)
// MonoBehaviour.Destroy(iTweens[i]);
// iTween.MoveTo(
// gameObject,
// iTween.Hash(
// "x",
// position.x,
// "y",
// position.y,
// "z",
// position.z,
// "onupdate",
// (Action)RefreshFunction_decoration,
// "oncomplete",
// (Action)confirm_step_2,
// "time",
// confirm_step_time_move
// )
// );
// iTween.RotateTo(
// gameObject,
// iTween.Hash(
// "x",
// confirm_step_r.x,
// "y",
// confirm_step_r.y,
// "z",
// confirm_step_r.z,
// "time",
// confirm_step_time_move
// )
// );
// }
// public void animation_confirm_screenCenter(Vector3 rotation, float time_move, float time_still)
// {
// ES_lock(time_move + time_move + time_still);
// confirm_step_time_still = time_still;
// confirm_step_time_move = time_move;
// confirm_step_r = rotation;
// iTween[] iTweens = gameObject.GetComponents<iTween>();
// for (int i = 0; i < iTweens.Length; i++)
// MonoBehaviour.DestroyImmediate(iTweens[i]);
// iTween.RotateTo(
// gameObject,
// iTween.Hash(
// "x",
// confirm_step_r.x,
// "y",
// confirm_step_r.y,
// "z",
// confirm_step_r.z,
// "easetype",
// iTween.EaseType.spring,
// "onupdate",
// (Action)RefreshFunction_decoration,
// "oncomplete",
// (Action)confirm_step_2,
// "time",
// confirm_step_time_move
// )
// );
// var ttt = gameObject.AddComponent<screenFader>();
// ttt.from = gameObject.transform.position;
// ttt.time = time_move;
// ttt.deltaTimeCloseUp = 0;
// MonoBehaviour.Destroy(ttt, time_move + time_still);
// }
Vector3 confirm_step_r = Vector3.zero;
float confirm_step_time_still = 0;
float confirm_step_time_move = 0;
void confirm_step_2()
{
iTween.RotateTo(
gameObject,
iTween.Hash(
"x",
confirm_step_r.x,
"y",
confirm_step_r.y,
"z",
confirm_step_r.z,
"onupdate",
(Action)RefreshFunction_decoration,
"oncomplete",
(Action)confirm_step_3,
"time",
confirm_step_time_still
)
);
}
void confirm_step_3()
{
iTween.RotateTo(
gameObject,
iTween.Hash(
"x",
accurate_rotation.x,
"y",
accurate_rotation.y,
"z",
accurate_rotation.z,
"time",
confirm_step_time_move
)
);
iTween.MoveTo(
gameObject,
iTween.Hash(
"x",
accurate_position.x,
"y",
accurate_position.y,
"z",
accurate_position.z,
"onupdate",
(Action)RefreshFunction_decoration,
"time",
confirm_step_time_move,
"easetype",
iTween.EaseType.easeInQuad
)
);
}
public void animation_shake_to(float time) public void animation_shake_to(float time)
{ {
ES_lock(time); ES_lock(time);
...@@ -2599,10 +2383,13 @@ public class gameCard : OCGobject ...@@ -2599,10 +2383,13 @@ public class gameCard : OCGobject
DOTween.Kill(gameObject.transform); DOTween.Kill(gameObject.transform);
MonoBehaviour.DestroyImmediate(gameObject.GetComponent<screenFader>()); MonoBehaviour.DestroyImmediate(gameObject.GetComponent<screenFader>());
gameObject.transform.DOMove(position, 0.2f); Sequence rushSequence = DOTween.Sequence();
gameObject.transform.DORotate(rotation, 0.21f) rushSequence.SetTarget(gameObject.transform);
.OnUpdate(RefreshFunction_decoration) rushSequence.Append(gameObject.transform.DOMove(position, 0.2f));
.OnComplete(ES_safe_card_move_to_original_place); rushSequence.Join(gameObject.transform.DORotate(rotation, 0.21f));
rushSequence.OnUpdate(RefreshFunction_decoration);
// OnComplete 现在是 Sequence 的一部分
rushSequence.OnComplete(ES_safe_card_move_to_original_place);
} }
...@@ -2774,15 +2561,7 @@ public class gameCard : OCGobject ...@@ -2774,15 +2561,7 @@ public class gameCard : OCGobject
shower.mask.mainTexture = GameTextureManager.Mask; shower.mask.mainTexture = GameTextureManager.Mask;
shower.disable.mainTexture = GameTextureManager.negated; shower.disable.mainTexture = GameTextureManager.negated;
shower.transform.localScale = Vector3.zero; shower.transform.localScale = Vector3.zero;
// iTween.ScaleTo(
// shower.gameObject,
// iTween.Hash(
// "scale",
// new Vector3(Screen.height / 650f, Screen.height / 650f, Screen.height / 650f),
// "time",
// 0.5f
// )
// );
Vector3 targetScale = new Vector3(Screen.height / 650f, Screen.height / 650f, Screen.height / 650f); Vector3 targetScale = new Vector3(Screen.height / 650f, Screen.height / 650f, Screen.height / 650f);
shower.transform.DOScale(targetScale, 0.5f); shower.transform.DOScale(targetScale, 0.5f);
Ocgcore.LRCgo = shower.gameObject; Ocgcore.LRCgo = shower.gameObject;
......
...@@ -453,16 +453,12 @@ public class GameField : OCGobject ...@@ -453,16 +453,12 @@ public class GameField : OCGobject
if (tex != null) if (tex != null)
{ {
UIHelper.getByName<UITexture>(gameObject, "field_" + player.ToString()).mainTexture = tex; UIHelper.getByName<UITexture>(gameObject, "field_" + player.ToString()).mainTexture = tex;
// UIHelper.clearITWeen(UIHelper.getByName(gameObject, "obj_" + player.ToString()));
// iTween.ScaleTo(UIHelper.getByName(gameObject, "obj_" + player.ToString()), new Vector3(1, 1, 1), 0.5f);
var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString()); var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString());
DOTween.Kill(obj.transform); DOTween.Kill(obj.transform);
obj.transform.DOScale(new Vector3(1, 1, 1), 0.5f); obj.transform.DOScale(new Vector3(1, 1, 1), 0.5f);
} }
else else
{ {
// UIHelper.clearITWeen(UIHelper.getByName(gameObject, "obj_" + player.ToString()));
// iTween.ScaleTo(UIHelper.getByName(gameObject, "obj_" + player.ToString()), new Vector3(0, 0, 0), 0.5f);
var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString()); var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString());
DOTween.Kill(obj.transform); DOTween.Kill(obj.transform);
obj.transform.DOScale(Vector3.zero, 0.5f); obj.transform.DOScale(Vector3.zero, 0.5f);
...@@ -470,8 +466,6 @@ public class GameField : OCGobject ...@@ -470,8 +466,6 @@ public class GameField : OCGobject
} }
else else
{ {
// UIHelper.clearITWeen(UIHelper.getByName(gameObject, "obj_" + player.ToString()));
// iTween.ScaleTo(UIHelper.getByName(gameObject, "obj_" + player.ToString()), new Vector3(0, 0, 0), 0.5f);
var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString()); var obj = UIHelper.getByName(gameObject, "obj_" + player.ToString());
DOTween.Kill(obj.transform); DOTween.Kill(obj.transform);
obj.transform.DOScale(Vector3.zero, 0.5f); obj.transform.DOScale(Vector3.zero, 0.5f);
...@@ -508,7 +502,6 @@ public class GameField : OCGobject ...@@ -508,7 +502,6 @@ public class GameField : OCGobject
{ {
Program.I().mod_ocgcore_ss_dark_hole.transform.localScale = Vector3.zero; Program.I().mod_ocgcore_ss_dark_hole.transform.localScale = Vector3.zero;
cookie_dark_hole = create(Program.I().mod_ocgcore_ss_dark_hole, v); cookie_dark_hole = create(Program.I().mod_ocgcore_ss_dark_hole, v);
// iTween.ScaleTo(cookie_dark_hole, new Vector3(6, 6, 6), 1f);
cookie_dark_hole.transform.DOScale(new Vector3(6, 6, 6), 1f); cookie_dark_hole.transform.DOScale(new Vector3(6, 6, 6), 1f);
cookie_dark_hole.transform.eulerAngles = new Vector3(90, 0, 0); cookie_dark_hole.transform.eulerAngles = new Vector3(90, 0, 0);
} }
...@@ -517,20 +510,6 @@ public class GameField : OCGobject ...@@ -517,20 +510,6 @@ public class GameField : OCGobject
{ {
if (cookie_dark_hole != null) if (cookie_dark_hole != null)
{ {
// iTween.ScaleTo(cookie_dark_hole, iTween.Hash(
// "delay", 1f,
// "x", 0,
// "y", 0,
// "z", 0,
// "time", 1f
// ));
// iTween.MoveTo(cookie_dark_hole, iTween.Hash(
// "delay", 1f,
// "position", v,
// "time", 1f
// ));
// destroy(cookie_dark_hole, 1.4f);
// 使用 DOTween 的序列来实现延迟和组合动画
Sequence seq = DOTween.Sequence(); Sequence seq = DOTween.Sequence();
seq.AppendInterval(1f); // 延迟1秒 seq.AppendInterval(1f); // 延迟1秒
seq.Append(cookie_dark_hole.transform.DOScale(Vector3.zero, 1f)); seq.Append(cookie_dark_hole.transform.DOScale(Vector3.zero, 1f));
...@@ -798,12 +777,6 @@ public class GameField : OCGobject ...@@ -798,12 +777,6 @@ public class GameField : OCGobject
if (player == 0) if (player == 0)
{ {
Program.I().ocgcore.Sleep((int)(60 * (float)amount / 2500f)); Program.I().ocgcore.Sleep((int)(60 * (float)amount / 2500f));
// iTween.ShakePosition(Program.camera_game_main.gameObject, iTween.Hash(
// "x", (float)amount / 1500f,
// "y", (float)amount / 1500f,
// "z", (float)amount / 1500f,
// "time", (float)amount / 2500f
// ));
float duration = (float)amount / 2500f; float duration = (float)amount / 2500f;
float strength = (float)amount / 1500f; float strength = (float)amount / 1500f;
......
using System; using System;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
public class gameHiddenButton : OCGobject public class gameHiddenButton : OCGobject
{ {
public CardLocation location; public CardLocation location;
...@@ -291,8 +291,6 @@ public class gameHiddenButton : OCGobject ...@@ -291,8 +291,6 @@ public class gameHiddenButton : OCGobject
qidian qidian
+ +
((float)index / (float)(gezi - 1)) * (zhongdian - qidian); ((float)index / (float)(gezi - 1)) * (zhongdian - qidian);
//iTween.MoveTo(Program.I().ocgcore.cards[i].gameObject, Camera.main.ScreenToWorldPoint(screen_vector_to_move), 0.5f);
//iTween.RotateTo(Program.I().ocgcore.cards[i].gameObject, new Vector3(-30, 0, 0), 0.1f);
Program.I().ocgcore.cards[i].TweenTo(Camera.main.ScreenToWorldPoint(screen_vector_to_move), new Vector3(-30, 0, 0),true); Program.I().ocgcore.cards[i].TweenTo(Camera.main.ScreenToWorldPoint(screen_vector_to_move), new Vector3(-30, 0, 0),true);
} }
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DG.Tweening;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using DG.Tweening;
public class Ocgcore : ServantWithCardDescription public class Ocgcore : ServantWithCardDescription
...@@ -466,7 +466,6 @@ public class Ocgcore : ServantWithCardDescription ...@@ -466,7 +466,6 @@ public class Ocgcore : ServantWithCardDescription
{ {
gameInfo.gameObject.transform.localPosition = new Vector3(300, 0, 0); gameInfo.gameObject.transform.localPosition = new Vector3(300, 0, 0);
gameInfo.gameObject.SetActive(true); gameInfo.gameObject.SetActive(true);
// iTween.MoveToLocal(gameInfo.gameObject, Vector3.zero, 0.6f);
gameInfo.gameObject.transform.DOLocalMove(Vector3.zero, 0.6f); gameInfo.gameObject.transform.DOLocalMove(Vector3.zero, 0.6f);
gameInfo.ini(); gameInfo.ini();
UIHelper.getByName<UIToggle>(gameInfo.gameObject, "ignore_").value = false; UIHelper.getByName<UIToggle>(gameInfo.gameObject, "ignore_").value = false;
...@@ -1261,24 +1260,24 @@ public class Ocgcore : ServantWithCardDescription ...@@ -1261,24 +1260,24 @@ public class Ocgcore : ServantWithCardDescription
return true; return true;
case GameMessage.Attack: case GameMessage.Attack:
return true; return true;
//case GameMessage.Attack: //case GameMessage.Attack:
// if (Program.I().setting.setting.Vbattle.value) // if (Program.I().setting.setting.Vbattle.value)
// { // {
// return true; // return true;
// } // }
// else // else
// { // {
// return false; // return false;
// } // }
//case GameMessage.Battle: //case GameMessage.Battle:
// if (Program.I().setting.setting.Vbattle.value) // if (Program.I().setting.setting.Vbattle.value)
// { // {
// return false; // return false;
// } // }
// else // else
// { // {
// return true; // return true;
// } // }
} }
return false; return false;
} }
...@@ -5804,22 +5803,11 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5804,22 +5803,11 @@ public class Ocgcore : ServantWithCardDescription
r.ReadByte(); r.ReadByte();
UIHelper.playSound("explode", 0.4f); UIHelper.playSound("explode", 0.4f);
int amount = (int)(Mathf.Clamp(attackCard.get_data().Attack, 0, 3500) * 0.8f); int amount = (int)(Mathf.Clamp(attackCard.get_data().Attack, 0, 3500) * 0.8f);
// iTween.ShakePosition(
// Program.camera_game_main.gameObject,
// iTween.Hash(
// "x",
// (float)amount / 1500f,
// "y",
// (float)amount / 1500f,
// "z",
// (float)amount / 1500f,
// "time",
// (float)amount / 2500f
// )
// );
float duration = (float)amount / 2500f; float duration = (float)amount / 2500f;
float strength = (float)amount / 1500f; float strength = (float)amount / 1500f;
Program.camera_game_main.transform.DOShakePosition(duration, strength); Program.camera_game_main.transform.DOShakePosition(duration, strength);
VectorAttackCard = get_point_worldposition(gpsAttacker); VectorAttackCard = get_point_worldposition(gpsAttacker);
if (attackedCard == null || gpsAttacked.location == 0) if (attackedCard == null || gpsAttacked.location == 0)
{ {
...@@ -5873,7 +5861,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5873,7 +5861,7 @@ public class Ocgcore : ServantWithCardDescription
case GameMessage.ReleaseRelation: case GameMessage.ReleaseRelation:
break; break;
case GameMessage.TossCoin: case GameMessage.TossCoin:
player = r.ReadByte(); player = localPlayer(r.ReadByte());
count = r.ReadByte(); count = r.ReadByte();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
...@@ -5897,19 +5885,17 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5897,19 +5885,17 @@ public class Ocgcore : ServantWithCardDescription
} }
destroy(tempobj, 7); destroy(tempobj, 7);
} }
if (data == 0) // 1. 根据玩家选择格式模板
{ string formatKey = (player == 0) ? "我方硬币结果:" : "对方硬币结果:";
RMSshow_none(InterString.Get("硬币反面")); // 2. 根据数据选择结果
} string resultKey = (data == 0) ? "反面" : "正面";
else // 3. 组合并显示提示
{ RMSshow_none($"{formatKey}{resultKey}");
RMSshow_none(InterString.Get("硬币正面"));
}
} }
Sleep(280); Sleep(280);
break; break;
case GameMessage.TossDice: case GameMessage.TossDice:
player = r.ReadByte(); player = localPlayer(r.ReadByte());
count = r.ReadByte(); count = r.ReadByte();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
...@@ -5926,7 +5912,14 @@ public class Ocgcore : ServantWithCardDescription ...@@ -5926,7 +5912,14 @@ public class Ocgcore : ServantWithCardDescription
tempobj.GetComponent<coiner>().todice(data); tempobj.GetComponent<coiner>().todice(data);
destroy(tempobj, 7); destroy(tempobj, 7);
} }
RMSshow_none(InterString.Get("骰子结果:[?]", data.ToString())); if (player == 0)
{
RMSshow_none($"我方骰子结果:{data}");
}
else
{
RMSshow_none($"对方骰子结果:{data}");
}
} }
Sleep(280); Sleep(280);
break; break;
......
...@@ -7,6 +7,7 @@ using System.Threading; ...@@ -7,6 +7,7 @@ using System.Threading;
using ICSharpCode.SharpZipLib.Core; using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip;
using UnityEngine; using UnityEngine;
using DG.Tweening;
public class Program : MonoBehaviour public class Program : MonoBehaviour
{ {
...@@ -907,8 +908,10 @@ public class Program : MonoBehaviour ...@@ -907,8 +908,10 @@ public class Program : MonoBehaviour
} }
if (fade == true) if (fade == true)
{ {
// 先将初始缩放设为0
return_value.transform.localScale = Vector3.zero; return_value.transform.localScale = Vector3.zero;
iTween.ScaleToE(return_value, scale, 0.3f); // 使用 DOTween 的 DOScale 方法,并添加一个更生动的 EaseType
return_value.transform.DOScale(scale, 0.3f).SetEase(Ease.OutBack);
} }
return return_value; return return_value;
} }
...@@ -921,7 +924,8 @@ public class Program : MonoBehaviour ...@@ -921,7 +924,8 @@ public class Program : MonoBehaviour
{ {
if (fade) if (fade)
{ {
iTween.ScaleTo(obj, Vector3.zero, 0.4f); // 使用 DOTween 执行缩放动画
obj.transform.DOScale(Vector3.zero, 0.4f);
MonoBehaviour.Destroy(obj, 0.6f); MonoBehaviour.Destroy(obj, 0.6f);
} }
else else
...@@ -943,21 +947,6 @@ public class Program : MonoBehaviour ...@@ -943,21 +947,6 @@ public class Program : MonoBehaviour
} }
} }
//public static void shiftCameraPan(Camera camera, bool enabled)
//{
// cameraPaning = enabled;
// PanWithMouse panWithMouse = camera.gameObject.GetComponent<PanWithMouse>();
// if (panWithMouse == null)
// {
// panWithMouse = camera.gameObject.AddComponent<PanWithMouse>();
// }
// panWithMouse.enabled = enabled;
// if (enabled == false)
// {
// iTween.RotateTo(camera.gameObject, new Vector3(60, 0, 0), 0.6f);
// }
//}
public static void reMoveCam(float xINscreen) public static void reMoveCam(float xINscreen)
{ {
float all = (float)Screen.width / 2f; float all = (float)Screen.width / 2f;
......
...@@ -3,6 +3,8 @@ using System.Collections.Generic; ...@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using DG.Tweening;
public class Servant public class Servant
{ {
...@@ -106,16 +108,14 @@ public class Servant ...@@ -106,16 +108,14 @@ public class Servant
buttomToScreen, buttomToScreen,
0 0
); );
iTween.MoveTo(
toolBar, Vector3 targetWorldPosition = Program.camera_back_ground_2d.ScreenToWorldPoint(vectorOfShowedBar_Screen);
Program.camera_back_ground_2d.ScreenToWorldPoint(vectorOfShowedBar_Screen), // 使用 DOTween 执行移动动画
0.6f toolBar.transform.DOMove(targetWorldPosition, 0.6f);
); // 缩放操作与动画库无关,保持不变
toolBar.transform.localScale = new Vector3( float scaleFactor = Screen.height / 700f;
((float)Screen.height) / 700f, toolBar.transform.localScale = new Vector3(scaleFactor, scaleFactor, scaleFactor);
((float)Screen.height) / 700f,
((float)Screen.height) / 700f
);
var items = toolBar.GetComponentsInChildren<toolShift>(); var items = toolBar.GetComponentsInChildren<toolShift>();
for (int i = 0; i < items.Length; i++) for (int i = 0; i < items.Length; i++)
{ {
...@@ -124,21 +124,20 @@ public class Servant ...@@ -124,21 +124,20 @@ public class Servant
} }
} }
public void hideBarOnly() public void hideBarOnly()
{ {
if (toolBar != null) if (toolBar != null)
{ {
Vector3 vectorOfHidedBar_Screen = new Vector3(Screen.width - RightToScreen, -100, 0); Vector3 vectorOfHidedBar_Screen = new Vector3(Screen.width - RightToScreen, -100, 0);
iTween.MoveTo(
toolBar, Vector3 targetWorldPosition = Program.camera_back_ground_2d.ScreenToWorldPoint(vectorOfHidedBar_Screen);
Program.camera_back_ground_2d.ScreenToWorldPoint(vectorOfHidedBar_Screen),
0.6f // 使用 DOTween 执行移动动画
); toolBar.transform.DOMove(targetWorldPosition, 0.6f);
toolBar.transform.localScale = new Vector3( // 缩放操作与动画库无关,保持不变
((float)Screen.height) / 700f, float scaleFactor = Screen.height / 700f;
((float)Screen.height) / 700f, toolBar.transform.localScale = new Vector3(scaleFactor, scaleFactor, scaleFactor);
((float)Screen.height) / 700f
);
var items = toolBar.GetComponentsInChildren<toolShift>(); var items = toolBar.GetComponentsInChildren<toolShift>();
for (int i = 0; i < items.Length; i++) for (int i = 0; i < items.Length; i++)
{ {
......
using System; using System;
using DG.Tweening;
using UnityEngine; using UnityEngine;
public class WindowServant2D : Servant public class WindowServant2D : Servant
{ {
public override void applyHideArrangement() public override void applyHideArrangement()
{ {
if (gameObject != null) if (gameObject != null)
{ {
UIHelper.clearITWeen(gameObject); gameObject.transform.DOKill();
iTween.MoveTo(gameObject, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)), 0.6f); Vector3 hidePosition = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
gameObject.transform.DOMove(hidePosition, 0.6f);
} }
resize(); resize();
} }
public override void applyShowArrangement() public override void applyShowArrangement()
{ {
if (gameObject != null) if (gameObject != null)
{ {
UIHelper.clearITWeen(gameObject); gameObject.transform.DOKill();
iTween.MoveTo(gameObject, Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)), 0.6f);
Vector3 showPosition = Program.camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0));
gameObject.transform.DOMove(showPosition, 0.6f);
} }
resize(); resize();
} }
void resize() void resize()
{ {
if (gameObject != null) if (gameObject != null)
......
...@@ -4,6 +4,8 @@ using System.IO; ...@@ -4,6 +4,8 @@ using System.IO;
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
using DG.Tweening;
public class DeckManager : ServantWithCardDescription public class DeckManager : ServantWithCardDescription
{ {
...@@ -185,13 +187,10 @@ public class DeckManager : ServantWithCardDescription ...@@ -185,13 +187,10 @@ public class DeckManager : ServantWithCardDescription
{ {
base.applyHideArrangement(); base.applyHideArrangement();
Program.cameraFacing = false; Program.cameraFacing = false;
iTween.MoveTo( Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
gameObjectSearch, new Vector3(Screen.width + 600, Screen.height / 2, 600)
Program.camera_main_2d.ScreenToWorldPoint( );
new Vector3(Screen.width + 600, Screen.height / 2, 600) gameObjectSearch.transform.DOMove(targetPos, 0.6f);
),
0.6f
);
refreshDetail(); refreshDetail();
} }
...@@ -201,13 +200,10 @@ public class DeckManager : ServantWithCardDescription ...@@ -201,13 +200,10 @@ public class DeckManager : ServantWithCardDescription
Program.cameraFacing = true; Program.cameraFacing = true;
UITexture tex = UIHelper.getByName<UITexture>(gameObjectSearch, "under_"); UITexture tex = UIHelper.getByName<UITexture>(gameObjectSearch, "under_");
tex.height = Screen.height; tex.height = Screen.height;
iTween.MoveTo( Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
gameObjectSearch, new Vector3(Screen.width - MAIN_PANEL_MARGIN_RIGHT, Screen.height / 2, 0)
Program.camera_main_2d.ScreenToWorldPoint( );
new Vector3(Screen.width - MAIN_PANEL_MARGIN_RIGHT, Screen.height / 2, 0) gameObjectSearch.transform.DOMove(targetPos, 0.6f);
),
0.6f
);
refreshDetail(); refreshDetail();
} }
...@@ -405,7 +401,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -405,7 +401,7 @@ public class DeckManager : ServantWithCardDescription
{ {
try try
{ {
UIHelper.clearITWeen(item.gameObject); item.gameObject.transform.DOKill();
var rid = item.gameObject.GetComponent<Rigidbody>(); var rid = item.gameObject.GetComponent<Rigidbody>();
if (rid == null) if (rid == null)
{ {
...@@ -517,20 +513,19 @@ public class DeckManager : ServantWithCardDescription ...@@ -517,20 +513,19 @@ public class DeckManager : ServantWithCardDescription
if (detailShowed) if (detailShowed)
{ {
gameObjectDetailedSearch.GetComponent<UITexture>().height = 700; gameObjectDetailedSearch.GetComponent<UITexture>().height = 700;
iTween.MoveTo(
gameObjectDetailedSearch, Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
Program.camera_main_2d.ScreenToWorldPoint( new Vector3(
new Vector3( Screen.width
Screen.width - MAIN_SEARCH_PANEL_WIDTH
- MAIN_SEARCH_PANEL_WIDTH - DETAILED_SEARCH_PANEL_WIDTH
- DETAILED_SEARCH_PANEL_WIDTH - 115f * Screen.height / 700f,
- 115f * Screen.height / 700f, Screen.height * 0.5f,
Screen.height * 0.5f, 0
0 )
)
),
0.6f
); );
gameObjectDetailedSearch.transform.DOMove(targetPos, 0.6f);
reShowBar( reShowBar(
0, 0,
MAIN_SEARCH_PANEL_WIDTH MAIN_SEARCH_PANEL_WIDTH
...@@ -540,20 +535,19 @@ public class DeckManager : ServantWithCardDescription ...@@ -540,20 +535,19 @@ public class DeckManager : ServantWithCardDescription
else else
{ {
gameObjectDetailedSearch.GetComponent<UITexture>().height = 700; gameObjectDetailedSearch.GetComponent<UITexture>().height = 700;
iTween.MoveTo(
gameObjectDetailedSearch, Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
Program.camera_main_2d.ScreenToWorldPoint( new Vector3(
new Vector3( Screen.width
Screen.width - MAIN_SEARCH_PANEL_WIDTH
- MAIN_SEARCH_PANEL_WIDTH - DETAILED_SEARCH_PANEL_WIDTH
- DETAILED_SEARCH_PANEL_WIDTH - 115f * Screen.height / 700f,
- 115f * Screen.height / 700f, Screen.height * 1.5f,
Screen.height * 1.5f, 0
0 )
)
),
0.6f
); );
gameObjectDetailedSearch.transform.DOMove(targetPos, 0.6f);
reShowBar(0, CAMERA_MARGIN_RIGHT_NORMAL); reShowBar(0, CAMERA_MARGIN_RIGHT_NORMAL);
} }
} }
...@@ -563,37 +557,29 @@ public class DeckManager : ServantWithCardDescription ...@@ -563,37 +557,29 @@ public class DeckManager : ServantWithCardDescription
if (detailShowed) if (detailShowed)
{ {
gameObjectDetailedSearch.GetComponent<UITexture>().height = Screen.height; gameObjectDetailedSearch.GetComponent<UITexture>().height = Screen.height;
// [修改] 使用常量替换硬编码的 575f
iTween.MoveTo( Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
gameObjectDetailedSearch, new Vector3(
Program.camera_main_2d.ScreenToWorldPoint( Screen.width - COMBINED_PANEL_WIDTH,
new Vector3( Screen.height * 0.5f,
Screen.width - COMBINED_PANEL_WIDTH, 0
Screen.height * 0.5f, )
0
)
),
0.6f
); );
// 使用常量替换硬编码的 460*2 gameObjectDetailedSearch.transform.DOMove(targetPos, 0.6f);
reShowBar(0, MAIN_SEARCH_PANEL_WIDTH + DETAILED_SEARCH_PANEL_WIDTH); reShowBar(0, MAIN_SEARCH_PANEL_WIDTH + DETAILED_SEARCH_PANEL_WIDTH);
} }
else else
{ {
gameObjectDetailedSearch.GetComponent<UITexture>().height = Screen.height; gameObjectDetailedSearch.GetComponent<UITexture>().height = Screen.height;
// 使用常量替换硬编码的 575f Vector3 targetPos = Program.camera_main_2d.ScreenToWorldPoint(
iTween.MoveTo( new Vector3(
gameObjectDetailedSearch, Screen.width - COMBINED_PANEL_WIDTH,
Program.camera_main_2d.ScreenToWorldPoint( Screen.height * 1.5f,
new Vector3( 0
Screen.width - COMBINED_PANEL_WIDTH, )
Screen.height * 1.5f,
0
)
),
0.6f
); );
// 使用常量替换硬编码的 230 gameObjectDetailedSearch.transform.DOMove(targetPos, 0.6f);
reShowBar(0, CAMERA_MARGIN_RIGHT_NORMAL); reShowBar(0, CAMERA_MARGIN_RIGHT_NORMAL);
} }
} }
...@@ -2058,7 +2044,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -2058,7 +2044,7 @@ public class DeckManager : ServantWithCardDescription
r.gameObject.transform.position = new Vector3(0, 5, 0); r.gameObject.transform.position = new Vector3(0, 5, 0);
r.gameObject.transform.eulerAngles = new Vector3(90, 0, 0); r.gameObject.transform.eulerAngles = new Vector3(90, 0, 0);
r.gameObject.transform.localScale = new Vector3(0, 0, 0); r.gameObject.transform.localScale = new Vector3(0, 0, 0);
iTween.ScaleTo(r.gameObject, new Vector3(3, 4, 1), 0.4f); r.gameObject.transform.DOScale(new Vector3(3, 4, 1), 0.4f);
r.gameObject.SetActive(true); r.gameObject.SetActive(true);
return r; return r;
} }
......
using UnityEngine; using UnityEngine;
using System.Collections; using DG.Tweening;
public class screenFader : MonoBehaviour public class screenFader : MonoBehaviour
{ {
...@@ -30,19 +31,18 @@ public class screenFader : MonoBehaviour ...@@ -30,19 +31,18 @@ public class screenFader : MonoBehaviour
Vector3 to = Program.camera_game_main.ScreenToWorldPoint(screen_point); Vector3 to = Program.camera_game_main.ScreenToWorldPoint(screen_point);
deltaTimeCloseUp += Time.deltaTime; deltaTimeCloseUp += Time.deltaTime;
if (deltaTimeCloseUp > time) if (deltaTimeCloseUp > time)
{ {
deltaTimeCloseUp = time; deltaTimeCloseUp = time;
} }
gameObject.transform.position = new Vector3 float progress = (time > 0) ? Mathf.Clamp01(deltaTimeCloseUp / time) : 1f;
(
iTween.easeOutQuad(from.x, to.x, deltaTimeCloseUp / time), // 分别计算 x, y, z 各个轴上的缓动值
iTween.easeOutQuad(from.y, to.y, deltaTimeCloseUp / time), float newX = DOVirtual.EasedValue(from.x, to.x, progress, Ease.OutQuad);
iTween.easeOutQuad(from.z, to.z, deltaTimeCloseUp / time) float newY = DOVirtual.EasedValue(from.y, to.y, progress, Ease.OutQuad);
); float newZ = DOVirtual.EasedValue(from.z, to.z, progress, Ease.OutQuad);
gameObject.transform.position = new Vector3(newX, newY, newZ);
} }
} }
using UnityEngine; using System.Collections.Generic;
using System.Collections; using DG.Tweening; // 1. 引入 DOTween 命名空间
using System.Collections.Generic; using UnityEngine;
public class number_loader : MonoBehaviour {
// 类名保持不变
public class number_loader : MonoBehaviour
{
public Sprite[] sps = new Sprite[60]; public Sprite[] sps = new Sprite[60];
public GameObject mod; public GameObject mod;
// Use this for initialization
void Start ()
{
}
List<GameObject> obj_nums = new List<GameObject>(); private List<GameObject> obj_nums = new List<GameObject>();
Color ccc = Color.white; private int n = -1;
int n = -1; private int _currentColorIndex = -1;
public void set_number(int number,int color)
public void set_number(int number, int color)
{ {
if (n!=number) if (n == number && _currentColorIndex == color)
{
return;
}
n = number;
_currentColorIndex = color;
foreach (GameObject digitObject in obj_nums)
{
GameObject objToDestroy = digitObject;
objToDestroy.transform.DOScale(Vector3.zero, 0.6f)
.SetEase(Ease.InBack)
.OnComplete(() =>
{
if (objToDestroy != null) Destroy(objToDestroy);
});
}
obj_nums.Clear();
if (number < 0)
{ {
n = number; return;
string number_strig = number.ToString(); }
for (int i = 0; i < obj_nums.Count; i++)
string number_strig = number.ToString();
for (int i = 0; i < number_strig.Length; i++)
{
if (!int.TryParse(number_strig[i].ToString(), out int digitValue)) continue;
int spriteIndex = color * 10 + digitValue;
if (mod == null)
{ {
iTween.ScaleTo(obj_nums[i], Vector3.zero, 0.6f); Debug.LogError("预设体 'mod' 未在 Inspector 中指定!", this);
Destroy(obj_nums[i], 0.6f); return; // 关键资源缺失,终止执行
} }
obj_nums.Clear(); if (spriteIndex >= sps.Length || sps[spriteIndex] == null)
if (number > -1)
{ {
for (int i = 0; i < number_strig.Length; i++) Debug.LogWarning($"精灵索引 '{spriteIndex}' 超出范围或对应的精灵为空。", this);
{ continue; // 跳过这个无效的数字位
if (color * 10 + int.Parse(number_strig[i].ToString()) < 60)
{
Sprite sprite = sps[color * 10 + int.Parse(number_strig[i].ToString())];
GameObject obj = (GameObject)MonoBehaviour.Instantiate(mod, Vector3.zero, Quaternion.identity);
obj.transform.SetParent(gameObject.transform, false);
obj.GetComponent<SpriteRenderer>().sprite = sprite;
obj.transform.localPosition = new Vector3(-(float)number_strig.Length / 2f + 0.5f + i, 0, 0);
obj.transform.localScale = Vector3.zero;
iTween.ScaleTo(obj, new Vector3(1, 1, 1), 0.6f);
obj_nums.Add(obj);
}
}
} }
set_color(ccc);
}
}
public void set_color(Color c) GameObject obj = (GameObject)Instantiate(mod, transform);
{
ccc = c; obj.transform.localPosition = new Vector3(-(float)number_strig.Length / 2f + 0.5f + i, 0, 0);
//var sps=GetComponentsInChildren<SpriteRenderer>();
//for (int i = 0; i < sps.Length;i++ ) var spriteRenderer = obj.GetComponent<SpriteRenderer>();
//{ if (spriteRenderer != null)
// Color aaa = c; {
// aaa.a = 0.8f; spriteRenderer.sprite = sps[spriteIndex];
// sps[i].color = aaa; }
//} else
{
Debug.LogError("预设体 'mod' 上缺少 SpriteRenderer 组件!", this);
Destroy(obj);
continue;
}
obj.transform.localScale = Vector3.zero;
obj.transform.DOScale(Vector3.one, 0.6f)
.SetEase(Ease.OutBack);
obj_nums.Add(obj);
}
} }
// Update is called once per frame
void Update ()
{
}
} }
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using DG.Tweening;
public class fade_died : MonoBehaviour { public class fade_died : MonoBehaviour {
public float time = 3; public float time = 3;
public Vector3 scale = new Vector3(1,1,1); public Vector3 scale = new Vector3(1,1,1);
// Use this for initialization // Use this for initialization
void Start () { void Start () {
// 初始缩放设为0
gameObject.transform.localScale = Vector3.zero; gameObject.transform.localScale = Vector3.zero;
iTween.ScaleTo(gameObject, scale, 0.6f); // 2. 创建一个 DOTween 序列来管理整个动画生命周期
iTween.ScaleTo(gameObject, iTween.Hash( Sequence mySequence = DOTween.Sequence();
"delay",time, // 3. 将动画按顺序添加到序列中
"x", 0, mySequence.Append(transform.DOScale(scale, 0.6f)) // 第一步:放大出现
"y", 0, .AppendInterval(time) // 第二步:等待'time'秒
"z", 0, .Append(transform.DOScale(Vector3.zero, 0.6f)) // 第三步:缩小消失
"time", 0.6f .OnComplete(() => // 第四步:动画序列完成后执行
)); {
Destroy(gameObject, time + 0.6f); Destroy(gameObject); // 安全地销毁对象
});
} }
// Update is called once per frame // Update is called once per frame
......
using UnityEngine; using System;
using System.Collections; using DG.Tweening;
using System; using UnityEngine;
public class sorder : MonoBehaviour { public class sorder : MonoBehaviour
int time; {
int time;
// Use this for initialization // Use this for initialization
void Start () { void Start()
time = Program.TimePassed(); {
iTween.ScaleTo(gameObject,new Vector3(3,3,3),1); time = Program.TimePassed();
transform.DOScale(3f, 1f);
} }
// Update is called once per frame // Update is called once per frame
void Update () { void Update()
int delta_time = Program.TimePassed() - time; {
int delta_time = Program.TimePassed() - time;
//gameObject.transform.Rotate((new Vector3(0, 0, 1)) * Time.deltaTime * 50); gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x, gameObject.transform.localPosition.y, gameObject.transform.localPosition.z + (float)(
gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x, gameObject.transform.localPosition.y, gameObject.transform.localPosition.z + (float)( Math.Sin((float)delta_time / 150f) / 40f
Math.Sin((float)delta_time / 150f) / 40f
)); ));
} }
} }
using UnityEngine; using UnityEngine;
using System.Collections; using DG.Tweening;
using System; using System;
public class coiner : MonoBehaviour {
int time;
// Use this for initialization
void Start () {
gameObject.transform.localScale = Vector3.zero;
gameObject.transform.eulerAngles = new Vector3(60, 0, 0);
time = Program.TimePassed();
}
public void coin_app()
{
iTween.ScaleTo(gameObject, new Vector3(10, 10, 8.743f), 1f);
}
public void dice_app()
{
iTween.ScaleTo(gameObject, new Vector3(0.2f, 0.2f, 0.2f), 1f);
}
public void disapp()
{
iTween.ScaleTo(gameObject, new Vector3(0,0,0), 1f);
}
public void tocoin(bool up)
{
if (up)
{
iTween.RotateTo(gameObject, new Vector3(60, 0, 0) + (new Vector3(360, 0, 0)) * 15, 3f);
}
else
{
iTween.RotateTo(gameObject, new Vector3(240, 0, 0) + (new Vector3(360, 0, 0)) * 15, 3f);
}
}
public void todice(int num)
{
switch (num)
{
case 1: iTween.RotateTo(gameObject, new Vector3(-60, 180, 180) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
case 2: iTween.RotateTo(gameObject, new Vector3(40, 180, 180) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
case 3: iTween.RotateTo(gameObject, new Vector3(-30, 0, -90) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
case 4: iTween.RotateTo(gameObject, new Vector3(-30, 0, 90) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
case 5: iTween.RotateTo(gameObject, new Vector3(-30, 0, 0) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
case 6: iTween.RotateTo(gameObject, new Vector3(60, 0, 0) + (new Vector3(360, 360, 360)) * 15, 3f);
break;
} public class coiner : MonoBehaviour
{
} private int time;
// Update is called once per frame private const float fastDuration = 1.5f;
void Update () {
if(Program.TimePassed()-time>4000){ void Start()
time = Program.TimePassed(); {
Destroy(gameObject, 3000); transform.localScale = Vector3.zero;
iTween.ScaleTo(gameObject, Vector3.zero, 1f); transform.eulerAngles = new Vector3(60, 0, 0);
}
} time = Program.TimePassed();
}
public void coin_app()
{
transform.DOScale(new Vector3(10, 10, 8.743f), 1f);
}
public void dice_app()
{
transform.DOScale(new Vector3(0.2f, 0.2f, 0.2f), 1f);
}
public void disapp()
{
transform.DOScale(Vector3.zero, 1f);
}
public void tocoin(bool up)
{
if (up)
{
transform.DORotate(new Vector3(60, 0, 0) + new Vector3(360, 0, 0) * 15, fastDuration, RotateMode.FastBeyond360);
}
else
{
transform.DORotate(new Vector3(240, 0, 0) + new Vector3(360, 0, 0) * 15, fastDuration, RotateMode.FastBeyond360);
}
}
public void todice(int num)
{
switch (num)
{
case 1:
transform.DORotate(new Vector3(-60, 180, 180) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
case 2:
transform.DORotate(new Vector3(40, 180, 180) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
case 3:
transform.DORotate(new Vector3(-30, 0, -90) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
case 4:
transform.DORotate(new Vector3(-30, 0, 90) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
case 5:
transform.DORotate(new Vector3(-30, 0, 0) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
case 6:
transform.DORotate(new Vector3(60, 0, 0) + new Vector3(360, 360, 360) * 15, fastDuration, RotateMode.FastBeyond360);
break;
}
}
void Update()
{
if (Program.TimePassed() - time > 4000)
{
time = Program.TimePassed();
transform.DOScale(Vector3.zero, 1f);
Destroy(gameObject, 3f);
}
}
} }
...@@ -18,18 +18,18 @@ public class LightningBolt : MonoBehaviour ...@@ -18,18 +18,18 @@ public class LightningBolt : MonoBehaviour
Perlin noise; Perlin noise;
float oneOverZigs; float oneOverZigs;
private ParticleSystem ps; // private ParticleSystem ps;
private Particle[] particles; // private Particle[] particles;
void Start() void Start()
{ {
oneOverZigs = 1f / (float)zigs; oneOverZigs = 1f / (float)zigs;
ps = GetComponent<ParticleSystem>(); // ps = GetComponent<ParticleSystem>();
particles = new Particle[zigs]; // particles = new Particle[zigs];
var em = ps.emission; // var em = ps.emission;
em.enabled = false; // em.enabled = false;
ps.Emit(zigs); // ps.Emit(zigs);
ps.GetParticles(particles); // ps.GetParticles(particles);
} }
void Update () void Update ()
...@@ -41,27 +41,27 @@ public class LightningBolt : MonoBehaviour ...@@ -41,27 +41,27 @@ public class LightningBolt : MonoBehaviour
float timey = Time.time * speed * 1.21688f; float timey = Time.time * speed * 1.21688f;
float timez = Time.time * speed * 2.5564f; float timez = Time.time * speed * 2.5564f;
for (int i = 0; i < particles.Length; i++) // for (int i = 0; i < particles.Length; i++)
{ // {
Vector3 position = Vector3.Lerp(transform.position, target.position, oneOverZigs * (float)i); // Vector3 position = Vector3.Lerp(transform.position, target.position, oneOverZigs * (float)i);
Vector3 offset = new Vector3(noise.Noise(timex + position.x, timex + position.y, timex + position.z), // Vector3 offset = new Vector3(noise.Noise(timex + position.x, timex + position.y, timex + position.z),
noise.Noise(timey + position.x, timey + position.y, timey + position.z), // noise.Noise(timey + position.x, timey + position.y, timey + position.z),
noise.Noise(timez + position.x, timez + position.y, timez + position.z)); // noise.Noise(timez + position.x, timez + position.y, timez + position.z));
position += (offset * scale * ((float)i * oneOverZigs)); // position += (offset * scale * ((float)i * oneOverZigs));
particles[i].position = position; // particles[i].position = position;
particles[i].startColor = Color.white; // particles[i].startColor = Color.white;
//particles[i].energy = 1f; // //particles[i].energy = 1f;
} // }
ps.SetParticles(particles); // ps.SetParticles(particles);
if (ps.particleCount >= 2) // if (ps.particleCount >= 2)
{ // {
if (startLight) // if (startLight)
startLight.transform.position = particles[0].position; // startLight.transform.position = particles[0].position;
if (endLight) // if (endLight)
endLight.transform.position = particles[particles.Length - 1].position; // endLight.transform.position = particles[particles.Length - 1].position;
} // }
} }
} }
\ No newline at end of file
fileFormatVersion: 2
guid: e778ea66df9cae740a9957b2cadd6b72
folderAsset: yes
timeCreated: 1469182548
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
This source diff could not be displayed because it is too large. You can view the blob instead.
fileFormatVersion: 2
guid: 092d0bff4e926854aa2558f53e14ee34
timeCreated: 1469174736
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment