示例#1
0
        public async Task OnTick()
        {
            await Task.FromResult(0);

            phoneScaleform.CallFunction("DISPLAY_VIEW", 23);
            phoneScaleform.CallFunction("SET_DATA_SLOT", 23, 0, -99, 0, 100, 1, false);
            phoneScaleform.CallFunction("SET_DATA_SLOT", 23, 1, 50, 100, 25, 105);
            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_LEFT, true, (int)PhoneSelectIcon.ICON_BLANK);

            if (Game.IsControlJustPressed(0, Control.PhoneCancel))
            {
                PhoneAppStarter.MainApp();
            }
        }
        public async Task OnTick()
        {
            await Task.FromResult(0);

            int slot = 0;

            if (inSubMenu)
            {
                phoneScaleform.CallFunction("SET_DATA_SLOT", 2, slot++, -1, Strings.PHONE_APP_PLAYERLIST_SEND);
            }
            else
            {
                Player[] players = new PlayerList().Where(player => player != Game.Player).ToArray();
                playersInGame = players.Length == 0 ? false : true;
                if (!playersInGame)
                {
                    phoneScaleform.CallFunction("SET_DATA_SLOT", 13, slot++, -1, Strings.PHONE_APP_PLAYERLIST_NO_PLAYERS);
                }
                else
                {
                    foreach (Player player in players)
                    {
                        phoneScaleform.CallFunction("SET_DATA_SLOT", 13, slot++, -1, player.Name);
                    }
                }
            }
            phoneScaleform.CallFunction("SET_HEADER", inSubMenu ? selectedPlayer.Name : Strings.PHONE_APP_PLAYERLIST);
            phoneScaleform.CallFunction("DISPLAY_VIEW", inSubMenu ? 2 : 13, selected);

            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_RIGHT, true, (int)PhoneSelectIcon.ICON_BACK);
            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_LEFT, true,
                                        slot > 0 ? (int)PhoneSelectIcon.ICON_SELECT : (int)PhoneSelectIcon.ICON_BLANK);

            bool pressed = false;

            if (Game.IsControlJustPressed(0, Control.PhoneUp) && slot > 0)
            {
                if (--selected < 0)
                {
                    selected = slot - 1;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneDown) && slot > 0)
            {
                if (++selected > slot - 1)
                {
                    selected = 0;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneSelect) && slot > 0)
            {
                if (playersInGame)
                {
                    if (!inSubMenu)
                    {
                        inSubMenu = true;
                        int selectedTemp = selected;
                        if (selected == Game.Player.Handle)
                        {
                            selectedTemp++;
                        }
                        selectedPlayer = new Player(selectedTemp);
                    }
                    else
                    {
                        string message = await Game.GetUserInput(60);

                        if (message != null)
                        {
                            message = message.Trim();
                            if (message.Length == 0)
                            {
                                Screen.ShowNotification(Strings.PHONE_APP_PLAYERLIST_SEND_NO_MSG);
                            }
                            else
                            {
                                BaseScript.TriggerServerEvent(Events.MESSAGE_FORWARD_PLAYER, selectedPlayer.ServerId, message);
                                Screen.ShowNotification(Strings.PHONE_APP_PLAYERLIST_SENT);
                            }
                        }
                    }
                }
                selected = 0;
                pressed  = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneCancel))
            {
                if (!inSubMenu)
                {
                    PhoneAppStarter.MainApp();
                }
                else
                {
                    Audio.ReleaseSound(Audio.PlaySoundFrontend("Hang_Up", "Phone_SoundSet_Michael"));
                    inSubMenu = false;
                }
            }

            if (pressed)
            {
                Audio.ReleaseSound(Audio.PlaySoundFrontend("Menu_Navigate", "Phone_SoundSet_Default"));
            }
        }
        public async Task OnTick()
        {
            await Task.FromResult(0);

            for (int i = 0; i < 9; i++)
            {
                PhoneAppIcon appIcon = PhoneAppHolder.Apps[i].AppIcon;
                if (PhoneAppHolder.Apps[i].Disabled)
                {
                    appIcon = PhoneAppIcon.APP_EMPTY;
                }
                phoneScaleform.CallFunction("SET_DATA_SLOT", 1, i, (int)appIcon);
            }

            phoneScaleform.CallFunction("DISPLAY_VIEW", 1, selected);
            phoneScaleform.CallFunction("SET_HEADER", PhoneAppHolder.Apps[selected].Disabled ? "" : PhoneAppHolder.Apps[selected].AppName);

            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_RIGHT, true, (int)PhoneSelectIcon.ICON_BACK);
            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_LEFT, true,
                                        PhoneAppHolder.Apps[selected].Disabled ? (int)PhoneSelectIcon.ICON_BLANK : (int)PhoneSelectIcon.ICON_SELECT);

            bool pressed = false;

            if (Game.IsControlJustPressed(0, Control.PhoneUp))
            {
                Navigate(PhoneInputDirection.UP);
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneRight))
            {
                Navigate(PhoneInputDirection.RIGHT);
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneDown))
            {
                Navigate(PhoneInputDirection.DOWN);
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneLeft))
            {
                Navigate(PhoneInputDirection.LEFT);
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneSelect))
            {
                if (!PhoneAppHolder.Apps[selected].Disabled)
                {
                    PhoneAppStarter.InitApp((IPhoneApp)Activator.CreateInstance(PhoneAppHolder.Apps[selected].AppHandler));
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneCancel))
            {
                PhoneStarter.StopPhone();
            }

            if (pressed)
            {
                Audio.ReleaseSound(Audio.PlaySoundFrontend("Menu_Navigate", "Phone_SoundSet_Default"));
            }
        }
        public async Task OnTick()
        {
            await Task.FromResult(0);

            if (Game.PlayerPed.IsInVehicle() && Game.PlayerPed.CurrentVehicle.ClassType != VehicleClass.Cycles)
            {
                PhoneAppStarter.MainApp();
                return;
            }

            int slot = 0;

            phoneScaleform.CallFunction("SET_DATA_SLOT", 13, slot++, -1, "Stop");
            foreach (AppRadioStationEntry radioStationEntry in radioStationEntries)
            {
                phoneScaleform.CallFunction("SET_DATA_SLOT", 13, slot++, -1, radioStationEntry.RadioName);
            }
            phoneScaleform.CallFunction("DISPLAY_VIEW", 13, selected);

            bool pressed = false;

            if (Game.IsControlJustPressed(0, Control.PhoneUp))
            {
                if (--selected < 0)
                {
                    selected = slot - 1;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneDown))
            {
                if (++selected > slot - 1)
                {
                    selected = 0;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneSelect))
            {
                if (selected == 0)
                {
                    StopRadio();
                }
                else
                {
                    API.SetMobileRadioEnabledDuringGameplay(true);
                    API.SetMobilePhoneRadioState(true);
                    API.SetRadioToStationIndex((int)radioStationEntries[selected - 1].Radio);
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneCancel))
            {
                PhoneAppStarter.MainApp();
            }

            if (pressed)
            {
                Audio.ReleaseSound(Audio.PlaySoundFrontend("Menu_Navigate", "Phone_SoundSet_Default"));
            }
        }
        public async Task OnTick()
        {
            await Task.FromResult(0);

            int slot = 0;

            if (inSubMenu)
            {
                foreach (KeyValuePair <string, Action> item in selectedContact.Items)
                {
                    phoneScaleform.CallFunction("SET_DATA_SLOT", 2, slot++, -1, item.Key);
                }
            }
            else
            {
                foreach (Contact contact in ContactsHolder.Contacts)
                {
                    phoneScaleform.CallFunction("SET_DATA_SLOT", 13, slot++, -1, contact.Name);
                }
            }
            phoneScaleform.CallFunction("SET_HEADER", inSubMenu ? selectedContact.Name : Strings.PHONE_APP_CONTACTS);
            phoneScaleform.CallFunction("DISPLAY_VIEW", inSubMenu ? 2 : 13, selected);

            if (!inputBlocked)
            {
                bool pressed = false;
                if (Game.IsControlJustPressed(0, Control.PhoneUp) && slot > 0)
                {
                    if (--selected < 0)
                    {
                        selected = slot - 1;
                    }
                    pressed = true;
                }
                else if (Game.IsControlJustPressed(0, Control.PhoneDown) && slot > 0)
                {
                    if (++selected > slot - 1)
                    {
                        selected = 0;
                    }
                    pressed = true;
                }
                else if (Game.IsControlJustPressed(0, Control.PhoneSelect) && slot > 0)
                {
                    if (!inSubMenu)
                    {
                        inSubMenu       = true;
                        selectedContact = ContactsHolder.Contacts[selected];
                    }
                    else
                    {
                        selectedContact.Items.ElementAt(selected).Value.Invoke();
                    }
                    selected = 0;
                    pressed  = true;
                }
                else if (Game.IsControlJustPressed(0, Control.PhoneCancel))
                {
                    if (!inSubMenu)
                    {
                        PhoneAppStarter.MainApp();
                    }
                    else
                    {
                        Audio.ReleaseSound(Audio.PlaySoundFrontend("Hang_Up", "Phone_SoundSet_Michael"));
                        inSubMenu = false;
                    }
                }

                if (pressed)
                {
                    Audio.ReleaseSound(Audio.PlaySoundFrontend("Menu_Navigate", "Phone_SoundSet_Default"));
                }
            }
        }
