Exemple #1
0
 bool IGourdUI.UIViewIsValidForDevice(UIViewConfigData viewData, AppDeviceData deviceData)
 {
     return(UIViewFilterResolver.ViewFilterResult(
                viewData.filterData.positiveFilters.ToArray(),
                viewData.filterData.negativeFilters.ToArray(),
                deviceData));
 }
Exemple #2
0
        /// <summary>
        /// Sets the valid UIView as active once it's been found.
        /// </summary>
        /// <param name="deviceData"></param>
        /// <param name="viewData"></param>
        private void SetValidUIView(AppDeviceData deviceData, UIViewConfigData viewData)
        {
            // Make sure we're not setting the same UI view
            if (_viewContract != null)
            {
                if (_currentViewData.prefab != viewData.prefab)
                {
                    DestroyCurrentView();
                }
                else
                {
                    _viewContract.OnAppDeviceDataUpdated(deviceData);
                    return;
                }
            }

            // Instantiate new view
            _currentViewData = viewData;

            // Instantiate the view prefab, hook up contract
            GameObject vObj = Instantiate(viewData.prefab, transform);

            _viewContract = vObj.GetComponent <V>();
            vObj.GetComponent <UIView <C, S> >().screenContract = this as C;
            _viewContract.OnViewInstantiated(deviceData, !_screenHasBeenInstantiated);

            // We can optionally reset the state between view changes
            if (_configBaseData.resetStateBetweenViewChanges)
            {
                ResetScreenState();
            }

            _viewContract.ApplyScreenStateToView(state);
            _viewContract.Show();
        }