本文整理汇总了C#中UICamera类的典型用法代码示例。如果您正苦于以下问题:C# UICamera类的具体用法?C# UICamera怎么用?C# UICamera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UICamera类属于命名空间,在下文中一共展示了UICamera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start ()
{
mTrans = transform;
mUITex = GetComponent<UITexture>();
mCam = UICamera.FindCameraForLayer(gameObject.layer);
mWidth = mUITex.width;
mHeight = mUITex.height;
Color[] cols = new Color[mWidth * mHeight];
for (int y = 0; y < mHeight; ++y)
{
float fy = (y - 1f) / mHeight;
for (int x = 0; x < mWidth; ++x)
{
float fx = (x - 1f) / mWidth;
int index = x + y * mWidth;
cols[index] = Sample(fx, fy);
}
}
mTex = new Texture2D(mWidth, mHeight, TextureFormat.RGB24, false);
mTex.SetPixels(cols);
mTex.filterMode = FilterMode.Trilinear;
mTex.wrapMode = TextureWrapMode.Clamp;
mTex.Apply();
mUITex.mainTexture = mTex;
Select(value);
}
示例2: InitFuc
/// <summary>
/// Init all roots and configs
/// </summary>
void InitFuc()
{
Application.runInBackground = playInBackGround;
Debuger.EnableLog = enableDebuger;
manager = this.gameObject.AddComponent<SceneManager>();
manager.cacheRoot = transform.FindChild("CacheRoot");
manager.uiRoot = transform.FindChild("UI Root");
manager.senceRoot = transform.FindChild("SceneRoot");
manager.playerRoot = transform.FindChild("PlayerRoot");
manager.ghostRoot = transform.FindChild("GhostRoot");
uicamera = manager.uiRoot.FindChild("Camera").GetComponent<UICamera>();
tool = this.gameObject.AddComponent<Utility>();
connector = this.gameObject.AddComponent<Connector>();
this.gameObject.AddComponent<CacheFactory>();
ConfigFactory.InitResourceConfig();
ConfigFactory.ReadSystemConfig();
this.gameObject.AddComponent<ConfigInfo>();
ConfigInfo.ReadUIRules();
GUIManager.instance.Loading.gameObject.SetActive(true);
GUIManager.instance.FloatMessagePanel.gameObject.SetActive(true);
GUIManager.instance.FloatTip.gameObject.SetActive(true);
GUIManager.LoadingPercent(10);
ConfigInfo.Init();
ConfigInfo.InitPreGameConfigs();
GUIManager.FinishLoading();
StartGame();
}
示例3: Awake
void Awake()
{
m_myTransform = transform;
FillFullNameData(m_myTransform);
m_instance = m_myTransform.GetComponentsInChildren<InstanceMissionChooseUIViewManager>(true)[0];
m_lblSweepNum = m_myTransform.FindChild(m_widgetToFullName["InstanceLeftChallengeNum"]).GetComponentsInChildren<UILabel>(true)[0];
m_lblResetNum = m_myTransform.FindChild(m_widgetToFullName["InstanceLeftResetNum"]).GetComponentsInChildren<UILabel>(true)[0];
m_camInstanceMissionChooseUI = FindTransform("InstanceMissionChooseUICamera").GetComponentsInChildren<Camera>(true)[0];
m_uicamInstanceMissionChooseUI = m_myTransform.FindChild(m_widgetToFullName["InstanceMissionChooseUICamera"]).GetComponentsInChildren<UICamera>(true)[0];
m_goInstanceMissionChooseUIMapListGrid = m_myTransform.FindChild(m_widgetToFullName["InstanceMissionChooseUIMapListGrid"]).gameObject;
m_tranInstanceMissionChooseUIPageDOT = FindTransform("InstanceMissionChooseUIPageDOT");
m_goGOInstanceMissionChooseUI = m_myTransform.FindChild(m_widgetToFullName["GOInstanceMissionChooseUI"]).gameObject;
m_goGOInstanceMissionChooseUI.SetActive(false);
m_goGOInstanceMissionChooseUIMapList = FindTransform("GOInstanceMissionChooseUIMapList").gameObject;
m_goGOInstanceMissionChooseUINormal = FindTransform("GOInstanceMissionChooseUINormal").gameObject;
m_goGOInstanceMissionChooseUIRandom = FindTransform("GOInstanceMissionChooseUIRandom").gameObject;
m_chooseMogoSingleButtonList = FindTransform("InstanceMissionChooseUIChoose").GetComponentsInChildren<MogoSingleButtonList>(true)[0];
m_chooseMogoSingleButtonList.SetCurrentDownButton(0);
m_lblInstanceMissionChooseUIChooseNormalText = FindTransform("InstanceMissionChooseUIChooseNormalText").GetComponentsInChildren<UILabel>(true)[0];
m_lblInstanceMissionChooseUIChooseNormalTextDown = FindTransform("InstanceMissionChooseUIChooseNormalTextDown").GetComponentsInChildren<UILabel>(true)[0];
m_lblInstanceMissionChooseUIChooseRandomText = FindTransform("InstanceMissionChooseUIChooseRandomText").GetComponentsInChildren<UILabel>(true)[0];
m_lblInstanceMissionChooseUIChooseRandomTextDown = FindTransform("InstanceMissionChooseUIChooseRandomTextDown").GetComponentsInChildren<UILabel>(true)[0];
m_lblInstanceMissionChooseUIRandomBtnEnterTip = FindTransform("InstanceMissionChooseUIRandomBtnEnterTip").GetComponentsInChildren<UILabel>(true)[0];
m_spInstanceMissionChooseUIChooseRandomBGUp = FindTransform("InstanceMissionChooseUIChooseRandomBGUp").GetComponentsInChildren<UISprite>(true)[0];
m_spInstanceMissionChooseUIChooseRandomBGDown = FindTransform("InstanceMissionChooseUIChooseRandomBGDown").GetComponentsInChildren<UISprite>(true)[0];
m_dragCamera = m_myTransform.FindChild(m_widgetToFullName["InstanceMissionChooseUIMapListCamera"]).GetComponentsInChildren<Camera>(true)[0];
Camera SourceCamera = GameObject.Find("MogoMainUI").transform.FindChild("Camera").GetComponentsInChildren<Camera>(true)[0];
m_dragCamera.GetComponentsInChildren<UIViewport>(true)[0].sourceCamera = SourceCamera;
m_dragableCameraMapList = m_dragCamera.transform.GetComponentsInChildren<MyDragableCamera>(true)[0];
m_dragableCameraMapList.LeftArrow = FindTransform("InstanceMissionChooseUIArrowL").gameObject;
m_dragableCameraMapList.RightArrow = FindTransform("InstanceMissionChooseUIArrowR").gameObject;
FillNewInstanceUIChooseGridData();
// 随机副本特效
m_goInstanceMissionChooseUIRandomFx = FindTransform("InstanceMissionChooseUIRandomFx").gameObject;
// ChineseData
m_lblInstanceMissionChooseUIChooseRandomText.text = LanguageData.GetContent(46975);
m_lblInstanceMissionChooseUIChooseRandomTextDown.text = LanguageData.GetContent(46975);
m_lblInstanceMissionChooseUIRandomBtnEnterTip.text = LanguageData.GetContent(46976);
Initialize();
}
示例4: Start
void Start()
{
uiCamera = GameObject.FindObjectOfType(typeof(UICamera)) as UICamera;
// Disable standard NGUI inputs
uiCamera.useMouse = false;
uiCamera.useTouch = false;
TouchManager.Instance.TouchesBegan += TouchManagerBegan;
TouchManager.Instance.TouchesMoved += TouchManagerMoved;
TouchManager.Instance.TouchesEnded += TouchManagerEnded;
TouchManager.Instance.TouchesCancelled += TouchManagerCancelled;
}
示例5: PreCreate
private static void PreCreate ()
{
if (m_uiRoot == null)
{
int uiLayer = LayerMask.NameToLayer("UI");
m_uiRootObj = new GameObject("UI Root(2D)");
m_uiRootObj.layer = uiLayer;
UIRoot uiRoot = m_uiRootObj.AddComponent<UIRoot>();
{
uiRoot.scalingStyle = UIRoot.Scaling.FixedSize;
if ((Double)Screen.width / Screen.height < 1.49)
uiRoot.manualHeight = 768;
else
uiRoot.manualHeight = 640;
}
m_cameraObj = new GameObject("Camera");
m_cameraObj.transform.parent = m_uiRootObj.transform;
m_camera = m_cameraObj.AddComponent<Camera>();
{
float depth = -1f;
m_camera.gameObject.layer = uiLayer;
m_camera.depth = depth + 1;
m_camera.backgroundColor = Color.black;
m_camera.cullingMask = 1 << uiLayer;
//Use Simple2D Camera
m_camera.orthographicSize = 1f;
m_camera.orthographic = true;
m_camera.nearClipPlane = -2f;
m_camera.farClipPlane = 2f;
m_camera.gameObject.AddComponent<UICamera>();
//m_camera.gameObject.AddComponent<UITick>();
}
m_uiCamera = m_cameraObj.AddComponent<UICamera>();
m_uiRootObj.AddComponent<UIPanel>();
m_uiRoot = uiRoot;
}
}
示例6: Start
public override void Start()
{
base.Start();
_nguiCamera = NguiUtils.GetComponentInParents<UICamera>(gameObject);
var anchor = NguiUtils.GetComponentInParents<UIAnchor>(gameObject);
if (anchor == null)
{
Debug.LogWarning("There have to be an UIAnchor upper in the hierarchy");
return;
}
if (anchor.side != UIAnchor.Side.BottomLeft &&
anchor.side != UIAnchor.Side.BottomRight &&
anchor.side != UIAnchor.Side.TopLeft &&
anchor.side != UIAnchor.Side.TopRight)
{
Debug.LogWarning("Parent UIAnchor have to be a corner one (BottomLeft, BottomRight, TopLeft or TopRight)");
}
_anchor = anchor.transform;
}
示例7: CreateUIRoot
void CreateUIRoot()
{
GameObject uiRootobj = new GameObject("UIRoot");
UiRoot = uiRootobj.AddComponent<UIRoot>();
CBase.Assert(UiRoot);
UiRoot.scalingStyle = UIRoot.Scaling.ConstrainedOnMobiles;
UiRoot.manualHeight = 1920;
GameObject panelRootObj = new GameObject("PanelRoot");
CTool.SetChild(panelRootObj.transform, uiRootobj.transform);
Transform panelTrans = panelRootObj.transform;
PanelRoot = panelRootObj.AddComponent<UIPanel>();
CBase.Assert(PanelRoot);
GameObject uiCamObj = new GameObject("UICamera");
CTool.SetChild(uiCamObj.transform, UiRoot.transform);
UiCamera = uiCamObj.AddComponent<UICamera>();
UiCamera.cachedCamera.cullingMask = 1 << (int)CLayerDef.UI;
UiCamera.cachedCamera.clearFlags = CameraClearFlags.Depth;
UiCamera.cachedCamera.orthographic = true;
UiCamera.cachedCamera.orthographicSize = 1;
UiCamera.cachedCamera.nearClipPlane = -2;
UiCamera.cachedCamera.farClipPlane = 2;
//panelTrans.gameObject.isStatic = true;
foreach (UIAnchor.Side side in Enum.GetValues(typeof(UIAnchor.Side)))
{
GameObject anchorObj = new GameObject(side.ToString());
CTool.SetChild(anchorObj.transform, panelTrans);
AnchorSide[side.ToString()] = anchorObj.transform;
}
GameObject nullAnchor = new GameObject("Null");
CTool.SetChild(nullAnchor.transform, panelTrans);
AnchorSide["Null"] = nullAnchor.transform;
AnchorSide[""] = AnchorSide[UIAnchor.Side.Center.ToString()]; // default
NGUITools.SetLayer(uiRootobj, (int)CLayerDef.UI);
}
示例8: Awake
void Awake()
{
Instance = this;
currentMenu = MenuType.Main;
Transform UIRoot = transform.FindChild("UI Root");
MainCamera = UIRoot.FindChild("Camera").GetComponent<UICamera>();
MainCamera.enabled = true;
MainCamera.GetComponent<Camera>().enabled = true;
// Get transforms for each menu
MainMenu = UIRoot.FindChild("Main Menu");
SettingsMenu = UIRoot.FindChild("Settings Menu");
LeaderboardMenu = UIRoot.FindChild("Leaderboard Menu");
GameMenu = UIRoot.FindChild("Game Menu");
CustomizeMenu = UIRoot.FindChild("Customize Menu");
ToggleMenusOn();
}
示例9: OnEnable
void OnEnable() {
Time.timeScale = PAUSED_TIME_SCALE;
GameObject uiRoot = GameObject.Find("UI Root");
if(uiRoot!=null) {
UICamera camera = uiRoot.GetComponentInChildren<UICamera>();
if(camera!=null) {
camera.eventType = UICamera.EventType.UI_3D;
cameraRef = camera;
if(Application.loadedLevelName=="Garage") {
blur = camera.GetComponent<CC_RadialBlur>();
if(blur==null) {
blur = camera.gameObject.AddComponent<CC_RadialBlur>();
}
blur.enabled = true;
/* analogTV = camera.GetComponent<CC_AnalogTV>();
if(analogTV==null) {
analogTV = camera.gameObject.AddComponent<CC_AnalogTV>();
}*/
//analogTV.enabled = true;
}
}
}
}
示例10: ChangeSelection
/// <summary>
/// Selection change is delayed on purpose. This way selection changes during event processing won't cause
/// the newly selected widget to continue processing when it is it's turn. Example: pressing 'tab' on one
/// button selects the next button, and then it also processes its 'tab' in turn, selecting the next one.
/// </summary>
System.Collections.IEnumerator ChangeSelection ()
{
yield return new WaitForEndOfFrame();
mCurrentSelection = mNextSelection;
mNextSelection = null;
if (mCurrentSelection != null)
{
current = this;
currentCamera = mCam;
UICamera.currentScheme = mNextScheme;
Notify(mCurrentSelection, "OnSelect", true);
current = null;
}
}
示例11: SetSelection
/// <summary>
/// Change the selection.
/// </summary>
static protected void SetSelection (GameObject go, ControlScheme scheme)
{
if (mNextSelection != null)
{
mNextSelection = go;
}
else if (mCurrentSelection != go)
{
if (mCurrentSelection != null)
{
UICamera uicam = FindCameraForLayer(mCurrentSelection.layer);
if (uicam != null)
{
current = uicam;
currentCamera = uicam.mCam;
UICamera.currentScheme = scheme;
Notify(mCurrentSelection, "OnSelect", false);
current = null;
}
}
mCurrentSelection = null;
mNextSelection = go;
mNextScheme = scheme;
if (UICamera.list.size > 0)
{
UICamera cam = (mNextSelection != null) ? FindCameraForLayer(mNextSelection.layer) : UICamera.list[0];
if (cam != null) cam.StartCoroutine(cam.ChangeSelection());
}
}
}
示例12: IsVisible
private static bool IsVisible(ref UICamera.DepthEntry de)
{
UIPanel uIPanel = NGUITools.FindInParents<UIPanel>(de.go);
while (uIPanel != null)
{
if (!uIPanel.IsVisible(de.point))
{
return false;
}
uIPanel = uIPanel.parentPanel;
}
return true;
}
示例13: Awake
void Awake()
{
uiCamera = GetComponent<UICamera>();
}
示例14: ChangeSelection
/// <summary>
/// Selection change is delayed on purpose. This way selection changes during event processing won't cause
/// the newly selected widget to continue processing when it is it's turn. Example: pressing 'tab' on one
/// button selects the next button, and then it also processes its 'tab' in turn, selecting the next one.
/// </summary>
System.Collections.IEnumerator ChangeSelection ()
{
yield return new WaitForEndOfFrame();
Notify(mCurrentSelection, "OnSelect", false);
mCurrentSelection = mNextSelection;
mNextSelection = null;
if (mCurrentSelection != null)
{
current = this;
currentCamera = mCam;
UICamera.currentScheme = mNextScheme;
inputHasFocus = (mCurrentSelection.GetComponent<UIInput>() != null);
Notify(mCurrentSelection, "OnSelect", true);
current = null;
}
else inputHasFocus = false;
}
示例15: Update
/// <summary>
/// Update the text based on input.
/// </summary>
protected virtual void Update ()
{
#if UNITY_EDITOR
if (!Application.isPlaying) return;
#endif
if (!isSelected || mSelectTime == Time.frameCount) return;
if (mDoInit) Init();
#if MOBILE
// Wait for the keyboard to open. Apparently mKeyboard.active will return 'false' for a while in some cases.
if (mWaitForKeyboard)
{
if (mKeyboard != null && !mKeyboard.active) return;
mWaitForKeyboard = false;
}
#endif
// Unity has issues bringing up the keyboard properly if it's in "hideInput" mode and you happen
// to select one input in the same Update as de-selecting another.
if (mSelectMe != -1 && mSelectMe != Time.frameCount)
{
mSelectMe = -1;
mSelectionEnd = string.IsNullOrEmpty(mValue) ? 0 : mValue.Length;
mDrawStart = 0;
mSelectionStart = selectAllTextOnFocus ? 0 : mSelectionEnd;
label.color = activeTextColor;
#if MOBILE
RuntimePlatform pf = Application.platform;
if (pf == RuntimePlatform.IPhonePlayer
|| pf == RuntimePlatform.Android
|| pf == RuntimePlatform.WP8Player
#if UNITY_4_3
|| pf == RuntimePlatform.BB10Player
#else
|| pf == RuntimePlatform.BlackBerryPlayer
|| pf == RuntimePlatform.MetroPlayerARM
|| pf == RuntimePlatform.MetroPlayerX64
|| pf == RuntimePlatform.MetroPlayerX86
#endif
)
{
string val;
TouchScreenKeyboardType kt;
if (inputShouldBeHidden)
{
TouchScreenKeyboard.hideInput = true;
kt = (TouchScreenKeyboardType)((int)keyboardType);
#if UNITY_METRO
val = "";
#else
val = "|";
#endif
}
else if (inputType == InputType.Password)
{
TouchScreenKeyboard.hideInput = false;
kt = TouchScreenKeyboardType.Default;
val = mValue;
mSelectionStart = mSelectionEnd;
}
else
{
TouchScreenKeyboard.hideInput = false;
kt = (TouchScreenKeyboardType)((int)keyboardType);
val = mValue;
mSelectionStart = mSelectionEnd;
}
mWaitForKeyboard = true;
mKeyboard = (inputType == InputType.Password) ?
TouchScreenKeyboard.Open(val, kt, false, false, true) :
TouchScreenKeyboard.Open(val, kt, !inputShouldBeHidden && inputType == InputType.AutoCorrect,
label.multiLine && !hideInput, false, false, defaultText);
#if UNITY_METRO
mKeyboard.active = true;
#endif
}
else
#endif // MOBILE
{
Vector2 pos = (UICamera.current != null && UICamera.current.cachedCamera != null) ?
UICamera.current.cachedCamera.WorldToScreenPoint(label.worldCorners[0]) :
label.worldCorners[0];
pos.y = Screen.height - pos.y;
Input.imeCompositionMode = IMECompositionMode.On;
Input.compositionCursorPos = pos;
}
UpdateLabel();
if (string.IsNullOrEmpty(Input.inputString)) return;
}
#if MOBILE
if (mKeyboard != null)
{
#if UNITY_METRO
string text = Input.inputString;
//.........这里部分代码省略.........