public void sendPing() { if (!instance.CounterSocket.Connected) { instance.mEnabled.Value = false; if (GameUI.m_Instance != null) { PopUpWarning.Display("Connection with application has been lost!\nDisabled the mod"); } CounterSocket.Close(); return; } byte[] data = new byte[1]; data[0] = 15; try { CounterSocket.Send(data); } catch (Exception e) { Debug.Log("Something went wrong while trying to send data!\n" + e.ToString()); instance.mEnabled.Value = false; if (GameUI.m_Instance != null) { PopUpWarning.Display("Connection with application has been lost!\nDisabled the mod"); } CounterSocket.Close(); } }
private static void popup_test() { GameUI.ShowMessage(ScreenMessageLocation.TOP_LEFT, "hey", 5f); PopUpMessage.DisplayOkOnly("ok only", null); PopUpMessage.Display("ok and cancel", null); PopUpMessage.Display("ok and cancel", null, () => {}); PopUpWarning.Display("PopUpWarning"); PopUpTwoChoices.Display( "PopUpTwoChoices", "aaa", "bbb", () => { return; }, () => { return; }); PopupInputField.Display( "PopUpInputField", "default", (result) => { uConsole.Log("You typed: " + result); } ); }
public void Display() { PopUpWarning.Display( message, category ); GameUI.m_Instance.m_PopUpWarning.m_NeverShowAgainToggle.transform.parent.gameObject.SetActive(false); }
public virtual void setSettings(string settings) { Logger.LogError("setSettings() Function Not Implemented, Please Have Mod Author Fix"); if (Profile.m_NeverShowAgain.Contains(PopUpWarningCategory.OLDER_PHYSICS_ENGINE)) { return; } PopUpWarning.Display("Something tried to automatically set the settings for a mod, but the mod doesn't support this feature. Try setting them manually.", PopUpWarningCategory.OLDER_PHYSICS_ENGINE); }
private void Update() { PopupQueue.TryShowNextPopup(); if (numEnabledCheatMods() > 0 && Bridge.IsSimulating() && !BridgeCheat.m_Cheated) { GameStateSim.m_BudgetUsed = Mathf.RoundToInt(Budget.CalculateBridgeCost()); BridgeCheat.m_Cheated = BridgeCheat.CheckForCheating((float)GameStateSim.m_BudgetUsed); } if (!flag && globalToggleHotkey.Value.IsDown()) { flag = true; if (this.isEnabled) { this.isEnabled = modEnabled.Value = false; this.disableMod(); } else { this.isEnabled = modEnabled.Value = true; this.enableMod(); } if (modsToggledSummary.Length > 0) { PopUpWarning.Display(modsToggledSummary); } //Logger.LogMessage(modsToggledSummary); } else if (flag & globalToggleHotkey.Value.IsUp()) { flag = false; } if (autoDraw == null) { var autoDraw = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/GridStress/ButtonsHorizontalLayout/ButtonContainer_AutoDraw"); if (autoDraw == null) { return; } autoDraw.SetActive(true); sandbox = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox"); sandboxSettings = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_SandboxSettings"); sandboxCreate = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Create"); sandboxVehicles = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Vehicles"); sandboxWorkshop = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Workshop"); sandboxResources = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Resources"); } sandboxCreate.SetActive(GameStateManager.GetState() == GameState.SANDBOX); sandboxVehicles.SetActive(GameStateManager.GetState() == GameState.SANDBOX); sandboxWorkshop.SetActive(GameStateManager.GetState() == GameState.SANDBOX); sandboxSettings.SetActive(true); sandboxResources.SetActive(true); sandbox.SetActive((sandboxEverywhere.Value && PolyTechMain.modEnabled.Value) || GameStateManager.GetState() == GameState.SANDBOX); }
public void sendReset() { if (!instance.LivesplitSocket.Connected) { if (GameUI.m_Instance != null) { PopUpWarning.Display("Could not send reset command to Live Split\nnot connected!"); } return; } byte[] byData = Encoding.ASCII.GetBytes("reset\r\n"); instance.LivesplitSocket.Send(byData); }
public static bool uploadScorePatch( LeaderboardsUploadBody body, string levelID, bool didBreak, LeaderboardUploadScore.OnUploadScoreDelegate callback, Queue <LeaderboardUploadScore> ___m_ScoresToUpload ) { int score = body.m_Value; int minScore = leaderboardProtMin.Value; bool allowedBudget = score >= minScore; if (leaderboardBlock.Value) { if (allowedBudget) { PopUpWarning.Display($"Your score would be {score}, however you have blocked all scores from being uploaded in the PTF settings."); } else { PopUpWarning.Display($"Your score ({score}) was below the minimum set in the PTF settings ({minScore})."); } GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh(); return(false); } if (!allowedBudget) { PopUpWarning.Display($"Your score {score} was below the minimum budget {minScore} and as such will not be submitted."); GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh(); return(false); } //PopUpMessage.Display($"Your score {score} was above or equal to the minimum budget {leaderboardProtMin.Value}.", () => {}); if (leaderboardCheck.Value) { PopUpMessage.Display($"Would you like to upload your score of {score} to the leaderboard?", () => { // On Yes LeaderboardUploadScore item = new LeaderboardUploadScore(body, didBreak, levelID, callback); ___m_ScoresToUpload.Enqueue(item); }, () => { // On No GameUI.m_Instance.m_LevelComplete.m_LeaderboardPanel.ForceRefresh(); }); return(false); } return(true); }
/// <summary> /// Method which connects client to the server. /// </summary> /// <returns>The connect.</returns> public async Task Connect() { Debug.Log("Connecting to: " + serverUri); try { await ws.ConnectAsync(serverUri, CancellationToken.None); } catch (Exception e) { PopUpWarning.Display($"Error Occurred trying to connect to server: {e.Message}"); MultiplayerMod.MultiplayerMod.Disconnect(); } while (IsConnecting()) { Debug.Log("Waiting to connect..."); Task.Delay(50).Wait(); } Debug.Log("Connect status: " + ws.State); if (ws.State == WebSocketState.Open) { MultiplayerMod.MultiplayerMod.instance.communication.Lobby.OnConnectedToServer?.Invoke(); } }
public void onSettingChanged(object sender, EventArgs e) { if (!CheckForCheating()) { return; } try { LivesplitSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPAddress ipAdd = IPAddress.Parse(mIP.Value); IPEndPoint remoteEP = new IPEndPoint(ipAdd, mPort.Value); LivesplitSocket.Connect(remoteEP); } catch { if (GameUI.m_Instance != null) { PopUpWarning.Display("Could not connect to Live Split server using port: " + mPort.Value + "\nAre you using the right ip and port?"); } Debug.LogWarning("Could not connect to Live Split server using port: " + mPort.Value); } }
public void onEnableDisable(object sender, EventArgs ev) { if (mEnabled.Value) { CounterSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); IPEndPoint remoteEP = new IPEndPoint(ipAddress, 23232); CounterSocket.Connect(remoteEP); Debug.Log("Connected to application server"); nums = new int[8]; sendDigitData(mDigits.Value); sendOnTopData(mOnTop.Value); } catch (Exception e) { instance.mEnabled.Value = false; Debug.Log("Something went wrong while trying to connect to the piece counter application: " + e.ToString()); if (GameUI.m_Instance != null) { PopUpWarning.Display("Could not connect to the application!\nDisabled the mod"); } } } else { if (CounterSocket.Connected) { sendClose(); CounterSocket.Close(); } CounterSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } }
public static bool Prefix( ref Vector3 ___m_StartPos, ref Vector3 ___m_StartPivot, ref float ___m_StartOrthographicSize, ref Vector3 ___m_EndPos, ref Vector3 ___m_EndPivot, ref float ___m_EndOrthographicSize, ref Quaternion ___m_EndRot, ref float ___m_ElapsedSeconds, ref float ___m_TransitionSeconds, ref bool ___m_Slerping ) { if (CinemaCamera.Activated()) { if (ModdedCinemaCamera.keyFrames.Count == 0) { CameraInterpolate.Cancel(); return(false); } else if (ModdedCinemaCamera.keyFrames.Count < 2) { PopUpWarning.Display("You must add at least 2 keyframes to use the cinematic camera!"); CameraInterpolate.Cancel(); return(false); } ___m_ElapsedSeconds += Time.unscaledDeltaTime; float num = Mathf.Clamp01(___m_ElapsedSeconds / ___m_TransitionSeconds); Vector3 vector = ModdedCinemaCamera.PivotHandler.Interpolate(ModdedCinemaCamera.current_start, num); Vector3 normalized3 = ModdedCinemaCamera.InterpolateHandler.Interpolate(ModdedCinemaCamera.current_start, num).normalized; // testing smooth movement PointsOfView.m_Pivot = vector; Cameras.MainCamera().transform.position = vector + normalized3 * GameSettings.CamDistFromPivot(); Cameras.MainCamera().transform.LookAt(vector); Cameras.SetOrthographicSize(Mathf.SmoothStep(___m_StartOrthographicSize, ___m_EndOrthographicSize, num)); Bridge.RefreshZoomDependentVisibility(); if (Mathf.Approximately(num, 1f)) { ModdedCinemaCamera.current_start += 1; ModdedCinemaCamera.current_end += 1; if (ModdedCinemaCamera.current_end >= ModdedCinemaCamera.keyFrames.Count) { CameraInterpolate.Cancel(); } else { CameraKeyFrame target = ModdedCinemaCamera.keyFrames[ModdedCinemaCamera.current_end]; CameraInterpolate.SlerpTo( target.m_StartPivot, target.m_StartPos, target.m_StartRot, target.m_StartOrthographicSize, target.m_DurationSeconds, target.m_Ease ); } } CameraControl.RegisterTransformUpdate(); return(false); } return(true); }