//... // Call this method when a player has completed his turn and wants to // go onto the next player, which may be himself. public void playTurn() { int rand = Random.Range(0, 2); string nextParticipantId = mMatch.Participants[0].id; //string.Empty; if (nextParticipantId == mMatch.PendingParticipantId) { nextParticipantId = mMatch.Participants[1].id; } // Get the next participant in the game-defined way, possibly round-robin. //nextParticipantId = getNextParticipantId(); // Get the updated state. In this example, we simply use a // a pre-defined string. In your game, there may be more complicated state. string mTurnData = "1"; // At this point, you might want to show a waiting dialog so that // the current player does not try to submit turn actions twice. AndroidNativeUtility.ShowPreloader("Loading..", "Sending the tunr data next is " + nextParticipantId); // Invoke the next turn. We are converting our data to a byte array. System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] byteArray = encoding.GetBytes(mTurnData); GooglePlayTBM.Instance.TakeTrun(mMatch.Id, byteArray, nextParticipantId); }
public void ShowPreloader() { #if DEBUG_INFO Debug.Log("AndroidManager: attempting to show preloader"); #endif #if UNITY_ANDROID AndroidNativeUtility.ShowPreloader("Loading", "Please wait..."); #endif }
public void SaveGame() { AndroidNativeUtility.ShowPreloader("\"Game\"", "Saving Game...\n\nPlease, wait!"); try { StartCoroutine(MakeScreenshotAndSaveGameData()); } catch (Exception e) { Debug.Log("SaveGame Exception: " + e.Message); AndroidNativeUtility.HidePreloader(); } }
public void LoadGame() { AndroidNativeUtility.ShowPreloader("\"Game\"", "Loading Game...\n\nPlease, wait!"); GooglePlaySavedGamesManager.ActionAvailableGameSavesLoaded += ActionAvailableGameSavesLoaded; try { GooglePlaySavedGamesManager.Instance.LoadAvailableSavedGames(); } catch (Exception e) { Debug.Log("LoadGame Exception: " + e.Message); AndroidNativeUtility.HidePreloader(); } }
public static void ShowPreloader() { if (TimeOutTask != null) { return; } TimeOutTask = MultiplayerPreloaderTimeoutTask.Create(); if (Application.platform == RuntimePlatform.Android) { AndroidNativeUtility.ShowPreloader("", ""); } if (Application.platform == RuntimePlatform.IPhonePlayer) { IOSNativeUtility.ShowPreloader(); } }
//... // Call this method when a player has completed his turn and wants to // go onto the next player, which may be himself. public void playTurn() { //Before we play turn, lets update the data based on changes I have made. Common.playerInformation.ChangeGameDataValuesAccordingToMyData(); bool isAllready = Common.roundInformation.AllReady(); string nextParticipantId = ""; if (!isAllready) { nextParticipantId = Common.roundInformation.GetNextPlayerID(); //TODO SELVITÄ HALUTAANKOplayerID vai ID } else { Common.roundInformation.ChangeGameState(); nextParticipantId = Common.roundInformation.gameData.playerIDS[Common.roundInformation.gameData.roundDeciderPID]; //Common.roundInformation.GetNextPlayerID(); } // Get the next participant in the game-defined way, possibly round-robin. //nextParticipantId = getNextParticipantId(); // Get the updated state. In this example, we simply use a // a pre-defined string. In your game, there may be more complicated state. //string mTurnData = "My turn data sample"; // At this point, you might want to show a waiting dialog so that // the current player does not try to submit turn actions twice. // Invoke the next turn. We are converting our data to a byte array. //System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); AndroidNativeUtility.ShowPreloader("Loading..", "Sending the turn data newxt player " + nextParticipantId + " matchis " + mMatch.Id); byte[] byteArray = Common.roundInformation.GetData(); unShowTurnUI(); Invoke("unShowLoadingPopUp", 4f); GooglePlayTBM.Instance.TakeTrun(mMatch.Id, byteArray, nextParticipantId); }
private void ShowPreloader() { Invoke("HidePreloader", 2f); AndroidNativeUtility.ShowPreloader("Loading", "Wait 2 seconds please"); }