Ejemplo n.º 1
0
	// Use this for initialization
	void Start () {
		#if COHERENT_UI_EVALUATION_UNITY3D
			StartActivator();
		#endif

		if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11")
				|| SystemInfo.operatingSystem.Contains("Mac"))
		{
			DeviceSupportsSharedTextures = true;
		}

		if (m_UISystem == null)
		{
			m_SystemListener = (SystemListenerFactoryFunc != null)? SystemListenerFactoryFunc(this.OnSystemReady) : new SystemListener(this.OnSystemReady);
			if (FileHandlerFactoryFunc != null)
			{
				m_FileHandler = FileHandlerFactoryFunc();
			}
			#if !UNITY_ANDROID || UNITY_EDITOR

			if (m_FileHandler == null)
			{
				Debug.LogWarning("Unable to create file handler using factory function! Falling back to default handler.");
				m_FileHandler = new UnityFileHandler();
			}
			#endif

			#if UNITY_EDITOR || COHERENT_UNITY_STANDALONE || COHERENT_UNITY_UNSUPPORTED_PLATFORM
			ContextSettings settings = new ContextSettings()
			{
				EnableProxy = this.EnableProxy,
				AllowCookies = this.AllowCookies,
				CookiesResource = "file:///" + Application.persistentDataPath + '/' + this.CookiesResource,
				CachePath = Path.Combine(Application.temporaryCachePath, this.CachePath),
				HTML5LocalStoragePath = Path.Combine(Application.temporaryCachePath, this.HTML5LocalStoragePath),
				ForceDisablePluginFullscreen = this.ForceDisablePluginFullscreen,
				DisableWebSecurity = this.DisableWebSecurity,
				DebuggerPort = this.DebuggerPort,
			};
			#elif UNITY_IPHONE || UNITY_ANDROID
			ContextSettings settings = new ContextSettings() {
				iOS_UseURLCache = m_UseURLCache,
				iOS_URLMemoryCacheSize = (uint)m_MemoryCacheSize,
				iOS_URLDiskCacheSize = (uint)m_DiskCacheSize,
			};
			int sdkVersion = Coherent.UI.Mobile.Versioning.SDKVersion;
			#endif

			if (string.IsNullOrEmpty(Coherent.UI.License.COHERENT_KEY))
			{
				throw new System.ApplicationException("You must supply a license key to start Coherent UI! Follow the instructions in the manual for editing the License.cs file.");
			}

			m_UISystem = CoherentUILibrary.CreateViewContext(
				settings, m_SystemListener, m_FileHandler);
			if (m_UISystem == null)
			{
				throw new System.ApplicationException("Creating a ViewContext"
					+ " failed!");
			}
			Debug.Log ("Coherent UI system initialized..");
			#if UNITY_EDITOR || COHERENT_UNITY_STANDALONE
			CoherentUIViewRenderer.WakeRenderer(
				(byte)m_UISystem.GetContextId());
			#endif
		}
		m_StartTime = Time.realtimeSinceStartup;

		DontDestroyOnLoad(this.gameObject);
	}
