public override void DoAction(NWPlayer player, string pageName, int responseID) { DialogResponse response = GetResponseByID("MainPage", responseID); switch (responseID) { case 1: // End current call HoloComService.SetIsInCall(player, HoloComService.GetTargetForActiveCall(player), false); EndConversation(); break; case 2: // Accept incoming call HoloComService.SetIsInCall(player, HoloComService.GetCallSender(player), true); EndConversation(); break; case 3: // Decline incoming call HoloComService.SetIsInCall(player, HoloComService.GetCallSender(player), false); SendMessageToPC(player, "Your HoloCom call was declined."); EndConversation(); break; default: // Make a call to (NWPlayer) response.CustomData if (!HoloComService.IsInCall((NWPlayer)response.CustomData)) { HoloComService.SetIsCallSender(player); DelayCommand(1.0f, () => { CallPlayer(player, (NWPlayer)response.CustomData); }); } EndConversation(); break; } }
public void LoadMainMenu() { ClearPageResponses("MainPage"); string header = ColorTokenService.Green("HoloCom Menu\n\n"); SetPageHeader("MainPage", header); NWPlayer user = GetPC(); AddResponseToPage("MainPage", "End current call with " + HoloComService.GetTargetForActiveCall(user).Name, HoloComService.IsInCall(user), HoloComService.GetTargetForActiveCall(user)); AddResponseToPage("MainPage", "Answer incoming call from " + HoloComService.GetCallSender(user).Name, HoloComService.IsCallReceiver(user) && !HoloComService.IsInCall(user), HoloComService.GetCallSender(user)); AddResponseToPage("MainPage", "Decline incoming call from " + HoloComService.GetCallSender(user).Name, HoloComService.IsCallReceiver(user) && !HoloComService.IsInCall(user), HoloComService.GetCallSender(user)); if (HoloComService.IsCallReceiver(user) || HoloComService.IsInCall(user) || HoloComService.IsCallSender(user)) { return; } foreach (var player in NWModule.Get().Players) { if (player == user || !player.IsPlayer) { continue; } string message = "Call " + player.Name; if (HoloComService.IsInCall(player)) { message += ColorTokenService.Red(" (LINE BUSY)"); } AddResponseToPage("MainPage", message, true, player); } }
// not showing in chat menu and not a valid command. public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args) { HoloComService.SetIsInCall(user, HoloComService.GetTargetForActiveCall(user), false); }