Ejemplo n.º 1
0
        void UpdateStatus()
        {
            saveState = (int)SDPlugin.SDSaveState.None;

            if (SDPlugin.IsSDKReady && (saveTime > 0 || loadTime > 0))
            {
            }
            else
            {
                return;
            }

            var status = "";

            if (saveTime > loadTime)
            {
                unsafe
                {
                    fixed(int *saveStatePtr = &saveState, saveErrorPtr = &saveError)
                    {
                        fixed(long *uploadSizePtr = &uploadSize)
                        {
                            fixed(float *uploadProgessPtr = &uploadProgress)
                            {
                                SDPlugin.SixDegreesSDK_GetSaveStatus(saveTime, saveStatePtr, saveErrorPtr, uploadSizePtr, uploadProgessPtr);
                            }
                        }
                    }
                }
            }

            StringBuilder sb = new StringBuilder(16);

            SDPlugin.SixDegreesSDK_GetLocationId(sb, sb.Capacity);
            SDPlugin.LocationID = sb.ToString();
        }
Ejemplo n.º 2
0
    private IEnumerator LoadCoroutine()
    {
        loadState = (int)SDPlugin.SDLoadState.None;

        yield return(new WaitForSeconds(0.1f));

        bool loading = true;

        while (loading)
        {
            UpdateLoadStatus();

            switch (loadState)
            {
            case (int)SDPlugin.SDLoadState.DoneFailed:
            case (int)SDPlugin.SDLoadState.DoneSuccess:
            case (int)SDPlugin.SDLoadState.DoneCancelled:
                loading = false;
                break;

            case (int)SDPlugin.SDLoadState.Positioning:
                if (OnFindingLocationEvent != null)
                {
                    OnFindingLocationEvent();
                }
                break;

            case (int)SDPlugin.SDLoadState.Downloading:
                if (OnDownloadingEvent != null)
                {
                    OnDownloadingEvent();
                }
                break;

            case (int)SDPlugin.SDLoadState.Relocalizing:
                if (OnRelocalizingEvent != null)
                {
                    OnRelocalizingEvent();
                }
                break;

            default:
                break;
            }

            yield return(null);
        }

        if (loadState == (int)SDPlugin.SDLoadState.DoneSuccess)
        {
            StringBuilder sb = new StringBuilder(16);
            SDPlugin.SixDegreesSDK_GetLocationId(sb, sb.Capacity);
            SDPlugin.LocationID = sb.ToString();
            if (OnLoadSucceededEvent != null)
            {
                OnLoadSucceededEvent();
            }
        }
        else if (loadState == (int)SDPlugin.SDLoadState.DoneFailed)
        {
            if (OnLoadErrorEvent != null)
            {
                OnLoadErrorEvent(loadError);
            }
        }

        yield return(null);

        activeCoroutine = null;
    }