/// <summary> /// 为屏幕增加一个立绘精灵描述子 /// </summary> /// <param name="id">立绘位置id号</param> /// <param name="source">资源名称</param> /// <param name="cst">立绘位置枚举</param> /// <param name="Z">Z坐标</param> /// <param name="Angle">角度</param> /// <param name="Opacity">不透明度</param> /// <param name="anchor">锚点类型</param> /// <param name="cut">纹理切割矩</param> public void AddCharacterStand(int id, string source, CharacterStandType cst, int Z, double Angle, double Opacity, SpriteAnchorType anchor, Int32Rect cut) { SpriteDescriptor sd = null; switch (cst) { case CharacterStandType.Left: sd = new SpriteDescriptor() { Id = id, ResourceType = ResourceType.Stand, ResourceName = source, X = GlobalDataContainer.GAME_CHARACTERSTAND_LEFT_X, Y = GlobalDataContainer.GAME_CHARACTERSTAND_LEFT_Y, Z = Z + GlobalDataContainer.GAME_Z_CHARACTERSTAND, Angle = Angle, Opacity = Opacity, AnchorType = anchor, CutRect = cut }; break; case CharacterStandType.MidLeft: sd = new SpriteDescriptor() { Id = id, ResourceType = ResourceType.Stand, ResourceName = source, X = GlobalDataContainer.GAME_CHARACTERSTAND_MIDLEFT_X, Y = GlobalDataContainer.GAME_CHARACTERSTAND_MIDLEFT_Y, Z = Z, Angle = Angle, Opacity = Opacity, AnchorType = anchor, CutRect = cut }; break; case CharacterStandType.Mid: sd = new SpriteDescriptor() { Id = id, ResourceType = ResourceType.Stand, ResourceName = source, X = GlobalDataContainer.GAME_CHARACTERSTAND_MID_X, Y = GlobalDataContainer.GAME_CHARACTERSTAND_MID_Y, Z = Z, Angle = Angle, Opacity = Opacity, AnchorType = anchor, CutRect = cut }; break; case CharacterStandType.MidRight: sd = new SpriteDescriptor() { Id = id, ResourceType = ResourceType.Stand, ResourceName = source, X = GlobalDataContainer.GAME_CHARACTERSTAND_MIDRIGHT_X, Y = GlobalDataContainer.GAME_CHARACTERSTAND_MIDRIGHT_Y, Z = Z, Angle = Angle, Opacity = Opacity, AnchorType = anchor, CutRect = cut }; break; case CharacterStandType.Right: sd = new SpriteDescriptor() { Id = id, ResourceType = ResourceType.Stand, ResourceName = source, X = GlobalDataContainer.GAME_CHARACTERSTAND_RIGHT_X, Y = GlobalDataContainer.GAME_CHARACTERSTAND_RIGHT_Y, Z = Z, Angle = Angle, Opacity = Opacity, AnchorType = anchor, CutRect = cut }; break; } this.characterDescVec[id] = sd; }
/// <summary> /// 演绎函数:移除立绘 /// </summary> private void Deletecstand(CharacterStandType cst) { if (cst == CharacterStandType.All) { this.viewMana.RemoveView(ResourceType.Stand); } else { this.viewMana.RemoveSprite(Convert.ToInt32(cst), ResourceType.Stand); } }