Esempio n. 1
0
        private void _phoneProxy_StateChanged(PhoneState obj)
        {
            InvokeGUIThread(() =>
            {
                switch (obj)
                {
                case PhoneState.Ringing:
                    LabelMessage.Background = new SolidColorBrush(Colors.Red);
                    break;

                case PhoneState.InCall:
                    LabelMessage.Background = new SolidColorBrush(Colors.Green);
                    break;

                case PhoneState.CallEnded:
                case PhoneState.Other:
                    LabelMessage.Background = new SolidColorBrush(Colors.White);
                    LabelNumber.Content     = string.Empty;
                    break;

                case PhoneState.Available:
                    break;

                case PhoneState.Unavailable:
                    Disable();
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(obj), obj, null);
                }
            });
        }
Esempio n. 2
0
        private void button10_Click(object sender, EventArgs e)
        {
            PhoneState state = new PhoneState();


            Int32 result = getPhoneState(ref state);

            if (result < 0)
            {
                textBox14.Text = result.ToString();
            }
            else
            {
                switch (state)
                {
                case PhoneState.PS_CONNECTED:
                {
                    textBox14.Text = "Connected";
                    break;
                }

                case PhoneState.PS_IDLE:
                {
                    textBox14.Text = "Idle";
                    break;
                }

                case PhoneState.PS_RING:
                {
                    textBox14.Text = "RING !!!";
                    break;
                }
                }
            }
        }
Esempio n. 3
0
 private void VoipClientOnPhoneStateChanged(PhoneState phoneState)
 {
     if (phoneState.Status == PhoneStatus.IncomingCall)
     {
         StartConversation(phoneState.OtherUserId);
     }
 }
Esempio n. 4
0
 public MobilePhone(string phoneNumber, PhoneState phoneState, ConnectionState connectionState, OperatingSystem os)
 {
     PhoneNumber     = phoneNumber;
     PhoneState      = phoneState;
     ConnectionState = connectionState;
     OS = os;
 }
Esempio n. 5
0
 public void Hangup()
 {
     GetComponent<Animator>().SetBool("Ring", false);
     if (State == PhoneState.Ongoing || State == PhoneState.Ring)
     {
         State = PhoneState.Idle;
     }
 }
Esempio n. 6
0
 public void Answer()
 {
     ring.Stop();
     if (State == PhoneState.Ring)
     {
         State = PhoneState.Ongoing;
     }
 }
Esempio n. 7
0
    public void TogglePhone()
    {
        if (m_phoneState == PhoneState.Down)
        {
            m_phoneState = PhoneState.Up;
//			m_playerInputAllowed = false;

            m_phone.clip = m_phone.GetClip("Phone_Raise01");
            m_phone.Play();

            AudioManager.instance.PlaySound(AudioManager.SoundType.Phone_Raise);

//			m_clickReceivers [1].gameObject.SetActive (true);
//			m_clickReceivers [0].gameObject.SetActive (false);
        }
        else if (m_phoneState == PhoneState.Up)
        {
            if (m_waitingForNextTurn)
            {
                if (m_turnNumber + 1 == m_maxTurns)
                {
                    StartCoroutine(FourMoreYears());
                    return;
                }
                else
                {
                    m_waitingForNextTurn = false;
                    EndRound();

                    StartRound();
                }
            }

            m_phoneState = PhoneState.Down;

            if (m_gameState != GameState.GameOver)
            {
                m_playerInputAllowed = true;
            }
            m_phone.clip = m_phone.GetClip("Phone_Lower01");
            m_phone.Play();

//			m_clickReceivers [0].gameObject.SetActive (true);
//			m_clickReceivers [1].gameObject.SetActive (false);

            AudioManager.instance.PlaySound(AudioManager.SoundType.Phone_Raise);

//			if (m_waitingForNextTurn) {
//
//				m_waitingForNextTurn = false;
//				EndRound ();
//
//				StartRound ();
//			}
        }
    }
Esempio n. 8
0
        private void VoipClientOnPhoneStateChanged(PhoneState phoneState)
        {
            Invoke(() =>
            {
                if (!phoneState.OtherUserId.IsOneOf(null, _otherUserId) || phoneState.Status.IsOneOf(PhoneStatus.Registering))
                {
                    btnCall.Enabled     = false;
                    btnHangUp.Enabled   = false;
                    btnCall.BackColor   = _disabledBtnColor;
                    btnHangUp.BackColor = _disabledBtnColor;
                    return;
                }
                else
                {
                    switch (phoneState.Status)
                    {
                    case PhoneStatus.Calling:
                        {
                            btnCall.Enabled     = false;
                            btnHangUp.Enabled   = true;
                            btnCall.BackColor   = _disabledBtnColor;
                            btnHangUp.BackColor = _enabledBtnColor;
                            break;
                        }

                    case PhoneStatus.InCall:
                        {
                            btnCall.Enabled     = false;
                            btnHangUp.Enabled   = true;
                            btnCall.BackColor   = _disabledBtnColor;
                            btnHangUp.BackColor = _enabledBtnColor;
                            break;
                        }

                    case PhoneStatus.IncomingCall:
                        {
                            btnCall.Enabled     = true;
                            btnHangUp.Enabled   = true;
                            btnCall.BackColor   = _enabledBtnColor;
                            btnHangUp.BackColor = _enabledBtnColor;
                            break;
                        }

                    case PhoneStatus.Registered:
                        {
                            btnCall.Enabled     = true;
                            btnHangUp.Enabled   = false;
                            btnCall.BackColor   = _enabledBtnColor;
                            btnHangUp.BackColor = _disabledBtnColor;
                            break;
                        }
                    }
                }
            });
        }
