public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go!=null) { _image = _go.GetComponent<UnityEngine.UI.Image>(); } DoSetImageSourceValue(); Finish(); }
public FocusOverlay() { // Load texture on create, removal of the old Textures class satellite = RTUtil.LoadImage("texSatellite"); // New AppLauncher Button instead of floating satellite button var actives = KSP.UI.Screens.ApplicationLauncher.AppScenes.TRACKSTATION | KSP.UI.Screens.ApplicationLauncher.AppScenes.MAPVIEW; mButton = KSP.UI.Screens.ApplicationLauncher.Instance.AddModApplication(OnButtonDown, OnButtonUp, null, null, null, null, actives, satellite); mButtonImg = mButton.GetComponent<UnityEngine.UI.Image>(); RebuildTrackingListeners(); MapView.OnEnterMapView += OnEnterMapView; MapView.OnExitMapView += OnExitMapView; }
void RemoveSequence(UnityEngine.UI.Image img) { int Index = -1; for (int dex = 0; dex < m_AllSequence.Count; ++dex) { if (m_AllSequence[dex].m_Img == img) { Index = dex; break; } } if (Index != -1) { m_AllSequence.RemoveAt(Index); } else { Debug.LogError("Sequence Not Exit " + img); } }
/// <summary>Tweens an Image's colors using the given gradient /// (NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener). /// Also stores the image as the tween's target so it can be used for filtered operations</summary> /// <param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param> public static Sequence DOGradientColor(this UnityEngine.UI.Image target, Gradient gradient, float duration) { Sequence s = DOTween.Sequence(); GradientColorKey[] colors = gradient.colorKeys; int len = colors.Length; for (int i = 0; i < len; ++i) { GradientColorKey c = colors[i]; if (i == 0 && c.time <= 0) { target.color = c.color; continue; } float colorDuration = i == len - 1 ? duration - s.Duration(false) // Verifies that total duration is correct : duration * (i == 0 ? c.time : c.time - colors[i - 1].time); s.Append(target.DOColor(c.color, colorDuration).SetEase(Ease.Linear)); } return(s); }
public IEnumerator TestNormalizedSize() { // Create UIScreenSpaceShape UIScreenSpace screenSpaceShape = TestHelpers.SharedComponentCreate <UIScreenSpace, UIScreenSpace.Model>(scene, CLASS_ID.UI_SCREEN_SPACE_SHAPE); yield return(screenSpaceShape.routine); // Create UIContainerRectShape UIContainerRect uiContainerRectShape = TestHelpers.SharedComponentCreate <UIContainerRect, UIContainerRect.Model>(scene, CLASS_ID.UI_CONTAINER_RECT); yield return(uiContainerRectShape.routine); // Update UIContainerRectShape properties yield return(TestHelpers.SharedComponentUpdate(uiContainerRectShape, new UIContainerRect.Model { parentComponent = screenSpaceShape.id, width = new UIValue(50, UIValue.Unit.PERCENT), height = new UIValue(30, UIValue.Unit.PERCENT) })); yield return(uiContainerRectShape.routine); UnityEngine.UI.Image image = uiContainerRectShape.childHookRectTransform.GetComponent <UnityEngine.UI.Image>(); // Check updated properties are applied correctly Assert.AreEqual(screenSpaceShape.childHookRectTransform.rect.width * 0.5f, uiContainerRectShape.childHookRectTransform.rect.width, 0.01f); Assert.AreEqual(screenSpaceShape.childHookRectTransform.rect.height * 0.3f, uiContainerRectShape.childHookRectTransform.rect.height, 0.01f); yield return(new WaitForAllMessagesProcessed()); screenSpaceShape.Dispose(); }
void Awake() { playerPlaceText = CustomExtensions.CreateWorldText(transform, ""); playerPlaceText.rectTransform.anchoredPosition = new Vector2(42.5f, -47.5f); playerPlaceText.fontSize = 8f; playerNameText = CustomExtensions.CreateWorldText(transform, ""); playerNameText.rectTransform.anchoredPosition = new Vector2(44f, -47.5f); playerNameText.fontSize = 7f; playerScoreText = CustomExtensions.CreateWorldText(transform, ""); playerScoreText.rectTransform.anchoredPosition = new Vector2(55f, -47.5f); playerScoreText.fontSize = 8f; playerSpeakerIcon = new GameObject("Player Speaker Icon", typeof(Canvas), typeof(CanvasRenderer)).AddComponent <Image>(); playerSpeakerIcon.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; playerSpeakerIcon.rectTransform.SetParent(transform); playerSpeakerIcon.rectTransform.localScale = new Vector3(0.008f, 0.008f, 1f); playerSpeakerIcon.rectTransform.pivot = new Vector2(0.5f, 0.5f); playerSpeakerIcon.rectTransform.anchoredPosition3D = new Vector3(-8.5f, 2f, 0f); playerSpeakerIcon.sprite = Sprites.speakerIcon; }
static StackObject *SetSprite_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @spritename = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.Image @im = (UnityEngine.UI.Image) typeof(UnityEngine.UI.Image).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); LCL.UIAtals instance_of_this_method = (LCL.UIAtals) typeof(LCL.UIAtals).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.SetSprite(@im, @spritename); return(__ret); }
static StackObject *set_Item_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int64 @value = *(long *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.Image @key = (UnityEngine.UI.Image) typeof(UnityEngine.UI.Image).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Collections.Generic.Dictionary <UnityEngine.UI.Image, System.Int64> instance_of_this_method; instance_of_this_method = (System.Collections.Generic.Dictionary <UnityEngine.UI.Image, System.Int64>) typeof(System.Collections.Generic.Dictionary <UnityEngine.UI.Image, System.Int64>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method[key] = value; return(__ret); }
static int _m_setMaterialFloat_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { UnityEngine.UI.Image img = (UnityEngine.UI.Image)translator.GetObject(L, 1, typeof(UnityEngine.UI.Image)); string key = LuaAPI.lua_tostring(L, 2); float val = (float)LuaAPI.lua_tonumber(L, 3); LuaExtend.setMaterialFloat(img, key, val); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
/// <summary> /// Custom made: Insert sprite into image. /// </summary> /// <param name="this Image">This image.</param> /// <param name="Texture2D">Texture.</param> public static void CreateImageSprite(this UnityEngine.UI.Image thisImage, Texture2D _texture) { if (thisImage == null) { return; } if (_texture == null) { return; } thisImage.preserveAspect = true; thisImage.sprite = Sprite.Create( _texture, new Rect(0, 0, (float)_texture.width, (float)_texture.height), new Vector2(0, 0), 1f); }
// Create the about dialog public void About() { // This will destroy all, because we shouldn't have anything left at the main menu Destroyer.Destroy(); Sprite bannerSprite; Texture2D newTex = Resources.Load("sprites/banner") as Texture2D; GameObject banner = new GameObject("banner"); banner.tag = "dialog"; banner.transform.parent = Game.Get().uICanvas.transform; RectTransform trans = banner.AddComponent <RectTransform>(); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 1 * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); trans.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, (UIScaler.GetWidthUnits() - 18f) * UIScaler.GetPixelsPerUnit() / 2f, 18f * UIScaler.GetPixelsPerUnit()); banner.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = banner.AddComponent <UnityEngine.UI.Image>(); bannerSprite = Sprite.Create(newTex, new Rect(0, 0, newTex.width, newTex.height), Vector2.zero, 1); image.sprite = bannerSprite; image.rectTransform.sizeDelta = new Vector2(18f * UIScaler.GetPixelsPerUnit(), 7f * UIScaler.GetPixelsPerUnit()); DialogBox db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 10f), new Vector2(30, 6), "Valkyrie is a game master helper tool inspired by Fantasy Flight Games' Descent: Road to Legend. Most images used are imported from FFG applications are are copyright FFG and other rights holders."); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); db = new DialogBox(new Vector2((UIScaler.GetWidthUnits() - 30f) / 2, 18f), new Vector2(30, 5), "Valkyrie uses DotNetZip-For-Unity and has code derived from Unity Studio and .NET Ogg Vorbis Encoder."); db.textObj.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetMediumFont(); TextButton tb = new TextButton(new Vector2(1, UIScaler.GetBottom(-3)), new Vector2(8, 2), "Back", delegate { Destroyer.MainMenu(); }); tb.background.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0.03f, 0f); tb.SetFont(Game.Get().gameType.GetHeaderFont()); }
public string UpdateCharaTalkImage(Position position, Texture texture, Color color) { UnityEngine.UI.Image image = null; if (position == Position.Left) { image = charaTalkLeft; } else if (position == Position.Right) { image = charaTalkRight; } else { image = charaTalkCenter; } if (texture == Texture.hide) { image.sprite = null; image.gameObject.SetActive(false); } else { Texture2D texture2d = Resources.Load(textureDic[texture]) as Texture2D; image.sprite = Sprite.Create(texture2d, new Rect(0, 0, texture2d.width, texture2d.height), Vector2.zero); image.color = colorDic[color]; image.gameObject.SetActive(true); } if (color == Color.white) { return(nameDic[texture]); } else { return(null); } }
protected void _Create(EleBaseRect parent, ScrollInfo scrollInfo, Vector2 size) { this.minSize = size; GameObject go = new GameObject("Slider_" + name); go.transform.SetParent(parent.GetContentRect(), false); // this.plate = go.AddComponent <UnityEngine.UI.Image>(); this.plate.type = UnityEngine.UI.Image.Type.Sliced; this.plate.sprite = scrollInfo.backplateSprite; // this.slider = go.AddComponent <SldTy>(); this.plate.RTQ().TopLeftAnchorsPivot(); GameObject slideRegion = new GameObject("Slidergn_" + name); slideRegion.transform.SetParent(go.transform, false); RectTransform rtSliderRegion = slideRegion.AddComponent <RectTransform>(); rtSliderRegion.RTQ().ExpandParentFlush(). OffsetMin(scrollInfo.scrollbarDim * 0.5f, 0.0f). OffsetMax(-scrollInfo.scrollbarDim * 0.5f, 0.0f); GameObject goThumb = new GameObject("Thumb_" + name); goThumb.transform.SetParent(slideRegion.transform, false); // this.thumb = goThumb.AddComponent <UnityEngine.UI.Image>(); this.thumb.type = UnityEngine.UI.Image.Type.Sliced; // this.thumb.RTQ().CenterPivot().SizeDelta(scrollInfo.scrollbarDim, 0.0f); this.slider.targetGraphic = this.thumb; this.slider.handleRect = this.thumb.rectTransform; scrollInfo.Apply(this.slider, this.thumb); }
public GameObject CreateButton( Transform parent, string objName, out UnityEngine.UI.Image img, out UnityEngine.UI.Button btn, params System.Type [] btnCmp) { GameObject go; if (btnCmp != null) { go = new GameObject(objName, btnCmp); } else { go = new GameObject(objName); } go.transform.SetParent(parent); go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; img = go.GetComponent <UnityEngine.UI.Image>(); if (img == null) { img = go.AddComponent <UnityEngine.UI.Image>(); } btn = go.AddComponent <UnityEngine.UI.Button>(); if (btn == null) { btn = go.AddComponent <UnityEngine.UI.Button>(); } this.Apply(btn, img, true, UnityEngine.UI.Image.Type.Sliced); return(go); }
public TimeWarpDecorator() { mFlightButtonGreen = GUITextureButtonFactory.CreateFromFilename("texFlightGreen", "texFlightGreenOver", "texFlightGreenDown", "texFlightGreenOver"); mFlightButtonYellow = GUITextureButtonFactory.CreateFromFilename("texFlightYellow", "texFlightYellowOver", "texFlightYellowDown", "texFlightYellowOver"); mFlightButtonRed = GUITextureButtonFactory.CreateFromFilename("texFlightRed", "texFlightRed", "texFlightRed", "texFlightRed"); mFlightButtonGreen.fixedHeight = mFlightButtonGreen.fixedWidth = 0; mFlightButtonYellow.fixedHeight = mFlightButtonYellow.fixedWidth = 0; mFlightButtonRed.fixedHeight = mFlightButtonRed.fixedWidth = 0; mFlightButtonGreen.stretchHeight = mFlightButtonGreen.stretchWidth = true; mFlightButtonYellow.stretchHeight = mFlightButtonYellow.stretchWidth = true; mFlightButtonRed.stretchHeight = mFlightButtonRed.stretchWidth = true; // create the Background RTUtil.LoadImage(out mTexBackground, "TimeQuadrantFcStatus"); // Get the image for positioning the decorator GameObject go = GameObject.Find("TimeQuadrant"); if (go) { mTimewarpImage = go.GetComponent <UnityEngine.UI.Image>(); } // objects on this scene? if (mTimewarpImage == null || TimeWarp.fetch == null) { return; } // create a style (for the connection / delay text) from the high logic skin label style. var skin = UnityEngine.Object.Instantiate(HighLogic.Skin); mTextStyle = new GUIStyle(skin.label); mTextStyle.alignment = TextAnchor.MiddleLeft; mTextStyle.wordWrap = false; mTextStyle.font = skin.font; }
static int _m_SetImageColor_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { UnityEngine.UI.Image _image = (UnityEngine.UI.Image)translator.GetObject(L, 1, typeof(UnityEngine.UI.Image)); float _x = (float)LuaAPI.lua_tonumber(L, 2); float _y = (float)LuaAPI.lua_tonumber(L, 3); float _z = (float)LuaAPI.lua_tonumber(L, 4); Game.UIUtil.SetImageColor(_image, _x, _y, _z); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.UI.Image image = (UnityEngine.UI.Image)value; writer.WriteProperty("sprite", image.sprite); writer.WriteProperty("overrideSprite", image.overrideSprite); writer.WriteProperty("type", image.type); writer.WriteProperty("preserveAspect", image.preserveAspect); writer.WriteProperty("fillCenter", image.fillCenter); writer.WriteProperty("fillMethod", image.fillMethod); writer.WriteProperty("fillAmount", image.fillAmount); writer.WriteProperty("fillClockwise", image.fillClockwise); writer.WriteProperty("fillOrigin", image.fillOrigin); writer.WriteProperty("alphaHitTestMinimumThreshold", image.alphaHitTestMinimumThreshold); writer.WriteProperty("material", image.material); writer.WriteProperty("maskable", image.maskable); writer.WriteProperty("color", image.color); writer.WriteProperty("raycastTarget", image.raycastTarget); writer.WriteProperty("useGUILayout", image.useGUILayout); writer.WriteProperty("enabled", image.enabled); writer.WriteProperty("tag", image.tag); writer.WriteProperty("name", image.name); writer.WriteProperty("hideFlags", image.hideFlags); }
/// <summary> /// Fades the given image in or out. /// </summary> /// <param name="img"> The image to fade </param> /// <param name="shouldFadeOut"> Whether the image should fade in or out </param> /// <param name="speedMultiplier"> The speed which the image will fade </param> public IEnumerator FadeImageCoroutine(UnityEngine.UI.Image img, bool shouldFadeOut, FadeSpeed fadeSpeed) { this.fadeSpeed = fadeSpeed; // Fade the image out (turns into transparent) if (shouldFadeOut) { for (float i = 1; i >= 0; i -= GetProcessedDeltaTime()) { img.color = new Color(1, 1, 1, i); yield return(null); } } // Fade the image out (turns into opaque) else { for (float i = 0; i <= 1; i += GetProcessedDeltaTime()) { img.color = new Color(1, 1, 1, i); yield return(null); } } }
/** 初期化。 */ public void Initialize(InputField2D a_parent) { //raw this.raw_gameobject = Fee.Instantiate.Instantiate.CreateUiInputField("InputField", Fee.Render2D.Render2D.GetInstance().GetRootTransform()); this.raw_focus_monobehaviour = this.raw_gameobject.AddComponent <Fee.Ui.Focus_MonoBehaviour>(); this.raw_transform = this.raw_gameobject.GetComponent <UnityEngine.Transform>(); this.raw_inputfield = this.raw_gameobject.GetComponent <UnityEngine.UI.InputField>(); this.raw_recttransform = this.raw_gameobject.GetComponent <UnityEngine.RectTransform>(); this.raw_text = this.raw_inputfield.textComponent; this.raw_image = this.raw_inputfield.image; this.raw_placeholder_text = this.raw_inputfield.placeholder.GetComponent <UnityEngine.UI.Text>(); this.raw_gameobject.SetActive(false); { UnityEngine.UI.Navigation t_navigation = this.raw_inputfield.navigation; t_navigation.mode = UnityEngine.UI.Navigation.Mode.None; this.raw_inputfield.navigation = t_navigation; } //共通マテリアルアイテム複製。 this.raw_custom_text_material_item = Render2D.GetInstance().GetUiTextMaterialItem().DuplicateMaterialItem(); this.raw_custom_image_material_item = Render2D.GetInstance().GetUiImageMaterialItem().DuplicateMaterialItem(); }
public void Init(DownloadObject mod) { Destroy(GetComponent <LevelListTableCell>()); reuseIdentifier = "DownloadCell"; this.mod = mod; _authorText = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "Author"); _authorText.enableWordWrapping = false; _authorText.overflowMode = TextOverflowModes.Overflow; _songNameText = GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "SongName"); _songNameText.enableWordWrapping = false; _songNameText.overflowMode = TextOverflowModes.Overflow; _coverRawImage = GetComponentsInChildren <UnityEngine.UI.RawImage>().First(x => x.name == "CoverImage"); _bgImage = GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "BG"); _highlightImage = GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Highlight"); _beatmapCharacteristicAlphas = new float[0]; _beatmapCharacteristicImages = new UnityEngine.UI.Image[0]; _bought = true; foreach (var icon in GetComponentsInChildren <UnityEngine.UI.Image>().Where(x => x.name.StartsWith("LevelTypeIcon"))) { Destroy(icon.gameObject); } _songNameText.text = $"{mod.Mod.Name} <size=60%>v{mod.Mod.ResolvedVersion}</size>"; _authorText.text = ""; _coverRawImage.texture = mod.Icon.texture; _bgImage.enabled = true; _bgImage.sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 1, 1), Vector2.one / 2f); _bgImage.type = UnityEngine.UI.Image.Type.Filled; _bgImage.fillMethod = UnityEngine.UI.Image.FillMethod.Horizontal; Update(); }
public TimeWarpDecorator() { mFlightButtonGreen = GUITextureButtonFactory.CreateFromFilename("texFlightGreen", "texFlightGreenOver", "texFlightGreenDown", "texFlightGreenOver"); mFlightButtonYellow = GUITextureButtonFactory.CreateFromFilename("texFlightYellow", "texFlightYellowOver", "texFlightYellowDown", "texFlightYellowOver"); mFlightButtonRed = GUITextureButtonFactory.CreateFromFilename("texFlightRed", "texFlightRed", "texFlightRed", "texFlightRed"); mFlightButtonGreen.fixedHeight = mFlightButtonGreen.fixedWidth = 0; mFlightButtonYellow.fixedHeight = mFlightButtonYellow.fixedWidth = 0; mFlightButtonRed.fixedHeight = mFlightButtonRed.fixedWidth = 0; mFlightButtonGreen.stretchHeight = mFlightButtonGreen.stretchWidth = true; mFlightButtonYellow.stretchHeight = mFlightButtonYellow.stretchWidth = true; mFlightButtonRed.stretchHeight = mFlightButtonRed.stretchWidth = true; // create the Background RTUtil.LoadImage(out mTexBackground, "TimeQuadrantFcStatus"); // Get the image for positioning the decorator GameObject go = GameObject.Find("TimeQuadrant"); if (go) { mTimewarpImage = go.GetComponent <UnityEngine.UI.Image>(); } // objects on this scene? if (mTimewarpImage == null) { return; } if (TimeWarp.fetch != null && TimeWarp.fetch.timeQuadrantTab != null) { var text = TimeWarp.fetch.timeQuadrantTab.transform.FindChild("MET timer").GetComponent <ScreenSafeGUIText>(); mTextStyle = new GUIStyle(text.textStyle); mTextStyle.fontSize = (int)(text.textSize * ScreenSafeUI.PixelRatio); } }
protected override void _init_cache() { base._init_cache(); if (!sprite) { var obj_sprite = transform.Find("sprite"); if (obj_sprite) { sprite = obj_sprite.GetComponent <UnityEngine.UI.Image>(); } else { debug.error("no se encontro el gameobject sprite"); } } if (!sprite) { debug.error("no esta asignado el sprite para el item"); } if (!amount) { var obj_amount = transform.Find("amount"); if (obj_amount) { amount = obj_amount.GetComponent <TMPro.TextMeshProUGUI>(); } else { debug.error("no se encontro el gameobject amount"); } } if (!amount) { debug.error("no se encontro el text para el amount"); } }
static StackObject *IsRaycastLocationValid_43(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Camera @eventCamera = (UnityEngine.Camera) typeof(UnityEngine.Camera).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Vector2 @screenPoint = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); UnityEngine.UI.Image instance_of_this_method = (UnityEngine.UI.Image) typeof(UnityEngine.UI.Image).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.IsRaycastLocationValid(@screenPoint, @eventCamera); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }
public void Init() { LeaderboardTableCell cell = GetComponent <LeaderboardTableCell>(); foreach (FieldInfo info in cell.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic)) { info.SetValue(this, info.GetValue(cell)); } Destroy(cell); reuseIdentifier = "DownloadCell"; _playerNameText.rectTransform.anchoredPosition = new Vector2(12f, 0f); playerSpeakerIcon = new GameObject("Player Speaker Icon", typeof(Canvas), typeof(CanvasRenderer)).AddComponent <Image>(); playerSpeakerIcon.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; playerSpeakerIcon.rectTransform.SetParent(transform); playerSpeakerIcon.rectTransform.localScale = new Vector3(0.05f, 0.05f, 0.05f); playerSpeakerIcon.rectTransform.pivot = new Vector2(0.5f, 0.5f); playerSpeakerIcon.rectTransform.anchoredPosition = new Vector2(-38f, 0f); playerSpeakerIcon.sprite = Sprites.speakerIcon; playerSpeakerIcon.material = Sprites.NoGlowMat; }
public void FlipEnterExit() { if (enterExit == EnterExit.Enter) { boxCollider.transform.position = boxCollider.transform.position - boxCollider.transform.forward; icon.transform.SetParent(GPS.gpsIconParent.transform); icon = null; enterExit = EnterExit.Exit; } else { boxCollider.transform.position = boxCollider.transform.position + boxCollider.transform.forward; enterExit = EnterExit.Enter; if (GPS.gpsIconParent.transform.childCount == 0) { InstantiateNew(); } else { LoadFromExisting(); } } }
static int _m_DOBlendableColor(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.Image __cl_gen_to_be_invoked = (UnityEngine.UI.Image)translator.FastGetCSObj(L, 1); try { { UnityEngine.Color endValue; translator.Get(L, 2, out endValue); float duration = (float)LuaAPI.lua_tonumber(L, 3); DG.Tweening.Tweener __cl_gen_ret = __cl_gen_to_be_invoked.DOBlendableColor(endValue, duration); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
static int _m_DOGradientColor(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.Image __cl_gen_to_be_invoked = (UnityEngine.UI.Image)translator.FastGetCSObj(L, 1); try { { UnityEngine.Gradient gradient = (UnityEngine.Gradient)translator.GetObject(L, 2, typeof(UnityEngine.Gradient)); float duration = (float)LuaAPI.lua_tonumber(L, 3); DG.Tweening.Sequence __cl_gen_ret = __cl_gen_to_be_invoked.DOGradientColor(gradient, duration); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public TimeWarpDecorator() { mFlightButtonGreen = GUITextureButtonFactory.CreateFromFilename("texFlightGreen", "texFlightGreenOver", "texFlightGreenDown", "texFlightGreenOver"); mFlightButtonYellow = GUITextureButtonFactory.CreateFromFilename("texFlightYellow", "texFlightYellowOver", "texFlightYellowDown", "texFlightYellowOver"); mFlightButtonRed = GUITextureButtonFactory.CreateFromFilename("texFlightRed", "texFlightRed", "texFlightRed", "texFlightRed"); mFlightButtonGreen.fixedHeight = mFlightButtonGreen.fixedWidth = 0; mFlightButtonYellow.fixedHeight = mFlightButtonYellow.fixedWidth = 0; mFlightButtonRed.fixedHeight = mFlightButtonRed.fixedWidth = 0; mFlightButtonGreen.stretchHeight = mFlightButtonGreen.stretchWidth = true; mFlightButtonYellow.stretchHeight = mFlightButtonYellow.stretchWidth = true; mFlightButtonRed.stretchHeight = mFlightButtonRed.stretchWidth = true; // create the Background RTUtil.LoadImage(out mTexBackground, "TimeQuadrantFcStatus"); // Get the image for positioning the decorator GameObject go = GameObject.Find("TimeQuadrant"); if (go) { mTimewarpImage = go.GetComponent<UnityEngine.UI.Image>(); } // objects on this scene? if (mTimewarpImage == null || TimeWarp.fetch == null) { return; } // create a style (for the connection / delay text) from the high logic skin label style. var skin = UnityEngine.Object.Instantiate(HighLogic.Skin); mTextStyle = new GUIStyle(skin.label); mTextStyle.alignment = TextAnchor.MiddleLeft; mTextStyle.wordWrap = false; mTextStyle.font = skin.font; }
private IEnumerator WaitForPlayerToCome() { while (true) { yield return(cinematicWaiter); var player = Physics.OverlapBox(boxCollider.transform.position, boxCollider.size * 0.5f, boxCollider.transform.rotation, LayerMask.GetMask("Player")); if (player.Length != 0) { enabled = true; startTime = Time.time; TurnCinematic(true); blackScreen = Instantiate(DeathMessage.blackScreenPrefab).GetComponent <UnityEngine.UI.Image>(); blackScreen.rectTransform.SetParent(GM.canvas.transform); blackScreen.rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height); blackScreen.rectTransform.localPosition = Vector3.zero; blackScreen.color = Color.clear; Theme.ChangeBGM(BGM.Silence); StopCoroutine(WaitForPlayerToCome()); break; } } }
public void ShowWorshipButton(bool isShow) { if (mWorshipButtonComponent != null) { mWorshipButtonComponent.ShowButton(isShow); if (isShow == true) { // 手指动画,第一次膜拜才显示 uint worshipedCount = 0; object[] param = { }; System.Type[] returnType = { typeof(int) }; object[] objs = LuaScriptMgr.Instance.CallLuaFunction_return(LuaScriptMgr.Instance.Lua.Global, "WorshipMeetingDataManager_GetWorshipedModelUnitIdsCount", param, returnType); if (objs != null && objs.Length > 0) { if (objs[0] != null) { int a = (int)objs[0]; worshipedCount = (uint)a; } } UnityEngine.UI.Image buttonImage = mWorshipButtonComponent.ButtonImage; if (buttonImage != null) { if (worshipedCount == 0) { buttonImage.gameObject.SetActive(true); } else { buttonImage.gameObject.SetActive(false); } } } } }
static int _m_SetImageSprite_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { UnityEngine.UI.Image _image = (UnityEngine.UI.Image)translator.GetObject(L, 1, typeof(UnityEngine.UI.Image)); string _assetPath = LuaAPI.lua_tostring(L, 2); XLua.LuaFunction _onEnd = (XLua.LuaFunction)translator.GetObject(L, 3, typeof(XLua.LuaFunction)); bool _isSetSize = LuaAPI.lua_toboolean(L, 4); int gen_ret = Lua.LuaHelp.SetImageSprite(_image, _assetPath, _onEnd, _isSetSize); LuaAPI.xlua_pushinteger(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static public IEnumerator LoadSprite(string spritePath, Image image, float aspectRatio) { Texture2D tex; if (_cachedSprites.ContainsKey(spritePath)) { image.sprite = _cachedSprites[spritePath]; yield break; } using (WWW www = new WWW(spritePath)) { yield return(www); tex = www.texture; float newHeight = tex.width / aspectRatio; float bottom = (tex.height - newHeight) / 2; var newSprite = Sprite.Create(tex, new Rect(0, bottom, tex.width, newHeight), Vector2.one * 0.5f, 100, 1); _cachedSprites.Add(spritePath, newSprite); image.sprite = newSprite; } }
static int _m_IsRaycastLocationValid(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.Image __cl_gen_to_be_invoked = (UnityEngine.UI.Image)translator.FastGetCSObj(L, 1); try { { UnityEngine.Vector2 screenPoint; translator.Get(L, 2, out screenPoint); UnityEngine.Camera eventCamera = (UnityEngine.Camera)translator.GetObject(L, 3, typeof(UnityEngine.Camera)); bool __cl_gen_ret = __cl_gen_to_be_invoked.IsRaycastLocationValid(screenPoint, eventCamera); LuaAPI.lua_pushboolean(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
/// <summary> /// Called when the entity is first ready. /// </summary> void Awake() { // Find the GameManager script gameManScript = GameObject.Find ("GameManager").GetComponent<GameManager> (); // Set default property values _drawnShapes = new List<ShapeDraw>(); _isPlayingBackDrawing = false; _followObjStartPos = followObjTrans.position; // Create line point holder if not around if (!_shapeHolder) { _shapeHolder = new GameObject("ShapeHolder"); _shapeHolderTrans = _shapeHolder.transform; } // Find the correct ink bar using the game objects' tags if (gameObject.tag == "Teacher") _inkBar = GameObject.FindGameObjectWithTag ("TeacherInkBar").GetComponent<UnityEngine.UI.Image>(); else _inkBar = GameObject.FindGameObjectWithTag ("StudentInkBar").GetComponent<UnityEngine.UI.Image>(); _inkBar.color = lineCol; // Start the first shape CreateNextDrawingShape(); }
private void InitWebView() { if (this.androidTvGameVersion != null && this.androidTvGameVersion != "") { if(webViewObject == null) { webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>(); GameObject.DontDestroyOnLoad(webViewObject.gameObject); webViewObject.Init((msg) => ProcessJS(msg)); string url = Settings.AIRCONSOLE_BASE_URL; url += "client?id=androidunity-" + Settings.VERSION; url += "&game-id=" + Application.bundleIdentifier; url += "&game-version=" + this.androidTvGameVersion; webViewObject.SetMargins(0, Screen.height, 0, -Screen.height); webViewObject.SetVisibility(true); webViewObject.LoadURL(url); //Display loading Screen webViewLoadingCanvas = (new GameObject("WebViewLoadingCanvas")).AddComponent<Canvas>(); #if !UNITY_EDITOR webViewLoadingCanvas.renderMode = RenderMode.ScreenSpaceOverlay; webViewLoadingBG = (new GameObject("WebViewLoadingBG")).AddComponent<UnityEngine.UI.Image>(); webViewLoadingImage = (new GameObject("WebViewLoadingImage")).AddComponent<UnityEngine.UI.Image>(); webViewLoadingBG.transform.SetParent(webViewLoadingCanvas.transform, true); webViewLoadingImage.transform.SetParent(webViewLoadingCanvas.transform, true); webViewLoadingImage.sprite = webViewLoadingSprite; webViewLoadingBG.color = Color.black; webViewLoadingImage.rectTransform.localPosition = new Vector3 (0, 0, 0); webViewLoadingBG.rectTransform.localPosition = new Vector3 (0, 0, 0); webViewLoadingImage.rectTransform.sizeDelta = new Vector2 (Screen.width / 2, Screen.height / 2); webViewLoadingBG.rectTransform.sizeDelta = new Vector2 (Screen.width, Screen.height); webViewLoadingImage.preserveAspect = true; if (webViewLoadingSprite == null){ webViewLoadingImage.sprite = Resources.Load("AirConsoleLogoLoadingScreen", typeof(Sprite)) as Sprite; } #endif } } else { if (Settings.debug.error) { Debug.LogError("AirConsole: for Android builds you need to provide the Game Version Identifier on the AirConsole object in the scene."); } } }
//------------------------------------------------------------------------------ public UIButton(GameObject obj, Sprite[] sprites) : base(obj, sprites) { //Log.Debug("UIButton "+obj.name); this.type = UIType.Button; this.onClick = onClick; this.onRelease = onRelease; this.onOver = onOver; textColors = new Color[5]; if(sprites != null) { this.image = gameObject.GetComponent<UnityEngine.UI.Image>(); if (this.image == null) { this.image = gameObject.AddComponent<UnityEngine.UI.Image>(); } //if(this.render == null) // Log.Error("Button must have a SpriteRenderer! Button:"+obj.name); } }
private void SetCustomCursor() { _caveCursorRect = GameObject.Find("CaveCursor").GetComponent<RectTransform>(); _caveCursorImage = GameObject.Find("CaveCursor").GetComponent< UnityEngine.UI.Image >(); if (API.Instance.Cave.WandSettings.Cursor != null) { //Canvas canvasMouseCursorDuplicate = GameObject.Find("CanvasMouseCursorDuplicate").GetComponent<Canvas>(); Rect rect = new Rect(0, 0, API.Instance.Cave.WandSettings.Cursor.width, API.Instance.Cave.WandSettings.Cursor.height); Sprite cursorSprite = Sprite.Create(API.Instance.Cave.WandSettings.Cursor, rect, Vector2.zero); _caveCursorImage.sprite = cursorSprite; _caveCursorRect.pivot = new Vector2(0.5f, 0.5f); _caveCursorRect.sizeDelta = new Vector2(API.Instance.Cave.WandSettings.Cursor.width, API.Instance.Cave.WandSettings.Cursor.height); } }
public void cleanup() { this.onUpdateFloat = null; this.onUpdateFloatRatio = null; this.onUpdateVector2 = null; this.onUpdateVector3 = null; this.onUpdateFloatObject = null; this.onUpdateVector3Object = null; this.onUpdateColor = null; this.onComplete = null; this.onCompleteObject = null; this.onCompleteParam = null; #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5 this.rectTransform = null; this.uiText = null; this.uiImage = null; this.sprites = null; #endif }
// This method is only for internal use public void init() { this.hasInitiliazed = true; // Set time based on current timeScale /*if( !this.useEstimatedTime ){ this.time = this.time*Time.timeScale; }*/ // Initialize From Values switch (this.type) { case TweenAction.MOVE: this.from = trans.position; break; case TweenAction.MOVE_X: this.from.x = trans.position.x; break; case TweenAction.MOVE_Y: this.from.x = trans.position.y; break; case TweenAction.MOVE_Z: this.from.x = trans.position.z; break; case TweenAction.MOVE_LOCAL_X: this.from.x = trans.localPosition.x; break; case TweenAction.MOVE_LOCAL_Y: this.from.x = trans.localPosition.y; break; case TweenAction.MOVE_LOCAL_Z: this.from.x = trans.localPosition.z; break; case TweenAction.SCALE_X: this.from.x = trans.localScale.x; break; case TweenAction.SCALE_Y: this.from.x = trans.localScale.y; break; case TweenAction.SCALE_Z: this.from.x = trans.localScale.z; break; case TweenAction.ALPHA: #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 if(trans.gameObject.renderer){ this.from.x = trans.gameObject.renderer.material.color.a; }else if(trans.childCount>0){ foreach (Transform child in trans) { if(child.gameObject.renderer!=null){ Color col = child.gameObject.renderer.material.color; this.from.x = col.a; break; } } } break; #else SpriteRenderer ren = trans.gameObject.GetComponent<SpriteRenderer>(); if (ren != null) { this.from.x = ren.color.a; } else { if (trans.gameObject.GetComponent<Renderer>() != null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_Color")) { this.from.x = trans.gameObject.GetComponent<Renderer>().material.color.a; } else if (trans.gameObject.GetComponent<Renderer>() != null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_TintColor")) { Color col = trans.gameObject.GetComponent<Renderer>().material.GetColor("_TintColor"); this.from.x = col.a; } else if (trans.childCount > 0) { foreach (Transform child in trans) { if (child.gameObject.GetComponent<Renderer>() != null) { Color col = child.gameObject.GetComponent<Renderer>().material.color; this.from.x = col.a; break; } } } } break; #endif case TweenAction.MOVE_LOCAL: this.from = trans.localPosition; break; case TweenAction.MOVE_CURVED: case TweenAction.MOVE_CURVED_LOCAL: case TweenAction.MOVE_SPLINE: case TweenAction.MOVE_SPLINE_LOCAL: this.from.x = 0; break; case TweenAction.ROTATE: this.from = trans.eulerAngles; this.to = new Vector3(LeanTween.closestRot(this.from.x, this.to.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z)); break; case TweenAction.ROTATE_X: this.from.x = trans.eulerAngles.x; this.to.x = LeanTween.closestRot(this.from.x, this.to.x); break; case TweenAction.ROTATE_Y: this.from.x = trans.eulerAngles.y; this.to.x = LeanTween.closestRot(this.from.x, this.to.x); break; case TweenAction.ROTATE_Z: this.from.x = trans.eulerAngles.z; this.to.x = LeanTween.closestRot(this.from.x, this.to.x); break; case TweenAction.ROTATE_AROUND: this.lastVal = 0.0f; // optional["last"] this.from.x = 0.0f; this.origRotation = trans.rotation; // optional["origRotation" break; case TweenAction.ROTATE_AROUND_LOCAL: this.lastVal = 0.0f; // optional["last"] this.from.x = 0.0f; this.origRotation = trans.localRotation; // optional["origRotation" break; case TweenAction.ROTATE_LOCAL: this.from = trans.localEulerAngles; this.to = new Vector3(LeanTween.closestRot(this.from.x, this.to.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z)); break; case TweenAction.SCALE: this.from = trans.localScale; break; case TweenAction.GUI_MOVE: this.from = new Vector3(this.ltRect.rect.x, this.ltRect.rect.y, 0); break; case TweenAction.GUI_MOVE_MARGIN: this.from = new Vector2(this.ltRect.margin.x, this.ltRect.margin.y); break; case TweenAction.GUI_SCALE: this.from = new Vector3(this.ltRect.rect.width, this.ltRect.rect.height, 0); break; case TweenAction.GUI_ALPHA: this.from.x = this.ltRect.alpha; break; case TweenAction.GUI_ROTATE: if (this.ltRect.rotateEnabled == false) { this.ltRect.rotateEnabled = true; this.ltRect.resetForRotation(); } this.from.x = this.ltRect.rotation; break; case TweenAction.ALPHA_VERTEX: this.from.x = trans.GetComponent<MeshFilter>().mesh.colors32[0].a; break; case TweenAction.CALLBACK: break; case TweenAction.CALLBACK_COLOR: this.diff = new Vector3(1.0f, 0.0f, 0.0f); break; case TweenAction.COLOR: #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 if(trans.gameObject.renderer){ Color col = trans.gameObject.renderer.material.color; this.setFromColor( col ); }else if(trans.childCount>0){ foreach (Transform child in trans) { if(child.gameObject.renderer!=null){ Color col = child.gameObject.renderer.material.color; this.setFromColor( col ); break; } } } #else SpriteRenderer renColor = trans.gameObject.GetComponent<SpriteRenderer>(); if (renColor != null) { Color col = renColor.color; this.setFromColor(col); } else { if (trans.gameObject.GetComponent<Renderer>() != null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_Color")) { Color col = trans.gameObject.GetComponent<Renderer>().material.color; this.setFromColor(col); } else if (trans.gameObject.GetComponent<Renderer>() != null && trans.gameObject.GetComponent<Renderer>().material.HasProperty("_TintColor")) { Color col = trans.gameObject.GetComponent<Renderer>().material.GetColor("_TintColor"); this.setFromColor(col); } else if (trans.childCount > 0) { foreach (Transform child in trans) { if (child.gameObject.GetComponent<Renderer>() != null) { Color col = child.gameObject.GetComponent<Renderer>().material.color; this.setFromColor(col); break; } } } } #endif break; #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5 case TweenAction.CANVAS_ALPHA: this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>(); if (this.uiImage != null) this.from.x = this.uiImage.color.a; break; case TweenAction.CANVAS_COLOR: this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>(); if (this.uiImage != null) this.setFromColor(this.uiImage.color); break; case TweenAction.TEXT_ALPHA: this.uiText = trans.gameObject.GetComponent<UnityEngine.UI.Text>(); if (this.uiText != null) this.from.x = this.uiText.color.a; break; case TweenAction.TEXT_COLOR: this.uiText = trans.gameObject.GetComponent<UnityEngine.UI.Text>(); if (this.uiText != null) this.setFromColor(this.uiText.color); break; case TweenAction.CANVAS_MOVE: this.from = this.rectTransform.anchoredPosition3D; break; case TweenAction.CANVAS_ROTATEAROUND: case TweenAction.CANVAS_ROTATEAROUND_LOCAL: this.lastVal = 0.0f; this.from.x = 0.0f; this.origRotation = this.rectTransform.rotation; break; case TweenAction.CANVAS_SCALE: this.from = this.rectTransform.localScale; break; case TweenAction.CANVAS_PLAYSPRITE: this.uiImage = trans.gameObject.GetComponent<UnityEngine.UI.Image>(); this.from.x = 0f; break; #endif } if (this.type != TweenAction.CALLBACK_COLOR && this.type != TweenAction.COLOR && this.type != TweenAction.TEXT_COLOR && this.type != TweenAction.CANVAS_COLOR) this.diff = this.to - this.from; if (this.onCompleteOnStart) { if (this.onComplete != null) { this.onComplete(); } else if (this.onCompleteObject != null) { this.onCompleteObject(this.onCompleteParam); } } }