Esempio n. 1
0
        void FailMission()
        {
#if FULLLOG
            MoreDebug.Log("go: " + gameObject.name);
#endif
            if (!isActive)
            {
                return;
            }
#if FULLLOG
            MoreDebug.Log("real.");
#endif
            if (!PauseGame.exists)
            {
#if FULLLOG
                MoreDebug.Log("No PauseGame -----");
#endif
            }
            if (InfoPriority > operation.MissionTerseness)
            {
                MessageBoxParams parms = new MessageBoxParams();
                parms.Message               = FailureInfo;
                parms.MessageBoxTitle       = MissionTitle;
                parms.Button1Action         = PauseGame.only.queueResume;
                parms.MultipleCallBehaviour = MultipleCallBehaviours.Queue;
                EasyMessageBox.Show(parms);
                PauseGame.only.queuePause();
            }
            currentState = GoalManager.GoalState.reallose;
            FailureEvent.Invoke();
            operation.LoseMission();
            isActive = false;
            //Reset ();
        }
        public void NotifyUserAboutError(object sender, FailureEvent e)
        {
            TelephoneStatus = TelephoneStatus.Inaction;

            switch (e.FailureType)
            {
            case FailureType.InsufficientFunds:
                DisplayMethod?.Invoke("You don't have enough funds to make a call");
                break;

            case FailureType.AbonentIsBusy:
                DisplayMethod?.Invoke($"{e.PhoneNumber} - Abonent is Busy");
                break;

            case FailureType.AbonentDoesNotExist:
                DisplayMethod?.Invoke($"{e.PhoneNumber} - Abonent Doesn't Exist");
                break;

            case FailureType.AbonentIsNotResponding:
                DisplayMethod?.Invoke(sender is IPort port && port.PhoneNumber == e.PhoneNumber
                        ? "You Have Missed Call"
                        : $"{e.PhoneNumber} - Abonent Is Not Responding");
                break;

            default:
                DisplayMethod?.Invoke("Unknown Error");
                break;
            }
        }
Esempio n. 3
0
 private void OnNotifyPortOfFailure(FailureEvent e, IPort port)
 {
     if (NotifyPortOfFailure?.GetInvocationList().FirstOrDefault(x => x.Target == port) != null)
     {
         (NotifyPortOfFailure?.GetInvocationList().First(x => x.Target == port) as
          EventHandler <FailureEvent>)?.Invoke(this, e);
     }
 }
Esempio n. 4
0
        void FailGoal()
        {
#if FULLLOG
            MoreDebug.Log("go: " + gameObject.name);
#endif
            // do stuff
            currentState = GoalState.reallose;
            FailureEvent.Invoke();
            CleanUp();
        }
Esempio n. 5
0
 protected void HandleFailureResolved(FailureEvent failureEvent)
 {
     if (FailureResolved != null)
     {
         var args = new FailureResolvedEventArgs()
         {
             FailureEvent = failureEvent
         };
         FailureResolved(this, args);
     }
 }
        void Awake()
        {
            // Called as soon as we can
            SetupProxy();

            if (tokenUpdated == null)
            {
                tokenUpdated = new TokenEvent();
            }
            if (authenticationFailed == null)
            {
                authenticationFailed = new FailureEvent();
            }
            if (userLoggedIn == null)
            {
                userLoggedIn = new UnityUserUnityEvent();
            }
            if (userLoggedOut == null)
            {
                userLoggedOut = new UnityEvent();
            }
            if (linkSharingDetected == null)
            {
                linkSharingDetected = new LinkSharingEvent();
            }
            if (openInViewerDetected == null)
            {
                openInViewerDetected = new OpenInViewerEvent();
            }

            ProjectServer.Init();

            authBackend = new AuthBackend(this);
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
            m_Interop = new Interop(this);
            m_Interop.Start();
#endif

            m_TokenPersistentPath = Path.Combine(Application.persistentDataPath, AuthConfiguration.JwtTokenFileName);
        }
Esempio n. 7
0
        /// <summary>
        /// Attempts to read incoming data from the server.
        /// </summary>
        private void ReceiveData()
        {
            if (!Running)
            {
                return;
            }
            byte code = 0;

            try
            {
                code = communicationStream.ReadByte();
                if (!Running)
                {
                    return;
                }
                INaoEvent naoEvent = NaoEventFactory.NewEvent(code);
                EventQueue.Nao.Post(naoEvent);
            }
            catch (InvalidEventCodeException e)
            {
                Logger.Except(e);
                Logger.Log(this, "Invalid event code received: " + code);
                INaoEvent failureEvent = new FailureEvent(code);
                EventQueue.Goal.Post(failureEvent);
            }
            catch (Exception e)
            {
                if (e is InvalidOperationException || e is IOException)
                {
                    Logger.Log(this, "Communication stream got closed.");
                    communicationStream.Open = false;
                }
                else
                {
                    Logger.Log(this, "Unexpected exception occurred while processing incoming data: " + e);
                }
            }
        }
Esempio n. 8
0
 public void Handle(FailureEvent message)
 {
     ActivateModel <FailureViewModel>(
         new NamedParameter("FailureDescription", message.FailureDescription),
         new NamedParameter("FailureText", message.FailureText));
 }
 private void OnNotifyTelephoneOfFailure(FailureEvent e)
 {
     NotifyTelephoneOfFailure?.Invoke(this, e);
 }
        public void ReportError(object sender, FailureEvent e)
        {
            PortStatus = PortStatus.Free;

            OnNotifyTelephoneOfFailure(e);
        }