From e9d39634ab1d441fc83cda9133aed2a925a4ceb1 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 24 Oct 2020 11:17:52 +0100 Subject: [PATCH] add boxes for characters --- AssetBundles/conversation | Bin 3183 -> 3143 bytes AssetBundles/conversation.manifest | 14 ++-------- QSB/ConversationSync/ConversationEvent.cs | 4 +++ QSB/ConversationSync/ConversationManager.cs | 29 ++++++++++++++++++-- QSB/ConversationSync/ConversationPatches.cs | 3 +- UnityProject/Assets/DialogueBubble.prefab | 8 +++--- 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/AssetBundles/conversation b/AssetBundles/conversation index ff7f3e2ca817ed515bc9920950fa4ca1d487cb0e..9dd2f86f8e35333054073221379d2133235b987b 100644 GIT binary patch delta 3080 zcmV+j4EOWz7{?fpB^yTo002P%003J6002WC009890RR9q%K!ii)R90ue=t3lX$lzu z?6(cDdaX*%uP(H_5D&jN^pa?M6K*zY(K?ka8Qnx3E+;llbGWsKRl>Jf33UObRMgf# zW1S$pNL^*s_RRN7(-5AQVz|EEQ^o0S>ruHTsAZWs{tm3S<*uh;nl_H^*0v13AVTA z7VleI6c)V-7mApnMJROE*gJF)m z7Z_T8aF%KKH( zDS6Nqsc<*!+Bv!@hH^l@7mj-f`k)SvImXHLZC_;O!Kt#ymzBkGqvX-Qi%2g!@qh@X zN>kR0;Kb`=e+ptu%r!~|L?ie`Q$mr9#Vi=Cjgz~Oekmw`Ak!j9B2}I+!@94eS0TOo zL^YRTv3{u4XN6ASBD4K{o53B~LmCk~Fw-3Nh`iyE4)6mc&@(|9l?O;%X*Ac_s&m@5 z07Nq}qhA)G=@p7D00V3V>xQa+u9yI{9kKd}iYYyef3o&P@=JC_u~@UmZy_fDWUj+w zKzQ=`<|+=_gTNl=eMnWE(x6)tGYX)i1wK8V5OV#(+F=FZLdNkC4Ui+2mQ&B7jj+#IDD3JKAZo_RA`-yq{Ipfi>#zA z8bkE)(e__rwrKX@)w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V8El5@}A$4ie_v$*599F z3gz?Sr}!~za6ZL{1dkTMsB1;i!$vc_C__{q5jZcGqqZ{9e~BP>!*PcA)*R6yn`AD$ z$T#A2Z2_Ha#}Op{#MjzdDzOF7#RWT;R+ul!lc|+v?=H6tShim1%m}Lf#E0iso|oLU zBchX0Sq_$FMx=4Va{M${;h!VB0n7u+KdvOZb#tB!kEDAuaR6m4hM|W$9XVbA_9aF9h{qP+7b?P${uXZN>X+Er{#N(S!4We*c=iAQr|0ELz6 z1EuOna?!RC3ZE4ly{VQ2tZ4BGHkR-@o^XB3d=+uH>Bb zacY;KMF3=b5#Ey2mkpQg6R13=_=YTnWMJ+bdjWZ56v*+Un2n)D08^gHhAxJWk^--*1Z=Sm$w zXm;;w4XNPbV2%fVTC`@Xn&U6l&+L!w!*5#mH{HtGLAe@GAHo= ze*|pbME6nRqvV@!0Ia(6kjU^MS4|r31Lu(<+8SB!&f8PCNTV1j+c`piyG*MxPZqz< zGVNFaHJU*BZ!t`UseU0`OpZ32wnNEtbf(LJZtVF5vhc_`4u|W`^?LV(LI(Q|Cc99~ z{Rf7e3+e&D0?}RtK=_**r~-SZbamA+e-LLra@kT_99OTWycx-0?Nack(D`D-7V1u) zNPq%G>3g2v6@bP2dWocg@|h=4v8iMX|1b}0U7-tHXGCJ@WdQj5k2r1qbW2{MnBwDv z0Xm=KehslgnHRtrT{uwGMoeUf@U{D9tydqinfAqM;cAhNO`Io{35W_>FUSm53n+cZ L3}f+2{okRwlzJo| diff --git a/AssetBundles/conversation.manifest b/AssetBundles/conversation.manifest index a669c957..6cae1daa 100644 --- a/AssetBundles/conversation.manifest +++ b/AssetBundles/conversation.manifest @@ -1,22 +1,16 @@ ManifestFileVersion: 0 -CRC: 674027210 +CRC: 3469869292 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 207385c19798113635f73bd17e7c2e5c + Hash: 86686b50f40f37c15d0bca36dcaff7af TypeTreeHash: serializedVersion: 2 - Hash: 27971550fda62b1a0371f7196924aa6c + Hash: 6ce89620af51ba381c9e4f226a2ebb1b HashAppended: 0 ClassTypes: - Class: 1 Script: {instanceID: 0} -- Class: 21 - Script: {instanceID: 0} -- Class: 28 - Script: {instanceID: 0} -- Class: 48 - Script: {instanceID: 0} - Class: 114 Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 114 @@ -27,8 +21,6 @@ ClassTypes: Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} - Class: 115 Script: {instanceID: 0} -- Class: 128 - Script: {instanceID: 0} - Class: 222 Script: {instanceID: 0} - Class: 223 diff --git a/QSB/ConversationSync/ConversationEvent.cs b/QSB/ConversationSync/ConversationEvent.cs index 5a44e3c2..d67bb039 100644 --- a/QSB/ConversationSync/ConversationEvent.cs +++ b/QSB/ConversationSync/ConversationEvent.cs @@ -1,5 +1,7 @@ using QSB.Events; using QSB.Messaging; +using QSB.Utility; +using QSB.WorldSync; namespace QSB.ConversationSync { @@ -23,6 +25,7 @@ namespace QSB.ConversationSync public override void OnReceiveRemote(ConversationMessage message) { + DebugLog.DebugWrite($"Conv. type {message.Type} id {message.ObjectId} text {message.Message}"); switch (message.Type) { case ConversationType.Character: @@ -33,6 +36,7 @@ namespace QSB.ConversationSync ConversationManager.Instance.DisplayPlayerConversationBox((uint)message.ObjectId, message.Message); break; case ConversationType.EndCharacter: + UnityEngine.Object.Destroy(ConversationManager.Instance.BoxMappings[WorldRegistry.OldDialogueTrees[message.ObjectId]]); break; case ConversationType.EndPlayer: UnityEngine.Object.Destroy(PlayerRegistry.GetPlayer((uint)message.ObjectId).CurrentDialogueBox); diff --git a/QSB/ConversationSync/ConversationManager.cs b/QSB/ConversationSync/ConversationManager.cs index e3decbef..e1543cff 100644 --- a/QSB/ConversationSync/ConversationManager.cs +++ b/QSB/ConversationSync/ConversationManager.cs @@ -2,6 +2,8 @@ using OWML.ModHelper.Events; using QSB.Events; using QSB.Utility; +using QSB.WorldSync; +using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; @@ -12,6 +14,7 @@ namespace QSB.ConversationSync public static ConversationManager Instance { get; private set; } public AssetBundle ConversationAssetBundle { get; private set; } private GameObject BoxPrefab; + public Dictionary BoxMappings = new Dictionary(); private void Start() { @@ -21,7 +24,7 @@ namespace QSB.ConversationSync DebugLog.LogState("ConversationBundle", ConversationAssetBundle); BoxPrefab = ConversationAssetBundle.LoadAsset("assets/dialoguebubble.prefab"); - var font = (Font)Resources.Load(@"fonts\english - latin\SpaceMono-Bold"); + var font = (Font)Resources.Load(@"fonts\english - latin\spacemono-bold"); if (font == null) { DebugLog.ToConsole("Error - Font is null!", MessageType.Error); @@ -32,21 +35,25 @@ namespace QSB.ConversationSync public void SendPlayerOption(string text) { + DebugLog.DebugWrite("sending player option - " + text); GlobalMessenger.FireEvent(EventNames.QSBConversation, PlayerRegistry.LocalPlayerId, text, ConversationType.Player); } public void SendCharacterDialogue(int id, string text) { + DebugLog.DebugWrite("sending char dialoge - " + text); GlobalMessenger.FireEvent(EventNames.QSBConversation, (uint)id, text, ConversationType.Character); } public void EndConversationPlayer() { + DebugLog.DebugWrite("Ending conversation -- player"); GlobalMessenger.FireEvent(EventNames.QSBConversation, PlayerRegistry.LocalPlayerId, "", ConversationType.EndPlayer); } public void EndConversationCharacter(int id) { + DebugLog.DebugWrite("Ending conversation -- character"); GlobalMessenger.FireEvent(EventNames.QSBConversation, (uint)id, "", ConversationType.EndCharacter); } @@ -63,7 +70,6 @@ namespace QSB.ConversationSync newBox.transform.parent = PlayerRegistry.GetPlayer(playerId).Body.transform; newBox.transform.localPosition = new Vector3(0, 25, 0); newBox.transform.rotation = PlayerRegistry.GetPlayer(playerId).Body.transform.rotation; - //newBox.transform.LookAt(PlayerRegistry.LocalPlayer.Camera.transform, PlayerRegistry.GetPlayer(playerId).Body.transform.up); var lookAt = newBox.AddComponent(); lookAt.SetValue("_useLookAt", false); lookAt.SetValue("_localFacingVector", Vector3.back); @@ -76,7 +82,26 @@ namespace QSB.ConversationSync public void DisplayCharacterConversationBox(int index, string text) { + var oldDialogueTree = WorldRegistry.OldDialogueTrees[index]; + if (BoxMappings.ContainsKey(oldDialogueTree)) + { + Destroy(BoxMappings[oldDialogueTree]); + BoxMappings.Remove(oldDialogueTree); + } + var newBox = Instantiate(BoxPrefab); + newBox.SetActive(false); + newBox.transform.parent = oldDialogueTree.gameObject.transform; + newBox.transform.localPosition = new Vector3(0, 2, 0); + newBox.transform.rotation = oldDialogueTree.gameObject.transform.rotation; + var lookAt = newBox.AddComponent(); + lookAt.SetValue("_useLookAt", false); + lookAt.SetValue("_localFacingVector", Vector3.back); + lookAt.SetValue("_localRotationAxis", Vector3.up); + newBox.GetComponent().text = text; + newBox.SetActive(true); + + BoxMappings.Add(oldDialogueTree, newBox); } } } diff --git a/QSB/ConversationSync/ConversationPatches.cs b/QSB/ConversationSync/ConversationPatches.cs index 51b1fb8a..07c7c1d5 100644 --- a/QSB/ConversationSync/ConversationPatches.cs +++ b/QSB/ConversationSync/ConversationPatches.cs @@ -15,6 +15,7 @@ namespace QSB.ConversationSync public static void EndConversation() { + ConversationManager.Instance.EndConversationCharacter(PlayerRegistry.LocalPlayer.CurrentDialogueID); PlayerRegistry.LocalPlayer.CurrentDialogueID = -1; ConversationManager.Instance.EndConversationPlayer(); } @@ -24,7 +25,7 @@ namespace QSB.ConversationSync if (optionIndex < 0) { // in a page where there is no selectable options - PlayerRegistry.LocalPlayer.CurrentDialogueID = -1; + //PlayerRegistry.LocalPlayer.CurrentDialogueID = -1; ConversationManager.Instance.EndConversationPlayer(); return true; } diff --git a/UnityProject/Assets/DialogueBubble.prefab b/UnityProject/Assets/DialogueBubble.prefab index f8713e30..262bc2fa 100644 --- a/UnityProject/Assets/DialogueBubble.prefab +++ b/UnityProject/Assets/DialogueBubble.prefab @@ -60,7 +60,7 @@ MonoBehaviour: m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: fff59d5e06ad5b74497d7cc1dddc5e28, type: 2} + m_Material: {fileID: 2100000, guid: 08e1a88dddd41604db20b0dcb92d17d8, type: 2} m_Color: {r: 1, g: 0.68275857, b: 0, a: 1} m_RaycastTarget: 0 m_OnCullStateChanged: @@ -69,7 +69,7 @@ MonoBehaviour: m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_Font: {fileID: 12800000, guid: 67f35d66c98319540bc681e5a18105d2, type: 2} m_FontSize: 1 m_FontStyle: 0 m_BestFit: 0 @@ -120,7 +120,7 @@ MonoBehaviour: m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3} m_Name: m_EditorClassIdentifier: - m_HorizontalFit: 2 + m_HorizontalFit: 0 m_VerticalFit: 2 --- !u!114 &114670735829080676 MonoBehaviour: @@ -205,7 +205,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 25, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!224 &224902966460615240 RectTransform: