update ActionGroup
This commit is contained in:
parent
418eab5667
commit
c3361187da
|
|
@ -25,24 +25,24 @@
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
||||||
ActionGroupPtr ActionGroup::Create(const Vector<ActionPtr>& actions, bool sync)
|
ActionGroupPtr ActionGroup::Create(const Vector<ActionPtr>& actions, bool parallel)
|
||||||
{
|
{
|
||||||
ActionGroupPtr ptr = memory::New<ActionGroup>();
|
ActionGroupPtr ptr = memory::New<ActionGroup>();
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
ptr->sync_ = sync;
|
ptr->parallel_ = parallel;
|
||||||
ptr->AddActions(actions);
|
ptr->AddActions(actions);
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionGroup::ActionGroup()
|
ActionGroup::ActionGroup()
|
||||||
: sync_(false)
|
: parallel_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionGroup::ActionGroup(bool sync)
|
ActionGroup::ActionGroup(bool parallel)
|
||||||
: sync_(sync)
|
: parallel_(parallel)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ void ActionGroup::Init(Actor* target)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sync_)
|
if (parallel_)
|
||||||
{
|
{
|
||||||
// init all actions
|
// init all actions
|
||||||
for (current_ = actions_.GetFirst(); current_; current_ = current_->GetNext())
|
for (current_ = actions_.GetFirst(); current_; current_ = current_->GetNext())
|
||||||
|
|
@ -73,7 +73,7 @@ void ActionGroup::Init(Actor* target)
|
||||||
|
|
||||||
void ActionGroup::Update(Actor* target, Duration dt)
|
void ActionGroup::Update(Actor* target, Duration dt)
|
||||||
{
|
{
|
||||||
if (!sync_)
|
if (!parallel_)
|
||||||
{
|
{
|
||||||
if (current_)
|
if (current_)
|
||||||
{
|
{
|
||||||
|
|
@ -133,7 +133,7 @@ ActionPtr ActionGroup::Clone() const
|
||||||
actions.push_back(action->Clone());
|
actions.push_back(action->Clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DoClone(ActionGroup::Create(actions, sync_));
|
return DoClone(ActionGroup::Create(actions, parallel_));
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionPtr ActionGroup::Reverse() const
|
ActionPtr ActionGroup::Reverse() const
|
||||||
|
|
@ -146,7 +146,7 @@ ActionPtr ActionGroup::Reverse() const
|
||||||
actions.push_back(action->Reverse());
|
actions.push_back(action->Reverse());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DoClone(ActionGroup::Create(actions, sync_));
|
return DoClone(ActionGroup::Create(actions, parallel_));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace kiwano
|
} // namespace kiwano
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ public:
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
/// @brief 创建动画组合
|
/// @brief 创建动画组合
|
||||||
/// @param actions 动画集合
|
/// @param actions 动画集合
|
||||||
/// @param sync 同步执行
|
/// @param parallel 同步执行
|
||||||
static ActionGroupPtr Create(const Vector<ActionPtr>& actions, bool sync = false);
|
static ActionGroupPtr Create(const Vector<ActionPtr>& actions, bool parallel = false);
|
||||||
|
|
||||||
ActionGroup();
|
ActionGroup();
|
||||||
|
|
||||||
ActionGroup(bool sync);
|
ActionGroup(bool parallel);
|
||||||
|
|
||||||
virtual ~ActionGroup();
|
virtual ~ActionGroup();
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ protected:
|
||||||
void Update(Actor* target, Duration dt) override;
|
void Update(Actor* target, Duration dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool sync_;
|
bool parallel_;
|
||||||
ActionPtr current_;
|
ActionPtr current_;
|
||||||
ActionList actions_;
|
ActionList actions_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -359,10 +359,10 @@ public:
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
/// @brief 动画组合
|
/// @brief 动画组合
|
||||||
/// @param actions 动画集合
|
/// @param actions 动画集合
|
||||||
/// @param sync 同步执行
|
/// @param parallel 同步执行
|
||||||
static inline ActionHelper Group(const Vector<ActionPtr>& actions, bool sync = false)
|
static inline ActionHelper Group(const Vector<ActionPtr>& actions, bool parallel = false)
|
||||||
{
|
{
|
||||||
return ActionHelper(ActionGroup::Create(actions, sync));
|
return ActionHelper(ActionGroup::Create(actions, parallel));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue