Exemplo n.º 1
0
        /// <summary>
        /// 为屏幕增加一个3D背景精灵描述子
        /// </summary>
        /// <param name="source">资源名称</param>
        /// <param name="depth">景深Z坐标</param>
        public void AddBackground3D(string source, double depth)
        {
            SpriteDescriptor sd = new SpriteDescriptor()
            {
                Id           = 1,
                ResourceType = ResourceType.Background,
                ResourceName = source,
                Deepth3D     = depth
            };

            this.backgroundDescVec[1] = sd;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 为屏幕增加一个2D立绘精灵描述子
        /// </summary>
        /// <param name="id">立绘位置id号</param>
        /// <param name="source">资源名称</param>
        /// <param name="X">左上角在画面的X坐标</param>
        /// <param name="Y">左上角在画面的Y坐标</param>
        /// <param name="Z">Z坐标</param>
        /// <param name="Angle">角度</param>
        /// <param name="Opacity">不透明度</param>
        /// <param name="anchor">锚点类型</param>
        /// <param name="cut">纹理切割矩</param>
        public void AddCharacterStand2D(int id, string source, double X, double Y, int Z, double Angle, double Opacity, SpriteAnchorType anchor, Int32Rect cut)
        {
            SpriteDescriptor sd = new SpriteDescriptor()
            {
                Id           = id,
                ResourceType = ResourceType.Stand,
                ResourceName = source,
                X            = X,
                Y            = Y,
                Z            = Z + GlobalConfigContext.GAME_Z_CHARACTERSTAND,
                Angle        = Angle,
                Opacity      = Opacity,
                AnchorType   = anchor,
                CutRect      = cut
            };

            this.characterDescVec2D[id] = sd;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 为屏幕增加一个2D背景精灵描述子
        /// </summary>
        /// <param name="id">背景层的类型:0-背景 1-前景</param>
        /// <param name="source">资源名称</param>
        /// <param name="X">左上角在画面的X坐标</param>
        /// <param name="Y">左上角在画面的Y坐标</param>
        /// <param name="Z">Z坐标</param>
        /// <param name="Angle">角度</param>
        /// <param name="Opacity">不透明度</param>
        /// <param name="ScaleX">横向缩放比</param>
        /// <param name="ScaleY">纵向缩放比</param>
        /// <param name="anchor">锚点类型</param>
        /// <param name="cut">纹理切割矩</param>
        public void AddBackground2D(int id, string source, double X, double Y, int Z, double Angle, double Opacity, double ScaleX, double ScaleY, SpriteAnchorType anchor, Int32Rect cut)
        {
            SpriteDescriptor sd = new SpriteDescriptor()
            {
                Id           = id,
                ResourceType = ResourceType.Background,
                ResourceName = source,
                X            = X,
                Y            = Y,
                Z            = Z + GlobalConfigContext.GAME_Z_BACKGROUND,
                ScaleX       = ScaleX,
                ScaleY       = ScaleY,
                Angle        = Angle,
                Opacity      = Opacity,
                AnchorType   = anchor,
                CutRect      = cut
            };

            this.backgroundDescVec[id] = sd;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 为屏幕增加一个图片精灵描述子
        /// </summary>
        /// <param name="id">图片的id</param>
        /// <param name="source">资源名称</param>
        /// <param name="X">左上角在画面的X坐标</param>
        /// <param name="Y">左上角在画面的Y坐标</param>
        /// <param name="Z">Z坐标</param>
        /// <param name="ScaleX">横向缩放比</param>
        /// <param name="ScaleY">纵向缩放比</param>
        /// <param name="Angle">角度</param>
        /// <param name="Opacity">不透明度</param>
        /// <param name="anchor">锚点类型</param>
        /// <param name="cut">纹理切割矩</param>
        public void AddPicture(int id, string source, double X, double Y, int Z, double ScaleX, double ScaleY, double Angle, double Opacity, SpriteAnchorType anchor, Int32Rect cut)
        {
            SpriteDescriptor sd = new SpriteDescriptor()
            {
                Id           = id,
                ResourceType = ResourceType.Pictures,
                ResourceName = source,
                X            = X,
                Y            = Y,
                Z            = Z + GlobalConfigContext.GAME_Z_PICTURES,
                ScaleX       = ScaleX,
                ScaleY       = ScaleY,
                Angle        = Angle,
                Opacity      = Opacity,
                AnchorType   = anchor,
                CutRect      = cut
            };

            this.pictureDescVec[id] = sd;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 为屏幕增加一个选择支描述子
        /// </summary>
        /// <param name="id">选择支按钮id</param>
        /// <param name="X">左上角在画面的X坐标</param>
        /// <param name="Y">左上角在画面的Y坐标</param>
        /// <param name="jumpTarget">按下后要跳转的标签名</param>
        /// <param name="text">选择支按钮上的文本</param>
        /// <param name="normalDesc">正常时的精灵描述子</param>
        /// <param name="overDesc">鼠标悬停时的精灵描述子</param>
        /// <param name="onDesc">鼠标按下时的精灵描述子</param>
        public void AddBranchButton(int id, double X, double Y, string jumpTarget, string text, SpriteDescriptor normalDesc, SpriteDescriptor overDesc = null, SpriteDescriptor onDesc = null)
        {
            BranchButtonDescriptor bbd = new BranchButtonDescriptor()
            {
                Id               = id,
                JumpTarget       = jumpTarget,
                X                = X,
                Y                = Y,
                Z                = GlobalConfigContext.GAME_Z_BRANCHBUTTON + id,
                Text             = text,
                NormalDescriptor = normalDesc,
                OverDescriptor   = overDesc,
                OnDescriptor     = onDesc
            };

            this.branchDescVec[id] = bbd;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 为屏幕增加一个按钮描述子
        /// </summary>
        /// <param name="id">按钮的id</param>
        /// <param name="enable">是否可点击</param>
        /// <param name="X">左上角在画面的X坐标</param>
        /// <param name="Y">左上角在画面的Y坐标</param>
        /// <param name="jumpTarget">按下后要跳转的标签名</param>
        /// <param name="funcCallSign">函数调用签名</param>
        /// <param name="type">按钮存续类型</param>
        /// <param name="normalDesc">正常时的精灵描述子</param>
        /// <param name="overDesc">鼠标悬停时的精灵描述子</param>
        /// <param name="onDesc">鼠标按下时的精灵描述子</param>
        public void AddButton(int id, bool enable, double X, double Y, string jumpTarget, string funcCallSign, string type, SpriteDescriptor normalDesc, SpriteDescriptor overDesc = null, SpriteDescriptor onDesc = null)
        {
            SpriteButtonDescriptor sbd = new SpriteButtonDescriptor()
            {
                Enable            = enable,
                X                 = X,
                Y                 = Y,
                Z                 = GlobalConfigContext.GAME_Z_BUTTON + id,
                JumpLabel         = jumpTarget,
                InterruptFuncSign = funcCallSign,
                NormalDescriptor  = normalDesc,
                OverDescriptor    = overDesc,
                OnDescriptor      = onDesc,
                Opacity           = 1.0,
                Eternal           = type != "once"
            };

            this.buttonDescVec[id] = sbd;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 为屏幕增加一个2D立绘精灵描述子
        /// </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 AddCharacterStand2D(int id, string source, CharacterStand2DType cst, int Z, double Angle, double Opacity, SpriteAnchorType anchor, Int32Rect cut)
        {
            SpriteDescriptor sd = null;

            switch (cst)
            {
            case CharacterStand2DType.Left:
                sd = new SpriteDescriptor()
                {
                    Id           = id,
                    ResourceType = ResourceType.Stand,
                    ResourceName = source,
                    X            = GlobalConfigContext.GAME_CHARACTERSTAND_LEFT_X,
                    Y            = GlobalConfigContext.GAME_CHARACTERSTAND_LEFT_Y,
                    Z            = Z + GlobalConfigContext.GAME_Z_CHARACTERSTAND,
                    Angle        = Angle,
                    Opacity      = Opacity,
                    AnchorType   = anchor,
                    CutRect      = cut
                };
                break;

            case CharacterStand2DType.MidLeft:
                sd = new SpriteDescriptor()
                {
                    Id           = id,
                    ResourceType = ResourceType.Stand,
                    ResourceName = source,
                    X            = GlobalConfigContext.GAME_CHARACTERSTAND_MIDLEFT_X,
                    Y            = GlobalConfigContext.GAME_CHARACTERSTAND_MIDLEFT_Y,
                    Z            = Z,
                    Angle        = Angle,
                    Opacity      = Opacity,
                    AnchorType   = anchor,
                    CutRect      = cut
                };
                break;

            case CharacterStand2DType.Mid:
                sd = new SpriteDescriptor()
                {
                    Id           = id,
                    ResourceType = ResourceType.Stand,
                    ResourceName = source,
                    X            = GlobalConfigContext.GAME_CHARACTERSTAND_MID_X,
                    Y            = GlobalConfigContext.GAME_CHARACTERSTAND_MID_Y,
                    Z            = Z,
                    Angle        = Angle,
                    Opacity      = Opacity,
                    AnchorType   = anchor,
                    CutRect      = cut
                };
                break;

            case CharacterStand2DType.MidRight:
                sd = new SpriteDescriptor()
                {
                    Id           = id,
                    ResourceType = ResourceType.Stand,
                    ResourceName = source,
                    X            = GlobalConfigContext.GAME_CHARACTERSTAND_MIDRIGHT_X,
                    Y            = GlobalConfigContext.GAME_CHARACTERSTAND_MIDRIGHT_Y,
                    Z            = Z,
                    Angle        = Angle,
                    Opacity      = Opacity,
                    AnchorType   = anchor,
                    CutRect      = cut
                };
                break;

            case CharacterStand2DType.Right:
                sd = new SpriteDescriptor()
                {
                    Id           = id,
                    ResourceType = ResourceType.Stand,
                    ResourceName = source,
                    X            = GlobalConfigContext.GAME_CHARACTERSTAND_RIGHT_X,
                    Y            = GlobalConfigContext.GAME_CHARACTERSTAND_RIGHT_Y,
                    Z            = Z,
                    Angle        = Angle,
                    Opacity      = Opacity,
                    AnchorType   = anchor,
                    CutRect      = cut
                };
                break;
            }
            this.characterDescVec2D[id] = sd;
        }