-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from cyritegamestudios/alpha
Merging alpha to main
- Loading branch information
Showing
14 changed files
with
216 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
local IndexPath = require('cylibs/ui/collection_view/index_path') | ||
|
||
local IndexedItem = {} | ||
IndexedItem.__index = IndexedItem | ||
IndexedItem.__type = "IndexedItem" | ||
|
||
--- | ||
-- Creates a new IndexedItem with the specified item and index path. | ||
-- | ||
-- @tparam any item The associated item. | ||
-- @tparam IndexPath indexPath The index path of the item. | ||
-- @treturn IndexedItem The newly created IndexedItem. | ||
-- | ||
function IndexedItem.new(item, indexPath) | ||
local self = setmetatable({}, IndexedItem) | ||
self.item = item | ||
self.indexPath = indexPath | ||
return self | ||
end | ||
|
||
--- | ||
-- Returns the associated item of this IndexedItem. | ||
-- | ||
-- @treturn any The associated item. | ||
-- | ||
function IndexedItem:getItem() | ||
return self.item | ||
end | ||
|
||
--- | ||
-- Returns the index path of this IndexedItem. | ||
-- | ||
-- @treturn IndexPath The index path of the item. | ||
-- | ||
function IndexedItem:getIndexPath() | ||
return self.indexPath | ||
end | ||
|
||
--- | ||
-- Checks if this IndexedItem is equal to another. | ||
-- | ||
-- @tparam IndexedItem otherItem The other IndexedItem to compare with. | ||
-- @treturn boolean True if the items and index paths are equal, false otherwise. | ||
-- | ||
function IndexedItem:__eq(otherItem) | ||
return otherItem.__type == IndexedItem.__type and self:getIndexPath() == otherItem:getIndexPath() | ||
and self:getItem() == otherItem:getItem() | ||
end | ||
|
||
return IndexedItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.