11using BepInEx ;
2- using System ;
3- using UnityEngine ;
4- using Utilla ;
5- using System . Reflection ;
6- using System . IO ;
7- using System . Collections ;
8- using System . Collections . Generic ;
92using Photon . Pun ;
10- using UnityEngine . UI ;
11- using UnityEngine . InputSystem ;
123using PlayerModel . Player ;
134using PlayerModel . Utils ;
5+ using System ;
6+ using System . Collections . Generic ;
7+ using System . IO ;
148using System . Linq ;
9+ using System . Reflection ;
10+ using UnityEngine ;
1511using UnityEngine . Audio ;
12+ using UnityEngine . InputSystem ;
13+ using UnityEngine . UI ;
14+ using Utilla ;
1615
1716
1817namespace PlayerModel
@@ -31,7 +30,7 @@ void Awake()
3130 {
3231 Utilla . Events . GameInitialized += OnGameInitialized ;
3332 }
34-
33+
3534
3635 string rootPath ;
3736 public static string textSavePath ;
@@ -42,13 +41,13 @@ void Awake()
4241 public static List < Material > materials = new List < Material > ( ) ;
4342 public static Material defMat ;
4443 public static Material matalpha ;
45-
46-
44+
45+ private ClientScript clientScript ;
46+
4747
4848 public void OnGameInitialized ( object sender , EventArgs e )
4949 {
50- GameObject headcollider = GorillaLocomotion . Player . Instance . headCollider . gameObject ;
51- Debug . LogError ( "headcollider name is: " + headcollider . name ) ;
50+
5251 //LipSyncStart();
5352 for ( int thisReading = 0 ; thisReading < samples ; thisReading ++ )
5453 {
@@ -63,7 +62,7 @@ public void OnGameInitialized(object sender, EventArgs e)
6362 PlayerModelAppearance . playerGameObjects . Add ( GameObject . Find ( "Global/Local VRRig/Actual Gorilla/rig/body/head/gorillaface" ) ) ;
6463 PlayerModelAppearance . gorillabody = GorillaTagger . Instance . offlineVRRig . mainSkin . gameObject ;
6564
66-
65+
6766 rootPath = Directory . GetCurrentDirectory ( ) ;
6867
6968 playerpath = Path . Combine ( rootPath , "BepInEx" , "Plugins" , "PlayerModel" , "PlayerAssets" ) ;
@@ -159,7 +158,7 @@ public void OnGameInitialized(object sender, EventArgs e)
159158 {
160159 misc_orbs [ i ] . AddComponent < PlayerModelButton > ( ) . button = 4 + i ;
161160 misc_orbs [ i ] . GetComponent < PlayerModelButton > ( ) . setColour = false ;
162-
161+
163162 }
164163
165164 materials . Add ( Resources . Load < Material > ( $ "objects/equipment/materials/" + "bluealive" ) ) ;
@@ -171,7 +170,7 @@ public void OnGameInitialized(object sender, EventArgs e)
171170 for ( int i = 0 ; i < mat_preview . Length ; i ++ )
172171 {
173172 mat_preview [ i ] = misc_orbs [ i ] . GetComponent < MeshRenderer > ( ) . material ;
174-
173+
175174 }
176175
177176 GameObject left_empty = GameObject . CreatePrimitive ( PrimitiveType . Sphere ) ;
@@ -183,7 +182,7 @@ public void OnGameInitialized(object sender, EventArgs e)
183182 left_empty . transform . localScale = new Vector3 ( .03f , .5f , .03f ) ;
184183 right_empty . transform . localScale = new Vector3 ( .03f , .5f , .03f ) ;
185184
186-
185+
187186
188187 if ( File . Exists ( textSavePath ) )
189188 {
@@ -217,7 +216,7 @@ public void OnGameInitialized(object sender, EventArgs e)
217216 STARTPLAYERMOD = true ;
218217 //Debug.Log("PlayerModel v1.2.5");
219218 }
220-
219+
221220
222221 public static AudioSource _audioSource ;
223222 public static bool vflag = true ;
@@ -301,23 +300,23 @@ static public float AudioClipLoudness(int clipPosition, AudioClip clip)
301300
302301 return totalLoudness / sampleWindow ;
303302 }
304-
303+
305304 static string textfilename = "PlayerModelDefault.pmdefault" ;
306305 static string split = "," ;
307306 public static void writeToText ( int index_ , int IsGorilla_ , string name )
308307 {
309-
308+
310309 string text = index_ + split + IsGorilla_ + split + name ;
311310 File . WriteAllText ( textSavePath , text ) ;
312311 }
313312
314313 public static string [ ] readFromText ( string path )
315314 {
316-
315+
317316 string text = File . ReadAllText ( textSavePath ) ;
318317 string [ ] strings = text . Split ( ',' ) ;
319-
320-
318+
319+
321320 return strings ;
322321
323322 }
@@ -351,7 +350,7 @@ public static void ButtonPress(int button)
351350 {
352351 switch ( button )
353352 {
354-
353+
355354 case 1 :
356355 //Debug.Log("Selector Button Pressed");
357356 if ( nachotext == false )
@@ -374,7 +373,7 @@ public static void ButtonPress(int button)
374373 }
375374 else //playermodel is assaigned, and spressed select button
376375 {
377-
376+
378377 if ( assignedIndex == playerIndex ) //playermodel to gorilla
379378 {
380379 //Debug.Log("PlayerModel to Gorilla");
@@ -388,10 +387,10 @@ public static void ButtonPress(int button)
388387 PlayerModelController . UnloadModel ( ) ;
389388 player_main_material = null ;
390389
391-
390+
392391 assignedIndex = playerIndex ;
393-
394-
392+
393+
395394 }
396395 }
397396 //writeToText(assignedIndex, Convert.ToInt32(IsGorilla));
@@ -400,9 +399,9 @@ public static void ButtonPress(int button)
400399 break ;
401400 case 2 :
402401 playerIndex ++ ; //righjt
403- //Debug.Log("Right");
404-
405- if ( playerIndex > fileName . Length - 1 )
402+ //Debug.Log("Right");
403+
404+ if ( playerIndex > fileName . Length - 1 )
406405 playerIndex = 0 ;
407406 PlayerModelController . PreviewModel ( playerIndex ) ;
408407
@@ -411,7 +410,7 @@ public static void ButtonPress(int button)
411410 playerIndex -- ;
412411 //Debug.Log("Left");
413412 if ( playerIndex < 0 )
414- playerIndex = fileName . Length - 1 ; //10 items but starts from 0 so 0 to 9 = 10 items
413+ playerIndex = fileName . Length - 1 ; //10 items but starts from 0 so 0 to 9 = 10 items
415414 PlayerModelController . PreviewModel ( playerIndex ) ;
416415
417416 break ;
@@ -435,8 +434,8 @@ public static void ButtonPress(int button)
435434 }
436435
437436 public float currentTime = 0 ;
438-
439-
437+
438+
440439
441440 public float voiceDelay = 1 ;
442441 public const int samples = 10 ;
@@ -448,9 +447,9 @@ public static void ButtonPress(int button)
448447
449448 public void voiceSmoothing ( )
450449 {
451-
450+
452451 total -= readings [ readIndex ] ;
453-
452+
454453 readings [ readIndex ] = loudness ;
455454 // add the reading to the total:
456455 total = total + readings [ readIndex ] ;
@@ -461,18 +460,18 @@ public void voiceSmoothing()
461460 if ( readIndex >= samples )
462461 {
463462 // ...wrap around to the beginning:
464-
463+
465464 readIndex = 0 ;
466465 }
467466
468467 // calculate the average:
469468 avg = total / samples ;
470-
469+
471470 }
472471 public static float loudness ;
473472
474473 public float LipSyncWeight = 0 ;
475-
474+
476475 public bool LipSyncFlag = true ;
477476
478477 public bool InRoom = false ;
@@ -529,9 +528,9 @@ private void Update()
529528 PlayerModelController . localPositionY = 1f ;
530529 }
531530 }
532-
533531
534-
532+
533+
535534 PlayerModelController . rotationY -= 0.2f ;
536535
537536 /*loudness = GetLoudnessFromMic() * loudnessSensitivity;
@@ -551,14 +550,14 @@ private void Update()
551550
552551 if ( Keyboard . current . jKey . wasPressedThisFrame )
553552 SelectButton . GetComponent < PlayerModelButton > ( ) . Press ( ) ;
554-
553+
555554 if ( Keyboard . current . hKey . wasPressedThisFrame )
556555 LeftButton . GetComponent < PlayerModelButton > ( ) . Press ( ) ;
557556
558557 if ( Keyboard . current . kKey . wasPressedThisFrame )
559558 RightButton . GetComponent < PlayerModelButton > ( ) . Press ( ) ;
560559
561-
560+
562561 //Debug.Log(IsGorilla);
563562
564563 /*if (GorillaParent.instance.vrrigs.Count >= 1)
@@ -593,36 +592,36 @@ private void Update()
593592 PlayerModelController . AssignModel ( ) ;
594593 }
595594 }
596-
597-
598-
595+
596+
597+
599598
600599 if ( PhotonNetwork . InRoom )
601- {
602-
600+ {
601+
603602 if ( IsGorilla == true ) //in a room, is gorilla model
604603 {
605-
604+
606605 PlayerModelAppearance . ShowOfflineRig ( ) ;
607606 //PlayerModelAppearance.ShowOnlineRig();
608607 flag_inroom = true ;
609608 PlayerModelAppearance . flag1 = true ;
610-
609+
611610 clone_body = null ;
612611 }
613612 else //in a room, is playermodel
614613 {
615614 if ( playermodel != null )
616615 {
617-
616+
618617 PlayerModelAppearance . HideOfflineRig ( ) ;
619618 //PlayerModelAppearance.HideOnlineRig();
620619
621620 if ( PlayerModelController . CustomColors )
622621 PlayerModelAppearance . AssignColor ( ) ;
623622
624623 if ( PlayerModelController . GameModeTextures )
625-
624+
626625 PlayerModelAppearance . AssignMaterial ( playermodel ) ;
627626
628627 if ( PlayerModelController . LipSync )
@@ -631,34 +630,34 @@ private void Update()
631630 }
632631 }
633632
634-
635-
633+
634+
636635 }
637636 }
638637 else if ( ! PhotonNetwork . InRoom )
639638 {
640-
639+
641640
642641 flag_inroom = false ;
643642 clone_body = null ;
644643 if ( IsGorilla == true ) //not in a room, is gorilla model
645644 {
646-
645+
647646 PlayerModelAppearance . flag1 = true ;
648647 PlayerModelAppearance . ShowOfflineRig ( ) ;
649-
648+
650649 }
651650 else //not in a room, is playermodel
652651 {
653652 playermodel = GameObject . Find ( "playermodel.body" ) ;
654653 if ( playermodel != null )
655654 {
656-
655+
657656 PlayerModelAppearance . ResetMaterial ( playermodel ) ;
658657 PlayerModelAppearance . HideOfflineRig ( ) ;
659-
660658
661-
659+
660+
662661 if ( PlayerModelController . CustomColors )
663662 PlayerModelAppearance . AssignColor ( ) ;
664663
@@ -670,7 +669,7 @@ private void Update()
670669 }
671670
672671 }
673-
672+
674673 }
675674
676675 }
0 commit comments