IEnumerator FadeIn(UIBehaviour thingToFade) { yield return null; yield return null; yield return null; yield return null; float timer = 0; if (thingToFade.GetComponent<Text>() != null) { while (timer <= FadeTimer) { Color textColor = thingToFade.GetComponent<Text>().color; textColor = new Color(textColor.r, textColor.g, textColor.b, timer / FadeTimer); thingToFade.GetComponent<Text>().color = textColor; timer += Time.deltaTime; yield return null; } } else if (thingToFade.GetComponent<Image>() != null) { while (timer <= FadeTimer) { Color imgColor = thingToFade.GetComponent<Image>().color; imgColor = new Color(imgColor.r, imgColor.g, imgColor.b, timer / FadeTimer); thingToFade.GetComponent<Image>().color = imgColor; timer += Time.deltaTime; yield return null; } } yield return null; }
void Start() { uiBehaviour = transform.GetComponent <UIBehaviour> (); iRest = transform.GetComponent <REST> (); sess = transform.GetComponent <Session> (); classR = transform.GetComponent <SClassroom> (); }
public static IObservable <PointerEventData> OnEndDragAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <PointerEventData>()); } return(ObservableTriggerExtensions.GetOrAddComponent <ObservableEndDragTrigger>(component.gameObject).OnEndDragAsObservable()); }
public void Binding(UIBehaviour uiComponent, UIBindingComponent bindingComponent, IUILogicalNode target) { tmpro = uiComponent as TextMeshProUGUI; string path = bindingComponent.GetBindingPath("TMPro"); target.BindingComponent(path, this); tmpro.text = target.DataContext.GetData(path) as string; }
/// <summary> /// 为UIPanel内的脚本提供便捷的UI事件监听接口 /// </summary> /// <param name="target"></param> /// <param name="listener"></param> public void AddUIClickListener(UIBehaviour target, Action listener) { if (target != null) { UIEventTrigger.Get(target).onClick -= listener; UIEventTrigger.Get(target).onClick += listener; } }
public static IObservable <AxisEventData> OnMoveAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <AxisEventData>()); } return(GetOrAddComponent <ObservableMoveTrigger>(component.gameObject).OnMoveAsObservable()); }
public static IObservable <PointerEventData> OnPointerExitAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <PointerEventData>()); } return(GetOrAddComponent <ObservablePointerExitTrigger>(component.gameObject).OnPointerExitAsObservable()); }
public static IObservable <BaseEventData> OnCancelAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <BaseEventData>()); } return(ObservableTriggerExtensions.GetOrAddComponent <ObservableCancelTrigger>(component.gameObject).OnCancelAsObservable()); }
// uGUI #region ObservableEventTrigger classes public static IObservable <BaseEventData> OnDeselectAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <BaseEventData>()); } return(GetOrAddComponent <ObservableDeselectTrigger>(component.gameObject).OnDeselectAsObservable()); }
public void AttachBackButton(UIBehaviour target_ui, int button_index) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) UI uI = (UI)(15 + button_index); Transform val = Attach(target_ui, GetCtrl(uI)); val.get_gameObject().set_name(UI.OBJ_BACK.ToString()); }
public static RectTransform RectTransform(this UIBehaviour behavior) { if (behavior == null) { return(null); } return(behavior.transform as RectTransform); }
private static bool IsTransitioning(UIBehaviour ui) { if (ui == null) { return(false); } return(ui.IsTransitioning()); }
public static UniRx.IObservable <BaseEventData> OnUpdateSelectedAsObservable(this UIBehaviour component) { if (component == null || component.gameObject == null) { return(Observable.Empty <BaseEventData>()); } return(GetOrAddComponent <ObservableUpdateSelectedTrigger>(component.gameObject).OnUpdateSelectedAsObservable()); }
public override void Initialize() { selectTypeIndex = UIBehaviour.GetEquipmentTypeIndex((EQUIPMENT_TYPE)(int)GameSection.GetEventData()); weaponPickupIndex = Array.FindIndex(uiTypeTab, (UI ui) => ui == UI.BTN_WEAPON_PICKUP); armorPickupIndex = Array.FindIndex(uiTypeTab, (UI ui) => ui == UI.BTN_ARMOR_PICKUP); SetPrefab((Enum)UI.OBJ_ROOT, "SmithEquipSelectBase_" + prefabSuffix); base.Initialize(); }
public void SetMaterialNum(int have_num, int need_num) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0018: Expected O, but got Unknown UIBehaviour.SetMaterialNumText(lblHave.get_transform(), lblNeed.get_transform(), have_num, need_num); }
public void OnDestroy(string panelName, string widgetName) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.OnDestroy(); } }
public void AddBtnOnClickListen(string panelName, string widgetName, UnityAction action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.AddButtonOnClickListener(action); } }
public void AddDeselectListener(string panelName, string widgetName, UnityAction <BaseEventData> action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.AddDeselectListener(action); } }
public void AddInitializePotentialDragListenListener(string panelName, string widgetName, UnityAction <BaseEventData> action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.AddInitializePotentialDragListener(action); } }
public void AddInputFieledListener(string panelName, string widgetName, UnityAction <string> action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.AddInputFieledListener(action); } }
public void AddToggleListener(string panelName, string widgetName, UnityAction <bool> action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName);; if (uiBehaviour != null) { uiBehaviour.AddToggleListener(action); } }
static int IsActive(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); UIBehaviour obj = LuaScriptMgr.GetUnityObject <UIBehaviour>(L, 1); bool o = obj.IsActive(); LuaScriptMgr.Push(L, o); return(1); }
private void SetProp_Amount(UIBehaviour uiBehaviour, object value) { var img = uiBehaviour as Image; if (value is float) { img.fillAmount = (float)value; } }
//添加Button的事件 public void AddButtonListen(string controlName, UnityAction action) { UIBehaviour tmpBehaviour = GetBehaviour(controlName); if (tmpBehaviour != null) { tmpBehaviour.AddButtonListen(action); } }
//================================== Common相关事件 ====================================== public static void InsertEvent(this UIBehaviour target, EventTriggerType triggerType, string strEvent, object objParam) { if (target == null) { Debug.LogError("insert event fail,because UIBehaviour is null."); return; } InsertEvent(target.gameObject, triggerType, strEvent, objParam); }
//点击事件添加方法 public void AddPointClick(string controlName, UnityAction <BaseEventData> action) { UIBehaviour tmpBehaviour = GetBehaviour(controlName); if (tmpBehaviour != null) { tmpBehaviour.AddPointClick(action); } }
public void AddButtonListener(string panelName, string widgetName, UnityAction <GameObject> action) { UIBehaviour uiBehaviour = GetUIBehaviour(panelName, widgetName); if (uiBehaviour != null) { uiBehaviour.AddButtonListener(action); } }
public static void SetChildText(UIBehaviour ui, string text) { Text objText = ui.transform.GetComponentInChildren <Text>(); if (objText != null) { objText.text = text; } }
static int IsDestroyed(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); UIBehaviour obj = (UIBehaviour)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIBehaviour"); bool o = obj.IsDestroyed(); LuaScriptMgr.Push(L, o); return(1); }
/// <summary> /// 设置颜色 /// </summary> /// <param name="uiBehaviour"></param> /// <param name="value"></param> private void SetProp_Color(UIBehaviour uiBehaviour, object value) { var img = uiBehaviour as Image; if (value is Color) { img.color = (Color)value; } }
public static RectTransform RT(this UIBehaviour ui) { if (ui == null) { return(null); } return(ui.transform as RectTransform); }
/// <summary> /// 绑定控件 /// </summary> /// <param name="control">绑定的目标控件</param> protected override void Binding(UIBehaviour control) { base.Binding(control); if (_bindedControls.Contains(control)) { return; } if (control is Dropdown) { Dropdown dropdown = control as Dropdown; if (dropdown.options == null) { dropdown.options = new List <Dropdown.OptionData>(); } while (dropdown.options.Count != _values.Count) { if (dropdown.options.Count < _values.Count) { dropdown.options.Add(new Dropdown.OptionData()); } else if (dropdown.options.Count > _values.Count) { dropdown.options.RemoveAt(0); } } for (int i = 0; i < _values.Count; i++) { dropdown.options[i].text = _values[i]; } dropdown.value = Value; dropdown.onValueChanged.AddListener(_callback); _onValueChanged += (value) => { if (dropdown) { dropdown.value = value; } }; _bindedControls.Add(control); } else if (control is Text) { Text text = control as Text; text.text = ValueString; _onValueChanged += (value) => { if (text) { text.text = ValueString; } }; _bindedControls.Add(control); } else { Log.Warning(string.Format("自动化任务:数据绑定失败,当前不支持控件 {0} 与 BindableSelectable 类型的数据绑定!", control.GetType().FullName)); } }
private void init() { _scoreCount = 0; isWaterTapOpen = false; particleSpawnRate = 0.25f; actualLatitude = -999f; actualLongitude = -999f; sunrise = DateTime.Now; sunset = DateTime.Now; isSunrise = true; isSunset = false; Now = DateTime.Now; _uiScriptReference = (UIBehaviour)GameObject.Find("Sensor - Script - Layer").GetComponent(typeof(UIBehaviour)); }
public static UIEventTrigger Get(UIBehaviour control) { UIEventTrigger listener = control.gameObject.GetComponent<UIEventTrigger>(); if (listener == null) listener = control.gameObject.AddComponent<UIEventTrigger>(); return listener; }
IEnumerator findOffsetPositon(UIBehaviour thing) { yield return null; yield return null; yield return null; yield return null; float timer = 0f; if (thing.GetComponent<Button>() != null) { while (timer < FadeTimer) { thing.GetComponent<RectTransform>().position = new Vector3(thing.GetComponent<RectTransform>().position.x - offsetPosition * timer / FadeTimer, thing.GetComponent<RectTransform>().position.y, thing.GetComponent<RectTransform>().position.z); timer += Time.deltaTime; yield return null; } } yield return null; }
private void TurnAlphaToZero(UIBehaviour thing) { if (thing.GetComponent<Text>() != null) { Color textColor = thing.GetComponent<Text>().color; textColor = new Color(textColor.r, textColor.g, textColor.b, 0); thing.GetComponent<Text>().color = textColor; } else if (thing.GetComponent<Image>() != null) { Color imgColor = thing.GetComponent<Image>().color; imgColor = new Color(imgColor.r, imgColor.g, imgColor.b, 0); thing.GetComponent<Image>().color = imgColor; } }