public delegate void Action(int frame); //Delegate for an action /** * Constructor. Loads the frame handles */ public Animation(ResourceComponent rc, string animDir, int xoffset = 0, int yoffset = 0, float ticksPerFrame = 6, bool loop = true, int delay = 0) { if (animDir.Equals("")) { throw new Exception("Animation directory not provided."); } this.animDir = animDir; this.xoffset = xoffset; this.yoffset = yoffset; this.ticksPerFrame = ticksPerFrame; this.loop = loop; this.delay = delay; frames = rc.discoverHandles(animDir).ToArray(); AnimationList.Add(frames); }
void discoverThumbnails() { String directory = "Tiles/Tiles"; ResourceComponent rc = editor.engine.resourceComponent; List <Handle> tempSet = rc.discoverHandles(directory); //Null Tile GUIButton nullTile = new GUIButton(editor.editorGui, null, null, text: "nul"); nullTile.size = new Vector2(Tile.size, Tile.size); nullTile.mouseDownEvent += (pos, button) => { editor.currentValues.texture = ""; if (!textureOverwriteBox.isDown) { textureOverwriteBox.toggle(); } editor.currentTile.texture = editor.currentValues.texture; }; thumbs.add(nullTile); //Dynamic tile discovery if (tempSet == null) { return; } for (int i = 0; i < tempSet.Count; i++) { GUIButton temp = new GUIButton(editor.editorGui, tempSet[i], tempSet[i], ""); temp.size = new Vector2(Tile.size, Tile.size); string texturePath = tempSet[i].key; temp.mouseDownEvent += (pos, button) => { editor.currentValues.texture = texturePath; if (!textureOverwriteBox.isDown) { textureOverwriteBox.toggle(); } editor.currentTile.texture = editor.currentValues.texture; }; thumbs.add(temp); } thumbs.performLayout(); }