Beispiel #1
0
        /// <summary>
        /// Requests privileges and starts MLContacts.
        /// </summary>
        private void StartAPI()
        {
            #if PLATFORM_LUMIN
            MLResult result = MLPrivilegesStarterKit.Start();
            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLContactsBehavior failed starting MLPrivileges, disabling script. Reason: {0}", result);
                OnStartupComplete?.Invoke(false);
                enabled = false;
                return;
            }

            result = MLPrivilegesStarterKit.RequestPrivileges(MLPrivileges.Id.AddressBookRead, MLPrivileges.Id.AddressBookWrite);
            if (result.Result != MLResult.Code.PrivilegeGranted)
            {
                Debug.LogErrorFormat("Error: MLContactsBehavior failed requesting privileges, disabling script. Reason: {0}", result);
                OnStartupComplete?.Invoke(false);
                enabled = false;
                return;
            }

            MLPrivilegesStarterKit.Stop();

            result = MLContacts.Start();
            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLContactsBehavior failed starting MLContacts, disabling script. Reason: {0}", result);
                OnStartupComplete?.Invoke(false);
                enabled = false;
                return;
            }

            OnStartupComplete?.Invoke(true);
            #endif
        }
Beispiel #2
0
    public override void Execute()
    {
        //StartMessageReciever if you are using UnityNetworking



        //TODO: Do some custom Setup Stuff here that is specific to your server

        /*
         * This could be stuff like setting up data, etc.. etc..
         * Notice that the ServerSettingsData is available for you to use here
         */

        OnStartupComplete.Dispatch();
    }