static bool Prefix(IngameChat __instance, string SentText, int Team) { if (!Main.enabled) { return(true); } try { if (Team == Main.ID_NUM) // Use the Team number to identify if this mod is being sent data { if (float.TryParse(SentText, out var t)) { Main.UpdateTimeScale(t); return(false); // Don't let the original "ReciveText" run } } } catch (Exception e) { Main.mod.Logger.Error(e.ToString()); } return(true); }
static bool Prefix(IngameChat __instance, string SentText, int Team) { if (!Main.enabled) { return(true); } try { if (Team == Main.ID_NUM) // Use the Team number to identify if this mod is being sent data { String[] caps = SentText.Split(','); if (int.TryParse(caps[0], out var fleet) && int.TryParse(caps[1], out var robot)) { Main.UpdateCaps(fleet, robot, false); // We are receiving data, so don't send it out again } return(false); // Don't let the original "ReciveText" run } } catch (Exception e) { Main.mod.Logger.Error(e.ToString()); } return(true); }
//[SerializeField] //private GameObject[] models; void Start() { playerTransform = transform.Find("Player"); nvs = GameObject.FindObjectOfType <NetworkVariables>(); username = playerTransform.GetComponentInChildren <TextMesh>(); //models = Resources.LoadAll<GameObject>("Prefabs/Player Models"); transform.SetParent(GameObject.Find("Players").transform); isAdmin = (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.OSXEditor); if (teleportSmoke != null) { ClientScene.RegisterPrefab(teleportSmoke); } if (isLocalPlayer) { //playerModel = Random.Range (0, models.Length); animMenuScript = GameObject.Find("HUD").transform.GetComponentInChildren <AnimationMenu>(); if (username.text == "USERNAME") { string[] types = { "adjectives", "animals" }; username.text = Wordlist.GenerateWordFromList(types); Color[] colors = { Color.red, Color.yellow, Color.green, Color.blue, Color.cyan }; username.color = colors[Random.Range(0, colors.Length)]; //transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform.GetChild(3).GetComponent<Renderer>().material.color = username.color; transform.GetChild(1).GetChild(0).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(1).GetChild(1).GetComponent <Renderer>().material.color = username.color; } username.transform.localScale = Vector3.zero; agent = playerTransform.GetComponent <NavMeshAgent>(); AnalyticsController.JoinMaze(username.text, username.color, nvs.mazeID); IngameChat.postLoginLogOut(true, username.text, username.color); startPosition = FindObjectOfType <NetworkStartPosition>().transform.position; } }
void OnDestroy() { IngameChat.postLoginLogOut(false, username.text, username.color); }