/**************************************************************************** Copyright (c) 2011-2013,WebJet Business Division,CYOU http://www.genesis-3d.com.cn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ using System; using System.Runtime.CompilerServices; using ScriptRuntime; namespace ScriptRuntime { /// /// 精灵渲染组件 /// public partial class SpriteRenderComponent : Component { public static readonly System.Type thisType = typeof(SpriteRenderComponent); private SpriteRenderComponent(DummyClass__ dummy) { } /// /// 创建一个精灵 /// public SpriteRenderComponent() { ICall_SpriteRenderComponent_Bind(this); } /// /// 通过资源包ID装载组件 /// /// 资源包ID public void Setup(string packID) { ICall_SpriteRenderComponent_Setup(this, packID); } /// /// 获取资源包ID /// public String PackageID { get { return ICall_SpriteRenderComponent_GetPackageID(this); } } /// /// 设置图块 /// /// T图块名称 public void SetBlock(string name) { ICall_SpriteRenderComponent_SetBlock(this, name); } /// /// 设置动画 /// /// 动画名 public void SetAnimation(string name) { SetAnimation(name, 0, 1.0f, true); } /// /// 移除图块的设置 /// public void RemoveBlock() { ICall_SpriteRenderComponent_RemoveBlock(this); } /// /// 移除动画的设置 /// public void RemoveAnimation() { ICall_SpriteRenderComponent_RemoveAnimation(this); } /// /// 设置动画 /// /// 动画名 /// 播放循环 /// 动画速度,默认为1.0f. /// 是否现在播放 public void SetAnimation(string name, int loops, float speed, bool play) { ICall_SpriteRenderComponent_SetAnimation(this, name, loops, play, speed); } /// /// 设置与获取动画速度 /// public float AnimationSpeed { get { return ICall_SpriteRenderComponent_GetAnimationSpeed(this); } set { ICall_SpriteRenderComponent_SetAnimationSpeed(this, value); } } /// /// 播放动画 /// public void Play() { ICall_SpriteRenderComponent_Play(this); } /// /// 重新播放动画 /// public void Replay() { ICall_SpriteRenderComponent_Replay(this); } /// /// 暂定动画 /// public void Pause() { ICall_SpriteRenderComponent_Pause(this); } /// /// 停止动画 /// public void Stop() { ICall_SpriteRenderComponent_Stop(this); } /// /// 播放暂停动画 /// public bool PlayOnWake { get { return ICall_SpriteRenderComponent_GetPlayOnWake(this); } set { ICall_SpriteRenderComponent_SetPlayOnWake(this, value); } } /// /// 获取图块名称 /// public String BlockName { get { return ICall_SpriteRenderComponent_GetBlockName(this); } } /// /// 获取动画名称 /// public String AnimationName { get { return ICall_SpriteRenderComponent_GetAnimationName(this); } } /// /// 获取动画循环设置 /// public int AnimationLoops { get { return ICall_SpriteRenderComponent_GetAnimationLoops(this); } } /// /// 获取动画是否正在播放 /// public bool IsAnimationPlaying { get { return ICall_SpriteRenderComponent_IsAnimationPlaying(this); } } } }