Skip to content

Commit

Permalink
服务端兼容代码调整
Browse files Browse the repository at this point in the history
  • Loading branch information
m969041 committed May 26, 2024
1 parent de0c9c4 commit 3fa5ab2
Show file tree
Hide file tree
Showing 40 changed files with 437 additions and 195 deletions.
84 changes: 37 additions & 47 deletions Assets/EGPsExamples/ExecutionLinkEditor/ExecutionLinkPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void NewExecutionAsset()
CurrentExecutionAssetPath = $"Assets/{assetName}.asset";
var excObj = ScriptableObject.CreateInstance<ExecutionObject>();
excObj.TotalTime = 1.5f;
excObj.Id = i.ToString();
excObj.AbilityId = i;
UnityEditor.AssetDatabase.CreateAsset(excObj, CurrentExecutionAssetPath);
SkillListPanel.Instance.RefreshList();
LoadCurrentSkill();
Expand Down Expand Up @@ -242,7 +242,7 @@ public void LoadCurrentSkill()

CurrentExecutionObject = UnityEditor.AssetDatabase.LoadAssetAtPath<ExecutionObject>(CurrentExecutionAssetPath);

self.TotalTime = CurrentExecutionObject.TotalTime;
self.TotalTime = (float)CurrentExecutionObject.TotalTime;

foreach (var item in CurrentExecutionObject.ExecuteClips)
{
Expand Down Expand Up @@ -270,58 +270,49 @@ public void LoadCurrentSkill()

DestroyChildren(self.FrameInfosContentTrm);

var frameCount = (int)(self.TotalTime * 100);
for (int i = 0; i < frameCount; i++)
if (self.TotalTime > 0)
{
var frameObj = GameObject.Instantiate(self.FrameTrm, self.FrameInfosContentTrm);
if (i % 5 != 0)
{
var c = frameObj.GetComponent<Image>().color;
frameObj.GetComponent<Image>().color = new Color(c.r, c.g, c.b, .5f);
var r = frameObj.rectTransform();
r.sizeDelta = new Vector2(r.sizeDelta.x, r.sizeDelta.y * 0.4f);
}
else
{
if (i % 10 != 0)
{
var c = frameObj.GetComponent<Image>().color;
var r = frameObj.rectTransform();
r.sizeDelta = new Vector2(r.sizeDelta.x, r.sizeDelta.y * 0.8f);
}
else
{
var textObj = GameObject.Instantiate(self.FrameTextTrm, frameObj.transform);
textObj.rectTransform().localPosition = self.FrameTextPos;
var milis = i * 10;
var secs = milis / 1000;
var secs2 = milis % 1000 / 10;
textObj.GetComponent<Text>().text = $"{secs}:{secs2.ToString().PadLeft(2, '0')}";
}
}
}
var frameCount = (int)(self.TotalTime * 100);
for (int i = 0; i < frameCount; i++)
{
var frameObj = GameObject.Instantiate(self.FrameTrm, self.FrameInfosContentTrm);
if (i % 5 != 0)
{
var c = frameObj.GetComponent<Image>().color;
frameObj.GetComponent<Image>().color = new Color(c.r, c.g, c.b, .5f);
var r = frameObj.rectTransform();
r.sizeDelta = new Vector2(r.sizeDelta.x, r.sizeDelta.y * 0.4f);
}
else
{
if (i % 10 != 0)
{
var c = frameObj.GetComponent<Image>().color;
var r = frameObj.rectTransform();
r.sizeDelta = new Vector2(r.sizeDelta.x, r.sizeDelta.y * 0.8f);
}
else
{
var textObj = GameObject.Instantiate(self.FrameTextTrm, frameObj.transform);
textObj.rectTransform().localPosition = self.FrameTextPos;
var milis = i * 10;
var secs = milis / 1000;
var secs2 = milis % 1000 / 10;
textObj.GetComponent<Text>().text = $"{secs}:{secs2.ToString().PadLeft(2, '0')}";
}
}
}
}
#endif
}

void LoadCurrentSkillCollisionClip(ExecuteClipData trackClipData)
{
var self = this;
//var cast = self.CurrentSkillConfig;
//var execution = "execution";
//if (string.IsNullOrEmpty(execution))
//{
// return;
//}
var animTrack = GameObject.Instantiate(self.TrackTrm);
animTrack.SetParent(self.TrackListTrm);
animTrack.GetComponentInChildren<Text>().text = "collision execute";
//var animLength = trackClipData.ExecutionClipData.EndTime;

//var trackClipData = new TrackClipData();
//trackClipData.TrackClipType = TrackClipType.ExecutionClip;
//trackClipData.ExecutionClipData = new ExecutionClipData();
//trackClipData.ExecutionClipData._StartTime = 0;
//trackClipData.ExecutionClipData._EndTime = animLength;
trackClipData.TotalTime = self.TotalTime;

var trackClip = animTrack.GetComponentInChildren<TrackClip>();
Expand Down Expand Up @@ -372,7 +363,6 @@ void LoadCurrentSkillParticleEffect(ExecuteClipData trackClipData)
void LoadCurrentSkillSound()
{
var self = this;
//var cast = self.CurrentSkillConfig;
var sound = "sound";
if (string.IsNullOrEmpty(sound))
{
Expand Down Expand Up @@ -412,8 +402,8 @@ void LoadCurrentSkillActionEvent(ExecuteClipData trackClipData)

var trackClip = actionTrack.GetComponentInChildren<TrackClip>();

trackClip.SliderLeft.value = startTime / self.TotalTime;
trackClip.SliderRight.value = startTime / self.TotalTime + 0.01f;
trackClip.SliderLeft.value = (float)startTime / self.TotalTime;
trackClip.SliderRight.value = (float)startTime / self.TotalTime + 0.01f;
trackClipData.TotalTime = self.TotalTime;
trackClip.DisableSlider();
trackClip.SetClipType(trackClipData);
Expand All @@ -430,7 +420,7 @@ public void PlaySkillExecution()
SkillTimeImage.fillAmount = 0;
CurrentTime = 0;
IsPlaying = true;
if (int.TryParse(CurrentExecutionObject.Id, out var skillId) && HeroEntity.IdSkills.TryGetValue(skillId, out var skillAbility))
if (CurrentExecutionObject.AbilityId > 0 && HeroEntity.IdSkills.TryGetValue(CurrentExecutionObject.AbilityId, out var skillAbility))
{
skillAbility.LoadExecution();
if (CurrentExecutionObject.TargetInputType == ExecutionTargetInputType.Target)
Expand Down
4 changes: 2 additions & 2 deletions Assets/EGPsExamples/ExecutionLinkEditor/TrackClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public void SetClipType(ExecuteClipData clipData)
}
}

SliderRight.value = TrackClipData.GetClipTime().EndTime / TrackClipData.TotalTime;
SliderLeft.value = TrackClipData.GetClipTime().StartTime / TrackClipData.TotalTime;
SliderRight.value = (float)TrackClipData.GetClipTime().EndTime / (float)TrackClipData.TotalTime;
SliderLeft.value = (float)TrackClipData.GetClipTime().StartTime / (float)TrackClipData.TotalTime;
SetDragEvent();
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-5308386053713574398
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4db22cb51ab2b354aae7c5f4e7e1d7aa, type: 3}
m_Name: ExecuteClip
m_EditorClassIdentifier:
StartTime: 0
EndTime: 1
ExecuteClipType: 0
ActionEventData:
FireType: 0
ActionEventType: 0
EffectApply: 0
NewExecution:
CollisionExecuteData:
ExecuteType: 1
ActionData:
FireType: 0
ActionEventType: 0
EffectApply: 100
NewExecution: Execution_1008_Expllosion
Shape: 0
Radius: 0.5
Center: {x: 0, y: 0, z: 0}
Size: {x: 0, y: 0, z: 0}
MoveType: 0
ObjAsset: {fileID: 123644, guid: 00a301e11327c274eb48187aaa8aa91a, type: 3}
Speed: 1
BezierCurve:
sampling: 25
normalizedTime: 0.5
keyPoints: []
AnimationData:
AnimationClip: {fileID: 0}
AudioData:
AudioClip: {fileID: 0}
ParticleEffectData:
ParticleEffect: {fileID: 0}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: beb448c210e2a7b4bb0777daef6b1b34, type: 3}
m_Name: Execution_2001
m_EditorClassIdentifier:
Id: 2001
TotalTime: -1
ObjAsset: {fileID: 0}
TargetInputType: 1
RangeIndicatorObjAsset: {fileID: 0}
PointIndicatorObjAsset: {fileID: 0}
DirectionIndicatorObjAsset: {fileID: 0}
ExecuteClips:
- {fileID: -5308386053713574398}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 21c81b993b3f0f243a50c243abdb6ef9, type: 3}
m_Name: Skill_2001
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes:
- Name: AutoRename
Entry: 5
Data: true
- Name: ChildrenStatuses
Entry: 7
Data: 0|System.Collections.Generic.List`1[[EGamePlay.Combat.ChildStatus, Assembly-CSharp]],
mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name: Effects
Entry: 7
Data: 1|System.Collections.Generic.List`1[[EGamePlay.Combat.Effect, Assembly-CSharp]],
mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
Id: 2001
SkillSpellType: 0
AffectTargetType: 2
TargetSelectType: 1
EnableChildrenStatuses: 0
EffectTypeName: "(\u6DFB\u52A0\u6548\u679C)"

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3fa5ab2

Please sign in to comment.