本文整理汇总了C#中UnityEngine.UI.RawImage.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# RawImage.GetComponent方法的具体用法?C# RawImage.GetComponent怎么用?C# RawImage.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.UI.RawImage
的用法示例。
在下文中一共展示了RawImage.GetComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupImages
void SetupImages() {
//MyPlayer1.GetComponent<CustomController>().m_Camera = MyPlayer1.gameObject.transform.GetChild(0).GetComponent<Camera>();
//MyPlayer2.GetComponent<CustomController>().m_Camera = MyPlayer2.gameObject.transform.GetChild(0).GetComponent<Camera>();
GameObject MyImage1Object = new GameObject ();
MyImage1Object.AddComponent<RawImage> ();
MyImage1 = MyImage1Object.GetComponent<RawImage>();
MyImage1.GetComponent<RawImage> ().texture = MyRenderTexture1;
RectTransform MyRectTransform1 = MyImage1Object.GetComponent<RectTransform> ();
MyRectTransform1.anchorMin = new Vector2 (0, 0);
MyRectTransform1.anchorMax = new Vector2 (1, 1);
MyRectTransform1.sizeDelta = new Vector2(0, 0);
MyRectTransform1.localPosition = new Vector2 (0, 0);
MyImage1Object.layer = MyUILayer;
MyImage1Object.name = "MyImage1";
MyImage1Object.transform.SetParent (MyCanvas.transform, false);
GameObject MyImage2Object = new GameObject ();
MyImage2Object.AddComponent<RawImage> ();
MyImage2 = MyImage2Object.GetComponent<RawImage>();
MyImage2.GetComponent<RawImage> ().texture = MyRenderTexture2;
RectTransform MyRectTransform2 = MyImage2Object.GetComponent<RectTransform> ();
MyRectTransform2.anchorMin = new Vector2 (0, 0);
MyRectTransform2.anchorMax = new Vector2 (1, 1);
MyImage2Object.transform.SetParent (MyCanvas.transform, false);
MyImage2Object.name = "MyImage2";
MyImage2Object.layer = MyUILayer;
MyImage1Object.SetActive (false);
MyImage2Object.SetActive (false);
SpawnedMainCamera = new GameObject ();
SpawnedMainCamera.AddComponent<Camera> ();
SpawnedMainCamera.tag = "MainCamera";
SpawnedMainCamera.SetActive (false);
}
示例2: Initialize
public void Initialize()
{
GameObject ob = GameObject.Find("COLLECT_PLACE");
if (ob != null)
{
RawImage rawimage = ob.transform.GetChild(0).GetComponent<RawImage>();
rawimage.gameObject.SetActive(true);
Image = Instantiate<RawImage>(rawimage);
Image.transform.parent = ob.gameObject.transform;
Image.name += "-" + gameObject.name;
Image.transform.localScale = new Vector3(1, 1, 1);
RectTransform rect = Image.GetComponent<RectTransform>();
RectTransform rectorgi = rawimage.GetComponent<RectTransform>();
this.rect = rect;
rect.offsetMin = new Vector2(rectorgi.offsetMin.x, rectorgi.offsetMin.y);
rect.offsetMax = new Vector2(rectorgi.offsetMax.x, rectorgi.offsetMax.y);
Image.texture = GetComponent<Building>().ResourceProduction.getSprite().texture;
rawimage.gameObject.SetActive(false);
}
else Debug.LogError("Cant Find TIMER_TEXT");
}
示例3: cloneBlockId
private void cloneBlockId (RawImage rawImage)
{
DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
if (cell.blockIdTop > 0) {
Global.selectedBlockId = cell.blockIdTop;
Global.showNotyMessage ("Block copied.");
ToolsController.deactivateCloneBucket ();
}else if(cell.blockIdBottom > 0){
Global.selectedBlockId = cell.blockIdBottom;
Global.showNotyMessage ("Block copied.");
ToolsController.deactivateCloneBucket ();
}else{
// Ignore. Do nothing.
}
}
示例4: placeSelectedBlock
// If the clicked cell is empty then place the selected block in it.
private void placeSelectedBlock (RawImage rawImage){
DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
cell.placeBlockOnCell (rawImage);
}
示例5: clearCellBlock
private void clearCellBlock (RawImage rawImage)
{
DrawingCell cell = rawImage.GetComponent<DrawingCell> ();
cell.removeBlockOnCell (rawImage);
}