/// <summary> /// 展示物品信息 by 贺丰 /// </summary> /// <param name="_itemUI"></param> /// <param name="_left"></param> /// <param name="_middle"></param> /// <param name="_right"></param> /// <param name="_tiggerUI"></param> public static void ShowEquipmentTooltip(ItemUI _itemUI, ItemActionType _left, ItemActionType _middle, ItemActionType _right, ItemActionType _other, GameObject _tiggerUI = null) { CloseAllTooltip(); EquipmentInfo info = _itemUI.EQInfo; if (info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } // Debug.Log("ShowEquipmentTooltip 热感"); equipmentTooltip.mSyncTriggerChk = _itemUI.GetComponent <UIToggle>(); equipmentTooltip.EquipmentInfo = info; equipmentTooltip.SetActionBtn(_left, _middle, _right, _other); panel.OpenUI(); //SetEquipTooltipPostion(panel.gameObject, _tiggerUI); }
public static bool IsTouching() { if (GUIManager.touchingCount < 0) { GUIManager.touchingCount = 0; } if (GUIManager.touchingCount > 2) { GUIManager.touchingCount = 2; } if (GUIManager.touchingCount > 0) { return(true); } foreach (KeyValuePair <Collider, ITouchEvent> keyValuePair in GUIManager.colliders) { if (keyValuePair.Value != null) { GUICollider guicollider = keyValuePair.Value as GUICollider; if (guicollider != null && guicollider.isTouching) { return(true); } } } GUIBase guibase = GUIManager.guiBases["CommonDialogBarrier"]; return(guibase.gameObject.activeSelf || GUIManager.touchEndTrg); }
void ContinuousUpdateToggleAction(GUIBase sender) { GUIToggle toggle = sender as GUIToggle; _continuousUpdate = toggle.isToggled; SetNeedsUpdate(); }
void ChangeModeAction(GUIBase sender) { GUIToolbar toolbar = sender as GUIToolbar; _mode = toolbar.selected; SetNeedsUpdate(); }
/// <summary> /// 协同打开UI。 /// </summary> /// <returns>The callback open UI.</returns> private IEnumerator <int> AyncCallbackOpenUI() { UIInfoData uiInfoData = null; UnityEngine.Object prefab = null; GameObject uiObject = null; if (stackOpenUI != null && stackOpenUI.Count > 0) { do { uiInfoData = stackOpenUI.Pop(); prefab = Singleton <ResourceManager> .Instance.LoadPrefab(uiInfoData.Path); if (prefab != null) { uiObject = NGUITools.AddChild(Game.Instance.UiRoot, prefab as GameObject); GUIBase baseUi = uiObject.GetComponent <GUIBase>(); if (baseUi != null) { baseUi.SetUIWhenOpening(uiInfoData.UIObjParams); } allOpenUIDic.Add(uiInfoData.UIKey, uiObject); } } while (stackOpenUI.Count > 0); } yield return(0); }
/// <summary> /// 关闭界面。 /// </summary> /// <param name="uiKey"></param> public void CloseUI(UIPanleID uiKey) { GameObject uiObject = null; if (!allOpenUIDic.TryGetValue(uiKey, out uiObject)) { return; } if (uiObject == null) { if (allOpenUIDic.ContainsKey(uiKey)) { allOpenUIDic.Remove(uiKey); } } else { GUIBase baseUI = uiObject.GetComponent <GUIBase>(); if (baseUI != null) { baseUI.StateChanged += CloseHandler; baseUI.Release(); } else { GameObject.Destroy(uiObject); allOpenUIDic.Remove(uiKey); } } }
private void OutlineThresholdChanged(GUIBase sender) { GUISlider threshold = sender as GUISlider; _previewOutline.depthThreshold = threshold.value; RenderPreview(_guiCurrentFrame.value); }
void UpdateSunPropertiesAction(GUIBase sender) { _clouds.sunLight.color = _guiSunColor.color; _clouds.sunLight.transform.eulerAngles = _guiSunRotation.vector; SetNeedsUpdate(); }
/// <summary> /// 根据类型获取预制 by吴江 /// </summary> /// <param name="_type"></param> /// <returns></returns> protected static GUIBase GetPanelByType(TooltipType _type) { if (!tooltipPanelDictionary.ContainsKey(_type) || tooltipPanelDictionary[_type] == null) { string path = GetPath(_type); Object obj = exResources.GetResource(ResourceType.GUI, path); if (obj == null) { GameSys.LogError("找不到UI预制:" + path); return(null); } GameObject panel = GameObject.Instantiate(obj) as GameObject; panel.transform.parent = GameCenter.uIMng.uIRoot.transform; panel.transform.localPosition = new Vector3(0, 0, 0); panel.transform.localScale = new Vector3(1, 1, 1); panel.name = obj.name; obj = null; GUIBase wnd = panel.GetComponent <GUIBase>(); if (wnd == null) { GameSys.LogError("找不到<GUIBase>组件!"); return(null); } if (_type != TooltipType.Access) { tooltipPanelDictionary[_type] = wnd; } else { return(wnd); } } return(tooltipPanelDictionary[_type]); }
public static DropdownSelection CreateNew(GUIBase baseGUI, Rect position, string[] selections, Setting <int> referenceSetting) { var element = new DropdownSelection(); element.guiOwner = baseGUI; element.cursorLimits = new Rect( position.x - new AutoScaleFloat(10f), position.y - new AutoScaleFloat(10f), position.width + new AutoScaleFloat(20f), position.height * selections.Length + (Style.VerticalMargin * (selections.Length - 1)) + (2 * selections.Length) + new AutoScaleFloat(20f) ); element.refSet = referenceSetting; element.boxPosition = new Rect( position.x, position.y, position.width, position.height * selections.Length + (Style.VerticalMargin * (selections.Length - 1)) + (2 * selections.Length) ); element.rect = new SmartRect(position); element.animator = new Animation.DropDownAnimation(element, position, selections.Length); element.Enable(); element.initialSelection = referenceSetting.Value; element.selections = selections; return(element); }
private void PaletteTextureChanged(GUIBase sender) { _selectedColorX = _selectedColorY = 0; Texture2D texture = _guiTexture == null ? null : _guiTexture.texture; RebuildGUI(texture); }
public UISlotZone(GUIBase parent, HoverItemSlot onHover, GetItem getItem, float scale) { parentGui = parent; onHoverAction = onHover; getItemFunc = getItem; OverallScale = scale; }
public static void DeleteGUIBase(GUIBase guiBase) { if (guiBase != null && GUIManager.guiBases.ContainsKey(guiBase.gameObject.name)) { GUIManager.guiBases.Remove(guiBase.gameObject.name); } }
void SuperSizeChanged(GUIBase sender) { GUIIntSlider slider = sender as GUIIntSlider; EditorPrefs.SetInt(SuperSizePrefsKey, slider.value); _recordVideo.superSize = slider.value; }
void FramerateChanged(GUIBase sender) { GUIIntSlider slider = sender as GUIIntSlider; EditorPrefs.SetInt(FrameratePrefsKey, slider.value); _recordVideo.captureFramerate = slider.value; }
public DropDownAnimation(GUIBase gUIBase, Rect startPosition, int rowsCount, GUIStyle boxStyle) : base(gUIBase) { basePosition = startPosition; position = new Rect(startPosition.x, startPosition.y, startPosition.width, startPosition.height); resultHeight = (rowsCount * Style.Height) + ((rowsCount + 1) * Style.VerticalMargin); this.boxStyle = boxStyle; }
/// <summary> /// 显示和隐藏某个主界面 /// </summary> protected void ShowSingleMain(string wndPrefab, bool _show) { GUIBase wnd = GameCenter.uIMng.GetGui <GUIBase>(wndPrefab); if (wnd != null) { UIPlayAnimation playAnimation = wnd.GetComponent <UIPlayAnimation>(); if (playAnimation != null) { bool nowState = !stateDic.ContainsKey(wnd.name)?true:stateDic[wnd.name]; //当前显示状态 if (_show == false && nowState == true) { playAnimation.PlayForward(); //此方向都是隐藏UI stateDic[wnd.name] = false; } if (_show == true && nowState == false) { playAnimation.PlayReverse(); //此方向都是显示UI stateDic[wnd.name] = true; } if (_show == true && nowState == true && !stateDic.ContainsKey(wnd.name)) //初始情况 { playAnimation.PlayReverse(); stateDic[wnd.name] = true; } } } }
public CenterAnimation(GUIBase @base, Rect pos, float openSpeed, float closeSpeed) : base(@base) { defaultRect = pos; heightKoeff = pos.height / pos.width; this.OpenSpeed = openSpeed; this.CloseSpeed = closeSpeed; }
public static ScrollableDropdownSelection CreateNew(GUIBase baseGUI, Rect position, string[] selections, Setting <int> referenceSetting, int showItems) { if (showItems > selections.Length) { throw new System.InvalidOperationException("showItems should be more then selections. You could use not scrollable DropdownSeleection in this case"); } var element = new ScrollableDropdownSelection(); element.guiOwner = baseGUI; element.cursorLimits = new Rect( position.x - new AutoScaleFloat(10f), position.y - new AutoScaleFloat(10f), position.width + new AutoScaleFloat(20f), position.height * showItems + Style.VerticalMargin * (showItems + 1) + (showItems * Style.Height * 0.8f) + new AutoScaleFloat(20f) ); element.refSet = referenceSetting; element.boxPosition = new Rect( position.x, position.y, position.width, position.height * showItems + Style.VerticalMargin * (showItems - 1) + (showItems * Style.Height * 0.8f) ); element.viewRect = new Rect(0f, 0f, position.width, position.height * selections.Length + (Style.VerticalMargin * (selections.Length - 1)) + (4 * (selections.Length - 1))); element.rect = new SmartRect(0f, 0f, position.width, position.height); element.animator = new Animation.DropDownAnimation(element, position, showItems + 1); element.Enable(); element.initialSelection = referenceSetting.Value; element.selections = selections; return(element); }
private void OutlineColorChanged(GUIBase sender) { GUIColorField color = sender as GUIColorField; _previewOutline.outlineColor = color.color; RenderPreview(_guiCurrentFrame.value); }
/// <summary> /// 展示物品信息 by吴江 /// </summary> /// <param name="_info">装备信息</param> /// <param name="_left">左边功能按钮的行为类型</param> /// <param name="_middle">中间功能按钮的行为类型</param> /// <param name="_right">右边功能按钮的行为类型</param> /// <param name="_itemUI">展示界面的碰撞依据。为空的话则是物品控件本身</param> public static void ShowEquipmentTooltip(EquipmentInfo _info, ItemActionType _left, ItemActionType _middle, ItemActionType _right, ItemActionType _other, GameObject _tiggerUI = null) { CloseAllTooltip(); if (_info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } equipmentTooltip.EquipmentInfo = _info; equipmentTooltip.SetActionBtn(_left, _middle, _right, _other); panel.OpenUI(); //SetEquipTooltipPostion(panel.gameObject, _tiggerUI); if (_info.IsEquip && _info.BelongTo != EquipmentBelongTo.EQUIP) { EquipmentInfo compareEquip = GameCenter.inventoryMng.GetEquipFromEquipDicBySlot(_info.Slot); if (compareEquip != null && _info.InstanceID != compareEquip.InstanceID) { ToolTipMng.ShowCompareEquipmentTooltip(compareEquip); } } }
/// <summary> /// 展示物品信息 by邓成 /// </summary> /// <param name="_info">装备信息</param> /// <param name="_left">左边功能按钮的行为类型</param> /// <param name="_middle">中间功能按钮的行为类型</param> /// <param name="_right">右边功能按钮的行为类型</param> /// <param name="_itemUI">展示界面的碰撞依据。为空的话则是物品控件本身</param> public static void ShowEquipmentTooltip(int _itemType) { CloseAllTooltip(); EquipmentInfo info = new EquipmentInfo(_itemType, EquipmentBelongTo.PREVIEW); if (info == null) { return; } GUIBase panel = GetPanelByType(TooltipType.Equipment); if (panel == null) { return; } EquipmentTooltip equipmentTooltip = panel.GetComponent <EquipmentTooltip>(); if (equipmentTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } equipmentTooltip.EquipmentInfo = info; equipmentTooltip.SetActionBtn(ItemActionType.None, ItemActionType.None, ItemActionType.None); panel.OpenUI(); }
/// <summary> /// 展示属性信息 by吴江 /// </summary> /// <param name="_triggerUI"></param> /// <param name="_tag"></param> /// <param name="_value"></param> public static void ShowPropertyTooltip(GameObject _triggerUI, ActorPropertyTag _tag, int _value) { CloseAllTooltip(); if (_tag == ActorPropertyTag.TOTAL) { return; } GUIBase panel = GetPanelByType(TooltipType.Property); if (panel == null) { return; } PropertyTooltip propertyTooltip = panel.GetComponent <PropertyTooltip>(); if (propertyTooltip == null) { GameSys.LogError("在预制上找不到组件 : <EquipmentTooltip>!"); return; } propertyTooltip.SetData(_tag, _value, _triggerUI); panel.OpenUI(); SetPropertyTooltipPosition(panel.gameObject, _triggerUI); }
private void TextureChanged(GUIBase sender) { _guiConvert.isEnabled = _guiTexture.texture != null; _guiPalette.texture = null; _guiPalettizedTexture.texture = null; _guiSave.isEnabled = false; }
public DropDownAnimation(GUIBase gUIBase, Rect startPosition, int rowsCount) : this(gUIBase, startPosition, rowsCount, null) { basePosition = startPosition; position = new Rect(startPosition.x, startPosition.y, startPosition.width, startPosition.height); resultHeight = (rowsCount * Style.Height) + ((rowsCount + 1) * Style.VerticalMargin); boxStyle = new GUIStyle(); boxStyle.normal.background = Style.Button.normal.background; }
public static void AddGUIBase(GUIBase guiBase) { if (guiBase != null && !GUIManager.guiBases.ContainsKey(guiBase.gameObject.name)) { GUIManager.guiBases.Add(guiBase.gameObject.name, guiBase); } guiBase.gameObject.SetActive(false); }
void ComponentIndexChanged(GUIBase sender) { GUIDelayedIntField field = sender as GUIDelayedIntField; GameObject gameObject = SelectedGameObject(); ReorderComponent(gameObject, field.previousValue, field.value); RefreshList(gameObject); }
public static void ShowBarrier() { GUIManager.ShowGUI("CommonDialogBarrier"); GUIBase guibase = GUIManager.guiBases["CommonDialogBarrier"]; Vector3 localPosition = guibase.gameObject.transform.localPosition; localPosition.z = GUIManager.DLG_START_Z + GUIManager.DLG_BARRIER_OFS_Z; guibase.gameObject.transform.localPosition = localPosition; }
void UpdateBrushPropertiesAction(GUIBase sender) { _editorState.cursorBlendValues = _guiBrushBlendValues.isToggled; _editorState.cursorRadius = _guiBrushSize.value / 2; _editorState.cursorOpacity = _guiBrushOpacity.value; _editorState.brushTexture = _guiBrushTexture.texture; SetNeedsUpdate(); }
private void DownloadButtonPressed(GUIBase sender) { AssetVersion remoteVersion = AssetUpdater.Instance.GetRemoteVersion(sender.tag); if (remoteVersion != null) { Application.OpenURL(Uri.EscapeUriString(remoteVersion.packageURI.ToString())); } }