v0.3.24 - Bug fixes

This commit is contained in:
MaticIvesic committed 2025-03-01 15:54:24 +01:00
1 parent e56d95dee7
commit 2b7b5cbd6a
7 files changed
+40 -171

No files matched your search

+2
View File
@@ -99,6 +99,7 @@ public class PickupManager : MonoBehaviour
public void ActivateMissle()
{
misslePickup.EnableMissle();
}
public void ShootMissle(Transform target)
@@ -344,5 +345,6 @@ public class MisslePickup
{
missleButton.SetActive(false);
pickupManager.EnableMissle();
pickupManager.currentPickup = 0;
}
}
-135
View File
@@ -1,135 +0,0 @@
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;
using System;
using TMPro;
public class PlayGamesManager_old : MonoBehaviour
{
[SerializeField]
TMP_Text nicknameText;
private score score;
[SerializeField]
private shopManager shopManager;
// Start is called before the first frame update
void Start()
{
this.score = GetComponent<score>();
SignIn();
}
public void SignIn()
{
PlayGamesPlatform.Activate();
PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
OpenSave(false);
}
internal void ProcessAuthentication(SignInStatus status)
{
if (status == SignInStatus.Success)
{
// Continue with Play Games Services
string name = PlayGamesPlatform.Instance.GetUserDisplayName();
nicknameText.text = name;
}
else
{
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication).
}
}
#region SavedGames
private bool isSaving;
public void OpenSave(bool saving)
{
if(Social.localUser.authenticated)
{
isSaving = saving;
((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution("Save", DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, SavedGameOpen);
}
}
private void SavedGameOpen(SavedGameRequestStatus status, ISavedGameMetadata metadata)
{
if(status == SavedGameRequestStatus.Success)
{
if(isSaving) // Saving
{
byte[] myData = System.Text.ASCIIEncoding.ASCII.GetBytes(GetSaveString());
SavedGameMetadataUpdate updateForMetadata = new SavedGameMetadataUpdate.Builder().WithUpdatedDescription("I have played my game at: " + DateTime.Now.ToString()).Build();
((PlayGamesPlatform)Social.Active).SavedGame.CommitUpdate(metadata, updateForMetadata, myData, SaveCallback);
}
else // Loading
{
((PlayGamesPlatform)Social.Active).SavedGame.ReadBinaryData(metadata, LoadCallBack);
}
}
}
private void LoadCallBack(SavedGameRequestStatus status, byte[] data)
{
if(status == SavedGameRequestStatus.Success)
{
string loadedData = System.Text.ASCIIEncoding.ASCII.GetString(data);
LoadSavedString(loadedData);
}
}
private void LoadSavedString(string loadedData)
{
string[] cloudStringArr = loadedData.Split('|');
int highscore = int.Parse(cloudStringArr[0]);
int coins = int.Parse(cloudStringArr[1]);
string ownedPlanes = cloudStringArr[2];
score.SetHighscore(highscore);
shopManager.coins = coins;
shopManager.ConvertOwnedPlanes(ownedPlanes);
}
private string GetSaveString()
{
string dataToSave = "";
dataToSave += ((int)score.highscoreAmount).ToString() + "|" + shopManager.coins.ToString() + "|" + shopManager.GetOwnedPlanesString();
return dataToSave;
}
private void SaveCallback(SavedGameRequestStatus status, ISavedGameMetadata metadata)
{
if(status == SavedGameRequestStatus.Success)
{
Debug.Log("Successfully saved to the cloud");
}
else
{
Debug.Log("Failed to save to cloud");
}
}
#endregion
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: dce2ad60d23539e44a8422890ae506cc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: