public override void Execute() { if (UnityEngine.Input.GetKey(KeyCode.LeftAlt)) { DiscordJoinRequestGui.Select(); } }
public static IEnumerator SpawnGui(User requestingUser) { user = requestingUser; yield return AssetBundleLoader.LoadUIAsset("discordjoinrequest", false, guiGameObject => { instance = guiGameObject.AddComponent<DiscordJoinRequestGui>(); profilePicture = guiGameObject.FindChild("ProfilePicture").GetComponent<Image>(); pressToFocus = guiGameObject.FindChild("PressToFocus"); Text[] texts = pressToFocus.GetComponentsInChildren<Text>(); texts[0].text = Language.main.Get("Nitrox_DiscordPressToFocus"); texts[3].text = GameInput.GetBinding(GameInput.Device.Keyboard, (GameInput.Button)46, GameInput.BindingSet.Primary); pressToFocus.SetActive(true); pressButtons = guiGameObject.FindChild("PressButtons"); pressButtons.SetActive(false); Text[] buttonTexts = pressButtons.GetComponentsInChildren<Text>(true); buttonTexts[0].text = Language.main.Get("Nitrox_DiscordAccept"); buttonTexts[1].text = Language.main.Get("Nitrox_DiscordDecline"); Button[] buttons = pressButtons.GetComponentsInChildren<Button>(true); buttons[0].onClick.AddListener(instance.AcceptInvite); buttons[1].onClick.AddListener(instance.DeclineInvite); Text[] userTexts = guiGameObject.FindChild("UpperText").GetComponentsInChildren<Text>(); userTexts[0].text = $"{user.Username}#{user.Discriminator}"; userTexts[1].text = Language.main.Get("Nitrox_DiscordRequestText"); }); yield return LoadAvatar(user.Id, user.Avatar); }
private void ActivityJoinRequest(ref User user) { if (!showingWindow && Multiplayer.Active) { Log.Info($"[Discord] JoinRequest: Name:{user.Username}#{user.Discriminator} UserID:{user.Id}"); StartCoroutine(DiscordJoinRequestGui.SpawnGui(user)); showingWindow = true; } else { Log.Debug("[Discord] Request window is already active."); } }
public void RequestCallback(ref DiscordRpc.DiscordUser request) { if (!ShowingWindow) { Log.Info($"[Discord] JoinRequest: Name:{request.username}#{request.discriminator} UserID:{request.userId}"); DiscordJoinRequestGui acceptRequest = gameObject.AddComponent <DiscordJoinRequestGui>(); acceptRequest.Request = request; ShowingWindow = true; } else { Log.Debug("[Discord] Request window is already active."); } }
public void RequestCallback(ref DiscordRpc.DiscordUser request) { if (!ShowingWindow) { Log.Info(string.Format("Discord: join request {0}#{1}: {2}", request.username, request.discriminator, request.userId)); DiscordJoinRequestGui acceptRequest = gameObject.AddComponent <DiscordJoinRequestGui>(); acceptRequest.Request = request; lastJoinRequestUserID = request.userId; ShowingWindow = true; } else { Log.Info("Discord: Request window is allready active."); } }