Full Rotator Sync

This commit is contained in:
brausjonas
2023-04-14 17:49:48 +02:00
parent 0742ff15b4
commit 9000450834
10 changed files with 206 additions and 183 deletions
+1 -1
View File
@@ -165,7 +165,7 @@
<workItem from="1680813239896" duration="4155000" />
<workItem from="1681056387914" duration="882000" />
<workItem from="1681415672515" duration="5000" />
<workItem from="1681479671396" duration="5656000" />
<workItem from="1681479671396" duration="7481000" />
</task>
<servers />
</component>
+30 -30
View File
@@ -1298,8 +1298,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -1307,8 +1307,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -1317,7 +1317,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
@@ -7855,8 +7855,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -7864,8 +7864,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -7874,7 +7874,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
@@ -15703,8 +15703,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -15712,8 +15712,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -15722,7 +15722,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
@@ -29023,8 +29023,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -29032,8 +29032,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -29042,7 +29042,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
@@ -38995,8 +38995,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -39004,8 +39004,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -39014,7 +39014,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
@@ -46502,8 +46502,8 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0.008106232
value: 0.689188
time: 0
value: 0.14864922
inSlope: 0
outSlope: 0
tangentMode: 0
@@ -46511,8 +46511,8 @@ ParticleSystem:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.57541054
value: 0.4783156
time: 0.57811135
value: 0.3161528
inSlope: -0.19598381
outSlope: -0.19598381
tangentMode: 0
@@ -46521,7 +46521,7 @@ ParticleSystem:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.43243706
value: 0.25676262
inSlope: -0.11902377
outSlope: -0.11902377
tangentMode: 0
+68
View File
@@ -9,6 +9,7 @@ using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Random = UnityEngine.Random;
public class Client : MonoBehaviour
{
@@ -290,6 +291,44 @@ public class Client : MonoBehaviour
}
players[job.data[3]].AddCoins(amount);
break;
case 14:
int type = job.data[9];
RandomRotator rotator = uiHandler.rotator.GetComponent<RandomRotator>();
switch (type)
{
case 0:
for (int i = 0; i < 4; i++)
{
int option = job.data[i + 1];
int value = job.data[i + 5];
switch (option)
{
case 0:
rotator.SetOptionsText(i, value + " Coins");
break;
case 1:
rotator.SetOptionsText(i, "-" + value + " Coins");
break;
case 2:
rotator.SetOptionsText(i, "Random Item");
break;
}
}
break;
}
uiHandler.ActivateRotator();
rotator.StartRandom();
break;
case 15:
RandomRotator rotator2 = uiHandler.rotator.GetComponent<RandomRotator>();
rotator2.Stop(job.data[1]);
Invoke("ActivateLayout1", 3.5f);
break;
case 126:
stream.Write(new byte[]{126, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 10);
break;
@@ -301,6 +340,11 @@ public class Client : MonoBehaviour
}
}
private void ActivateLayout1()
{
uiHandler.ActivateLayout1();
}
private void Activate(int player)
{
for (int i = 0; i < players.Length; i++)
@@ -402,9 +446,33 @@ public class Client : MonoBehaviour
if (amount < 0)
{
isPositive = 0;
amount *= -1;
}
stream.Write(new byte[]{13, isPositive, (byte)amount, 0, 0, 0, 0, 0, 0, 0});
}
/*
* OPT:
* 0 = Get Coins
* 1 = Loose Coins
* 2 = Get Item (Random)
* 3 = Loose Item (Random)
*
* VAL:
* value of each option (not needed = 0)
*
* TYPE:
* 0 = Pink Field
*/
public void SendStartRotator(int opt1, int opt2, int opt3, int opt4, int val1, int val2, int val3, int val4, int type)
{
stream.Write(new byte[]{14, (byte)opt1, (byte)opt2, (byte)opt3, (byte)opt4, (byte)val1, (byte)val2, (byte)val3, (byte)val4, (byte)type});
}
public void SendStopRotator(int stopIndex)
{
stream.Write(new byte[]{15, (byte)stopIndex, 0, 0, 0, 0, 0, 0, 0, 0});
}
}
@@ -270,7 +270,8 @@ public class PlayablePlayer : Player
rotator.SetOptionsText(3, "Random Item");
rotator.StartRandom();
client.SendStartRotator(0, 0, 1, 2, randCoins1, randCoins2, -randCoins3, 0, 0);
int randomOption = Random.Range(0, 4);
switch (randomOption)
{
@@ -489,6 +490,7 @@ public class PlayablePlayer : Player
private void StopRotator()
{
client.SendStopRotator(rotatorStopIndex);
rotator.Stop(rotatorStopIndex);
}
}
+12 -6
View File
@@ -14,6 +14,7 @@ public class RandomRotator : MonoBehaviour
private float lastTimeSwitched = 0;
private int stopIndex = 0;
public UIHandler uiHandler;
private bool ended = false;
public void SetOptionsText(int index, string text)
{
@@ -45,31 +46,35 @@ public class RandomRotator : MonoBehaviour
lastTimeSwitched = Time.time;
ColorOption(currentIndex);
currentIndex++;
if (currentIndex > options.Length)
if (currentIndex >= options.Length)
{
currentIndex = 0;
}
}
}
else
else if(!ended)
{
if (currentIndex != stopIndex)
{
if (Time.time - lastTimeSwitched > slowDown)
{
slowDown += 0.2f;
slowDown += 0.05f;
lastTimeSwitched = Time.time;
ColorOption(currentIndex);
currentIndex++;
if (currentIndex > options.Length)
if (currentIndex >= options.Length)
{
currentIndex = 0;
}
}
}
else
if(currentIndex == stopIndex)
{
ColorOption(stopIndex);
if (Time.time - lastTimeSwitched > slowDown)
{
ColorOption(stopIndex);
ended = true;
}
}
}
}
@@ -78,6 +83,7 @@ public class RandomRotator : MonoBehaviour
{
lastTimeSwitched = Time.time;
started = true;
ended = false;
}
public void Stop(int index)