void Start() { rawImage = gameObject.GetComponent <UnityEngine.UI.RawImage>() as UnityEngine.UI.RawImage; tex = new RenderTexture((int)m_Resolution.x, (int)m_Resolution.y, 0, RenderTextureFormat.ARGB32); tex.enableRandomWrite = true; tex.Create(); m_Values = new float[(int)m_Resolution.x]; for (int i = 0; i < m_Values.Length; i++) { m_Values[i] = 0; } m_RandTestOffset = Random.RandomRange(0f, 100f); buffer = new ComputeBuffer((int)m_Resolution.x, sizeof(float)); buffer.SetData(m_Values); shader.SetBuffer(0, "buffer", buffer); shader.SetTexture(0, "tex", tex); shader.SetInt("texWidth", (int)m_Resolution.x); shader.SetInt("texHeight", (int)m_Resolution.y); shader.Dispatch(0, tex.width / 8, tex.height / 8, 1); rawImage.texture = tex; }
// Use this for initialization void Start() { canvas = (RectTransform)this.GetComponent(typeof(RectTransform)); cam = Camera.main; image = (UnityEngine.UI.RawImage)this.GetComponent(typeof(UnityEngine.UI.RawImage)); maxWidth = canvas.rect.width; }
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"); }
void UpdateAspect() { var arf = this.GetComponent <UnityEngine.UI.AspectRatioFitter> (); if (arf == null) { return; } UnityEngine.UI.Image img = this.GetComponent <UnityEngine.UI.Image> (); float aspect = 1f; if (img == null) { UnityEngine.UI.RawImage rawimg = this.GetComponent <UnityEngine.UI.RawImage> (); if (rawimg.texture == null) { return; } aspect = (float)rawimg.texture.width / (float)rawimg.texture.height; } else { if (img.sprite == null) { return; } aspect = (float)img.sprite.texture.width / (float)img.sprite.texture.height; } arf.aspectRatio = aspect; }
// Use this for initialization void Start () { penX.onValueChange.AddListener(ChangePenX); penY.onValueChange.AddListener(ChangePenY); brushX.onValueChange.AddListener(ChangeBrushX); brushY.onValueChange.AddListener(ChangeBrushY); bSize.onValueChange.AddListener(ChangeBSize); penX.text = PlayerPrefs.GetInt("penOffsetX", 0).ToString(); penY.text = PlayerPrefs.GetInt("penOffsetY", 0).ToString(); brushX.text = PlayerPrefs.GetInt("brushOffsetX", 0).ToString(); brushY.text = PlayerPrefs.GetInt("brushOffsetY", 0).ToString(); bSize.text = PlayerPrefs.GetInt("bSize", 10).ToString(); var detector = DrawUtility.CreateDetector(prefab); detector.OnStartPaint += new PaintingDetector2D.DelegatePaint(OnStartPaint); detector.OnPaintMovement += new PaintingDetector2D.DelegatePaint(OnPaintMovement); detector.OnPaintEnd += new PaintingDetector2D.DelegatePaint(OnPaintEnd); drawRect = DrawUtility.CreateRectTransform(prefab, new Vector2(Screen.width, Screen.height)); drawImage = drawRect.GetComponent<RawImage>(); paintTexture = DrawUtility.CreateCanvas(Screen.width, Screen.height); drawImage.texture = paintTexture; btn.onClick.AddListener(Click); }
// Use this for initialization void Start() { if (this.AnyBladeModeElement) { this.BladeModeElementRawImage = this.AnyBladeModeElement.GetComponent<RawImage>(); } }
public override void OnEnter() { if (safeMode.Value == true && webCamTex != null){ if (webCamTex.isPlaying == true){ webCamTex.Stop (); } } if (autoAdjustRotation.Value == true && UiRawImage.Value != null) { _texture = UiRawImage.Value.GetComponent<UnityEngine.UI.RawImage>(); if (UiRawImage.Value.GetComponent<UnityEngine.UI.AspectRatioFitter>() != null){ setAspectRatio = UiRawImage.Value.GetComponent<UnityEngine.UI.AspectRatioFitter>(); } } if (useCustom.Value == true) { if (webcamName.Value.Length >= 1){ finalWebCamName = webcamName.Value; } else { finalWebCamName = WebCamTexture.devices[device.Value].name; } webCamTex = new WebCamTexture(finalWebCamName,webTextureWidth.Value,webTextureHeight.Value,setFps.Value); } else { webCamTex = new WebCamTexture(); } switch (filterModeselect) { case FilterModeSelect.Bilinear: webCamTex.filterMode = FilterMode.Bilinear; break; case FilterModeSelect.Point: webCamTex.filterMode = FilterMode.Point; break; case FilterModeSelect.Trilinear: webCamTex.filterMode = FilterMode.Trilinear;; break; } webcamMaterial.Value.SetTexture("_MainTex", webCamTex); PlayCam (); }
void Awake () { handState = HandState.NoAction; leapManager = (GameObject.Find ("LeapManager") as GameObject).GetComponent (typeof(LeapManager)) as LeapManager; cueStickController = (GameObject.Find ("CueStickTip") as GameObject).GetComponent (typeof(CueStickController)) as CueStickController; leapManager.leapController.EnableGesture (Gesture.GestureType.TYPE_SWIPE); leapManager.leapController.Config.SetFloat ("Gesture.Swipe.MinLength", 200.0f); leapManager.leapController.Config.SetFloat ("Gesture.Swipe.MinVelocity", 750f); leapManager.leapController.Config.Save (); gameStates.Add (GameState.CameraAutoAdjust); gameStates.Add (GameState.CameraManualAdjust); gameStates.Add (GameState.Aiming); gameStates.Add (GameState.AfterShot); gameStates.Add (GameState.TurnEnd); viewAdjustmentStateIcon = (GameObject.Find ("ViewAdjustmentStateIcon") as GameObject).GetComponent (typeof(RawImage)) as RawImage; aimingStateIcon = (GameObject.Find ("AimingStateIcon") as GameObject).GetComponent (typeof(RawImage)) as RawImage; swipeActionIcon = (GameObject.Find ("SwipeActionIcon") as GameObject).GetComponent (typeof(RawImage)) as RawImage; playerTurn = (GameObject.Find ("PlayerTurn") as GameObject).GetComponent (typeof(Text)) as Text; cueBall = GameObject.FindGameObjectWithTag ("cueBall"); cueBall = GameObject.FindGameObjectWithTag ("cueBall"); camera = GameObject.FindGameObjectWithTag ("PlayerCamera"); ballsParent = GameObject.FindGameObjectWithTag ("balls"); foreach (Transform ball in ballsParent.transform) { balls.Add (ball.gameObject); } }
void Start() { this.rawImage = this.GetComponent<RawImage>(); this.rawImage.color = Color.black; this.rawImage.gameObject.SetActive(false); Invoke("MoviePlay", .5f); }
// Use this for initialization void Start() { if (Application.platform != RuntimePlatform.Android) { return; } // player1 = new player; liveRawImage = GetComponent <RawImage>(); Debug.Log("Start"); //videoPlaying = new AndroidJavaObject("com.fuho.fromfleetcloud.video.FleetLive", "WW00001ASED5", 1, "fleet.vacron.com", "admin", "admin", "L"); videoPlaying = new AndroidJavaObject("com.fuho.fromfleetcloud.video.FleetLive", "WW00001ASED5", 1, "fleet.vacron.com", "admin", "admin", "L"); videoPlaying = new AndroidJavaObject("com.fuho.fromfleetcloud.video.FleetLive", "VG500122", 1, "54.199.103.26", "admin", "admin", "L"); //videoPlaying = new AndroidJavaObject("com.fuho.fromfleetcloud.video.FleetLive", "TT001802", 1, "125.227.91.156", "guest", "123456", "L"); IntPtr methodID = AndroidJNI.GetMethodID(videoPlaying.GetRawClass(), "start", "()[I"); AndroidJavaObject nullObject = null; UnityEngine.jvalue[] args = AndroidJNIHelper.CreateJNIArgArray(new[] { nullObject }); IntPtr intArray = AndroidJNI.CallObjectMethod(videoPlaying.GetRawObject(), methodID, args); if (intArray != IntPtr.Zero) { wh = AndroidJNI.FromIntArray(intArray); } Debug.LogFormat("============================= width : {0}, height : {0} =============================", wh[0], wh[1]); }
// Use this for initialization void Start() { rawimage = image.GetComponent<RawImage>(); rawimage.CrossFadeAlpha(0.0F,0, false); rawimage.CrossFadeAlpha(1F,splash_timer, false); StartCoroutine("Timer"); }
/// <summary> /// Updateを行う前の最初のフレームに呼び出される関数 /// </summary> void Start() { // 画像のスクリプトを取得する transparentImage = GetComponent<RawImage>(); // 最初の透過度を取得しておく firstAlpha = transparentImage.color.a; }
void Awake() { instance = this; topCard = GameObject.Find("cardDeck").GetComponentInChildren<RawImage>(); cards = GameObject.Find("cardSelected").GetComponentsInChildren<RawImage>(); }
// Initialization void Start() { timerText = gameObject.transform.Find("TimerText").GetComponent<Text>(); timer = GameObject.Find("Timer").GetComponent<Timer>(); screenBackground = gameObject.transform.Find("ScreenBackground").GetComponent<RawImage>(); gameOver = false; }
private void Awake() { slider = GetComponent<BoxSlider>(); image = GetComponent<RawImage>(); RegenerateSVTexture(); }
IEnumerator UserImage(string url,RawImage image) { WWW www = new WWW(url); Texture2D textFb2 = new Texture2D(128, 128, TextureFormat.DXT1, false); //TextureFormat must be DXT5 yield return www; Avatar.texture = www.texture; }
// Start is called before the first frame update void Start() { if (!ConfigFile.IsLoaded) { ConfigFile.Load(); } loadingLeft = GameObject.Find("LoadingLeft").GetComponent <RectTransform>(); loadingRight = GameObject.Find("LoadingRight").GetComponent <RectTransform>(); backgroundImage = GameObject.Find("Bg").GetComponent <UnityEngine.UI.RawImage>(); if (backgroundImage != null && backgroundImage.texture != null) { backgroundImage.texture.wrapMode = TextureWrapMode.Repeat; } Bg1.SetColor(ThemeColors.Pink); Bg2.SetColor(ThemeColors.Blue); Bg3.SetColor(ThemeColors.Yellow); Pools.GameSettingOptions = ScriptableObject.CreateInstance <ObjectPooler>(); Pools.GameSettingOptions.SetPool(OptionBase, 10, true, this.gameObject); GameSettingsScreen.Initialize(Selection, ConfirmReject); GameSettingsScreen.SetConfig(ConfigFile.GetTable(Defines.GameConfig)); ConfirmReject.SetActive(false); init = true; }
/** * Places the selected block (from the menu) into the bottom or top layer of this cell. * */ public void placeBlockOnCell(RawImage rawImage) { if (blockIdBottom == 0) { // bottom block is empty blockIdBottom = Global.selectedBlockId; rawImage.texture = getTextureByBlockId (blockIdBottom); playBlockPlacedSound (); } else if (blockIdTop == 0) { // top block is empty // Ignore. Trying to put the same block on top. if (Global.selectedBlockId == blockIdBottom) return; blockIdTop = Global.selectedBlockId; Texture2D bottomTex = getTextureByBlockId (blockIdBottom); Texture2D topTex = getTextureByBlockId (blockIdTop); rawImage.texture = mixTextures (bottomTex, topTex); playBlockPlacedSound (); } else { // Ignore. Do nothing. Both layers are already busy. } }
void Awake() { logoState = LogoState.WaitFade; #if UNITY_EDITOR timerLength = 0f; #elif UNITY_ANDROID timerLength = 0f; #elif UNITY_IPHONE timerLength = 3.5f; #endif timer = 0; backgroundImage = GameObject.Find("Background").GetComponent<RawImage>(); backgroundColor = backgroundImage.color; //backgroundImage.color = new Color(ba) logoImage = GameObject.Find("Logo").GetComponent<RawImage>(); logoColor = logoImage.color; logoImage.color = new Color(logoColor.r, logoColor.g, logoColor.b, 0f); GameObject.Find("AdColonyAdManager").GetComponent<AdColonyManager>().Initialize(); }
private RectTransform rTrans; //rect transform component #endregion Fields #region Methods // Use this for initialization void Start() { rImg = GetComponent<RawImage>(); rTrans = GetComponent<RectTransform>(); rTrans.sizeDelta = new Vector2(Screen.width, Screen.height); rImg.color = Color.Lerp(rImg.color, new Color(1,1,1,0.15f), 0.04f); }
// Use this for initialization void Start() { Invoke("ShowContinueText", 5); startTime = Time.realtimeSinceStartup; tScaler = GameObject.Find("Time Manager").GetComponent<TimeScaler>(); boxTransform = GetComponent<RectTransform>(); backgroundTransform = transform.parent.GetComponent<RectTransform>(); gradientTransform = transform.Find("Background Gradient").GetComponent<RectTransform>(); topBorder = transform.Find("Top Border").GetComponent<RectTransform>(); bottomBorder = transform.Find("Bottom Border").GetComponent<RectTransform>(); boxImage = GetComponent<RawImage>(); backgroundImage = transform.parent.GetComponent<RawImage>(); gradientImage = transform.Find("Background Gradient").GetComponent<RawImage>(); topImage = transform.Find("Top Border").GetComponent<RawImage>(); bottomImage = transform.Find("Bottom Border").GetComponent<RawImage>(); iconImage = transform.Find("Info Icon").GetComponent<RawImage>(); tutorialText = transform.Find("Tutorial Text").GetComponent<Text>(); continueText = transform.Find("Continue Text").GetComponent<Text>(); SetStartingColors(); i = 0; }
void Awake() { m_rawImage = GetComponent<RawImage>(); gameObject.tag = "Layer"; m_rawImage.enabled = false; }
void Awake(){ screenFader = GetComponent<RawImage>(); if (screenFader == null) { throw new UnityException ("No Screen Fader added"); } }
public void ShowOnPanel(GameObject dataPoint) { Debug.Log("clicked"); // change the text of Slate Debug.Log("ddd"); GameObject.Find("Slate/TitleBar/Title").GetComponent <TMP_Text>().text = "" + dataPoint.name; //works: Debug.Log(GameObject.Find("Slate/TitleBar/Title")); // change the r graphs for a last subject Debug.Log("last_graph"); Debug.Log(GameObject.Find("RawImage_2").GetComponent <RawImage>().texture); UnityEngine.UI.RawImage UIicon = GameObject.Find("RawImage_2").GetComponent <RawImage>(); Debug.Log("text" + "Assets/Resources/Patients/" + dataPoint.name + "_distribution.png"); Texture2D othericon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Resources/Patients/" + dataPoint.name + "_distribution.png", typeof(Texture2D)); Debug.Log(othericon); Debug.Log("before texture change"); UIicon.texture = othericon; UnityEngine.UI.RawImage UIicon2 = GameObject.Find("RawImage_1").GetComponent <RawImage>(); Debug.Log("text" + "Assets/Resources/Patients/" + dataPoint.name + "_distribution.png"); Texture2D othericon3 = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Resources/Patients/" + dataPoint.name + "_contr.png", typeof(Texture2D)); Debug.Log(othericon3); Debug.Log("before texture change"); UIicon2.texture = othericon3; }
public void clickResetTextureCoordinates(RawImage UVselector) { //Update coordinates U_bottomLeft.text = "0"; V_bottomLeft.text = "0"; U_bottomRight.text = "1"; V_bottomRight.text = "0"; U_topRight.text = "1"; V_topRight.text = "1"; U_topLeft.text = "0"; V_topLeft.text = "1"; //Transform pin points Vector2 windowSize = UVselector.rectTransform.sizeDelta; Vector3 rawPosition = UVselector.transform.position; GameObject pptopleft, pptopright, ppbottomleft, ppbottomright; GameObject UVcomponent = buildingEditSkinMenu.transform.Find("Panel").Find("TextureCoordinates").Find("Panel").gameObject; pptopleft = UVcomponent.transform.Find("PinPointTopLeft").gameObject; pptopright = UVcomponent.transform.Find("PinPointTopRight").gameObject; ppbottomleft = UVcomponent.transform.Find("PinPointBottomLeft").gameObject; ppbottomright = UVcomponent.transform.Find("PinPointBottomRight").gameObject; pptopleft.transform.position = new Vector3(rawPosition.x - windowSize.x / 2, rawPosition.y + windowSize.y / 2, 0); pptopright.transform.position = new Vector3(rawPosition.x + windowSize.x / 2, rawPosition.y + windowSize.y / 2, 0); ppbottomleft.transform.position = new Vector3(rawPosition.x - windowSize.x / 2, rawPosition.y - windowSize.y / 2, 0); ppbottomright.transform.position = new Vector3(rawPosition.x + windowSize.x / 2, rawPosition.y - windowSize.y / 2, 0); }
// Start is called before the first frame update void Start() { if (!ConfigFile.IsLoaded) { ConfigFile.Load(); } loadingLeft = GameObject.Find("LoadingLeft").GetComponent <RectTransform>(); loadingRight = GameObject.Find("LoadingRight").GetComponent <RectTransform>(); backgroundImage = GameObject.Find("Bg").GetComponent <UnityEngine.UI.RawImage>(); if (backgroundImage != null && backgroundImage.texture != null) { backgroundImage.texture.wrapMode = TextureWrapMode.Repeat; } Bg1.SetColor(ThemeColors.Pink); Bg2.SetColor(ThemeColors.Blue); Bg3.SetColor(ThemeColors.Yellow); LanguageSelect.Initialize(Confirm); Confirm.SetActive(false); init = true; }
void Awake() { m_rawImage = this.GetComponent<RawImage>(); //Draw and save the biome graph texture immediately, as it doesn't depend upon any generated data. m_biomeGraph = new Texture2D (Size, Size); Color[] pixels = m_biomeGraph.GetPixels (); for (int x = 0; x < m_biomeGraph.width; ++x) { for (int y = 0; y < m_biomeGraph.height; ++y) { float temperature = x / (float)m_biomeGraph.width; float precipitation = y / (float)m_biomeGraph.height; float[] biomeWeights = BiomeCalculator.Instance.GetBiomeWeights (temperature, precipitation, 1f); BiomeType[] allBiomes = System.Enum.GetValues(typeof(BiomeType)) as BiomeType[]; Color pixel = new Color(0f, 0f, 0f, 0f); foreach (BiomeType biome in allBiomes) { pixel += BiomeDatabase.Instance.Get(biome).MinimapColor * biomeWeights[(int) biome]; } pixels [y * m_biomeGraph.width + x] = pixel; } } m_biomeGraph.SetPixels (pixels); m_biomeGraph.Apply (); //Also, write out the biome map to a png file for reference. byte[] outfile = m_biomeGraph.EncodeToPNG(); File.WriteAllBytes(Application.dataPath + "/../BiomeMap.png", outfile); }
// Use this for initialization void Start() { prefabInstantiate = Instantiate(prefab, transform);// 实例化预制 m_avatar = prefabInstantiate.transform.Find("avatar").GetComponent <UnityEngine.UI.RawImage>(); m_team_name = prefabInstantiate.transform.Find("Text").GetComponent <UnityEngine.UI.Text>(); SetInfo();//此句用于调试,请在设置好队伍相关信息后调用SetInfo() }
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); }
private IEnumerator LoadTextureFromWWW(UnityEngine.UI.RawImage c, string p) { var www = new WWW(p.Trim()); while (!www.isDone) { yield return(null); } if (!string.IsNullOrEmpty(www.error)) { Debug.Log("Error downloading image: " + p + " (" + www.error + ")"); www.Dispose(); yield break; } var texture = www.texture; if (texture == null || c == null) { Debug.Log("Error downloading image: " + p + " (not an image)"); www.Dispose(); yield break; } c.texture = texture; www.Dispose(); }
// Use this for initialization void Start() { //if we are here, then el presidente attached this component to a slider slider = ElPresidente.Instance.whereWeAt; // Set the thumbnail to be hidden on initialization. thumbnailEnabled = false; //attach scrubbing mouse events to the slider if (!registerSliderScrubEvents()) { return; } //don't set up the thumbnail if we don't want the keyframes displayed if (ElPresidente.Instance.GenerateKeyframes) { if (!registerSliderThumbnailEvents()) { return; } // Get the slider's transform rectangle. sliderRect = slider.GetComponent <RectTransform>(); //create a thumbnail to use for displaying keyframes and staple it onto the canvas thumb = (GameObject.Instantiate(Resources.Load("Thumbnail")) as GameObject).GetComponent <UnityEngine.UI.RawImage>(); var canvas = GameObject.Find("Canvas"); thumb.transform.SetParent(canvas.transform); // Remember that initialization has not occurred. hasInitialized = false; } }
// Use this for initialization protected void Start () { rectTransform = (RectTransform)this.GetComponent<RectTransform> (); rawImage = (RawImage) this.GetComponent<RawImage> (); Reset (); GetZoneInfos (); }
void Awake() { raw = GetComponent<UnityEngine.UI.RawImage>(); loadingGifPath = Application.streamingAssetsPath + "/gif.gif"; drawPosition = transform.position; var gifImage = Image.FromFile(loadingGifPath); var dimension = new FrameDimension(gifImage.FrameDimensionsList[0]); int frameCount = gifImage.GetFrameCount(dimension); for (int i = 0; i < frameCount; i++) { gifImage.SelectActiveFrame(dimension, i); var frame = new Bitmap(gifImage.Width, gifImage.Height); System.Drawing.Graphics.FromImage(frame).DrawImage(gifImage, Point.Empty); var frameTexture = new Texture2D(frame.Width, frame.Height); for (int x = 0; x < frame.Width; x++) for (int y = 0; y < frame.Height; y++) { System.Drawing.Color sourceColor = frame.GetPixel(x, y); frameTexture.SetPixel(frame.Width - 1 - x, y, new Color32(sourceColor.R, sourceColor.G, sourceColor.B, sourceColor.A)); // for some reason, x is flipped } frameTexture.Apply(); gifFrames.Add(frameTexture); } }
void Start() { KinectManager kinectManager = KinectManager.Instance; if (kinectManager && kinectManager.IsInitialized()) { // determine the target screen aspect ratio float screenAspectRatio = targetAspectRatio != Vector2.zero ? (targetAspectRatio.x / targetAspectRatio.y) : ((float)Screen.width / (float)Screen.height); float fFactorDW = 0f; // if(!useDepthImageResolution) { fFactorDW = (float)kinectManager.GetColorImageWidth() / (float)kinectManager.GetColorImageHeight() - //(float)kinectManager.GetColorImageHeight() / (float)kinectManager.GetColorImageWidth(); screenAspectRatio; } // else // { // fFactorDW = (float)kinectManager.GetDepthImageWidth() / (float)kinectManager.GetDepthImageHeight() - // (float)kinectManager.GetDepthImageHeight() / (float)kinectManager.GetDepthImageWidth(); // } float fDeltaWidth = (float)Screen.height * fFactorDW; float dOffsetX = -fDeltaWidth / 2f; float fFactorSW = 0f; // if(!useDepthImageResolution) { fFactorSW = (float)kinectManager.GetColorImageWidth() / (float)kinectManager.GetColorImageHeight(); } // else // { // fFactorSW = (float)kinectManager.GetDepthImageWidth() / (float)kinectManager.GetDepthImageHeight(); // } float fScreenWidth = (float)Screen.height * fFactorSW; float fAbsOffsetX = fDeltaWidth / 2f; pixelInsetRect = new Rect(dOffsetX, 0, fDeltaWidth, 0); backgroundRect = new Rect(dOffsetX, 0, fScreenWidth, Screen.height); inScreenRect = new Rect(fAbsOffsetX, 0, fScreenWidth - fDeltaWidth, Screen.height); shaderUvRect = new Rect(fAbsOffsetX / fScreenWidth, 0, (fScreenWidth - fDeltaWidth) / fScreenWidth, 1); GUITexture guiTexture = GetComponent <GUITexture>(); if (guiTexture) { guiTexture.pixelInset = pixelInsetRect; } UnityEngine.UI.RawImage rawImage = GetComponent <UnityEngine.UI.RawImage>(); if (rawImage) { rawImage.uvRect = shaderUvRect; } isInitialized = true; } }
//**************************************************************************************************** // //**************************************************************************************************** public void Awake() { if (m_instance == null) { m_instance = this; } m_group = GetComponent <CanvasGroup>(); GameObject text = CORE.HIERARCHY.Find(gameObject, "HUDDLoadText"); GameObject bar = CORE.HIERARCHY.Find(gameObject, "HUDDLoadBar"); if (text != null) { m_text = text.GetComponent <UnityEngine.UI.Text>(); } if (bar != null) { m_bar = bar.GetComponent <UnityEngine.UI.RawImage>(); } if (m_bar != null) { m_barTransform = m_bar.GetComponent <RectTransform>(); } m_fade.Begin(FADE_TYPE.FADE_OUT, FADE_OUT_DURATION); }
// Use this for initialization void Start () { thisimage = GetComponent<RawImage>(); sound = GetComponent<AudioSource>(); dialoguescript = GameObject.Find("Character").transform.GetChild(1).GetComponent<VillageDialogue>(); bgm = GameObject.Find("BGM").GetComponent<AudioSource>(); }
void Start() { this.img = null; this.uit = null; this.offx = 0.0f; this.getSelf(); }
static public int get_texture(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.RawImage self = (UnityEngine.UI.RawImage)checkSelf(l); pushValue(l, true); pushValue(l, self.texture); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
void Start() { if (backgroundImage == null) { backgroundImage = GetComponent <UnityEngine.UI.RawImage>(); } }
static int SetNativeSize(IntPtr L) { L.ChkArgsCount(1); UnityEngine.UI.RawImage obj = (UnityEngine.UI.RawImage)L.ChkUnityObjectSelf(1, "UnityEngine.UI.RawImage"); obj.SetNativeSize(); return(0); }
void Start() { moveRawImage = (RawImage) moveObject.GetComponent<RawImage>(); rotRawImage = (RawImage) rotObject.GetComponent<RawImage>(); downRawImage = (RawImage) downObject.GetComponent<RawImage>(); ci = new ControllerInterface (player, false); }
private void Awake() { var rectTransform = GetComponent<RectTransform>(); var textureWidth = (int) rectTransform.rect.width; var textureHeight = (int) rectTransform.rect.height; var gradient = GameManager.Instance.StateColorDisplayRange; var stepCount = Settings.Instance.Amplitude * 2 + 1; texture = new Texture2D(textureWidth, textureHeight, TextureFormat.ARGB32, false, false); var colors = new Color[textureWidth * textureHeight]; for (var x = 0; x < textureWidth; x++) { //var color = gradient.Evaluate(Mathf.Clamp((float) x / (textureWidth - 1), cutoffValues.From, cutoffValues.To)); var t = (float) x / textureWidth; var color = gradient.Evaluate((Mathf.FloorToInt(t * stepCount) + 0.5f) / stepCount); for (var y = 0; y < textureHeight; y++) { colors[x + y * textureWidth] = color; } } texture.SetPixels(colors); texture.Apply(); imageDisplay = GetComponent<RawImage>(); imageDisplay.texture = texture; }
//**************************************************************************************************** // //**************************************************************************************************** public void Awake() { if (m_instance == null) { m_instance = this; HTTPReq.defaultTimeoutIndicator = this; HTTPReq.delaySimulation = 0.0f; } m_group = GetComponent <CanvasGroup>(); GameObject text = CORE.HIERARCHY.Find(gameObject, "Text"); GameObject bar = CORE.HIERARCHY.Find(gameObject, "Bar"); if (text != null) { m_text = text.GetComponent <UnityEngine.UI.Text>(); } if (bar != null) { m_bar = bar.GetComponent <UnityEngine.UI.RawImage>(); } if (m_bar != null) { m_barTransform = m_bar.GetComponent <RectTransform>(); } m_fade.Begin(FADE_TYPE.FADE_OUT, FADE_OUT_DURATION); }
void Start() { image = gameObject.GetComponent <UnityEngine.UI.RawImage>(); dest = transform.position; origin = dest + new Vector3(offset, 0f, 0f); startTime = Time.time; }
public override void gaxb_init() { gameObject = new GameObject ("<Movie/>", typeof(RectTransform)); canvasRenderer = gameObject.AddComponent<CanvasRenderer> (); image = gameObject.AddComponent<RawImage> (); if (color != null) { image.color = color.Value; } if (resourcePath != null) { // Why, oh why are movie textures not supported in iOS? #if (UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL) #else // Set texture MovieTexture tex = Resources.Load (resourcePath) as MovieTexture; if (tex != null) { image.texture = tex; tex.Play (); tex.loop = looping; } #endif } }
// Slide the texture in the direction indicated by inTexOffsetBy. Assume there is a UV wrapping to this texture. public static void TranslateRawImage(ref UnityEngine.UI.RawImage rawImage, Vector2 inTexOffsetBy) { if (rawImage != null && rawImage.texture != null) { Rect currTexOffset = rawImage.uvRect; rawImage.uvRect = new Rect(currTexOffset.x + inTexOffsetBy.x, currTexOffset.y + inTexOffsetBy.y, currTexOffset.width, currTexOffset.height); } }
public override void OnEnter () { component = gameObject.Value.GetComponent<RawImage>(); DoSetImage (); if (!everyFrame) { Finish (); } }
void Start() { isFirstFrame = true; riLeft = GameObject.Find("UI_LeftArrow").GetComponent<RawImage>(); riRight = GameObject.Find("UI_RightArrow").GetComponent<RawImage>(); riUp = GameObject.Find("UI_UpArrow").GetComponent<RawImage>(); riDown = GameObject.Find("UI_DownArrow").GetComponent<RawImage>(); }
// Use this for initialization void Start () { img = (RawImage)ImageOnPanel.GetComponent<RawImage> (); img.texture = introPics[picNumber]; text.text = introTexts [textNumber]; }
static public int set_texture(IntPtr l) { UnityEngine.UI.RawImage o = (UnityEngine.UI.RawImage)checkSelf(l); UnityEngine.Texture v; checkType(l, 2, out v); o.texture = v; return(0); }
static public int set_uvRect(IntPtr l) { UnityEngine.UI.RawImage o = (UnityEngine.UI.RawImage)checkSelf(l); UnityEngine.Rect v; checkType(l, 2, out v); o.uvRect = v; return(0); }
public override UGUINode DrawImage(ImgNode image, UGUINode parent) { UGUINode node = CreateRootNode(image.Name, image.rect, parent); UnityEngine.UI.RawImage pic = node.InitComponent <UnityEngine.UI.RawImage>(); PSDImporterUtility.SetPictureOrLoadColor(image, pic); return(node); }
// Use this for initialization void Start() { prefabInstantiate = Instantiate(prefab, transform); m_avatar = prefabInstantiate.transform.Find("avatar").GetComponent <UnityEngine.UI.RawImage>(); m_order = prefabInstantiate.transform.Find("order").GetComponent <UnityEngine.UI.RawImage>(); m_order.texture = orderTexture; SetInfo();//此句用于调试,请在设置好队伍相关信息后调用SetInfo() }
void Start() { Screen.SetResolution(960, 720, true); image = gameObject.GetComponent <UnityEngine.UI.RawImage>(); dest = transform.position; origin = dest + new Vector3(0f, 800f, 0f); startTime = Time.time; }
public void Start() { m_Image = GetComponent<RawImage>(); Color color = m_Image.color; color.a = From; m_Image.color = color; StartCoroutine(coroutine_Fade()); }
public void OnLevelChange(AppManager app) { _movie = GetComponent <UnityEngine.UI.RawImage>(); #if UNITY_WEBGL _movie.enabled = false; #else #endif }
public void Clear(UnityEngine.UI.RawImage displayImage) { if (m_AutoClearTexture && displayImage != null && displayImage.texture != null) { Texture.Destroy(displayImage.texture); displayImage.texture = null; } }
public void SetTexture() { if (HUDRawImage != null && VideoFeed != null) { UnityEngine.UI.RawImage img = HUDRawImage.GetComponent <UnityEngine.UI.RawImage>(); img.texture = VideoFeed; } }
private UGUINode DrawRawImage(ImgNode image, UGUINode parent) { UGUINode node = PSDImportUtility.InstantiateItem(GroupType.RawIMAGE, image.sprite.name, parent); UnityEngine.UI.RawImage pic = node.InitComponent <UnityEngine.UI.RawImage>(); PSDImportUtility.SetPictureOrLoadColor(image, pic); PSDImportUtility.SetRectTransform(image, pic.GetComponent <RectTransform>()); return(node); }
private UINode DrawRawImage(Image image, UINode parent) { UINode node = PSDImportUtility.InstantiateItem(PSDImporterConst.PREFAB_PATH_RawIMAGE, image.name, parent); UnityEngine.UI.RawImage pic = node.GetComponent <UnityEngine.UI.RawImage>(); PSDImportUtility.SetPictureOrLoadColor(image, pic); PSDImportUtility.SetRectTransform(image, pic.GetComponent <RectTransform>()); return(node); }