Lets talk about the major changes:
Instantiation:
+ (id) progressWithSprite:(CCSprite*) sprite;
- (id) initWithSprite:(CCSprite*) sprite;
You can now do that by passing a sprite and that sprite can be from a sprite frame. Note that this is a MAJOR change so REALLY use the new properties to get the right progress look.
I've reduced the progress types to Radial and Bar and you change its look through the new properties I've added.
So lets look at the new properties.
reverse
If you want a counter-clockwise radial indicator then you can set the reverse property rather than setting the type like before. This reverse property allowed me to have a cool effect for bar progress timer types.
midpoint
Midpoint can also change the look of the radial/bar progression. It should usually be at {0.5, 0.5} so the radial looks like a clock. Modifying the midpoint moves the center around.
This is more important for the bar types since we can have more variety by modifying the midpoint. You can now have bar start at the left (0,0), right (1,0), top (0,1), or bottom (0,1). Actually anything in between as well.
barChangeRate
barChangeRate only works on the bar types and what it does is modify the rate that x and y would change due to the percentage.
So if you want a horizontal bar then the bar rate would be {1, 0} which means x will move at the rate of 1 percentage but y can't move at all (since it's 0).
With that kinda idea in mind, we can create a vertical bar like so: {0, 1}.
Or even a weird bar that can move both in the x and y but maybe slower on the y {1, 0.5}
探讨Unity游戏引擎中进度条的全新实现方式
本文深入探讨了Unity游戏引擎中进度条的实现方式的变化,包括使用新属性来改变径向和条形进度条的外观,以及如何通过`reverse`属性创建逆时针径向指示器。此外,介绍了`midpoint`属性如何调整进度条的视觉效果,特别是对于条形类型的进度条,允许更灵活地设置起始位置。同时,解释了`barChangeRate`属性的作用,用于调整条形进度条在不同百分比下的变化速率。
787

被折叠的 条评论
为什么被折叠?