Esempio n. 9
0
 // Changes the phone state
 public void ChangeState <T>() where T : PhoneState
 {
     // Leave the current state if it is valid
     if (_state != null)
     {
         _state.OnExit(this);
     }
     // Change the state
     _state = Activator.CreateInstance <T>();
     _state.OnEnter(this);
 }
Esempio n. 10
0
 public void SimulateConnected(bool connected)
 {
     if (connected)
     {
         PhoneState.HandleConnectionTry(this);
     }
     else
     {
         PhoneState.HandleDisconnectionTry(this);
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Recreates the phone in wanted state
 /// </summary>
 /// <param name="state">State to create phone in</param>
 private void RecreatePhone(PhoneState state)
 {
     if (state == PhoneState.PHONE_CALLING)
     {
         DeletePhone();
         CreatePhoneCalling();
     }
     else
     {
         DeletePhone();
         CreatePhone();
     }
 }
Esempio n. 12
0
 void silent()
 {
     one.renderer.enabled = false;
     sprite_phone.SetBool("ringing", false);
     if (start && Time.time > start_time + delay)
     {
         print("switch");
         next_state = PhoneState.ringing;
         audio.loop = true;
         audio.Play();
         start = false;
     }
 }
Esempio n. 13
0
 void DialogForm_Load(object sender, EventArgs e)
 {
     _state                 = PhoneState.Idle;
     _txtFromAlias.Text     = "alice";
     _txtToAlias.Text       = "bob";
     _chkPeerToPeer.Checked = false;
     _chkPeerToPeer_CheckedChanged(null, null);
     _txtState.Text = StateToLabel(_state);
     MainForm.MainSipListener.RegisterListener(this);
     if (_chbStubTimerFactory.Checked)
     {
         MainForm.SipStack.SetTimerFactory(new TimerFactoryStubBuilder().Build());
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Sets phone into pocket and not using state
        /// </summary>
        public void SetPhoneNotUsing()
        {
            if (phoneState == PhoneState.PHONE_NOT_USING)
            {
                return;
            }

            SetPhoneNotUsingAnimation();

            phoneState = PhoneState.PHONE_NOT_USING;
            secondAnimationTimer.Elapsed += TimerElapsed;
            secondAnimationTimer.Interval = 800;
            secondAnimationTimer.Enabled  = true;
        }
Esempio n. 15
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            PhoneState phoneStateVal = (PhoneState)Enum.Parse(typeof(PhoneState), value.ToString());

            switch (phoneStateVal)
            {
            case PhoneState.TRYING:
            case PhoneState.TRYING_IN:
            case PhoneState.CALL_ACCEPTS:
                return(new BitmapImage(new Uri("pack://application:,,,/mba-application;component/Resources/Images/Icons/endCallButtonImage.png")));

            default:
                return(new BitmapImage(new Uri("pack://application:,,,/mba-application;component/Resources/Images/Icons/callButtonImage.png")));
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Sets phone to calling state and animation
        /// Calling phone animation
        /// </summary>
        public void SetPhoneCalling()
        {
            if (phoneState == PhoneState.PHONE_CALLING)
            {
                return;
            }

            if (phoneState != PhoneState.PHONE_CALLING)
            {
                RecreatePhone(PhoneState.PHONE_CALLING);
            }

            SetPhoneCallingAnimation();
            phoneState = PhoneState.PHONE_CALLING;
        }
Esempio n. 17
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var        result        = "#6CFF5F";
            PhoneState phoneStateVal = (PhoneState)Enum.Parse(typeof(PhoneState), value.ToString());

            switch (phoneStateVal)
            {
            case PhoneState.TRYING:
            case PhoneState.TRYING_IN:
            case PhoneState.CALL_ACCEPTS:
                result = "#FF5F5F";
                break;
            }
            return(result);
        }
Esempio n. 18
0
        /// <summary>
        /// Sets phone to using state and animation
        /// Standing with phone on hand
        /// </summary>
        public void SetPhoneUsing()
        {
            if (phoneState == PhoneState.PHONE_READING)
            {
                return;
            }

            if (phoneState != PhoneState.PHONE_READING)
            {
                secondAnimationTimer.Stop();
                RecreatePhone(PhoneState.PHONE_READING);
            }


            SetPhoneUsingAnimation();
            phoneState = PhoneState.PHONE_READING;
        }
Esempio n. 19
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            this.m_PhoneState = PhoneState.HangUp;

            this.m_Context = null;

            if (null != m_TM)
            {
                m_TM = null;
            }

            if (null != m_OnPhoneStateChanged)
            {
                m_OnPhoneStateChanged = null;
            }
        }
    public float TextureAspectRatio;          //宽高比

    private void Init()
    {
        //需要适配的手机配置 四个锚点位置和分辨率
        _phoneEdgeInsetDict = new Dictionary <PhoneState, EdgeInset>()
        {
            { PhoneState.IPhoneX, new EdgeInset(80, 0, 0, 0, 2436, 1125) }, //80:刘海宽度
        };
        _curPhoneState     = GetCurPhone();
        TextureAspectRatio = GetTextureAspectRatio();
        UpdateOrientation();
        _leftRect  = CalculateNGUIRect();
        _rightRect = _leftRect != null?_leftRect.Flip() : null;

        if (IsNeedResize())
        {
            JSTimer.Instance.SetupTimer(ScreenResizeManagerUpdate, UpdateOrientation); //添加计时器,用于当屏幕朝向发生变化时
        }
    }
Esempio n. 21
0
    // Use this for initialization
    void Start()
    {
        scoreSystem = GameObject.FindGameObjectWithTag("scoring").GetComponent <Scoring>();
        dontDestroy = GameObject.FindGameObjectWithTag("dontdestroy");
        information = dontDestroy.GetComponent <DontDestroy>();

        /* P H O N E  S T A T E */
        cur_state  = PhoneState.silent;
        next_state = PhoneState.silent;
        start_time = Time.time;
        orderBubble.renderer.enabled = false;

        /* T O P P I N G S */
        one.renderer.enabled   = false;
        two.renderer.enabled   = false;
        three.renderer.enabled = false;
        four.renderer.enabled  = false;
        if (information.cognitiveMode >= 1)
        {
            five.renderer.enabled = false;
            six.renderer.enabled  = false;
        }
        if (information.cognitiveMode == 2)
        {
            seven.renderer.enabled = false;
            eight.renderer.enabled = false;
        }
        /* P L U S  I M A G E */
        plus0.renderer.enabled = false;
        plus1.renderer.enabled = false;
        plus2.renderer.enabled = false;
        if (information.cognitiveMode >= 1)
        {
            plus3.renderer.enabled = false;
            plus4.renderer.enabled = false;
        }
        if (information.cognitiveMode == 2)
        {
            plus5.renderer.enabled = false;
            plus6.renderer.enabled = false;
        }

        numToppings = 0;
    }
Esempio n. 22
0
    // Update is called once per frame
    void Update()
    {
        switch (cur_state)
        {
        case PhoneState.ringing:
            ringing();
            break;

        case PhoneState.silent:
            silent();
            break;

        case PhoneState.busy:
            sprite_phone.SetBool("ringing", false);
            takeOrders();
            break;
        }

        cur_state = next_state;
    }
Esempio n. 23
0
        public void phoneStateChanged(PhoneState phoneState, string phoneID, IntPtr param)
        {
            string s="";
            if (phoneState == PhoneState.PS_IDLE)
            {
                s = "Idle";
            }
            else
            {
                if (phoneState == PhoneState.PS_CONNECTED)
                {
                    s = "Connected to " + phoneID;
                }
                else
                {
                    s = phoneID + " RING !!!";
                }
            }

            textBox7.Invoke((MethodInvoker)delegate() { textBox7.Text=s; });
        }
Esempio n. 24
0
        public void phoneStateChanged(PhoneState phoneState, string phoneID, IntPtr param)
        {
            string s = "";

            if (phoneState == PhoneState.PS_IDLE)
            {
                s = "Idle";
            }
            else
            {
                if (phoneState == PhoneState.PS_CONNECTED)
                {
                    s = "Connected to " + phoneID;
                }
                else
                {
                    s = phoneID + " RING !!!";
                }
            }

            textBox7.Invoke((MethodInvoker) delegate() { textBox7.Text = s; });
        }
Esempio n. 25
0
        public override void OnCallStateChanged(CallState state, string incomingNumber)
        {
            base.OnCallStateChanged(state, incomingNumber);

            switch (state)
            {
            case CallState.Ringing:
            {
                this.m_PhoneState = PhoneState.Calling;
                if (null != m_OnPhoneStateChanged)
                {
                    m_OnPhoneStateChanged(CallStateEnum.Ringing);
                }
                break;
            }

            case CallState.Offhook:
            {
                this.m_PhoneState = PhoneState.Calling;
                if (null != m_OnPhoneStateChanged)
                {
                    m_OnPhoneStateChanged(CallStateEnum.Offhook);
                }
                break;
            }

            case CallState.Idle:
            {
                this.m_PhoneState = PhoneState.HangUp;
                if (null != m_OnPhoneStateChanged)
                {
                    m_OnPhoneStateChanged(CallStateEnum.Idle);
                }
                break;
            }
            }
        }
Esempio n. 26
0
        public void InitializeMBAPhone()
        {
            CallDuration = 0;
            phoneTimer = new Timer(1000);
            phoneTimer.Elapsed += PhoneTimer_Elapsed;

            Number = string.Empty;
            SoundPlayer = new SoundPlayer();
            MBAPhone = new VaxVoIPSIP();
            phoneState = PhoneState.FREE;

            MBAPhone.OnTryingToRegister += MBAPhone_OnTryingToRegister;
            MBAPhone.OnSuccessToRegister += MBAPhone_OnSuccessToRegister;
            MBAPhone.OnConnecting += MBAPhone_OnConnecting;
            MBAPhone.OnProvisionalResponse += MBAPhone_OnProvisionalResponse;
            MBAPhone.OnSuccessToConnect += MBAPhone_OnSuccessToConnect;
            MBAPhone.OnDisconnectCall += MBAPhone_OnDisconnectCall;

            MBAPhone.OnIncomingCall += MBAPhone_OnIncomingCall;
            MBAPhone.OnIncomingCallRingingStart += MBAPhone_OnIncomingCallRingingStart;
            MBAPhone.OnIncomingCallRingingStop += MBAPhone_OnIncomingCallRingingStop;

            MBAPhone.SetLicenceKey("VAXVOIP.COM-219I154I179I10I184I170I120I239I130I80I157I51I140I153I41I175I5I245I56I56I44I125I37I15I102I133I114I96I216I239I27I157I63I215I195I128I16I109I37I82I64I127I218I163I226I29I249I104I12I150I58I82I72I19I221I136I125I235I205I131I150I64I241I246I195I249I73I199I230I57I68I186I244I245I58I222I172I27I85I162I244I85I47I125I16I30I189I252I1I118I185I164I181I225I111I196I140I147I156I42I132I56I229I140I117I165I150I197I156I129I4I93I70I67I136I152I81I16I47I17I142I15I78I106I240I48I86I36I9I132I35I71I192I252I114I147I172I70I79I177I29I244I34I110I106I170I92I63I239I39I59I5I149I186I143I112I247I13I205I16I187I202I186I94I61I140I4I255I230I210I54I228I176I57I4I201I252I54I22I30I0I12I104I67I205I222I104I227I36I174I139I226I214I237I179I123I100I112I98I141I215I133I42I45I28I39I146I7I88I158I156I209I154I147I38I195I88I192I155I184I49I152I219I44I157I212I234I35I106I240I181I212I123I254I174I92I242I252I86I196I128I187I65I84I249I111I224I59I244I51I119I125I61I35I73I244I246I167I191I187I97I255I79I210I115I126I98I178I189I239I51I142I96I41I133I184I53I150I17I167I16I151I168I73I205I119I36I154I104I250I69I211I61I124I157I89I5I98I252I56I27I105I189I104I16I234I202I99I147I228I148I204I56I40I91I83I129I190I216I246I152I80I75I249I211I84I104I249I150I113I58I182I62I64I232I206I2I105I249I74I67I110I97I127I17I9I40I230I62I26I246I202I14I10I88I120I220I31I64I229I42I49I177I56I-UNLIMITED.MBAFIN.RU");

            if (!MBAPhone.InitializeEx(false, "", -1, "151", "151", "heslox151", "Chasik", "aster.mbaru.ru", "10.100.0.5", "", true, 2))
                Trace.WriteLine("ERROR InitializeEx method. CODE: " + MBAPhone.GetVaxObjectError().ToString());

            if (!MBAPhone.OpenLine(1, false, "", -1))
                Trace.WriteLine("ERROR OpenLine method. CODE: " + MBAPhone.GetVaxObjectError().ToString());

            if (!MBAPhone.SelectVoiceCodec(MBAComponents.cDefinForVaxVoIP.VAX_CODEC_G711A))
                Trace.WriteLine("ERROR SelectVoiceCodec method. CODE: " + MBAPhone.GetVaxObjectError().ToString());

            if (!MBAPhone.RegisterToProxy(1800))
                Trace.WriteLine("ERROR RegisterToProxy method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
        }
Esempio n. 27
0
 private String StateToLabel(PhoneState state)
 {
     return _state.ToString().ToUpper();
 }
Esempio n. 28
0
 void DialogForm_Load(object sender, EventArgs e)
 {
     _state = PhoneState.Idle;
     _txtFromAlias.Text = "alice";
     _txtToAlias.Text = "bob";
     _chkPeerToPeer.Checked = false;
     _chkPeerToPeer_CheckedChanged(null,null);
     _txtState.Text = StateToLabel(_state);
     MainForm.MainSipListener.RegisterListener(this);
     if(_chbStubTimerFactory.Checked) MainForm.SipStack.SetTimerFactory(new TimerFactoryStubBuilder().Build());
 }
Esempio n. 29
0
        private void button10_Click(object sender, EventArgs e)
        {
            PhoneState state = new PhoneState();

            Int32 result = getPhoneState(ref state);

            if (result < 0)
            {
                textBox14.Text = result.ToString();
            }
            else
            {
                switch (state)
                {
                    case PhoneState.PS_CONNECTED:
                        {
                            textBox14.Text = "Connected";
                            break;
                        }
                    case PhoneState.PS_IDLE:
                        {
                            textBox14.Text = "Idle";
                            break;
                        }
                    case PhoneState.PS_RING:
                        {
                            textBox14.Text = "RING !!!";
                            break;
                        }
                }
            }
        }
Esempio n. 30
0
        private async void BtnSend_Click(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.isSending == false)
            {
                // Ensures that the program has been configured.
                if (String.IsNullOrWhiteSpace(config.Sender) || String.IsNullOrWhiteSpace(config.ApiToken) ||
                    String.IsNullOrWhiteSpace(config.Message))
                {
                    MnuConfig_Click(this, EventArgs.Empty); // Prompts for configuration.
                    return;
                }

                // Ensures that there is an internet connection before starting the sending process.
                if (Connection.IsInternetAvailable() == false)
                {
                    MessageBox.Show(Properties.Strings.Alert_NoInternetConnection,
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                // Prepares state information for the sending process.
                Properties.Settings.Default.isSending       = true;
                Properties.Settings.Default.ControlsEnabled = false;
                btnSend.Text = Properties.Strings.Cancel; // Changes the Send button to a Cancel button.

                WaboxAppAPI whatsapp = new WaboxAppAPI(config.ApiToken, config.Sender);

                try
                {
                    PhoneState phoneState = await whatsapp.GetPhoneConnectedStateAsync();

                    if (phoneState == PhoneState.NoWhatsAppSession)
                    {
                        MessageBox.Show(String.Format(Properties.Strings.Alert_WhatsAppNotConnected, config.Sender),
                                        this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (phoneState == PhoneState.Unauthorized)
                    {
                        MessageBox.Show(String.Format(Properties.Strings.Error_UnauthorizedSender, config.Sender),
                                        this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else // Everything is connected and ready.
                    {
                        List <string> notSentList = new List <string>();

                        // Send the batch messages.
                        await whatsapp.SendBatchMessagesAsync(txtNumbers, config.Message, notSentList,
                                                              pbSending, cancelRequested);

                        // Displays those numbers that need to be retried if any otherwise the view is cleared.
                        txtNumbers.Text = notSentList.Count > 0 ? NumbersToRetry(notSentList) : "";

                        MessageBox.Show(String.Format(Properties.Strings.Info_SentSuccessful,
                                                      pbSending.Maximum - notSentList.Count, pbSending.Maximum),
                                        this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception)
                {
                    // Generic message for multiple possible exceptions that are handled the same.
                    MessageBox.Show(Properties.Strings.Error_GetRequestFailed, this.Text,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                // Resets everything after sending process is done.
                pbSending.Value = 0;
                Properties.Settings.Default.isSending       = false;
                Properties.Settings.Default.ControlsEnabled = true;
                cancelRequested = false;
                btnSend.Text    = Properties.Strings.Send;
                btnSend.Enabled = true;
            }
            else // Cancel button mode.
            {
                btnSend.Enabled = false; // Disabled to prevent canceling twice.
                cancelRequested = true;
            }
        }
Esempio n. 31
0
 private void MBAPhone_OnProvisionalResponse(int LineNo, int StatusCode, string ReasonPhrase)
 {
     switch (StatusCode)
     {
         case 100:
             phoneState = PhoneState.TRYING;
             break;
         case 180:
             CallDuration = 0;
             phoneTimer.Enabled = true;
             SoundPlayer.Stream = Properties.Resources.ring;
             SoundPlayer.PlayLooping();
             break;
     }
 }
Esempio n. 32
0
 private static extern Int32 getPhoneState(ref PhoneState phoneState);
Esempio n. 33
0
    /* P H O N E  O R D E R S */
    // RANDOMLY GENERATES NUMBER OF TOPPINGS ON PIZZA
    // EACH TOPPING IS ALSO RANDOMLY GENERATED
    void takeOrders()
    {
        if (!timerSet)
        {
            audio.Pause();
            timerSet   = true;
            timerUsage = Time.time + timerDelay;
            if (information.cognitiveMode == 2)
            {
                timerUsage += 2f;
            }
            orderBubble.renderer.enabled = true;
            //pick a number of toppings
            int topping1 = -1;
            int topping2 = -1;
            int topping3 = -1;
            int topping4 = -1;
            int topping5 = -1;
            int topping6 = -1;
            int topping7 = -1;
            int topping8 = -1;

            /* N U M B E R  O F  T O P P I N G S */
            if (information.cognitiveMode == 0)
            {
                numToppings = Random.Range(1, 5);
            }
            else if (information.cognitiveMode == 1)
            {
                numToppings = Random.Range(1, 7);
            }
            else if (information.cognitiveMode == 2)
            {
                numToppings = Random.Range(1, 9);
            }

            /* R E N D E R  I M A G E S */
            if (numToppings >= 1)
            {
                if (information.cognitiveMode == 0)
                {
                    topping1 = Random.Range(0, 4);
                }
                else if (information.cognitiveMode == 1)
                {
                    topping1 = Random.Range(0, 6);
                }
                else if (information.cognitiveMode == 2)
                {
                    topping1 = Random.Range(0, 8);
                }
                one.GetComponent <SpriteRenderer>().sprite = spritePicker(topping1);
                one.renderer.enabled = true;
            }
            if (numToppings >= 2)
            {
                topping2 = topping1;
                while (topping2 == topping1)
                {
                    if (information.cognitiveMode == 0)
                    {
                        topping2 = Random.Range(0, 4);
                    }
                    else if (information.cognitiveMode == 1)
                    {
                        topping2 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping2 = Random.Range(0, 8);
                    }
                }
                two.GetComponent <SpriteRenderer>().sprite = spritePicker(topping2);
                two.renderer.enabled   = true;
                plus1.renderer.enabled = true;
            }
            if (numToppings >= 3)
            {
                topping3 = topping2;
                while (topping3 == topping1 || topping3 == topping2)
                {
                    if (information.cognitiveMode == 0)
                    {
                        topping3 = Random.Range(0, 4);
                    }
                    else if (information.cognitiveMode == 1)
                    {
                        topping3 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping3 = Random.Range(0, 8);
                    }
                }
                three.GetComponent <SpriteRenderer>().sprite = spritePicker(topping3);
                three.renderer.enabled = true;
                plus0.renderer.enabled = true;
            }
            if (numToppings >= 4)
            {
                topping4 = topping3;
                while (topping4 == topping1 || topping4 == topping2 || topping4 == topping3)
                {
                    if (information.cognitiveMode == 0)
                    {
                        topping4 = Random.Range(0, 4);
                    }
                    else if (information.cognitiveMode == 1)
                    {
                        topping4 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping4 = Random.Range(0, 8);
                    }
                }
                four.GetComponent <SpriteRenderer>().sprite = spritePicker(topping4);
                four.renderer.enabled  = true;
                plus2.renderer.enabled = true;
            }
            if (numToppings >= 5 && information.cognitiveMode >= 1)
            {
                topping5 = topping4;
                while (topping5 == topping1 || topping5 == topping2 ||
                       topping5 == topping3 || topping5 == topping4)
                {
                    if (information.cognitiveMode == 1)
                    {
                        topping5 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping5 = Random.Range(0, 8);
                    }
                }
                five.GetComponent <SpriteRenderer>().sprite = spritePicker(topping5);
                five.renderer.enabled  = true;
                plus3.renderer.enabled = true;
            }
            if (numToppings >= 6 && information.cognitiveMode >= 1)
            {
                topping6 = topping5;
                while (topping6 == topping1 || topping6 == topping2 ||
                       topping6 == topping3 || topping6 == topping4 ||
                       topping6 == topping5)
                {
                    if (information.cognitiveMode == 1)
                    {
                        topping6 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping6 = Random.Range(0, 8);
                    }
                }
                six.GetComponent <SpriteRenderer>().sprite = spritePicker(topping6);
                six.renderer.enabled   = true;
                plus4.renderer.enabled = true;
            }
            if (numToppings >= 7 && information.cognitiveMode == 2)
            {
                topping7 = topping6;
                while (topping7 == topping1 || topping7 == topping2 || topping7 == topping3 ||
                       topping7 == topping4 || topping7 == topping5 ||
                       topping7 == topping6)
                {
                    if (information.cognitiveMode == 1)
                    {
                        topping7 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping7 = Random.Range(0, 8);
                    }
                }
                seven.GetComponent <SpriteRenderer>().sprite = spritePicker(topping7);
                seven.renderer.enabled = true;
                plus5.renderer.enabled = true;
            }
            if (numToppings >= 8 && information.cognitiveMode == 2)
            {
                topping8 = topping7;
                while (topping8 == topping1 || topping8 == topping2 || topping8 == topping3 ||
                       topping8 == topping4 || topping8 == topping5 ||
                       topping8 == topping6 || topping8 == topping7)
                {
                    if (information.cognitiveMode == 1)
                    {
                        topping8 = Random.Range(0, 6);
                    }
                    else if (information.cognitiveMode == 2)
                    {
                        topping8 = Random.Range(0, 8);
                    }
                }
                eight.GetComponent <SpriteRenderer>().sprite = spritePicker(topping8);
                eight.renderer.enabled = true;
                plus6.renderer.enabled = true;
            }
        }
        if (Time.time > timerUsage)
        {
            timerSet = false;
            orderBubble.renderer.enabled = false;
            one.renderer.enabled         = false;
            two.renderer.enabled         = false;
            three.renderer.enabled       = false;
            four.renderer.enabled        = false;
            if (information.cognitiveMode >= 1)
            {
                five.renderer.enabled = false;
                six.renderer.enabled  = false;
            }
            if (information.cognitiveMode == 2)
            {
                seven.renderer.enabled = false;
                eight.renderer.enabled = false;
            }

            plus0.renderer.enabled = false;
            plus1.renderer.enabled = false;
            plus2.renderer.enabled = false;

            if (information.cognitiveMode >= 1)
            {
                plus3.renderer.enabled = false;
                plus4.renderer.enabled = false;
            }
            if (information.cognitiveMode == 2)
            {
                plus5.renderer.enabled = false;
                plus6.renderer.enabled = false;
            }

            next_state = PhoneState.silent;
            start_time = Time.time;
        }
    }
Esempio n. 34
0
        /// <summary>
        /// Updates the current phone UI state
        /// </summary>
        /// <param name="next">The state to update to</param>
        private void UpdatePhoneState(PhoneState next)
        {
            phoneTapped_sfx.start();
            switch (next)
            {
            case PhoneState.CONTACTS:
                // get current status information
                UpdateContacts();

                containerHome.gameObject.SetActive(false);
                containerContacts.gameObject.SetActive(true);
                containerMessages.gameObject.SetActive(false);
                containerNews.gameObject.SetActive(false);
                containerTasklist.gameObject.SetActive(false);
                break;

            case PhoneState.MESSAGES:
                // get current messages information based on current character
                // the current character isn't updated from the messages icon, but from the contacts buttons
                UpdateMessages();

                containerHome.gameObject.SetActive(false);
                containerContacts.gameObject.SetActive(false);
                containerMessages.gameObject.SetActive(true);
                containerNews.gameObject.SetActive(false);
                containerTasklist.gameObject.SetActive(false);
                break;

            case PhoneState.NEWS:
                // get random news
                UpdateNews();

                containerHome.gameObject.SetActive(false);
                containerContacts.gameObject.SetActive(false);
                containerMessages.gameObject.SetActive(false);
                containerNews.gameObject.SetActive(true);
                containerTasklist.gameObject.SetActive(false);
                break;

            case PhoneState.TASKLIST:
                // get current task information
                UpdateTaskProgress();

                containerHome.gameObject.SetActive(false);
                containerContacts.gameObject.SetActive(false);
                containerMessages.gameObject.SetActive(false);
                containerNews.gameObject.SetActive(false);
                containerTasklist.gameObject.SetActive(true);
                break;

            case PhoneState.HOME:
            default:
                containerHome.gameObject.SetActive(true);
                containerContacts.gameObject.SetActive(false);
                containerMessages.gameObject.SetActive(false);
                containerNews.gameObject.SetActive(false);
                containerTasklist.gameObject.SetActive(false);
                break;
            }

            currentState = next;
        }
Esempio n. 35
0
 public void PhoneCallButtonClick()
 {
     switch (phoneState)
     {
         case PhoneState.FREE:
             if (!MBAPhone.DialCall(1, Number, -1, -1))
                 Trace.WriteLine("ERROR DialCall method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
             break;
         case PhoneState.TRYING:
         case PhoneState.TRYING_IN:
         case PhoneState.CALL_ACCEPTS:
             if (!MBAPhone.Disconnect(1))
                 Trace.WriteLine("ERROR Disconnect method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
             else
             {
                 phoneState = PhoneState.FREE;
                 SoundPlayer.Stop();
                 phoneTimer.Enabled = false;
                 CallDuration = 0;
             }
             break;
         case PhoneState.RINGING:
             break;
         default:
             break;
     }
 }
Esempio n. 36
0
 public TalkOnPhoneState(TalkOnPhoneState phoneState)
 {
     this._start = phoneState._start;
     this._end = phoneState._end;
     this._state = phoneState._state;
 }
Esempio n. 37
0
 private void MBAPhone_OnDisconnectCall(int LineNo)
 {
     phoneState = PhoneState.FREE;
     phoneTimer.Enabled = false;
     CallDuration = 0;
 }
Esempio n. 38
0
    private IEnumerator NextRoundTimer()
    {
        // remove the 'no tweets' text

        if (m_tweetHeader.m_text.gameObject.activeSelf)
        {
            m_tweetHeader.m_text.gameObject.SetActive(false);
        }

        // refresh current tweets with updated favs & retweet numbers

        foreach (TweetUI tUI in m_tweets)
        {
            Tweet thisTweet = m_tweetList[tUI.m_ID];
            tUI.Tweet(thisTweet, tUI.m_portrait.texture);
        }

        yield return(new WaitForSeconds(1.0f));

        // phone raises up

        m_phoneState = PhoneState.Up;
        m_phone.clip = m_phone.GetClip("Phone_Raise01");
        m_phone.Play();

        AudioManager.instance.PlaySound(AudioManager.SoundType.Phone_Raise);

        yield return(new WaitForSeconds(1.0f));

//		m_clickReceivers [1].gameObject.SetActive (true);
//		m_clickReceivers [0].gameObject.SetActive (false);

        m_currentTweet.m_id = GameManager.instance.newID;

        // new tweet appears

        GameObject newTweetOBJ = (GameObject)Instantiate(m_tweetOBJ, m_tweetPanel);

        newTweetOBJ.transform.localScale       = Vector3.one;
        newTweetOBJ.transform.localEulerAngles = Vector3.zero;
        newTweetOBJ.transform.localPosition    = Vector3.zero;

        newTweetOBJ.transform.SetAsFirstSibling();

        AudioManager.instance.PlaySound(AudioManager.SoundType.Tweet_Sent);

        TweetUI t = newTweetOBJ.GetComponent <TweetUI> ();

        // get face state

        Texture tex = m_tweetPortraitStates[0];

        switch (CharacterController.instance.currentFaceState)
        {
        case CharacterController.FaceState.Uncertain:
            tex = m_tweetPortraitStates[1];
            break;

        case CharacterController.FaceState.Distraught:
            tex = m_tweetPortraitStates[2];
            break;

        case CharacterController.FaceState.Anger:
            tex = m_tweetPortraitStates[3];
            break;

        case CharacterController.FaceState.Fear:
            tex = m_tweetPortraitStates[4];
            break;
        }

        t.Tweet(m_currentTweet, tex);
        m_tweets.Add(t);

        m_tweetList.Add(m_currentTweet.m_id, m_currentTweet);
        m_currentTweet = null;


        // play audio cue

        if (UnityEngine.Random.Range(0.0f, 1.0f) > 0.8f)
        {
            yield return(new WaitForSeconds(0.5f));

            if (m_currentNoun.m_random)
            {
                AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizeRandom);
            }
            else if (m_currentVerb.m_affinities [0].m_quality == Word.WordQuality.Positive)
            {
                AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizePositive);
            }
            else if (m_currentVerb.m_affinities [0].m_quality == Word.WordQuality.Negative)
            {
                AudioManager.instance.PlaySound(AudioManager.SoundType.Character_VocalizeNegative);
            }
        }

//		int incAmount = 15;
        int incAmount = 20;
        int amt       = 0;


        for (int i = 0; i < m_currentNoun.m_affinities.Length; i++)
        {
            Word.Affinity af = m_currentNoun.m_affinities [i];

            Word.Affinity vAf = m_currentVerb.m_affinities [0];

            bool specificResponse = false;

            // uncomment and fix if specific responses are needed

//			if (m_currentVerb.m_specificResponses.Length > 0) {
//
//				foreach (Word.SpecificResponse s in m_currentVerb.m_specificResponses) {
//
//					if (s.m_noun == m_currentNoun) {
//						Debug.Log ("SPECIFIC RESPONSE");
//						if (s.m_quality == Word.WordQuality.Negative) {
//
//							amt = incAmount*-1;
//						} else if (s.m_quality == Word.WordQuality.Positive) {
//							amt = incAmount;
//						}
//						specificResponse = true;
//						break;
//					}
//				}
//
//			}

            if (!specificResponse)
            {
                if (af.m_quality == Word.WordQuality.Negative && vAf.m_quality == Word.WordQuality.Negative)
                {
                    amt = incAmount;
                }
                else if (af.m_quality == Word.WordQuality.Positive && vAf.m_quality == Word.WordQuality.Negative)
                {
                    amt = incAmount * -1;
                }
                else if (af.m_quality == Word.WordQuality.Negative && vAf.m_quality == Word.WordQuality.Positive)
                {
                    amt = incAmount * -1;
                }
                else if (af.m_quality == Word.WordQuality.Positive && vAf.m_quality == Word.WordQuality.Positive)
                {
                    amt = incAmount;
                }
                else if (af.m_quality == Word.WordQuality.Positive)
                {
                    amt = incAmount;
                }
                else if (af.m_quality == Word.WordQuality.Negative)
                {
                    amt = incAmount * -1;
                }
            }

            if (amt != 0)
            {
                yield return(new WaitForSeconds(1.0f));

                // update stat values

                foreach (Stat thisStat in m_stats)
                {
                    if (thisStat.m_category == af.m_category)
                    {
                        thisStat.UpdateValue(amt);

                        switch (thisStat.m_category)
                        {
                        case Word.WordCategory.Captialism:

                            if (amt > 0)
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Capitalism_Increase);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Increase);
                            }
                            else
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Capitalism_Decrease);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Decrease);
                            }
                            break;

                        case Word.WordCategory.Law:

                            if (amt > 0)
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Law_Increase);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Increase);
                            }
                            else
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Law_Decrease);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Decrease);
                            }
                            break;

                        case Word.WordCategory.Democracy:

                            if (amt > 0)
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Democracy_Increase);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Increase);
                            }
                            else
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Democracy_Decrease);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Decrease);
                            }
                            break;

                        case Word.WordCategory.Culture:

                            if (amt > 0)
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Culture_Increase);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Increase);
                            }
                            else
                            {
                                AudioManager.instance.PlaySound(AudioManager.SoundType.Culture_Decrease);
                                thisStat.ui.SetArrow(StatUI.ArrowType.Decrease);
                            }
                            break;
                        }

