private void _ThreadWork(Vector3[] vec, float time) { Vector3[] vertices = new Vector3[vec.Length]; for (int i = 0; i < vertices.Length; i++) { Vector3 vertex = baseHeight[i]; vertex.y += Mathf.Sin(time * speed + baseHeight[i].x + baseHeight[i].y + baseHeight[i].z) * scale; vertex.y += Mathf.PerlinNoise(baseHeight[i].x + noiseWalk, baseHeight[i].y + Mathf.Sin(time * 0.1f)) * noiseStrength; vertices[i] = vertex; } MainThread.Call(() => _Cb(vertices)); }
public void ShowOnMainThread(string message) { MainThread.Call(_Show, message); }
// Update is called once per frame void Update() { if (rgc == null) { rgc = BalanceUnity.ACCESS().GetRGC(); rgc.OnMatchDisband += packet => { MainThread.Call(() => { removeOthers(); removePlayer(); }); }; rgc.OnMatchEnd += packet => { MainThread.Call(() => { removeOthers(); removePlayer(); }); }; rgc.OnMatchExit += () => { MainThread.Call(() => { removeOthers(); removePlayer(); }); }; rgc.OnOtherMatchExit += otherId => { MainThread.Call(() => { removeSingleOther(otherId); }); }; rgc.OnUdpClientClose += () => { Debug.Log("udp disconnected."); MainThread.Call(() => { removeOthers(); removePlayer(); }); }; rgc.OnMatchStart += packet => { Debug.Log("OnMatchStart."); MainThread.Call(() => { spawnPlayer(); }); }; rgc.OnMatchValidated += () => { Debug.Log("OnMatchValidated."); }; rgc.OnStatesUpdate += states => { //Debug.Log("OnStatesUpdate."); MainThread.Call(() => { handleStates(states); }); }; } int now = (int)(Time.time * 1000); if (now - lastUpdated >= updateMs) { lastUpdated = now; if (rgc.IsInMatch()) { if (Player != null && Player.transform != null) { rgc.SendUdpStateUpdate(getStateUpdate()); } } } }
public void SetTextOnMainThread(string text) { MainThread.Call(SetText, text); }
public void DecrementPowerUp(PowerTypes powerType, Action doIfHasPower) { if (!isLocalPlayer) { return; } switch (powerType) { case PowerTypes.Mirror: var currentMirrors = CurrentMirrors(); Debug.LogError("ANZAHL VON MIRRORS: " + currentMirrors); //if (currentMirrors == 0) return; user["mirrors"] = currentMirrors - 1; break; case PowerTypes.Noiz: var currentNoiz = CurrentNoiz(); //if (currentNoiz == 0) return; user["noiz"] = currentNoiz - 1; break; case PowerTypes.Boom: var currentBooms = CurrentBooms(); if (currentBooms == 0) { return; } user["booms"] = currentBooms - 1; break; default: break; } if (!user.IsAuthenticated) { GuiManager.Instance.message.For(2).Show("NOT AUTHENTICATED"); Debug.LogError("ERROR: " + "NOT AUTHENTICATED"); } user.SaveAsync() .ContinueWith(task => { if (task.IsCompleted && (task.IsFaulted || task.IsCanceled)) { GuiManager.Instance.message.For(2).ShowOnMainThread("Cant add -1 powerUp"); Debug.LogError("Cant substract powerup"); GuiManager.Instance.loading.HideOnMainThread(); // Errors from Parse Cloud and network interactions using (IEnumerator <System.Exception> enumerator = task.Exception.InnerExceptions.GetEnumerator()) { if (enumerator.MoveNext()) { ParseException error = (ParseException)enumerator.Current; GuiManager.Instance.message.For(2).ShowOnMainThread(error.Message); Debug.LogError("ERROR: " + error.Message + " " + error.Code); } } } else { MainThread.Call(() => { doIfHasPower.Invoke(); UpdateUi(); }); GuiManager.Instance.message.For(2).ShowOnMainThread("PowerUp -1 :)"); Debug.LogError("Substacted power up"); } }); }
public void HideOnMainThread() { MainThread.Call(Hide); }
public void ShowOnMainThread() { MainThread.Call(Show); }
public void ShowUserStatsPage() { MainThread.Call(ShowPage, "UserStatsPage"); }
public void ShowBattleGroundNamedLobbyPage() { MainThread.Call(ShowPage, "BattleGroundNamedLobbyPage"); }
public void ShowLoginPage() { MainThread.Call(ShowPage, "LoginPage"); }
public void ShowUserHomePage() { MainThread.Call(ShowPage, "UserHomePage"); }
public void ShowQuizPage() { MainThread.Call(ShowPage, "QuizPage"); }
public void ShowSignUpAditionalInfoPage() { MainThread.Call(ShowPage, "SignUpAdditionalInfo"); }
public void ShowQuizResultsPage() { MainThread.Call(ShowPage, "QuizResults"); }
public void ShowSplashPage() { MainThread.Call(ShowPage, "SplashPage"); }
public void ShowWaitingForUserPage() { MainThread.Call(ShowPage, "WaitingForUsersPage"); }