public static bool Prefix(HintDisplay __instance, Hint hint) { if (hint == null) { throw new ArgumentNullException("hint"); } if (__instance.isLocalPlayer) { throw new InvalidOperationException("Cannot display a hint to the local player (headless server)."); } if (NetworkServer.active) { Player player = Player.Get(__instance.gameObject); if (player == null) { return(false); } if (hint is TextHint textHint) { player.QueueHint(textHint.Text, hint.DurationScalar, int.MaxValue, false, true); return(false); } NetworkServer.SendToClientOfPlayer <HintMessage>(__instance.netIdentity, new HintMessage(hint)); return(false); } return(false); }
void Start() { // Define the different layers used for this level. Shift the bits of // the layer mask based on the position of the layers. interactble_layer = 1 << 9; hint_display = (HintDisplay)this.GetComponent("HintDisplay"); }
public void SpawnOne(int i) { // 60 width of item float spawnY = i * ItemHeight; //newSpawn Position Vector3 pos = new Vector3(0, -spawnY, 0); //instantiate item GameObject SpawnedItem = Instantiate(item, pos, SpawnPoint.rotation); //setParent SpawnedItem.transform.SetParent(SpawnPoint, false); //get ItemDetails Component HintDisplay hintDisplay = SpawnedItem.GetComponent <HintDisplay>(); hintDisplay.hint = hints[i]; }
public static void Postfix(HintDisplay __instance, Hint hint) { // Try to get the player, if it doesn't exist, just return if (!(Player.Get(__instance.gameObject) is Player player)) { return; } // If Player value has couroutine, kill it if (playerHasHintCoroutines.TryGetValue(player, out CoroutineHandle oldcoroutine)) { // Kill the coroutine Timing.KillCoroutines(oldcoroutine); } // Create a new couroutine and assing the value to the player playerHasHintCoroutines[player] = Timing.RunCoroutine(HasHintToFalse(player, hint.DurationScalar)); // If it is false, then to true if (!player.HasHint) { player.HasHint = true; } }
public static void ShowText(this HintDisplay hints, string text, float duration) { hints.Show(new TextHint(text, new HintParameter[] { new StringHintParameter("") }, null, duration)); }