//------------------------------ private void PlayGrid() { GComponent obj = _demoObjects["Grid"]; GList list1 = obj.GetChild("list1").asList; list1.RemoveChildrenToPool(); string[] testNames = System.Enum.GetNames(typeof(System.IO.FileAttributes)); Color[] testColor = new Color[] { Color.Yellow, Color.Red, Color.White, Color.Cyan }; int cnt = testNames.Length; for (int i = 0; i < cnt; i++) { GButton item = list1.AddItemFromPool().asButton; item.GetChild("t0").text = "" + (i + 1); item.GetChild("t1").text = testNames[i]; item.GetChild("t2").asTextField.color = testColor[ToolSet.Random(0, 4)]; item.GetChild("star").asProgress.value = (int)((float)ToolSet.Random(1, 4) / 3f * 100); } GList list2 = obj.GetChild("list2").asList; list2.RemoveChildrenToPool(); for (int i = 0; i < cnt; i++) { GButton item = list2.AddItemFromPool().asButton; item.GetChild("cb").asButton.selected = false; item.GetChild("t1").text = testNames[i]; item.GetChild("mc").asMovieClip.playing = i % 2 == 0; item.GetChild("t3").text = "" + ToolSet.Random(0, 10000); } }
void RenderListItem(int index, GObject obj) { GButton button = (GButton)obj; button.icon = "i" + ToolSet.Random(0, 10); button.title = "" + ToolSet.Random(0, 100); }
void AddMsg(string sender, string senderIcon, string msg, bool fromMe) { bool isScrollBottom = _list.scrollPane.isBottomMost; Message newMessage = new Message(); newMessage.sender = sender; newMessage.senderIcon = senderIcon; newMessage.msg = msg; newMessage.fromMe = fromMe; _messages.Add(newMessage); if (newMessage.fromMe) { if (_messages.Count == 1 || ToolSet.Random(0f, 1f) < 0.5f) { Message replyMessage = new Message(); replyMessage.sender = "FairyGUI"; replyMessage.senderIcon = "r1"; replyMessage.msg = "Today is a good day. [:cool]"; replyMessage.fromMe = false; _messages.Add(replyMessage); } } if (_messages.Count > 100) { _messages.RemoveRange(0, _messages.Count - 100); } _list.numItems = _messages.Count; if (isScrollBottom) { _list.scrollPane.ScrollBottom(); } }
void Update() { _ended = 0; if (_valueSize == 0) //DelayedCall { if (_elapsedTime >= _delay + _duration) { _ended = 1; } return; } if (!_started) { if (_elapsedTime < _delay) { return; } _started = true; CallStartCallback(); if (_killed) { return; } } bool reversed = false; float tt = _elapsedTime - _delay; if (_breakpoint >= 0 && tt >= _breakpoint) { tt = _breakpoint; _ended = 2; } if (_repeat != 0) { int round = (int)Math.Floor(tt / _duration); tt -= _duration * round; if (_yoyo) { reversed = round % 2 == 1; } if (_repeat > 0 && _repeat - round < 0) { if (_yoyo) { reversed = _repeat % 2 == 1; } tt = _duration; _ended = 1; } } else if (tt >= _duration) { tt = _duration; _ended = 1; } _normalizedTime = EaseManager.Evaluate(_easeType, reversed ? (_duration - tt) : tt, _duration, _easeOvershootOrAmplitude, _easePeriod); _value.SetZero(); _deltaValue.SetZero(); if (_valueSize == 5) { double d = _startValue.d + (_endValue.d - _startValue.d) * _normalizedTime; if (_snapping) { d = Math.Round(d); } _deltaValue.d = d - _value.d; _value.d = d; } else if (_valueSize == 6) { if (_ended == 0) { Vector2 r = new Vector2(ToolSet.Random(-1.0f, 1.0f), ToolSet.Random(-1.0f, 1.0f)); r.X = r.X > 0 ? 1 : -1; r.Y = r.Y > 0 ? 1 : -1; r *= _startValue.w * (1 - _normalizedTime); _deltaValue.vec2 = r; _value.vec2 = _startValue.vec2 + r; } else { _value.vec2 = _startValue.vec2; } } else { for (int i = 0; i < _valueSize; i++) { float n1 = _startValue[i]; float n2 = _endValue[i]; float f = n1 + (n2 - n1) * _normalizedTime; if (_snapping) { f = (float)Math.Round(f); } _deltaValue[i] = f - _value[i]; _value[i] = f; } } if (_target != null && _propType != TweenPropType.None) { TweenPropTypeUtils.SetProps(_target, _propType, _value); } CallUpdateCallback(); }