当前位置: 首页>>代码示例>>C#>>正文


C# UIManager.AddCamera方法代码示例

本文整理汇总了C#中UIManager.AddCamera方法的典型用法代码示例。如果您正苦于以下问题:C# UIManager.AddCamera方法的具体用法?C# UIManager.AddCamera怎么用?C# UIManager.AddCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIManager的用法示例。


在下文中一共展示了UIManager.AddCamera方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

	private float originalCameraSize; //used for animating
	
	#endregion
	
	#region Init
	
	public void Initialize()
	{
		myPopup = this as IPopup;
		
		//parse out the clone name
		string newName = gameObject.name;
		gameObject.name = StringExtensions.ParseOutClone(ref newName);
		
		background.Start(); //resize it before we call preinit so we know we have correct size
		
		myPopup.PreInit();
		
		myCam = GetComponent(typeof(Camera)) as Camera;
		originalCameraSize = myCam.orthographicSize;
		
		//pause game
		if (shouldPauseGame == true)
			Time.timeScale = 0.0f;
		
		if (openSound != null)
			SoundManager.PlaySoundOnce(openSound);
		
		if (cancelButton != null)
		{
			cancelButton.ResizeAndReposition(cancelButton);cancelButton.Start();
			
			if (cancelButton.spriteText != null)
			{
				cancelButton.spriteText.multiline = false;
				cancelButton.spriteText.maxWidth = cancelButton.width - (cancelButton.width * GameValues.buttonTextPaddingPercentage);
			}
		}
		
		if (shouldAnimate)
			myCam.orthographicSize *= 5;
		
		popupManager = PopupManager.I;
		
		if (popupManager == null)
		{
			Kill();
			return;
		}
		
		uiManager = UIManager.instance;

		if (uiManager != null)
		{
			//save all old cameras then delete from UIManager. Otherwise objects behind will still detect input
			originalCameraSettings = uiManager.uiCameras;
			
			for (int x = uiManager.uiCameras.Length -1; x >= 0; x--)
			{
				uiManager.RemoveCamera(x);
			}
			
			uiManager.AddCamera(myCam, myCam.cullingMask, Mathf.Infinity, 0);
			
			originalRayCam = uiManager.rayCamera;
			uiManager.rayCamera = myCam;
		}
		else
		{
			Kill();
			return;
		}
		
		popupManager.activePopups.Add(myPopup);
        myCam.depth = popupManager.activePopups.Count + 1;

		if (shouldAnimate)
		{
			//called right before animation
			myPopup.PreAnimate();
			
			HOTween.defUpdateType = UpdateType.TimeScaleIndependentUpdate;
			
			Sequence s = new Sequence();
			//s.Append(HOTween.To(myCam, 1.2f, "orthographicSize", originalCameraSize));
			s.Append(HOTween.To(myCam, 0.3f, new TweenParms()
										.UpdateType(UpdateType.TimeScaleIndependentUpdate)
										.Prop("orthographicSize", originalCameraSize)
										.Ease(EaseType.EaseInBounce)
										));
			s.ApplyCallback(CallbackType.OnComplete, AnimationComplete);
			s.Play();
		}
		else
		{
			AddCancelButtonDelegate();
			myPopup.InitComplete();
		}
	}
开发者ID:adahera222,项目名称:properme,代码行数:99,代码来源:PopupBase.cs


注:本文中的UIManager.AddCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。