Ejemplo n.º 2
0
	// Use this for initialization
	void Start () {
		
		if(SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11") || SystemInfo.operatingSystem.Contains("Mac"))
		{
			DeviceSupportsSharedTextures = true;
		}
		
		if (m_UISystem == null)
		{
			m_SystemListener = (SystemListenerFactoryFunc != null)? SystemListenerFactoryFunc(this.OnSystemReady) : new SystemListener(this.OnSystemReady);
			m_LogHandler = new UnityLogHandler();
			if (FileHandlerFactoryFunc != null)
			{
				m_FileHandler = FileHandlerFactoryFunc();
			}
			if (m_FileHandler == null)
			{
				Debug.LogWarning("Unable to create file handler using factory function! Falling back to default handler.");
				m_FileHandler = new UnityFileHandler();
			}
			
			#if UNITY_EDITOR || COHERENT_UNITY_STANDALONE
			SystemSettings settings = new SystemSettings() { 
				HostDirectory = Path.Combine(Application.dataPath, this.HostDirectory),
				EnableProxy = this.EnableProxy,
				AllowCookies = this.AllowCookies,
				CookiesResource = "file:///" + Application.persistentDataPath + '/' + this.CookiesResource,
				CachePath = Path.Combine(Application.temporaryCachePath, this.CachePath),
				HTML5LocalStoragePath = Path.Combine(Application.temporaryCachePath, this.HTML5LocalStoragePath),
				ForceDisablePluginFullscreen = this.ForceDisablePluginFullscreen,
				DisableWebSecurity = this.DisableWebSecutiry,
				DebuggerPort = this.DebuggerPort,
			};
			#elif UNITY_IPHONE
			SystemSettings settings = new SystemSettings() {
				
			};
			#endif
			if (string.IsNullOrEmpty(Coherent.UI.License.COHERENT_KEY))
			{
				throw new System.ApplicationException("You must supply a license key to start Coherent UI! Follow the instructions in the manual for editing the License.cs file.");
			}
			m_UISystem = CoherentUI_Native.InitializeUISystem(Coherent.UI.License.COHERENT_KEY, settings, m_SystemListener, Severity.Warning, m_LogHandler, m_FileHandler);
			if (m_UISystem == null)
			{
				throw new System.ApplicationException("UI System initialization failed!");
			}
			Debug.Log ("Coherent UI system initialized..");
		}
		
		DontDestroyOnLoad(this.gameObject);
	}
	// Use this for initialization
	void Start () {
		if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 11")
				|| SystemInfo.operatingSystem.Contains("Mac"))
		{
			DeviceSupportsSharedTextures = true;
		}

		if (m_UISystem == null)
		{
			m_SystemListener = (SystemListenerFactoryFunc != null)? SystemListenerFactoryFunc(this.OnSystemReady) : new SystemListener(this.OnSystemReady);
			m_LogHandler = new UnityLogHandler();
			if (FileHandlerFactoryFunc != null)
			{
				m_FileHandler = FileHandlerFactoryFunc();
			}
			#if !UNITY_ANDROID || UNITY_EDITOR

			if (m_FileHandler == null)
			{
				Debug.LogWarning("Unable to create file handler using factory function! Falling back to default handler.");
				m_FileHandler = new UnityFileHandler();
			}
			#endif

			#if COHERENT_UNITY_STANDALONE || COHERENT_UNITY_UNSUPPORTED_PLATFORM
			SystemSettings settings = new SystemSettings() {
				HostDirectory = Path.Combine(Application.dataPath, this.HostDirectory),
				EnableProxy = this.EnableProxy,
				AllowCookies = this.AllowCookies,
				CookiesResource = "file:///" + Application.persistentDataPath + '/' + this.CookiesResource,
				CachePath = Path.Combine(Application.temporaryCachePath, this.CachePath),
				HTML5LocalStoragePath = Path.Combine(Application.temporaryCachePath, this.HTML5LocalStoragePath),
				ForceDisablePluginFullscreen = this.ForceDisablePluginFullscreen,
				DisableWebSecurity = this.DisableWebSecutiry,
				DebuggerPort = this.DebuggerPort,
			};
			int sdkVersion = Coherent.UI.Versioning.SDKVersion;
			#elif UNITY_IPHONE || UNITY_ANDROID
			SystemSettings settings = new SystemSettings() {
				iOS_UseURLCache = m_UseURLCache,
				iOS_URLMemoryCacheSize = (uint)m_MemoryCacheSize,
				iOS_URLDiskCacheSize = (uint)m_DiskCacheSize,
			};
			int sdkVersion = Coherent.UI.Mobile.Versioning.SDKVersion;
			#endif

			m_UISystem = CoherentUI_Native.InitializeUISystem(sdkVersion, Coherent.UI.License.COHERENT_KEY, settings, m_SystemListener, Severity.Info, m_LogHandler, m_FileHandler);
			if (m_UISystem == null)
			{
				throw new System.ApplicationException("UI System initialization failed!");
			}
			Debug.Log ("Coherent UI system initialized..");
			#if COHERENT_UNITY_STANDALONE
			CoherentUIViewRenderer.WakeRenderer();
			#endif
		}
		m_StartTime = Time.realtimeSinceStartup;

		DontDestroyOnLoad(this.gameObject);
	}