Skip to content

Commit

Permalink
asadfadSADFGSDASGBsdasfodubahdsfouabfoub
Browse files Browse the repository at this point in the history
  • Loading branch information
pnhalim committed May 22, 2024
1 parent 853038a commit c82e9f4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
13 changes: 13 additions & 0 deletions Assets/CLAWS/2-Geosampling/GeosamplingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ public static void CreateLoadedGeosample(Geosample sample)
}


public static void SendData(Geosample Sample)
{
for (int i = 0; i < AstronautInstance.User.GeosampleData.AllGeosamples.Count; i++)
{
if (AstronautInstance.User.GeosampleData.AllGeosamples[i].geosample_id == Sample.geosample_id)
{
AstronautInstance.User.GeosampleData.AllGeosamples[i] = Sample;
}
}
GameObject.Find("Controller").GetComponent<WebsocketDataHandler>().SendGeosampleData();
EventBus.Publish<GeosampleSentEvent>(new());
}

public static void SendData()
{
GameObject.Find("Controller").GetComponent<WebsocketDataHandler>().SendGeosampleData();
Expand Down
2 changes: 1 addition & 1 deletion Assets/CLAWS/2-Geosampling/GeosamplingZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void Init()

AstronautInstance.User.GeosampleZonesData.AllGeosampleZones.Add(Zone);

GeosamplingManager.SendData();
GeosamplingManager.SendData();
StartCoroutine(TrackUserLocation());
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/GeosamplingPhotoScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void UseThisPhoto()
{
Geosample.SetPhoto(s);
Geosample.Sample.photo_jpg = s;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Geosample.Sample);
}
else
{
Expand Down
24 changes: 12 additions & 12 deletions Assets/SingleGeosampleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public void Load(Geosample Sample_f)
Sample = Sample_f;

CurrentScreen = GeoSampleScreens.None;
SetZone(((char)('A' + (char)(Sample.zone_id++ % 27))).ToString());
SetSampleName("Sample " + Sample.geosample_id);
// SetZone(((char)('A' + (char)(Sample.zone_id++ % 27))).ToString());
// SetSampleName("Sample " + Sample.geosample_id);
SetDescription(Sample.description);
SetStar();
StarredIcon.SetActive(Sample_f.starred);
Expand Down Expand Up @@ -205,7 +205,7 @@ public void waitingForXRF(XRFScanEvent e)
XRFReadings.SetActive(true);

Sample.eva_data.data = e.data;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}

public void OnShapeButtonPressed()
Expand Down Expand Up @@ -349,7 +349,7 @@ public void SetSampleName(string name)
{
Name_tmp.text = name;

GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetID()
{
Expand All @@ -376,7 +376,7 @@ public void SetZone(string letter)
}

SetZoneId();
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetCoordinates()
{
Expand All @@ -396,7 +396,7 @@ public void SetRockType(string name)
// called after xrf scan
RockType_tmp.text = name;
Sample.rock_type = name;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
[SerializeField]
public void SetShape(GeosamplingShape shape_in)
Expand Down Expand Up @@ -437,7 +437,7 @@ public void SetShape(GeosamplingShape shape_in)
break;
}

GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
CloseCurrentScreen();
}
public void SetShape(string shape_in)
Expand Down Expand Up @@ -477,33 +477,33 @@ public void SetShape(string shape_in)
Debug.Log("setting shape to " + shape.ToString());
Shape_visual.SetShape(shape);

GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
CloseCurrentScreen();
}
public void SetColor(string hex)
{
Color_visual.SetColor(hex);
Sample.color = hex;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetPhoto(string jpg)
{
Sample.photo_jpg = jpg;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetDescription(string desc)
{
desc = desc.Trim();
Sample.description = desc;
Description.text = desc;
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetNote()
{
// TODO update tmp

// TODO update Sample.note
GeosamplingManager.SendData();
GeosamplingManager.SendData(Sample);
}
public void SetStar()
{
Expand Down

0 comments on commit c82e9f4

Please sign in to comment.