public void Awake() { _items = new InventoryEntry[maxSize]; onItemChangedCallback += checkFull; onSizeChangedCallback += checkFull; checkFull(); }
public void ChangeState() { if (_isExpanded) { TreeButton.State = 0; _rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, MinHeight); _layoutElement.minHeight = MinHeight; _layoutElement.preferredHeight = MinHeight; Content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0); Content.gameObject.SetActive(false); _isExpanded = false; } else { TreeButton.State = 1; var expanded = GetExpandedSize(true); _rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, expanded); _layoutElement.minHeight = expanded; Content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, expanded - MinHeight); Content.gameObject.SetActive(true); _isExpanded = true; } OnSizeChanged?.Invoke(); }
private void OnChildSizeChanged() { var expanded = GetExpandedSize(); _rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, expanded); _layoutElement.minHeight = expanded; Content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, expanded - MinHeight); OnSizeChanged?.Invoke(); }
private void InspectSize() { if (ScreenPixelSize.x != Screen.width || ScreenPixelSize.y != Screen.height) { //사이즈 변경 감지됨 UpdateInfo(); OnSizeChanged?.Invoke(); } }
public void Shrink(int shrinkBySlots, CollectionContext context) { if (isReadOnly) { return; } int currentSize = slotCount; Array.Resize(ref slots, slotCount - shrinkBySlots); if (context.HasFlag(CollectionContext.Events.SizeChanged)) { OnSizeChanged?.Invoke(this, new CollectionSizeChangedResult(currentSize, currentSize - shrinkBySlots)); } }
private void LateUpdate() { if (uiScreenRect != null) { if (uiRect == null || uiRect.size.x == 0) { uiRect = UIContainer.GetComponent <RectTransform>().rect; } if (uiScreenRect.size != uiRect.size || uiScreenRect.position != uiRect.position) { UpdateUIScreenRect(); CheckDeviceOrientation(); OnSizeChanged?.Invoke(); } } }
public void Expand <TNewSlotType>(int expandBySlots, CollectionContext context) where TNewSlotType : TSlotType, new() { if (isReadOnly) { return; } int currentSize = slotCount; Array.Resize(ref slots, currentSize + expandBySlots); GenerateSlotsRange <TNewSlotType>(currentSize - 1, currentSize + expandBySlots - 1, context); if (context.HasFlag(CollectionContext.Events.SizeChanged)) { OnSizeChanged?.Invoke(this, new CollectionSizeChangedResult(currentSize, currentSize + expandBySlots)); } }
public void UpdateInfo() { if (ScreenPixelSize.x != Screen.width || ScreenPixelSize.y != Screen.height) { //사이즈 변경 감지됨 ScreenPixelSize = new Vector2( Screen.width, Screen.height); float height = 2f * camera.orthographicSize; float width = height * camera.aspect; ScreenUnitSize = new Vector2( width, height); Pixel2Unit = ((width) / (ScreenPixelSize.x + SampleOffset)); Unit2Pixel = ((ScreenPixelSize.x + SampleOffset) / (width)); OnSizeChanged?.Invoke(); } }
/// <summary> /// This method makes the player go to the small state. /// </summary> public void Shrink() { Invulnerable = true; Solid = false; PowerState = SizeState.SMALL; Width = _smallWidth; Height = _smallHeight; JumpImpulse = _smallJumpImpulse; OnSizeChanged?.Invoke(this, new SizeChangeEventArgs(PowerState)); PlaySound("shrink"); _flickerTimer.Enable(); }
/// <summary> /// This method makes the player go to the big state. /// </summary> public void Grow() { PowerState = SizeState.BIG; Width = _bigWidth; Height = _bigHeight; Vector2 position = Position; position.Y -= _bigHeight - _smallHeight; Position = position; JumpImpulse = _bigJumpImpulse; OnSizeChanged?.Invoke(this, new SizeChangeEventArgs(PowerState)); PlaySound("grow"); _flickerTimer.Enable(); }
private IEnumerator CheckChildrenChanges() { while (true) { lock (Node.Children) { NameLabel.SetLocalizedText(Node.DisplayName); var newChildren = Node.Children.Where(c => !_children.Exists(ui => ui.Node == c)).ToList(); foreach (var child in newChildren) { var go = Instantiate(SelfPrefab, Content); var treeElement = go.GetComponent <SourceTreeElement>(); treeElement.Node = child; treeElement.OnSizeChanged += OnChildSizeChanged; _children.Add(treeElement); } var removedChildren = _children.Where(c => !Node.Children.Contains(c.Node)).ToList(); foreach (var child in removedChildren) { _children.Remove(child); Destroy(child.gameObject); } if (newChildren.Count + removedChildren.Count != 0) { OnChildSizeChanged(); OnSizeChanged?.Invoke(); } var hasChildren = _children.Count > 0; Spacer.SetActive(!hasChildren); TreeButton.gameObject.SetActive(hasChildren); } yield return(new WaitForSeconds(1)); } // ReSharper disable once IteratorNeverReturns }
private void CC_SizeChanged(object sender, SizeChangedEventArgs e) { OnSizeChanged?.Invoke(sender, e); }
private void Form_SizeChanged(object sender, EventArgs e) { OnSizeChanged?.Invoke(); }
protected void InvokeOnSizeChanged(CollectionSizeChangedResult sizeChangedResult) { OnSizeChanged?.Invoke(this, sizeChangedResult); }