[deploy] update Action
This commit is contained in:
parent
2225456507
commit
a197ea38bb
|
|
@ -181,7 +181,8 @@ protected:
|
||||||
/// @brief 是否可移除
|
/// @brief 是否可移除
|
||||||
bool IsRemoveable() const;
|
bool IsRemoveable() const;
|
||||||
|
|
||||||
protected:
|
/// \~chinese
|
||||||
|
/// @brief Ö´ÐпË¡
|
||||||
ActionEntityPtr DoClone(ActionEntityPtr to) const;
|
ActionEntityPtr DoClone(ActionEntityPtr to) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -201,10 +202,18 @@ private:
|
||||||
class KGE_API Action
|
class KGE_API Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Action() = default;
|
||||||
|
|
||||||
|
inline Action(ActionEntityPtr ptr)
|
||||||
|
: ptr(ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
/// @brief 设置循环次数
|
/// @brief 设置循环次数
|
||||||
inline Action& Loops(int loops)
|
inline Action& Loops(int loops)
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->SetLoops(loops);
|
ptr->SetLoops(loops);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -213,6 +222,7 @@ public:
|
||||||
/// @brief 设置动画延迟
|
/// @brief 设置动画延迟
|
||||||
inline Action& Delay(Duration delay)
|
inline Action& Delay(Duration delay)
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->SetDelay(delay);
|
ptr->SetDelay(delay);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -221,6 +231,7 @@ public:
|
||||||
/// @brief 设置动画结束回调函数
|
/// @brief 设置动画结束回调函数
|
||||||
inline Action& DoneCallback(const ActionDoneCallback& cb)
|
inline Action& DoneCallback(const ActionDoneCallback& cb)
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->SetDoneCallback(cb);
|
ptr->SetDoneCallback(cb);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -229,6 +240,7 @@ public:
|
||||||
/// @brief 设置动画循环结束时的回调函数
|
/// @brief 设置动画循环结束时的回调函数
|
||||||
inline Action& LoopDoneCallback(const ActionDoneCallback& cb)
|
inline Action& LoopDoneCallback(const ActionDoneCallback& cb)
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->SetLoopDoneCallback(cb);
|
ptr->SetLoopDoneCallback(cb);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -237,6 +249,7 @@ public:
|
||||||
/// @brief 动画结束时移除目标角色
|
/// @brief 动画结束时移除目标角色
|
||||||
inline Action& RemoveTargetWhenDone()
|
inline Action& RemoveTargetWhenDone()
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->RemoveTargetWhenDone();
|
ptr->RemoveTargetWhenDone();
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -245,6 +258,7 @@ public:
|
||||||
/// @brief 设置名称
|
/// @brief 设置名称
|
||||||
inline Action& Name(const String& name)
|
inline Action& Name(const String& name)
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
ptr->SetName(name);
|
ptr->SetName(name);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
@ -253,14 +267,18 @@ public:
|
||||||
/// @brief 克隆动画
|
/// @brief 克隆动画
|
||||||
inline Action Clone() const
|
inline Action Clone() const
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
return Action(ptr->Clone());
|
return Action(ptr->Clone());
|
||||||
|
return Action();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
/// @brief 获取反向动画
|
/// @brief 获取反向动画
|
||||||
inline Action Reverse() const
|
inline Action Reverse() const
|
||||||
{
|
{
|
||||||
|
if (ptr)
|
||||||
return Action(ptr->Reverse());
|
return Action(ptr->Reverse());
|
||||||
|
return Action();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
|
|
@ -270,24 +288,29 @@ public:
|
||||||
return const_cast<ActionEntity*>(ptr.Get());
|
return const_cast<ActionEntity*>(ptr.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline operator ActionEntityPtr() const
|
/// \~chinese
|
||||||
{
|
/// @brief ÉèÖö¯»ÊµÌå
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Action() = default;
|
|
||||||
|
|
||||||
inline Action(ActionEntityPtr ptr)
|
|
||||||
: ptr(ptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void SetEntity(ActionEntityPtr ptr)
|
inline void SetEntity(ActionEntityPtr ptr)
|
||||||
{
|
{
|
||||||
this->ptr = ptr;
|
this->ptr = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline ActionEntity* operator->() const
|
||||||
|
{
|
||||||
|
return Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator ActionEntityPtr() const
|
||||||
|
{
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline operator bool() const
|
||||||
|
{
|
||||||
|
return ptr != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
ActionEntityPtr ptr;
|
ActionEntityPtr ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,32 +126,44 @@ private:
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
/// @brief 补间动画
|
/// @brief 补间动画
|
||||||
struct ActionTween : Action
|
class ActionTween : public Action
|
||||||
{
|
{
|
||||||
/// \~chinese
|
public:
|
||||||
/// @brief 设置缓动函数
|
|
||||||
inline ActionTween& Ease(EaseFunc ease)
|
|
||||||
{
|
|
||||||
tween_ptr->SetEaseFunc(ease);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ActionTween() = default;
|
ActionTween() = default;
|
||||||
|
|
||||||
inline ActionTween(ActionTweenEntityPtr ptr)
|
inline ActionTween(ActionTweenEntityPtr ptr)
|
||||||
: Action(ptr.Get())
|
: Action(ptr.Get())
|
||||||
, tween_ptr(ptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetEntity(ActionEntityPtr tween_ptr)
|
/// \~chinese
|
||||||
|
/// @brief 设置缓动函数
|
||||||
|
inline ActionTween& Ease(EaseFunc ease)
|
||||||
{
|
{
|
||||||
this->ptr = tween_ptr;
|
auto tween_ptr = Get();
|
||||||
this->tween_ptr = (ActionTweenEntity*)tween_ptr.Get();
|
if (tween_ptr)
|
||||||
|
tween_ptr->SetEaseFunc(ease);
|
||||||
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionTweenEntityPtr tween_ptr;
|
/// \~chinese
|
||||||
|
/// @brief 获取指针
|
||||||
|
inline ActionTweenEntity* Get() const
|
||||||
|
{
|
||||||
|
return const_cast<ActionTweenEntity*>(static_cast<const ActionTweenEntity*>(ptr.Get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \~chinese
|
||||||
|
/// @brief 设置动画实体
|
||||||
|
inline void SetEntity(ActionTweenEntityPtr tween_ptr)
|
||||||
|
{
|
||||||
|
this->ptr = static_cast<ActionEntity*>(tween_ptr.Get());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ActionTweenEntity* operator->() const
|
||||||
|
{
|
||||||
|
return Get();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \~chinese
|
/// \~chinese
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue