From 46c87911062b29fab8995ac9bc483b1d8981f5b2 Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期二, 18 九月 2018 10:11:51 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
Fight/GameActor/GActorNpcFight.cs | 104 ++++++++++++++++++++
Utility/RuntimeLogUtility.cs | 2
Fight/Actor/Status/Status_Polymorph.cs | 55 +++++++++++
Fight/Actor/Status/StatusMgr.cs | 20 ++++
Fight/Actor/Status/Status_RedName.cs | 4
Fight/GameActor/GActorFight.cs | 7 +
Fight/GameActor/GActorPlayerBase.cs | 80 +++++++--------
Fight/Actor/Status/Status_Polymorph.cs.meta | 12 ++
8 files changed, 239 insertions(+), 45 deletions(-)
diff --git a/Fight/Actor/Status/StatusMgr.cs b/Fight/Actor/Status/StatusMgr.cs
index 770cbb7..e67465e 100644
--- a/Fight/Actor/Status/StatusMgr.cs
+++ b/Fight/Actor/Status/StatusMgr.cs
@@ -107,6 +107,10 @@
{
_status = new Status_InVisible();
}
+ else if (IsPolymorch(h0605.SkillID))
+ {
+ _status = new Status_Polymorph();
+ }
else
{
_status = new Status_Normal();
@@ -522,6 +526,22 @@
return false;
}
+ private bool IsPolymorch(int id)
+ {
+ SkillConfig _config = Config.Instance.Get<SkillConfig>(id);
+ if (_config != null
+ && (_config.Effect1 == 1063
+ || _config.Effect2 == 1063
+ || _config.Effect3 == 1063
+ || _config.Effect4 == 1063
+ || _config.Effect5 == 1063
+ || _config.Effect6 == 1063))
+ {
+ return true;
+ }
+ return false;
+ }
+
private bool IsInVisibleStatus(int id)
{
SkillHelper.SkillInfo _skillInfo = SkillHelper.Instance.Get(id);
diff --git a/Fight/Actor/Status/Status_Polymorph.cs b/Fight/Actor/Status/Status_Polymorph.cs
new file mode 100644
index 0000000..564573b
--- /dev/null
+++ b/Fight/Actor/Status/Status_Polymorph.cs
@@ -0,0 +1,55 @@
+public class Status_Polymorph : Status_Base
+{
+ public sealed override void Init(H0605_tagObjAddBuff data)
+ {
+ base.Init(data);
+
+ GActorFight _actor = GAMgr.Instance.GetBySID(data.ObjID) as GActorFight;
+
+ if (_actor != null)
+ {
+ var _config = Config.Instance.Get<TableConfig.SkillConfig>(data.SkillID);
+
+ int _npcID = 0;
+
+ if (_config.Effect1 == 1063)
+ {
+ _npcID = _config.EffectValue11;
+ }
+ else if (_config.Effect2 == 1063)
+ {
+ _npcID = _config.EffectValue21;
+ }
+ else if (_config.Effect3 == 1063)
+ {
+ _npcID = _config.EffectValue31;
+ }
+ else if (_config.Effect4 == 1063)
+ {
+ _npcID = _config.EffectValue41;
+ }
+ else if (_config.Effect5 == 1063)
+ {
+ _npcID = _config.EffectValue51;
+ }
+ else if (_config.Effect6 == 1063)
+ {
+ _npcID = _config.EffectValue61;
+ }
+
+ _actor.Polymorph(true, _npcID);
+ }
+ }
+
+ public sealed override void Update() { }
+
+ public sealed override void UnInit(uint objId, byte buffType)
+ {
+ GActorFight _actor = GAMgr.Instance.GetBySID(objId) as GActorFight;
+
+ if (_actor != null)
+ {
+ _actor.Polymorph(false);
+ }
+ }
+}
diff --git a/Fight/Actor/Status/Status_Polymorph.cs.meta b/Fight/Actor/Status/Status_Polymorph.cs.meta
new file mode 100644
index 0000000..d8b1510
--- /dev/null
+++ b/Fight/Actor/Status/Status_Polymorph.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3ed1ff2502d8a2a4ca28527101eaa8d6
+timeCreated: 1537186972
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Fight/Actor/Status/Status_RedName.cs b/Fight/Actor/Status/Status_RedName.cs
index 3c4a081..b21a619 100644
--- a/Fight/Actor/Status/Status_RedName.cs
+++ b/Fight/Actor/Status/Status_RedName.cs
@@ -2,7 +2,7 @@
public class Status_RedName : Status_Base
{
- public override void Init(H0605_tagObjAddBuff data)
+ public sealed override void Init(H0605_tagObjAddBuff data)
{
base.Init(data);
@@ -15,7 +15,7 @@
public sealed override void Update() { }
- public override void UnInit(uint objId, byte buffType)
+ public sealed override void UnInit(uint objId, byte buffType)
{
GActorPlayerBase _player = GAMgr.Instance.GetBySID(h0605.ObjID) as GActorPlayerBase;
if (_player != null)
diff --git a/Fight/GameActor/GActorFight.cs b/Fight/GameActor/GActorFight.cs
index 4a905e2..3928de3 100644
--- a/Fight/GameActor/GActorFight.cs
+++ b/Fight/GameActor/GActorFight.cs
@@ -417,4 +417,11 @@
{
SoundUtility.PlayHitAudio(attacker.m_AudioSource);
}
+
+ public bool IsPolyMorph { get; protected set; }
+ protected GameObject m_SheepModel;
+ protected bool m_SheepIsDefaultNpc;
+ public virtual void Polymorph(bool doOrNo, int npcID = 0) { }
+ protected virtual void ChangeBinderToRoot() { }
+ protected virtual void ChangeBinderToClothes() { }
}
diff --git a/Fight/GameActor/GActorNpcFight.cs b/Fight/GameActor/GActorNpcFight.cs
index 1b1b0cf..874295f 100644
--- a/Fight/GameActor/GActorNpcFight.cs
+++ b/Fight/GameActor/GActorNpcFight.cs
@@ -720,4 +720,108 @@
{
m_LastCantAtkedTime = Time.time;
}
+
+ public sealed override void Polymorph(bool doOrNo, int npcID)
+ {
+ IsPolyMorph = doOrNo;
+
+ if (IsPolyMorph)
+ {
+ ChangeBinderToRoot();
+
+ m_SheepIsDefaultNpc = false;
+ var _p = InstanceResourcesLoader.LoadNpc(npcID);
+ if (_p == null)
+ {
+ _p = InstanceResourcesLoader.LoadDefaultFightNPC();
+ m_SheepIsDefaultNpc = true;
+ }
+
+ m_Model.transform.localPosition = Constants.Special_Hide_Position;
+
+ m_SheepModel = GameObjectPoolManager.Instance.RequestGameObject(_p);
+ m_SheepModel.transform.SetParent(m_Root);
+
+ var _a = m_SheepModel.GetComponent<Animator>();
+ if (_a)
+ {
+ _a.enabled = true;
+ _a.SetInteger(GAStaticDefine.Param_ActorInstID, (int)ClientInstID);
+ m_Animator.enabled = false;
+ m_Animator = _a;
+ }
+
+ if (ShowOrHide)
+ {
+ m_SheepModel.transform.localPosition = Vector3.zero;
+ }
+ else
+ {
+ m_SheepModel.transform.localPosition = Constants.Special_Hide_Position;
+ }
+
+ m_SheepModel.transform.localRotation = Quaternion.identity;
+ }
+ else
+ {
+ if (m_SheepModel)
+ {
+ if (m_SheepIsDefaultNpc)
+ {
+ GameObjectPoolManager.Instance.ReleaseDefaultFightNPC(m_SheepModel);
+ }
+ else
+ {
+ var _prefab = InstanceResourcesLoader.LoadNpc(10101001);
+ GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_SheepModel);
+ }
+ }
+
+ m_SheepModel = null;
+ m_Model.transform.localPosition = Vector3.zero;
+
+ ChangeBinderToClothes();
+
+ m_Animator = m_Model.GetComponent<Animator>();
+ m_Animator.enabled = true;
+ m_Animator.SetInteger(GAStaticDefine.Param_ActorInstID, (int)ClientInstID);
+ m_Animator.SetInteger(GAStaticDefine.Param_MoveState, (int)E_MovingState.Normal);
+ }
+ }
+
+ protected sealed override void ChangeBinderToRoot()
+ {
+ if (MP_Name != m_Model.transform)
+ {
+ MP_Name.SetParent(Root);
+ }
+
+ if (MP_Hit != m_Model.transform)
+ {
+ MP_Hit.SetParent(Root);
+ }
+
+ if (MP_Stun != m_Model.transform)
+ {
+ MP_Stun.SetParent(Root);
+ }
+ }
+
+ protected sealed override void ChangeBinderToClothes()
+ {
+ if (MP_Name != m_Model.transform)
+ {
+ MP_Name.SetParent(m_Model.transform);
+ }
+
+ if (MP_Hit != m_Model.transform)
+ {
+ MP_Hit.SetParent(m_Model.transform);
+ }
+
+ if (MP_Stun != m_Model.transform)
+ {
+ MP_Stun.SetParent(m_Model.transform);
+ }
+ }
}
diff --git a/Fight/GameActor/GActorPlayerBase.cs b/Fight/GameActor/GActorPlayerBase.cs
index b27dfd1..be51c4d 100644
--- a/Fight/GameActor/GActorPlayerBase.cs
+++ b/Fight/GameActor/GActorPlayerBase.cs
@@ -84,10 +84,7 @@
}
}
- public bool IsPolyMorph { get; private set; }
- private GameObject m_SheepModel;
- private bool m_SheepIsDefaultNpc;
- public virtual void Polymorph(bool doOrNo)
+ public sealed override void Polymorph(bool doOrNo, int npcID)
{
IsPolyMorph = doOrNo;
@@ -108,7 +105,7 @@
}
m_SheepIsDefaultNpc = false;
- var _p = InstanceResourcesLoader.LoadNpc(10101001);
+ var _p = InstanceResourcesLoader.LoadNpc(npcID);
if (_p == null)
{
_p = InstanceResourcesLoader.LoadDefaultFightNPC();
@@ -162,6 +159,42 @@
m_ClothesAnimator.enabled = true;
m_ClothesAnimator.SetInteger(GAStaticDefine.Param_ActorInstID, (int)ClientInstID);
m_ClothesAnimator.SetInteger(GAStaticDefine.Param_MoveState, (int)E_MovingState.Normal);
+ }
+ }
+
+ protected sealed override void ChangeBinderToRoot()
+ {
+ if (MP_Name != m_ClothesModel.transform)
+ {
+ MP_Name.SetParent(Root);
+ }
+
+ if (MP_Hit != m_ClothesModel.transform)
+ {
+ MP_Hit.SetParent(Root);
+ }
+
+ if (MP_Stun != m_ClothesModel.transform)
+ {
+ MP_Stun.SetParent(Root);
+ }
+ }
+
+ protected sealed override void ChangeBinderToClothes()
+ {
+ if (MP_Name != m_ClothesModel.transform)
+ {
+ MP_Name.SetParent(m_ClothesModel.transform);
+ }
+
+ if (MP_Hit != m_ClothesModel.transform)
+ {
+ MP_Hit.SetParent(m_ClothesModel.transform);
+ }
+
+ if (MP_Stun != m_ClothesModel.transform)
+ {
+ MP_Stun.SetParent(m_ClothesModel.transform);
}
}
@@ -2196,43 +2229,6 @@
}
}
-
- private void ChangeBinderToClothes()
- {
- if (MP_Name != m_ClothesModel.transform)
- {
- MP_Name.SetParent(m_ClothesModel.transform);
- }
-
- if (MP_Hit != m_ClothesModel.transform)
- {
- MP_Hit.SetParent(m_ClothesModel.transform);
- }
-
- if (MP_Stun != m_ClothesModel.transform)
- {
- MP_Stun.SetParent(m_ClothesModel.transform);
- }
- }
-
- private void ChangeBinderToRoot()
- {
- if (MP_Name != m_ClothesModel.transform)
- {
- MP_Name.SetParent(Root);
- }
-
- if (MP_Hit != m_ClothesModel.transform)
- {
- MP_Hit.SetParent(Root);
- }
-
- if (MP_Stun != m_ClothesModel.transform)
- {
- MP_Stun.SetParent(Root);
- }
- }
-
/// <summary>
/// 鍒ゆ柇鎶�鑳芥槸鍚﹀彲浠ヨ鎵撴柇
diff --git a/Utility/RuntimeLogUtility.cs b/Utility/RuntimeLogUtility.cs
index eaa22df..bb51030 100644
--- a/Utility/RuntimeLogUtility.cs
+++ b/Utility/RuntimeLogUtility.cs
@@ -223,7 +223,7 @@
if (GUILayout.Button("閰烽叿閰�"))
{
- PlayerDatas.Instance.hero.Polymorph(!PlayerDatas.Instance.hero.IsPolyMorph);
+ PlayerDatas.Instance.hero.Polymorph(!PlayerDatas.Instance.hero.IsPolyMorph, 0);
}
if (GUILayout.Button("鐩存帴閲嶈繛"))
--
Gitblit v1.8.0