コード例 #1
0
            public static HEvent Reverse(HEvent events)
            {
                HEvent current = end;

                while (events != end)
                {
                    HEvent prev;
                    do
                    {
                        prev = events.Prev;
                    } while (prev == null);
                    events.Prev = current;
                    current     = events;
                    events      = prev;
                }
                return(current);
            }
コード例 #2
0
        private static void HandleServerResponse(string _Answer, EMessageTypes _MsgType, Delegate _OnSuccess)
        {
            if (_Answer == "error")
            {
                // Silent Handling of Error Answer
                switch (_MsgType)
                {
                case EMessageTypes.MSG_SEND_USER_DATA:
                    FileService.SetStorageEntry(Constants.STORAGE_KEY_USER_NOT_SEND, FileService.GetUserData());
                    break;
                }
            }
            switch (_MsgType)
            {
            case EMessageTypes.MSG_LOAD_REFERENTS:
                List <Referent> HReferents = new List <Referent>();
                if (_Answer != "error")
                {
                    HReferents = JsonConvert.DeserializeObject <List <Referent> >(_Answer);
                    HReferents.RemoveAll(r => r.IDENT == 1);
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => NotificationService.ShowAlert(Messages.ERROR, Messages.ERROR_AT_LOADING, Messages.CLOSE));
                }
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadReferentsSuccess)(HReferents));
                break;

            case EMessageTypes.MSG_LOAD_STANDS:
                List <Stand> HStands = new List <Stand>();
                if (_Answer != "error")
                {
                    HStands = JsonConvert.DeserializeObject <List <Stand> >(_Answer);
                    Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadStandsSuccess)(HStands));
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => NotificationService.ShowAlert(Messages.ERROR, Messages.ERROR_AT_LOADING, Messages.CLOSE));
                }
                break;

            case EMessageTypes.MSG_LOAD_ALL_EVENTS:
                List <Event> HEvents = new List <Event>();
                if (_Answer != "error")
                {
                    HEvents = JsonConvert.DeserializeObject <List <Event> >(_Answer);
                    HEvents.Sort(delegate(Event _A, Event _B) {
                        return(_A.START_AS_DATE.CompareTo(_B.START_AS_DATE));
                    });
                    foreach (Event HEvent in HEvents)
                    {
                        // Referents setzen
                        HEvent.GenerateReferent();
                        HEvent.IsInbound = (HEvents.IndexOf(HEvent) % 2) == 0;
                    }
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => NotificationService.ShowAlert(Messages.ERROR, Messages.ERROR_AT_LOADING, Messages.CLOSE));
                }
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadEventsSuccess)(HEvents));
                break;

            case EMessageTypes.MSG_LOAD_BREAKOUT_SESSION:
                List <Event> HBreakoutEvents = new List <Event>();
                if (_Answer != "error")
                {
                    HBreakoutEvents = JsonConvert.DeserializeObject <List <Event> >(_Answer);
                    foreach (Event HEvent in HBreakoutEvents)
                    {
                        // Referents setzen
                        HEvent.GenerateReferent();
                    }
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => NotificationService.ShowAlert(Messages.ERROR, Messages.ERROR_AT_LOADING, Messages.CLOSE));
                }
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadEventsSuccess)(HBreakoutEvents));
                break;

            case EMessageTypes.MSG_LOAD_USER_EVENTS:
                List <Event> HPersonalEvents = new List <Event>();
                if (_Answer != "error")
                {
                    HPersonalEvents = JsonConvert.DeserializeObject <List <Event> >(_Answer);
                    HPersonalEvents.Sort(delegate(Event _A, Event _B) {
                        return(_A.START_AS_DATE.CompareTo(_B.START_AS_DATE));
                    });
                    foreach (Event HPersonalEvent in HPersonalEvents)
                    {
                        // Referents setzen
                        if (HPersonalEvent.CAN_BE_RESERVED)
                        {
                            HPersonalEvent.USER_HAS_RESERVED = true;
                        }

                        HPersonalEvent.GenerateReferent();
                        HPersonalEvent.IsInbound = (HPersonalEvents.IndexOf(HPersonalEvent) % 2) == 0;
                    }
                }
                else
                {
                    if (_Answer != "error")
                    {
                    }
                    else
                    {
                    }
                }

                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadEventsSuccess)(HPersonalEvents));
                break;

            case EMessageTypes.MSG_SEND_USER_DATA:
                if (FileService.DoesStorageEntryExist(Constants.STORAGE_KEY_USER_NOT_SEND))
                {
                    FileService.RemoveStorageEntry(Constants.STORAGE_KEY_USER_NOT_SEND);
                }
                break;

            case EMessageTypes.MSG_CHECK_UNLOCK_KEY:
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnHandleCheckCustomerKey)(_Answer));
                break;

            case EMessageTypes.MSG_SEND_RESERVATION:
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnCommunicationSuccess)(_Answer));
                break;

            case EMessageTypes.MSG_LOAD_NOTIFICATIONS:
                List <Notification> HNotifications = new List <Notification>();
                if (_Answer != "error")
                {
                    HNotifications = JsonConvert.DeserializeObject <List <Notification> >(_Answer);
                }
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnLoadNotificationsSuccess)(HNotifications));
                break;

            case EMessageTypes.MSG_SEND_FEEDBACK:
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnCommunicationSuccess)(_Answer));
                break;

            case EMessageTypes.MSG_LOAD_SINGLE_EVENT:
                Device.BeginInvokeOnMainThread(() => (_OnSuccess as OnCommunicationSuccess)(_Answer));
                break;

            default:
                throw new NotImplementedException();
            }
        }
コード例 #3
0
    public static void HapticEvent(HEvent e)
    {
    #if UNITY_IOS
        bool available = IGHapticFeedback.IsHapticFeedbackSupported;
    #elif UNITY_ANDROID
        bool available = AGVibrator.HasVibrator();
    #endif

        if (!available)
        {
            return;
        }

        switch (e)
        {
        case HEvent.Select:
        #if UNITY_IOS
            IGHapticFeedback.SelectionChanged();
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(400, 120));
        #endif
            break;

        case HEvent.Delete:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Medium);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(600, 170));
        #endif
            break;

        case HEvent.Deleted:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Heavy);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(600, 250));
        #endif
            break;

        case HEvent.Click:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Light);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(300, 100));
        #endif
            break;

        case HEvent.Error:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Error);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(error_pattern, error_amplitude, -1));
        #endif
            break;

        case HEvent.Warning:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Warning);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(warning_pattern, warning_amplitude, -1));
        #endif
            break;

        case HEvent.Success:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Success);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(success_pattern, success_amplitude, -1));
        #endif
            break;
        }
    }