示例#6
0
        public async Task OnTick()
        {
            await Task.FromResult(0);

            int slot = 0;

            if (inSubMenu)
            {
                phoneScaleform.CallFunction("SET_DATA_SLOT", 7, 0, selectedMessage.SenderName, selectedMessage.SenderMessage, selectedMessage.SenderCharImg);
            }
            else
            {
                foreach (Message message in Enumerable.Reverse(MessagesHolder.Messages))
                {
                    phoneScaleform.CallFunction("SET_DATA_SLOT", 6, slot++, message.Timestamp.Hours, message.Timestamp.Minutes, -1,
                                                message.SenderName, message.SenderMessage);
                }
            }
            phoneScaleform.CallFunction("DISPLAY_VIEW", inSubMenu ? 7 : 6, inSubMenu ? 0 : selected);

            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_RIGHT, true, (int)PhoneSelectIcon.ICON_BACK);
            phoneScaleform.CallFunction("SET_SOFT_KEYS", (int)PhoneSelectSlot.SLOT_LEFT, true,
                                        slot > 0 && !inSubMenu ? (int)PhoneSelectIcon.ICON_SELECT : (int)PhoneSelectIcon.ICON_BLANK);

            bool pressed = false;

            if (Game.IsControlJustPressed(0, Control.PhoneUp) && slot > 0)
            {
                if (--selected < 0)
                {
                    selected = slot - 1;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneDown) && slot > 0)
            {
                if (++selected > slot - 1)
                {
                    selected = 0;
                }
                pressed = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneSelect) && slot > 0)
            {
                if (!inSubMenu)
                {
                    inSubMenu       = true;
                    selectedMessage = MessagesHolder.Messages[MessagesHolder.Messages.Count - 1 - selected];
                }
                selected = 0;
                pressed  = true;
            }
            else if (Game.IsControlJustPressed(0, Control.PhoneCancel))
            {
                if (!inSubMenu)
                {
                    PhoneAppStarter.MainApp();
                }
                else
                {
                    Audio.ReleaseSound(Audio.PlaySoundFrontend("Hang_Up", "Phone_SoundSet_Michael"));
                    inSubMenu = false;
                }
            }

            if (pressed)
            {
                Audio.ReleaseSound(Audio.PlaySoundFrontend("Menu_Navigate", "Phone_SoundSet_Default"));
            }
        }