本文整理汇总了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();
}
}