private void AddOutlines() { if (hasOutline) { return; } //Outline target foreach (MeshRenderer renderer in gameObject.GetComponentsInChildren <MeshRenderer>()) { if (renderer.gameObject.GetComponent <cakeslice.Outline>() == null) { outlines.Add(renderer.gameObject.AddComponent <cakeslice.Outline>()); } } //Outline icons foreach (GameStatusIcon icon in FindObjectsOfType <GameStatusIcon>()) { if (icon.follow.GetTarget() == gameObject) { //Get the first icon(Which is the one behind, and the one NOT fading away) CanvasRenderer renderer = icon.GetComponentInChildren <CanvasRenderer>(); if (renderer != null && renderer.gameObject.GetComponent <UnityEngine.UI.Outline>() == null) { UnityEngine.UI.Outline outline = renderer.gameObject.AddComponent <UnityEngine.UI.Outline>(); outline.effectColor = iconOutlineColor; outline.effectDistance = new Vector2(iconOutlineSize, iconOutlineSize); outlines.Add(outline); } } } hasOutline = true; }
/// <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.Outline outline = (UnityEngine.UI.Outline)value; writer.WriteProperty("effectColor", outline.effectColor); writer.WriteProperty("effectDistance", outline.effectDistance); writer.WriteProperty("useGraphicAlpha", outline.useGraphicAlpha); writer.WriteProperty("useGUILayout", outline.useGUILayout); writer.WriteProperty("enabled", outline.enabled); writer.WriteProperty("tag", outline.tag); writer.WriteProperty("name", outline.name); writer.WriteProperty("hideFlags", outline.hideFlags); }
// METHODS public void ChangeSelectedValue() { UnityEngine.UI.Outline outline = transform.parent.GetComponent <UnityEngine.UI.Outline>(); if (_isSelected ^= true) { outline.effectColor = Color.red; outline.effectDistance = new Vector2(6, 6); } else { outline.effectColor = Color.black; outline.effectDistance = new Vector2(3, 3); } }
protected override void Init() { if (null == m_target) { return; } // end if m_Outline = m_target.GetComponent <UnityEngine.UI.Outline>(); if (null == m_Outline) { return; } // end if m_beginColor = m_Outline.effectColor; }
static StackObject *ModifyMesh_0(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, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.VertexHelper @vh = (UnityEngine.UI.VertexHelper) typeof(UnityEngine.UI.VertexHelper).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.Outline instance_of_this_method = (UnityEngine.UI.Outline) typeof(UnityEngine.UI.Outline).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.ModifyMesh(@vh); return(__ret); }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.UI.Outline outline = (UnityEngine.UI.Outline)value; foreach (string property in reader.Properties) { switch (property) { case "effectColor": outline.effectColor = reader.ReadProperty <UnityEngine.Color> (); break; case "effectDistance": outline.effectDistance = reader.ReadProperty <UnityEngine.Vector2> (); break; case "useGraphicAlpha": outline.useGraphicAlpha = reader.ReadProperty <System.Boolean> (); break; case "useGUILayout": outline.useGUILayout = reader.ReadProperty <System.Boolean> (); break; case "enabled": outline.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": outline.tag = reader.ReadProperty <System.String> (); break; case "name": outline.name = reader.ReadProperty <System.String> (); break; case "hideFlags": outline.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
static int _m_ModifyMesh(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.Outline __cl_gen_to_be_invoked = (UnityEngine.UI.Outline)translator.FastGetCSObj(L, 1); try { { UnityEngine.UI.VertexHelper vh = (UnityEngine.UI.VertexHelper)translator.GetObject(L, 2, typeof(UnityEngine.UI.VertexHelper)); __cl_gen_to_be_invoked.ModifyMesh(vh); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
/** CreateUiText */ public static UnityEngine.GameObject CreateUiText(string a_name, UnityEngine.Transform a_parent_transform) { UnityEngine.UI.DefaultControls.Resources t_resources = new UnityEngine.UI.DefaultControls.Resources(); { } UnityEngine.GameObject t_gameobject = UnityEngine.UI.DefaultControls.CreateText(t_resources); if (t_gameobject != null) { //name t_gameobject.name = a_name; //parent t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform); //outline UnityEngine.UI.Outline t_outline = t_gameobject.AddComponent <UnityEngine.UI.Outline>(); { t_outline.useGraphicAlpha = true; t_outline.effectColor = UnityEngine.Color.black; t_outline.effectDistance = new UnityEngine.Vector2(1.0f, -1.0f); } //shadow UnityEngine.UI.Shadow t_shadow = t_gameobject.AddComponent <UnityEngine.UI.Shadow>(); { t_shadow.useGraphicAlpha = true; t_outline.effectColor = UnityEngine.Color.black; t_outline.effectDistance = new UnityEngine.Vector2(1.0f, -1.0f); } } else { Tool.Assert(false); } return(t_gameobject); }
/** プールから作成。 */ public void InitializeFromPool() { //フォントサイズ。 this.fontsize = Config.DEFAULT_TEXT_FONTSIZE; //アライメントタイプ。左揃え。 this.alignment_type_x = Text2D_HorizontalAlignmentType.Left; //アライメントタイプ。上揃え。 this.alignment_type_y = Text2D_VerticalAlignmentType.Top; //クリップ。 this.clip = false; this.clip_rect.Set(0, 0, 0, 0); //シェーダの変更が必要。 this.raw_is_changeshader = true; //フォントサイズの計算が必要。 this.raw_is_calcfontsize = true; //サイズの計算が必要。 this.raw_is_calcsize = true; //raw this.raw_gameobject.SetActive(false); //カスタムマテリアルアイテム設定。 this.raw_custom_text_material_item.SetMaterialToInstance(this.raw_text); //font this.raw_text.font = Render2D.GetInstance().GetDefaultFont(); //color this.raw_text.color = Config.DEFAULT_TEXT_COLOR; //text this.raw_text.text = ""; //localscale this.raw_recttransform.localScale = new UnityEngine.Vector3(1.0f, 1.0f, 1.0f); //sizedelta this.raw_recttransform.sizeDelta = new UnityEngine.Vector2(Screen.GetScreenWidth(), Screen.GetScreenHeight()); { UnityEngine.UI.BaseMeshEffect[] t_effect_list = this.raw_gameobject.GetComponents <UnityEngine.UI.BaseMeshEffect>(); for (int ii = 0; ii < t_effect_list.Length; ii++) { if (t_effect_list[ii].GetType() == typeof(UnityEngine.UI.Shadow)) { this.raw_shadow = t_effect_list[ii] as UnityEngine.UI.Shadow; if (this.raw_shadow != null) { this.raw_shadow.enabled = false; } } else if (t_effect_list[ii].GetType() == typeof(UnityEngine.UI.Outline)) { this.raw_outline = t_effect_list[ii] as UnityEngine.UI.Outline; if (this.raw_outline != null) { this.raw_outline.enabled = false; } } } } }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.UI.Outline outline = SaveGameType.CreateComponent <UnityEngine.UI.Outline> (); ReadInto(outline, reader); return(outline); }
/// <summary>Tweens a Outline's effectDistance to the given value. /// Also stores the Outline as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOScale(this UnityEngine.UI.Outline target, Vector2 endValue, float duration) { return(DOTween.To(() => target.effectDistance, x => target.effectDistance = x, endValue, duration) .SetTarget(target)); }
/// <summary>Tweens a Outline's effectColor alpha to the given value. /// Also stores the Outline as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOFade(this UnityEngine.UI.Outline target, float endValue, float duration) { return(DOTween.ToAlpha(() => target.effectColor, x => target.effectColor = x, endValue, duration) .SetTarget(target)); }