コード例 #1
0
        /// <summary>
        /// Call this contact.
        /// If DialTimeout less or equal than 0, the contact will pickup instantly.
        /// </summary>
        public void Call()
        {
            // Cannot call if already on call or contact is busy (Active == false)
            if (_dialActive || _busyActive)
            {
                return;
            }

            Game.Player.Character.Task.UseMobilePhone();

            // Do we have to wait before the contact pickup the phone?
            if (DialTimeout > 0)
            {
                // Play the Dial sound
                iFruitContactCollection.DisplayCallUI(CustomiFruit.GetCurrentInstance().Handle, Name, "CELL_220", Icon.Name.SetBold(Bold)); // Displays "BUSY"
                _dialSoundID = Function.Call <int>(Hash.GET_SOUND_ID);
                Function.Call(Hash.PLAY_SOUND_FRONTEND, _dialSoundID, "Dial_and_Remote_Ring", "Phone_SoundSet_Default", 1);
                _callTimer  = Game.GameTime + DialTimeout;
                _dialActive = true;
            }
            else
            {
                iFruitContactCollection.DisplayCallUI(CustomiFruit.GetCurrentInstance().Handle, Name, "CELL_219", Icon.Name.SetBold(Bold)); // Displays "CONNECTED"
                OnAnswered(this);                                                                                                           // Answer the phone instantly
            }
        }
コード例 #2
0
        internal void Update()
        {
            // Contact was busy and busytimer has ended
            if (_busyActive && Game.GameTime > _busyTimer)
            {
                Game.Player.Character.Task.PutAwayMobilePhone();
                Function.Call(Hash.STOP_SOUND, _busySoundID);
                Function.Call(Hash.RELEASE_SOUND_ID, _busySoundID);
                _busySoundID = -1;
                _busyActive  = false;
            }

            // We are calling the contact
            if (_dialActive && Game.GameTime > _callTimer)
            {
                Function.Call(Hash.STOP_SOUND, _dialSoundID);
                Function.Call(Hash.RELEASE_SOUND_ID, _dialSoundID);
                _dialSoundID = -1;

                if (!Active)
                {
                    // Contact is busy, play the busy sound until the busytimer runs off
                    iFruitContactCollection.DisplayCallUI(CustomiFruit.GetCurrentInstance().Handle, Name, "CELL_220", Icon.Name.SetBold(Bold)); // Displays "BUSY"
                    _busySoundID = Function.Call <int>(Hash.GET_SOUND_ID);
                    Function.Call(Hash.PLAY_SOUND_FRONTEND, _busySoundID, "Remote_Engaged", "Phone_SoundSet_Default", 1);
                    _busyTimer  = Game.GameTime + 5000;
                    _busyActive = true;
                }
                else
                {
                    iFruitContactCollection.DisplayCallUI(CustomiFruit.GetCurrentInstance().Handle, Name, "CELL_219", Icon.Name.SetBold(Bold)); // Displays "CONNECTED"
                    OnAnswered(this);                                                                                                           // Answer the phone
                }

                _dialActive = false;
            }
        }
コード例 #3
0
ファイル: CustomiFruit.cs プロジェクト: prens2/iFruitAddon2
 /// <summary>
 /// Initialize the class.
 /// </summary>
 /// <param name="contacts"></param>
 public CustomiFruit(iFruitContactCollection contacts)
 {
     _instance    = this;
     _contacts    = contacts;
     _mScriptHash = Game.GenerateHash("cellphone_flashhand");
 }