//						if (amt > 0) {
//
//							thisStat.ui.SetColor (Color.green);
//
//						} else if (amt < 0) {
//
//							thisStat.ui.SetColor (Color.red);
//						}
//						if (amt != 0) {


//							if (amt == 0 || amt == 100) {
//
//								thisStat.ui.SetColor (Color.red);
//
//							} else {

//								thisStat.ui.SetBorderColor (Color.red);
//							}
//						}

                        if (thisStat.currentScore == 0 || thisStat.currentScore == thisStat.maxScore)
                        {
                            foreach (Stat s in m_stats)
                            {
//								if (s != thisStat) {

                                thisStat.ui.SetColor(Color.white);
//								}
                            }

                            thisStat.ui.SetColor(Color.red);

                            GameOver(thisStat);
                            yield break;
                        }
                        else if (amt != 0 && m_gameState != GameState.GameOver)
                        {
                            thisStat.ui.SetBorderColor(Color.red);
                        }

                        break;
                    }
                }
            }
        }

        yield return(new WaitForSeconds(1.0f));

        // reset stat colors back to white

        foreach (Stat thisStat in m_stats)
        {
            thisStat.ui.SetColor(Color.white);
        }

        // check if at end of timeline, four more years if so

//		if (m_turnNumber+1 == m_maxTurns) {
//
//			yield return StartCoroutine (FourMoreYears ());
//		}

        m_playerInputAllowed = true;
        m_waitingForNextTurn = true;


        if (!m_helpTapIconPhoneShown)
        {
            m_tapIcon.gameObject.SetActive(true);
            m_tapIcon.Play("Help_TapIcon01");
        }


        yield return(true);
    }
