Example #1
0
        void SetImgAttr(SetImgAttrCmd cmd)
        {
                        #if FDB
            Should.True("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id));
            Should.InRange("cmd.imgAttrId", cmd.imgAttrId, 0, ImgAttr.End - 1);
                        #endif
            var img  = (TpSprite *)PtrIntDict.Get(nodeDict, cmd.id);
            var args = cmd.args;
            switch (cmd.imgAttrId)
            {
            case ImgAttr.Interactable: SetImgInteractable(cmd); break;

            case ImgAttr.Position:     TpSprite.SetPosition(img, (float)args[0], (float)args[1], (float)args[2]); needDepthSort = true; break;

            case ImgAttr.Rotation:     TpSprite.SetRotation(img, (float)args[0]); break;

            case ImgAttr.Scale:        TpSprite.SetScale(img, (float)args[0], (float)args[1]); break;

            case ImgAttr.Alpha:        TpSprite.SetAlpha(img, (float)args[0]); break;

            case ImgAttr.Tint:         TpSprite.SetTint(img, (float)args[0], (float)args[1], (float)args[2]); break;

            case ImgAttr.ImgId:        TpSprite.SetMeta(img, Res.GetSpriteMeta((int)args[0])); break;
            }
        }
Example #2
0
        void SetImgAttrEased(SetImgAttrEasedCmd cmd)
        {
                        #if FDB
            Should.True("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id));
            Should.InRange("cmd.imgAttrId", cmd.imgAttrId, 0, ImgAttr.End - 1);
            Should.GreaterThan("cmd.duration", cmd.duration, 0);
            Should.InRange("cmd.esType", cmd.esType, 0, EsType.End - 1);
                        #endif
            float endTime = time + cmd.duration;
            if (endTime > lastEsEndTime)
            {
                lastEsEndTime = endTime;
            }

            var img  = (TpSprite *)PtrIntDict.Get(nodeDict, cmd.id);
            var args = cmd.args;
            switch (cmd.imgAttrId)
            {
            case ImgAttr.Position: esJobList.AddLast(new EsSetImgPositionJob {
                    node = img, duration = cmd.duration, esType = cmd.esType, x = img->pos[0], dx = (float)args[0] - img->pos[0], y = img->pos[1], dy = (float)args[1] - img->pos[1], z = img->pos[2], dz = 0
                }); break;                                                                                                                                                                                                                                                                      // (float)args[2] - img->pos[2] }); break;

            case ImgAttr.Rotation: esJobList.AddLast(new EsSetImgRotationJob {
                    node = img, duration = cmd.duration, esType = cmd.esType, r = img->rot, dr = (float)args[0] - img->rot
                }); break;

            case ImgAttr.Scale:    esJobList.AddLast(new EsSetImgScaleJob {
                    node = img, duration = cmd.duration, esType = cmd.esType, x = img->scl[0], dx = (float)args[0] - img->scl[0], y = img->scl[1], dy = (float)args[1] - img->scl[1]
                }); break;

            case ImgAttr.Alpha:    esJobList.AddLast(new EsSetImgAlphaJob {
                    node = img, duration = cmd.duration, esType = cmd.esType, a = img->color[3], da = (float)args[0] - img->color[3]
                }); break;

            case ImgAttr.Tint:     esJobList.AddLast(new EsSetImgTintJob {
                    node = img, duration = cmd.duration, esType = cmd.esType, r = img->color[0], dr = (float)args[0] - img->color[0], g = img->color[1], dg = (float)args[1] - img->color[1], b = img->color[2], db = (float)args[2] - img->color[2]
                }); break;
            }
        }
Example #3
0
 public static TpSpriteMeta *GetSpriteMeta(int id)
 {
     return((TpSpriteMeta *)PtrIntDict.Get(spriteMetaDict, id));
     // return (TpSpriteMeta *)spriteMetaLst->arr[spriteMetaLstIdxDict[id]];
 }