From fc5d4318db0dbe68eb5e8d3e7bb7dacbf05bc3a7 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期二, 06 十一月 2018 17:26:29 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
UI/Common/UI3DModelExhibition.cs | 155 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 103 insertions(+), 52 deletions(-)
diff --git a/UI/Common/UI3DModelExhibition.cs b/UI/Common/UI3DModelExhibition.cs
index e3e2cf8..f184f79 100644
--- a/UI/Common/UI3DModelExhibition.cs
+++ b/UI/Common/UI3DModelExhibition.cs
@@ -66,10 +66,8 @@
public static UI3DModelExhibition Instance { get; private set; }
static UI3DModelExhibition m_InstanceClone1 = null;
- public static UI3DModelExhibition InstanceClone1
- {
- get
- {
+ public static UI3DModelExhibition InstanceClone1 {
+ get {
if (m_InstanceClone1 == null)
{
CreateCloneStage();
@@ -240,7 +238,7 @@
ShowPlayer(_rawImage, data);
}
- public void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
+ void ShowPlayer(RawImage _rawImage, UI3DPlayerExhibitionData data)
{
StopShow();
@@ -442,6 +440,69 @@
}
}
+ public void ShowNPC(RawImage rawImage, UI3DNPCExhibitionData data)
+ {
+ StopShow();
+ ResetCameraColor();
+ var config = Config.Instance.Get<NPCConfig>(data.npcId);
+ var job = 0;
+ if (config.MODE.Contains("A_Zs"))
+ {
+ job = 1;
+ }
+ else if (config.MODE.Contains("A_Fs"))
+ {
+ job = 2;
+ }
+
+ var offset = config.UIModeLOffset;
+ var eulerAngles = config.UIModelRotation;
+ var scale = Vector3.one * config.UIModeLProportion;
+
+ var isPlayer = job != 0;
+ if (isPlayer)
+ {
+ var instance = UI3DModelFactory.LoadUINPC(data.npcId);
+ if (instance == null)
+ {
+ DebugEx.LogFormat("鏃犳硶鑾峰緱npc妯″瀷璧勬簮锛宨d :{0}", data.npcId);
+ return;
+ }
+
+ instance.transform.SetParentEx(data.isDialogue ? m_DialogPoint : m_NPCShowPoint, offset, eulerAngles, scale);
+ npcModel = instance;
+ isShowingNPC = true;
+
+ var ids = config.Equips.Split('|');
+ var weaponId = int.Parse(ids[0]);
+ var secondaryId = ids.Length > 1 ? int.Parse(ids[1]) : 0;
+ var wingId = ids.Length > 3 ? int.Parse(ids[3]) : 0;
+
+ playerModel.Show(instance, job, weaponId, wingId, secondaryId, m_PlayerShowPoint);
+ playerModel.UnloadClothedEffect();
+ playerModel.StandUp();
+
+ m_PlayerShowPoint.localEulerAngles = Vector3.zero;
+ isShowingPlayer = true;
+
+ interactable = true;
+ m_ShowCamera.enabled = true;
+ if (rawImage != null)
+ {
+ var x = rawImage.rectTransform.rect.height * 4f / 3;
+ var y = rawImage.rectTransform.rect.height;
+ rawImage.rectTransform.sizeDelta = new Vector2(x, y);
+ rawImage.texture = m_ShowCamera.targetTexture;
+ rawImage.material = MaterialUtility.GetGUIRenderTextureMaterial();
+ m_InteractProcessor.rectTransform = rawImage.rectTransform;
+ }
+ }
+ else
+ {
+ ShowNPC(data.npcId, offset, eulerAngles, rawImage, data.gray, data.isDialogue);
+ }
+ }
+
public void ShowNPC(int _npcId, Vector3 _localEulerAngles, RawImage _rawImage, bool _gray = false, bool _isDialogue = false)
{
ShowNPC(_npcId, Vector3.zero, _localEulerAngles, _rawImage, _gray, _isDialogue);
@@ -506,67 +567,49 @@
{
m_ShowCamera.enabled = false;
- if (isShowingNPC)
+ playerModel.Dispose();
+ isShowingPlayer = false;
+
+ if (npcModel != null)
{
- if (npcModel != null)
+ npcModel.transform.localScale = Vector3.one;
+ if (m_NpcEffect != null)
{
- npcModel.transform.localScale = Vector3.one;
-
- if (m_NpcEffect != null)
- {
- SFXPlayUtility.Instance.Release(m_NpcEffect);
- m_NpcEffect = null;
- }
-
- UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel);
- npcModel = null;
+ SFXPlayUtility.Instance.Release(m_NpcEffect);
+ m_NpcEffect = null;
}
- m_NPCId = 0;
- isShowingNPC = false;
+ UI3DModelFactory.ReleaseUINPC(m_NPCId, npcModel);
+ npcModel = null;
}
+ m_NPCId = 0;
+ isShowingNPC = false;
- if (isShowingHorse)
+ if (horseModel != null)
{
- if (horseModel != null)
- {
- horseModel.transform.localScale = Vector3.one;
- UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel);
- horseModel = null;
- }
-
- m_HorseModelId = 0;
- isShowingHorse = false;
+ horseModel.transform.localScale = Vector3.one;
+ UI3DModelFactory.ReleaseUIHourse(m_HorseModelId, horseModel);
+ horseModel = null;
}
+ m_HorseModelId = 0;
+ isShowingHorse = false;
- if (isShowingPlayer)
+ if (wingModel != null)
{
- playerModel.Dispose();
- isShowingPlayer = false;
+ wingModel.transform.localScale = Vector3.one;
+ UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel);
+ wingModel = null;
}
+ m_WingModelId = 0;
+ isShowWing = false;
- if (isShowWing)
+ if (equipmentModel != null)
{
- if (wingModel != null)
- {
- wingModel.transform.localScale = Vector3.one;
- UI3DModelFactory.ReleaseUIWing(m_WingModelId, wingModel);
- wingModel = null;
- }
- m_WingModelId = 0;
- isShowWing = false;
+ UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel);
+ equipmentModel = null;
}
-
- if (isShowinEquipment)
- {
- if (equipmentModel != null)
- {
- UI3DModelFactory.ReleaseUIWing(m_EquipmentModelId, equipmentModel);
- equipmentModel = null;
- }
- m_EquipmentModelId = 0;
- isShowinEquipment = false;
- }
+ m_EquipmentModelId = 0;
+ isShowinEquipment = false;
interactable = false;
}
@@ -669,6 +712,14 @@
public int secondaryId;
public bool isDialogue;
}
+
+ public struct UI3DNPCExhibitionData
+ {
+ public int npcId;
+ public bool gray;
+ public bool isDialogue;
+ }
+
}
}
--
Gitblit v1.8.0