@@ -52,61 +52,6 @@ namespace Komodo.Runtime
5252 [ System . Serializable ] public class UnityEvent_Int : UnityEvent < int > { }
5353 [ System . Serializable ] public class UnityEvent_String : UnityEvent < string > { }
5454
55- //For handling different type of text between clients
56- public enum STRINGTYPE
57- {
58- TUTORIAL ,
59- CLIENT_NAME ,
60- SPEECH_TO_TEXT ,
61- }
62- public struct SpeechToTextSnippet
63- {
64- public int target ;
65- public int stringType ;
66- public string text ;
67- }
68- //types of data in scene
69- public enum Entity_Type
70- {
71- none = - 1 ,
72- users_head = 0 ,
73- users_Lhand = 1 ,
74- users_Rhand = 2 ,
75- objects = 3 ,
76- physicsObject = 4 ,
77- main_Player = 5 ,
78- physicsEnd = 8 ,
79- Line = 10 ,
80- LineEnd = 11 ,
81- LineDelete = 12 ,
82- LineRender = 13 ,
83- LineNotRender = 14 ,
84- }
85-
86- #region INTERACTION TYPES
87- public enum INTERACTIONS
88- {
89- LOOK = 0 ,
90- LOOK_END = 1 ,
91- SHOW = 2 ,
92- HIDE = 3 ,
93- GRAB = 4 ,
94- DROP = 5 ,
95- CHANGE_SCENE = 6 ,
96- SLICE_OBJECT = 7 ,
97- LOCK = 8 ,
98- UNLOCK = 9 ,
99- LINE = 10 ,
100- LINE_END = 11 ,
101- SHOW_MENU = 12 ,
102- HIDE_MENU = 13 ,
103-
104- SETTING_TAB = 14 ,
105- PEOPLE_TAB = 15 ,
106- INTERACTION_TAB = 16 ,
107- CREATE_TAB = 17 ,
108- }
109- #endregion
11055 /// <summary>
11156 /// This class is meant to:
11257 /// --- set up main player
@@ -560,7 +505,9 @@ public void AddNewClient(int clientID, bool isMainPlayer = false)
560505
561506 var ROT = entityManager . GetComponentData < Rotation > ( avatarEntityGroupFromClientId [ clientID ] . rootEntity ) . Value . value ; //.entity_data.rot;
562507
563- //To prevent offset issues when working with editor
508+
509+ // TODO -- investigate whether this area is a cause of the
510+ // hand position and rotation being wrong in the browser
564511#if UNITY_WEBGL && ! UNITY_EDITOR || TESTING_BEFORE_BUILDING
565512
566513 mainPlayer . transform . position = temp . position ;
@@ -719,100 +666,6 @@ public async void DestroyClient(int clientID)
719666 }
720667 #endregion
721668
722- #region Create A Network Managed Objects
723-
724-
725- #endregion
726-
727- #region Draw Receive Calls
728- //Setting up Line Rendering Calls
729- private Dictionary < int , LineRenderer > lineRenderersInQueue = new Dictionary < int , LineRenderer > ( ) ;
730- private Dictionary < int , int > allStrokeIDValidator = new Dictionary < int , int > ( ) ;
731-
732- //To avoid duplicating stroke ids because sending different ids states ma
733- public void Draw_Refresh ( string stringData ) //Draw newData)
734- {
735- Draw newData = JsonUtility . FromJson < Draw > ( stringData ) ;
736-
737-
738- LineRenderer currentLineRenderer = default ;
739-
740- //we start a new line if there is no ID already corresponding to one in the scene
741- if ( ! allStrokeIDValidator . ContainsKey ( newData . strokeId ) )
742- {
743- GameObject lineRendCopy = Instantiate ( DrawingInstanceManager . Instance . lineRendererContainerPrefab ) . gameObject ;
744- lineRendCopy . name = "LineR:" + newData . strokeId ;
745-
746- lineRendCopy . transform . SetParent ( DrawingInstanceManager . Instance . externalStrokeParent , true ) ;
747- currentLineRenderer = lineRendCopy . GetComponent < LineRenderer > ( ) ;
748-
749- currentLineRenderer . positionCount = 0 ;
750-
751- allStrokeIDValidator . Add ( newData . strokeId , newData . strokeId ) ;
752- lineRenderersInQueue . Add ( newData . strokeId , currentLineRenderer ) ;
753- }
754-
755- //we get reference to the linenderer we are supposed to be working with
756- if ( lineRenderersInQueue . ContainsKey ( newData . strokeId ) )
757- currentLineRenderer = lineRenderersInQueue [ newData . strokeId ] ;
758-
759- switch ( newData . strokeType )
760- {
761- //Continues A Line
762- case ( int ) Entity_Type . Line :
763-
764- var brushColor = new Vector4 ( newData . curColor . x , newData . curColor . y , newData . curColor . z , newData . curColor . w ) ;
765- currentLineRenderer . startColor = brushColor ;
766- currentLineRenderer . endColor = brushColor ;
767- currentLineRenderer . widthMultiplier = newData . lineWidth ;
768-
769- ++ currentLineRenderer . positionCount ;
770- currentLineRenderer . SetPosition ( currentLineRenderer . positionCount - 1 , newData . curStrokePos ) ;
771-
772- break ;
773-
774- //Ends A Line A completes its setup
775- case ( int ) Entity_Type . LineEnd :
776-
777- ++ currentLineRenderer . positionCount ;
778- currentLineRenderer . SetPosition ( currentLineRenderer . positionCount - 1 , newData . curStrokePos ) ;
779-
780- //Create external client stroke instance
781- DrawingInstanceManager . Instance . CreateExternalClientStrokeInstance ( newData . strokeId , currentLineRenderer ) ; //new GameObject("LineRender:" + (newData.strokeId), typeof(BoxCollider//;
782-
783- break ;
784-
785- //Deletes a Line
786- case ( int ) Entity_Type . LineDelete :
787-
788- if ( NetworkedObjectsManager . Instance . networkedObjectFromEntityId . ContainsKey ( newData . strokeId ) )
789- {
790- if ( lineRenderersInQueue . ContainsKey ( newData . strokeId ) )
791- lineRenderersInQueue . Remove ( newData . strokeId ) ;
792-
793- Destroy ( NetworkedObjectsManager . Instance . networkedObjectFromEntityId [ newData . strokeId ] . gameObject ) ;
794- NetworkedObjectsManager . Instance . networkedObjectFromEntityId . Remove ( newData . strokeId ) ;
795- }
796- break ;
797-
798- case ( int ) Entity_Type . LineRender :
799-
800- if ( NetworkedObjectsManager . Instance . networkedObjectFromEntityId . ContainsKey ( newData . strokeId ) )
801- NetworkedObjectsManager . Instance . networkedObjectFromEntityId [ newData . strokeId ] . gameObject . SetActive ( true ) ;
802-
803- break ;
804-
805- case ( int ) Entity_Type . LineNotRender :
806-
807- if ( NetworkedObjectsManager . Instance . networkedObjectFromEntityId . ContainsKey ( newData . strokeId ) )
808- NetworkedObjectsManager . Instance . networkedObjectFromEntityId [ newData . strokeId ] . gameObject . SetActive ( false ) ;
809-
810- break ;
811- }
812- }
813-
814- #endregion
815-
816669 public void AddClientIfNeeded ( int id )
817670 {
818671 if ( NetworkUpdateHandler . Instance . client_id == id )
@@ -941,16 +794,8 @@ public void ApplyPositionToRightHand(Position positionData)
941794 }
942795
943796 #region Text Receive Calls
944-
945- public struct SpeechToText
946- {
947- public int session_id ;
948- public int client_id ;
949- public string text ;
950- public string type ;
951- public int ts ;
952- }
953-
797+ // TODO: as much as possible, move these functions to static functions
798+ // in SpeechToText.cs
954799 public void OnReceiveSpeechToTextSnippet ( string data )
955800 {
956801 var deserializedData = JsonUtility . FromJson < SpeechToText > ( data ) ;
@@ -989,13 +834,9 @@ public void ProcessSpeechToTextSnippet(SpeechToTextSnippet newText)
989834 clientIndex = avatarIndexFromClientId [ newText . target ] ;
990835 clientUsernameDisplays [ clientIndex ] . text = newText . text ;
991836 break ;
992-
993837 }
994-
995838 }
996839
997-
998-
999840 private static string SplitWordsByLength ( string str , int maxLength )
1000841 {
1001842 List < string > chunks = new List < string > ( ) ;
@@ -1057,10 +898,8 @@ public IEnumerator SetTextTimer(int textIndex, string textD, float seconds = 5)
1057898
1058899 }
1059900
1060-
1061901 public IEnumerator ShutOffText ( int textIndex , float seconds )
1062902 {
1063-
1064903 clientSpeechToTextDisplays [ textIndex ] . transform . parent . gameObject . SetActive ( true ) ;
1065904
1066905 // secondsToWaitDic[index] -= seconds;
0 commit comments