UnityEngine.GUI.DrawTexture(UnityEngine.Rect, UnityEngine.Texture, UnityEngine.ScaleMode, bool, float, UnityEngine.Color, UnityEngine.Vector4, float)

Here are the examples of the csharp api UnityEngine.GUI.DrawTexture(UnityEngine.Rect, UnityEngine.Texture, UnityEngine.ScaleMode, bool, float, UnityEngine.Color, UnityEngine.Vector4, float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 View Source File : BasicDialog.cs
License : MIT License
Project Creator : BlueMonk1107

void OnGUI() {
		GUISkin tempSkin = GUI.skin;
		if(guiSkin != null){
			GUI.skin = guiSkin;
		}
		
		if(state == State.Show) {
			
			//GUI.DrawTexture(Rect(Screen.width * x, Screen.height * y, Screen.width * width, Screen.height * height), dialogBG, ScaleMode.ScaleToFit, false, 0);
			//GUI.DrawTexture(Rect(Screen.width * 0.18, Screen.height * 0.28, Screen.width * 0.64, Screen.height * 0.44), dialogBg);
			if(dialogBG != null){
				GUI.DrawTexture(new Rect(Screen.width * x, Screen.height * y, Screen.width * width, Screen.height * height), dialogBG);
			}
			
			if(replacedleBG != null){
				GUI.DrawTexture(new Rect(Screen.width * replacedleX, Screen.height * replacedleY, Screen.width * replacedleWidth, Screen.height * replacedleHeight), replacedleBG);
			}
			
			if(replacedle != null && replacedle != ""){
				if(replacedleFont != null){
					GUI.skin.font = replacedleFont;
				}
				GUI.Label(new Rect(Screen.width * (replacedleX + padding), Screen.height * (replacedleY + replacedlePadding), Screen.width * (replacedleWidth - padding * 2), Screen.height * (replacedleHeight - replacedlePadding * 2)), replacedle);
			}
			
			if(texts != null && texts.Length != 0){
				if(textFont != null){
					GUI.skin.font = textFont;
				}
				GUI.Label(new Rect(Screen.width * bodyX, Screen.height * bodyY, Screen.width * bodyWidth, Screen.height * bodyHeight), texts[index]);
				if(index == texts.Length - 1){
					if(replacedleFont != null){
						GUI.skin.font = replacedleFont;
					}
					if(GUI.Button(new Rect(Screen.width * midX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")){
						hide();
					}
				}else { 
					if(index < texts.Length - 1){
						if(replacedleFont != null){
							GUI.skin.font = replacedleFont;
						}
						if(GUI.Button(new Rect(Screen.width * leftX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")){
							hide();
						}
						if(GUI.Button(new Rect(Screen.width * rightX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "下一页")){
							index++;
						}
					}
				}
			}else {
				if(replacedleFont != null){
					GUI.skin.font = replacedleFont;
				}
				if(GUI.Button(new Rect(Screen.width * midX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")){
					hide();
				}
			}
		}
		GUI.skin = tempSkin;
	}

19 View Source File : SplashScreen.cs
License : MIT License
Project Creator : BlueMonk1107

void OnGUI()
    {

        if (logoPositioning == LogoPositioning.Centered)
        {
            splashLogoPos.x = (Screen.width * 0.5f) - (logoList[currentIndex].width * 0.5f);
            splashLogoPos.y = (Screen.height * 0.5f) - (logoList[currentIndex].height * 0.5f);
       
            splashLogoPos.width = logoList[currentIndex].width;
            splashLogoPos.height = logoList[currentIndex].height;
        }
        else
        {
            splashLogoPos.x = 0;
            splashLogoPos.y = 0;
           
            splashLogoPos.width = Screen.width;
            splashLogoPos.height = Screen.height;
        }
		
        if (logoList[currentIndex] != null)
        {
            GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, Mathf.Clamp01(alpha));
            //GUI.color = new Color(sceneBackgroundColor.r, sceneBackgroundColor.g, sceneBackgroundColor.b, 0);
            GUI.DrawTexture(splashLogoPos, logoList[currentIndex]);
            if (alpha > 1.0f)
            {
                status = FadeStatus.FadeWaiting;
                timeFadingInFinished = Time.time;
                alpha = 1.0f;
                if (splashType == SplashType.LoadNextLevelThenFadeOut && currentIndex == logoList.Length - 1)
                {
                    oldCam.depth = -1000;
                    loadingNextLevel = true;
                    Application.LoadLevel(levelToLoad);
                }
            }
            if (alpha < 0.0f)
            {
				if(currentIndex == logoList.Length - 1){
					if (splashType == SplashType.FadeOutThenLoadNextLevel)
					{
						Application.LoadLevel(levelToLoad);
					}
					else
					{
						Destroy(oldCamGO); // somehow this doesn't work
						Destroy(this);
					}
				} else {
					currentIndex++;
					status = FadeStatus.FadeIn;
					alpha = 0.0f;
				}
            }
        }
    }