Esempio n. 39
0
        private void MBAPhone_OnSuccessToConnect(int LineNo, string ToRTPIP, int ToRTPPort)
        {
            phoneState = PhoneState.CALL_ACCEPTS;
            CallDuration = 0;
            SoundPlayer.Stop();

            var svol = MBAPhone.GetSpkVolume();
            var mvol = MBAPhone.GetMicVolume();

            //if (!MBAPhone.SetSpkVolume(255))
            //    Trace.WriteLine("ERROR SetSpkVolume method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
            //if (!MBAPhone.SetSpkSoftVolume(255))
            //    Trace.WriteLine("ERROR SetSpkSoftVolume method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
            //if (!MBAPhone.SetMicVolume(255))
            //    Trace.WriteLine("ERROR SetMicVolume method. CODE: " + MBAPhone.GetVaxObjectError().ToString());
            //svol = MBAPhone.GetSpkVolume();
            //mvol = MBAPhone.GetMicVolume();
        }
 //刘海模式启用
 public static void SetPhoneState(PhoneState state)
 {
     PlayerPrefs.SetInt(PhoneStateKey, (int)state);
 }
Esempio n. 41
0
 private static extern Int32 getPhoneState(ref PhoneState phoneState);
Esempio n. 42
0
    public void Ring()
    {
        ring.Play();
        Debug.Log("Phone is Ringing!!");

        GetComponent<Animator>().SetBool("Ring", true);
        if (State == PhoneState.Idle)
        {
            State = PhoneState.Ring;
        }
    }
