コード例 #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;
            }
        }
コード例 #2
0
        void AddImg(AddImgCmd cmd)
        {
                        #if FDB
            Should.False("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id));
            Should.True("Res.HasSpriteMeta(cmd.imgId)", Res.HasSpriteMeta(cmd.imgId));
                        #endif
            var node = (TpSprite *)Pool.Alloc(spritePool, sizeof(TpSprite));
            TpSprite.Init(node, Res.GetSpriteMeta(cmd.imgId));
            node->id = cmd.id;

            if (spritePool->shift != 0)
            {
                PtrLst.ShiftBase(spritePtrLst, spritePool->shift);
                PtrIntDict.ShiftBase(nodeDict, spritePool->shift);
                foreach (var esJob in esJobList)
                {
                    if (esJob is EsImgJob)
                    {
                        var esTpSpriteJob = (EsImgJob)esJob;
                        esTpSpriteJob.node = (TpSprite *)((byte *)esTpSpriteJob.node + spritePool->shift);
                    }
                }
                needDepthSort     = true;
                spritePool->shift = 0;
            }
            PtrLst.Push(spritePtrLst, node);
            PtrIntDict.Set(nodeDict, cmd.id, node);
        }
コード例 #3
0
 void RmImg(RmImgCmd cmd)
 {
                 #if FDB
     if (cmd.id >= 0)
     {
         Should.True("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id));
     }
                 #endif
     if (cmd.id < 0)
     {
         nodeTouchHandlerDict.Clear();
         PtrIntDict.Clear(nodeDict);
         PtrLst.Clear(spritePtrLst);
         Pool.Clear(spritePool);
     }
     else
     {
         if (nodeTouchHandlerDict.ContainsKey(cmd.id))
         {
             nodeTouchHandlerDict.Remove(cmd.id);
         }
         void *node = PtrIntDict.Remove(nodeDict, cmd.id);
         PtrLst.Remove(spritePtrLst, node);
         Pool.Free(spritePool, node);
     }
 }
コード例 #4
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;
            }
        }
コード例 #5
0
ファイル: Res.cs プロジェクト: DotLab/Futilef
 public static bool HasSpriteMeta(int id)
 {
     return(PtrIntDict.Contains(spriteMetaDict, id));
     // return spriteMetaLstIdxDict.ContainsKey(id);
 }