public static void ListenOnceForOne(this IEventDispatcher dispatcher, params BaseEventListener[] listeners)
    {
        bool returned = false;

        for (int i = 0; i < listeners.Length; i++)
        {
            BaseEventListener listener = listeners[i];

            if (listener is DispatcherBaseEventListener)
            {
                (listener as DispatcherBaseEventListener).SetDispatcher(dispatcher);
            }

            listener.proxy =
                evt => {
                if (returned)
                {
                    return;
                }
                returned = true;

                for (int j = 0; j < listeners.Length; j++)
                {
                    dispatcher.RemoveListener(listeners[j].returnEvent, listener.proxy);
                }

                listener.Callback(evt);
            };

            dispatcher.AddListener(listeners[i].returnEvent, listener.proxy);
        }
    }
コード例 #2
0
    private static BaseEventListener GetListenerScript(GameObject go, EventTriggerType eventType, bool bAdd)
    {
        BaseEventListener script = null;

        switch (eventType)
        {
        case EventTriggerType.PointerEnter: script = GetListenerScript <PointerEnterListener>(go, bAdd); break;

        case EventTriggerType.PointerExit: script = GetListenerScript <PointerExitListener>(go, bAdd); break;

        case EventTriggerType.PointerDown: script = GetListenerScript <PointerDownListener>(go, bAdd); break;

        case EventTriggerType.PointerUp: script = GetListenerScript <PointerUpListener>(go, bAdd); break;

        case EventTriggerType.PointerClick: script = GetListenerScript <PointerClickListener>(go, bAdd); break;

        case EventTriggerType.Drag: script = GetListenerScript <DragListener>(go, bAdd); break;

        case EventTriggerType.BeginDrag: script = GetListenerScript <BeginDragListener>(go, bAdd); break;

        case EventTriggerType.EndDrag: script = GetListenerScript <EndDragListener>(go, bAdd); break;

        case EventTriggerType.Drop:
        case EventTriggerType.Scroll:
        case EventTriggerType.UpdateSelected:
        case EventTriggerType.Select:
        case EventTriggerType.Deselect:
        case EventTriggerType.Move:
        case EventTriggerType.InitializePotentialDrag:
        case EventTriggerType.Submit:
        case EventTriggerType.Cancel: break;
        }
        return(script);
    }
コード例 #3
0
    public static void UnRegisterEvent(GameObject go, EventTriggerType eventType, BaseEventListener.Action callBack)
    {
        BaseEventListener listener = GetListenerScript(go, eventType, false);

        if (null == listener)
        {
            return;
        }
        listener.RemoveListener(callBack);
    }
コード例 #4
0
    public static void RegisterEvent(GameObject go, EventTriggerType eventType, BaseEventListener.Action callBack, params object[] objs)
    {
        BaseEventListener listener = GetListenerScript(go, eventType, true);

        if (null == listener)
        {
            return;
        }
        listener.AddListener(callBack, objs);
    }
コード例 #5
0
        private void Start()
        {
            //create BaseEventListeners
            foreach (PlayerDataProvider pdp in playerDataProviders)
            {
                BaseEventListener eventListenerResponse = this.gameObject.AddComponent <BaseEventListener>();
                eventListenerResponse.Events.Add(pdp.waitForResponse);
                eventListenerResponse.callMethod = "ResponseEvent";

                /*
                 * BaseEventListener eventListenerResponseCancel = this.gameObject.AddComponent<BaseEventListener>();
                 * eventListenerResponseCancel.Events.Add(pdp.cancelResponse);
                 * eventListenerResponseCancel.callMethod = "ResponseEvent";
                 */
            }
        }
コード例 #6
0
        static DataTestUtility()
        {
            Config c = Config.Load();

            NPConnectionString          = c.NPConnectionString;
            TCPConnectionString         = c.TCPConnectionString;
            TCPConnectionStringHGSVBS   = c.TCPConnectionStringHGSVBS;
            TCPConnectionStringAASVBS   = c.TCPConnectionStringAASVBS;
            TCPConnectionStringAASSGX   = c.TCPConnectionStringAASSGX;
            AADAuthorityURL             = c.AADAuthorityURL;
            AADPasswordConnectionString = c.AADPasswordConnectionString;
            AADServicePrincipalId       = c.AADServicePrincipalId;
            AADServicePrincipalSecret   = c.AADServicePrincipalSecret;
            LocalDbAppName                 = c.LocalDbAppName;
            LocalDbSharedInstanceName      = c.LocalDbSharedInstanceName;
            SupportsIntegratedSecurity     = c.SupportsIntegratedSecurity;
            FileStreamDirectory            = c.FileStreamDirectory;
            EnclaveEnabled                 = c.EnclaveEnabled;
            TracingEnabled                 = c.TracingEnabled;
            UseManagedSNIOnWindows         = c.UseManagedSNIOnWindows;
            DNSCachingConnString           = c.DNSCachingConnString;
            DNSCachingServerCR             = c.DNSCachingServerCR;
            DNSCachingServerTR             = c.DNSCachingServerTR;
            IsAzureSynapse                 = c.IsAzureSynapse;
            IsDNSCachingSupportedCR        = c.IsDNSCachingSupportedCR;
            IsDNSCachingSupportedTR        = c.IsDNSCachingSupportedTR;
            EnclaveAzureDatabaseConnString = c.EnclaveAzureDatabaseConnString;
            UserManagedIdentityClientId    = c.UserManagedIdentityClientId;
            MakecertPath           = c.MakecertPath;
            KerberosDomainPassword = c.KerberosDomainPassword;
            KerberosDomainUser     = c.KerberosDomainUser;

            System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;

            if (TracingEnabled)
            {
                TraceListener = new BaseEventListener();
            }

            if (UseManagedSNIOnWindows)
            {
                AppContext.SetSwitch(ManagedNetworkingAppContextSwitch, true);
                Console.WriteLine($"App Context switch {ManagedNetworkingAppContextSwitch} enabled on {Environment.OSVersion}");
            }

            AKVOriginalUrl = c.AzureKeyVaultURL;
            if (!string.IsNullOrEmpty(AKVOriginalUrl) && Uri.TryCreate(AKVOriginalUrl, UriKind.Absolute, out AKVBaseUri))
            {
                AKVBaseUri = new Uri(AKVBaseUri, "/");
                AKVBaseUrl = AKVBaseUri.AbsoluteUri;
                AKVUrl     = (new Uri(AKVBaseUri, $"/keys/{AKVKeyName}")).AbsoluteUri;
            }

            AKVTenantId     = c.AzureKeyVaultTenantId;
            AKVClientId     = c.AzureKeyVaultClientId;
            AKVClientSecret = c.AzureKeyVaultClientSecret;

            if (EnclaveEnabled)
            {
                if (!string.IsNullOrEmpty(TCPConnectionStringHGSVBS))
                {
                    AEConnStrings.Add(TCPConnectionStringHGSVBS);
                    AEConnStringsSetup.Add(TCPConnectionStringHGSVBS);
                }

                if (!string.IsNullOrEmpty(TCPConnectionStringAASVBS))
                {
                    AEConnStrings.Add(TCPConnectionStringAASVBS);
                }

                if (!string.IsNullOrEmpty(TCPConnectionStringAASSGX))
                {
                    AEConnStrings.Add(TCPConnectionStringAASSGX);
                    AEConnStringsSetup.Add(TCPConnectionStringAASSGX);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(TCPConnectionString))
                {
                    AEConnStrings.Add(TCPConnectionString);
                    AEConnStringsSetup.Add(TCPConnectionString);
                }
            }
        }