Esempio n. 43
0
 public void CallStarts()
 {
     this.m_PhoneState = PhoneState.Calling;
 }
Esempio n. 44
0
        public void GoToState(PhoneState state)
        {
            _state = state;
            this.OnUIThread(() =>
                                {
                                    _txtState.Text = StateToLabel(_state);

                                    if (_state == PhoneState.WaitForProvisional)
                                    {
                                        //_btnPhone.Enabled = false;
                                    }
                                    if (_state == PhoneState.Ringing)
                                    {
                                        _btnPhone.Enabled = true;
                                        _btnPhone.Text = "Answer";
                                    }
                                    if (_state == PhoneState.CallerEstablished)
                                    {
                                        _btnPhone.Enabled = true;
                                        _btnPhone.Text = "End Call";
                                    }

                                    //if (_state == PhoneState.Idle)
                                    //{
                                    //    Foreach(_grpbForm.Controls, (c) => c.Enabled = true);
                                    //}
                                    //else
                                    //{
                                    //    Foreach(_grpbForm.Controls, (c) => c.Enabled = false);
                                    //}

                                    //if (_state == PhoneState.Idle)
                                    //{
                                    //    Foreach(_grpbCalleeActions.Controls, (c) => c.Enabled = true);
                                    //    Foreach(_grpbCallerActions.Controls, (c) => c.Enabled = true);
                                    //}
                                    //else if (_state == PhoneState.WaitForProvisional)
                                    //{
                                    //    Foreach(_grpbCalleeActions.Controls, (c) => c.Enabled = false);
                                    //    _btnInvite.Enabled = false;
                                    //}
                                    //else if (_state == PhoneState.WaitForFinal)
                                    //{

                                    //}
                                    //else if (_state == PhoneState.CallerEstablished)
                                    //{
                                    //    _btnCallerSendBye.Enabled = true;
                                    //}
                                    //else if (_state == PhoneState.Ringing)
                                    //{
                                    //    Foreach(_grpbCallerActions.Controls, (c) => c.Enabled = false);
                                    //    _btnCalleeSendBye.Enabled = false;
                                    //    _btnCalleeSendCancel.Enabled = _btnCalleeSendOk.Enabled = true;
                                    //}
                                    //else if (_state == PhoneState.WaitingForAck)
                                    //{
                                    //    _btnCalleeSendCancel.Enabled = false;
                                    //}
                                    //else if (_state == PhoneState.CalleeEstablished)
                                    //{
                                    //    _btnCalleeSendBye.Enabled = true;
                                    //}

                                });
        }
Esempio n. 45
0
 private void MBAPhone_OnIncomingCall(string CallId, string DisplayName, string UserName, string FromURI, string ToURI)
 {
     Number = DisplayName;
     phoneState = PhoneState.TRYING_IN;
 }
Esempio n. 46
0
 public TalkOnPhoneState(PhoneState state, DateTime start, DateTime end)
 {
     this._start = start;
     this._end = end;
     this._state = state;
 }
Esempio n. 47
0
 private static void _realPhone_StateChanged(PhoneState obj)
 {
     _parentProcess.SendMessage($"$E:StateChanged#{obj}");
 }